Server IP : 192.64.118.117 / Your IP : 3.148.113.167 Web Server : LiteSpeed System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : thecgapy ( 1160) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/thecgapy/www/wp-content/plugins/e-signature/models/ |
Upload File : |
<?php class WP_E_Recipient extends WP_E_Model { private $table; public function __construct(){ global $wpdb; $this->table = $wpdb->prefix . "esign_recipients"; } public function getRecipient($id){ global $wpdb; $document = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $this->table . " WHERE recipient_id=%s", $id ) ); return $document[0]; } /** * Insert Recipient row * * @since 1.0.1 * @param Array $recipient * @return Int recipient_id */ public function insert($recipient){ global $wpdb; // first check for existing $recipient $result = $wpdb->get_results( $wpdb->prepare( "SELECT recipient_id FROM " . $this->table . " WHERE recipient_email=%s", $recipient['email'] ) ); // if count is greater than 0 return the recipient id for the matched recipient if(count($result) > 0){ return $result[0]->recipient_id; } // else insert new row $result = $wpdb->get_results( $wpdb->prepare( "INSERT INTO " . $this->table . " VALUES(null, %s, %s, %s)", $recipient['email'], '', // first name '' // last name ) ); return $wpdb->insert_id; } public function fetchAll(){ global $wpdb; return $wpdb->get_results("SELECT * FROM " . $this->table); } }