Changeset 1751613
- Timestamp:
- 10/24/2017 04:34:14 AM (8 years ago)
- Location:
- sr-partner/trunk
- Files:
-
- 13 edited
-
admin/class-sr-partner-admin.php (modified) (37 diffs)
-
includes/class-sr-partner-activator.php (modified) (5 diffs)
-
includes/class-sr-partner-core.php (modified) (3 diffs)
-
includes/class-sr-partner-db.php (modified) (7 diffs)
-
includes/class-sr-partner-deactivator.php (modified) (3 diffs)
-
includes/class-sr-partner-helper.php (modified) (28 diffs)
-
includes/class-sr-partner-i18n.php (modified) (1 diff)
-
includes/class-sr-partner-loader.php (modified) (2 diffs)
-
includes/class-sr-partner-uninstall.php (modified) (2 diffs)
-
includes/class-sr-partner.php (modified) (7 diffs)
-
public/class-sr-partner-public.php (modified) (17 diffs)
-
readme.txt (modified) (3 diffs)
-
sr-partner.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sr-partner/trunk/admin/class-sr-partner-admin.php
r1725925 r1751613 1 1 <?php 2 2 3 /** 3 4 * The admin-specific functionality of the plugin. … … 8 9 * @package SR_Partner 9 10 * @subpackage SR_Partner/admin 10 * @author Ryan Magbanua <ryan@getreview.co>11 11 */ 12 12 13 class SR_Partner_Admin extends SR_Partner_Core { 13 14 … … 28 29 * @var string $version The current version of this plugin. 29 30 */ 30 private $version; 31 private $version; 31 32 32 33 … … 82 83 */ 83 84 add_menu_page( 84 'SEOReseller Partner', //page title 85 'SEOReseller', //menu title 85 'SEOReseller Partner', //page title 86 'SEOReseller', //menu title 86 87 'manage_options', //capability 87 88 $this->plugin_name, //menu slug, … … 91 92 ); 92 93 } 93 94 94 95 95 96 } … … 101 102 */ 102 103 public function get_menu_icon() 103 { 104 return 'dashicons-admin-site'; 105 //return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAEeklEQVQ4T31UcUiUZxx+fu93c96c4VxcprRUvKgrbpSZhBSJ0M55iqgLFOfBNrLBiuU04kgxT6rbuStWbV0OzNoJTtR1stamMkX9I0cTK0/BaqnLLUfs4nThnd/7jveG0TjXCx/fx/e97/M9v+f3PD/CC5YQgjjnrsXFxXytVmskoj9etF9+o//bIITQAXj3+vXrDbdu3UJlZeUIgB8YY9VEtCTPqapaD6CAMfYlEZ39D6AQ4mUiWpQvhRAvLSwsPHa73dFzc3MwGAxwu91wuVxLq1evfoOIfhdCGPv6+kb7+/uRl5eHrVu3JhHRgxBDIcSl+/fvW9avX9+rKIpJ/hxAq8PheMdoNIJzjpiYGOzcubMIwBDnvIox9qfX663v6upSsrOzYTQaNxDRJAkhXr13757f5XKhsLAQ6enpiQD0qqrWXrlyJSMyMhLd3d2oqKjA5s2b33v06JHz2LFjMVarlSclJb3NOX+LMTZARJ3PSlZVtWV8fLx406ZN3zDGrHfu3Jm02+20b98+5ObmhmSWLD0eDxwOB+bn50MSbNmyRcoUeL4PyyXL++sAHgNI7u3tvStZ+Xw+TExMoLa2Fi0tLVi7di2sVivKyspw/PhxbNy4Ucs5txLRm0R0kYi+C+uytIrf758pKipKkNrs3bsXTU1NKC8vR0pKSohMQUEB7HY79Hr9Bx0dHV9JF+zfvz8QHx8fvcwwAoCVc57MGDvLOS83m83v19fXY9u2bWHOMpvNOH36NNfr9WUej+frkZERaasHUVFRycuAlW1tbQ6v14vDhw/Prlq1ynn06NGGXbt2IScnJwzQZDLhzJkzsuQcznk6ERmIqI6Ibj8DbG5udkxPT6Oqquo2Y0wxm82Ga9euQaPRhAG2tbXBZrOhsbERaWlpJxhjNUQkrfZvUoQQr3DOnUSUQEQ3mpubbVqtFrLLK61AIIDOzk5cuHAB+fn5OHjwoFtRlNKw6AkhWDAYHLFYLEZpC6LwZA4ODqKvrw+yEQsLCxgaGsLk5KRPp9O9thJgweXLl9ulmWNjYzEwMIDk5GRYLJYQ0bGxMZSWliI1NVWaXPpQXn+vWbOmSVGUj8IAOecek8mUu7S0hD179mDHjh04d+4cqqurQ8+HDh0KGT0rK6sBQARj7C9VVS2KopQT0Y8rMTSrqiqniZcxdgPA3ampqW9LSkqienp6kJGRgeHh4RGNRvPFzZs3G/1+P1pbW3H+/PmVNVxugBAiZ3Z2tjUYDEasW7fuV5vNtmF4eDhUot1u/wTAL+3t7T89fPgQ0dHRSExMRGZmpmR5MaS6qqqfz83NHdDpdFKLcs7593V1dSaZ2VOnTv08Pz8fv3379oSrV6+qBoMhgXN+xOl0Vjx9+hRPnjxBSUmJDEAVETXIaaOZmZkJ1NTU0MmTJ4NxcXGRAD7u6en5LCIiArt37z4A4DdVVWsURWknok+FEGVCiNLR0dGs8fFxVlxcnEdEXc9PG6fP5/swNjbWRkQnZJ4BZAIIENHgC6b6ESFENhGZlofzP8gPAzT6LBalAAAAAElFTkSuQmCC'; 104 { 105 return 'dashicons-admin-site'; 106 106 } 107 107 … … 129 129 */ 130 130 public function enqueue_scripts() 131 { 132 wp_enqueue_script( $this->plugin_name . '-colorpicker', 131 { 132 wp_enqueue_script( $this->plugin_name . '-colorpicker', 133 133 plugin_dir_url( __FILE__ ) . 'js/sr-partner-colorpicker.js', array( 'jquery' ), $this->version, false ); 134 134 135 wp_enqueue_script( $this->plugin_name . '-scripts', 135 wp_enqueue_script( $this->plugin_name . '-scripts', 136 136 plugin_dir_url( __FILE__ ) . 'js/sr-partner-scripts.js', array( 'jquery' ), $this->version, false ); 137 137 } … … 152 152 } else if (isset($_POST['sr-partner-form-update-submit'])) { 153 153 154 $this->generate_short_code('update', false); 154 $this->generate_short_code('update', false); 155 155 156 156 } else if (isset($_POST['sr-partner-form-install-to-all-submit'])) { 157 157 158 $this->generate_short_code('add', true); 158 $this->generate_short_code('add', true); 159 159 $this->update_audit_status(); 160 160 $this->_helper->tracker('post'); … … 182 182 183 183 $this->_helper->set_msg(__("Successfully Deleted!","sr-partner"), true); 184 wp_redirect(admin_url('admin.php?page=sr-partner#setup-audit-widget')); 184 wp_redirect(admin_url('admin.php?page=sr-partner#setup-audit-widget')); 185 185 } else if (isset($_POST['sr-partner-form-activate-plugin-submit'])) { 186 186 $this->activate_plugin(); … … 223 223 224 224 $this->deactivate_plugin(); 225 226 } 225 226 } 227 227 } 228 228 … … 251 251 * 252 252 * @since 1.0.0 253 * @param String $key - post key 253 * @param String $key - post key 254 254 * @param String $default - default value of the post data. 255 * @return String 255 * @return String 256 256 */ 257 257 private function get_post_value($key, $default = "") … … 267 267 * 268 268 * @since 1.0.0 269 * @param String $key - post key 269 * @param String $key - post key 270 270 * @param String $index - indext in post data 271 271 * @param String $default - default value of the post data. … … 293 293 $types['calltoaction'] = __("Call to Action","sr-partner"); 294 294 } 295 295 296 296 $types['notification'] = __("Notification Bar","sr-partner"); 297 297 $types['takeover'] = __("Page Takeover","sr-partner"); … … 337 337 338 338 $form_type = sanitize_text_field($_POST['sr_partner_type']); 339 $token = preg_replace('/\d+\//i', '', $api_key); 339 $token = preg_replace('/\d+\//i', '', $api_key); 340 340 $form_parameters = $this->get_type_parameters($form_type); 341 341 $params = $form_parameters; 342 343 344 342 345 343 foreach ($params as $key => $value) { 346 344 if (!$this->is_not_empty($_POST['sr_partner_' . $key])) { 347 $this->_helper->set_msg($value . __(" is required!","sr-partner"), false); 348 return; 345 $this->_helper->set_msg($value . __(" is required!","sr-partner"), false); 346 return; 349 347 } 350 348 $params[$key] = sanitize_text_field($_POST['sr_partner_' . $key]); … … 357 355 358 356 $res = $this->_helper->call_api($api_params); 359 357 360 358 $response = json_decode($res, true); 361 359 … … 374 372 $unique_code = md5(time().rand()); 375 373 $embedded_code = ' 376 <!--Begin WebAuditGen--> 374 <!--Begin WebAuditGen--> 377 375 <div id="sr-partner-code-'.$unique_code.'" '.$attrib_data.' class="sr-partner-audit-widget" ></div> 378 376 <!--End WebAuditGen--> … … 389 387 $data['attributes'] = serialize($params); 390 388 $data['embed_code'] = html_entity_decode($embedded_code); 391 389 392 390 if ($type == 'add') { 393 391 $id = $this->_db->save_shortcode($data); … … 407 405 408 406 } else if (!isset($_POST['sr_partner_install_to_all_pages']) ) { 409 $install_all_status = get_option(SR_PARTNER_INSTALL_TO_ALL_PAGES); 407 $install_all_status = get_option(SR_PARTNER_INSTALL_TO_ALL_PAGES); 410 408 if ($install_all_status==$id ) { 411 409 delete_option(SR_PARTNER_INSTALL_TO_ALL_PAGES); … … 422 420 423 421 } else{ 424 $this->_helper->set_msg(__("You do not have a valid token.","sr-partner"), false); 425 } 426 } else if ($response['statusCode'] == 400) { 422 $this->_helper->set_msg(__("You do not have a valid token.","sr-partner"), false); 423 } 424 } else if ($response['statusCode'] == 400) { 427 425 $message = isset($response['response']['error']) ? $response['response']['error'] : 'Unknown error occured.'; 428 426 $this->_helper->set_msg(__($message,"sr-partner"), false); … … 461 459 'heading' => __("Heading Text","sr-partner"), 462 460 'subheading' => __("Sub Heading Text","sr-partner"), 463 461 464 462 'button_background_color' => __("Form Button Background Color","sr-partner"), 465 463 'button_text_color' => __("Form Button Text Color","sr-partner"), … … 549 547 * @since 1.0.0 550 548 * @param String $string 551 * @return Boolean 549 * @return Boolean 552 550 */ 553 551 private function is_not_empty($string) … … 581 579 update_option(PARTNER_PLUGIN_STATUS, $status); 582 580 } 583 } 581 } 584 582 585 583 /** … … 614 612 private function update_dashboard() 615 613 { 616 if ($_POST) { 614 if ($_POST) { 617 615 if (!isset($_POST['enable_dashboard_status'])) { 618 616 619 617 if (get_option(SR_PARTNER_DASHBOARD_STATUS) == 1) { 620 $this->_helper->set_msg( sprintf( __("%s deactivated successfully!","sr-partner"), 'White Label Dashboard') , 'warning'); 621 } 622 618 $this->_helper->set_msg( sprintf( __("%s deactivated successfully!","sr-partner"), 'White Label Dashboard') , 'warning'); 619 } 620 623 621 update_option(SR_PARTNER_DASHBOARD_STATUS, 0); 624 622 … … 634 632 ); 635 633 636 // update page status 637 update_option(SR_PARTNER_DASHBOARD_PAGE_INFO, serialize($page_info)); 634 // update page status 635 update_option(SR_PARTNER_DASHBOARD_PAGE_INFO, serialize($page_info)); 638 636 } 639 637 //delete … … 674 672 // seems that dashboard page is not yet created, lets create one 675 673 $params['title'] = $_POST['dashboard-page']; 676 $params['page_title'] = SR_PARTNER_DASHBOARD_PAGE_TITLE; 674 $params['page_title'] = SR_PARTNER_DASHBOARD_PAGE_TITLE; 677 675 $params['page_info'] = SR_PARTNER_DASHBOARD_PAGE_INFO; 678 676 … … 683 681 $this->_helper->set_msg(SR_PARTNER_DASHBOARD_PAGE_TITLE. __(" Page Title is required.","sr-partner"), false); 684 682 } 685 }//if ($_POST['enable_dashboard_status'] == 1) 686 687 }//if (isset($_POST['enable_dashboard_status'])) 683 }//if ($_POST['enable_dashboard_status'] == 1) 684 685 }//if (isset($_POST['enable_dashboard_status'])) 688 686 } //if post 689 687 690 688 } 691 689 … … 719 717 ); 720 718 721 // update page status 722 update_option(SR_PARTNER_PORTFOLIO_PAGE_INFO, serialize($page_info)); 719 // update page status 720 update_option(SR_PARTNER_PORTFOLIO_PAGE_INFO, serialize($page_info)); 723 721 } 724 722 //delete … … 761 759 // seems that portfolio page is not yet created, lets create one 762 760 $params['title'] = $post['portfolio-page']; 763 $params['page_title'] = SR_PARTNER_PORTFOLIO_PAGE_TITLE; 761 $params['page_title'] = SR_PARTNER_PORTFOLIO_PAGE_TITLE; 764 762 $params['page_info'] = SR_PARTNER_PORTFOLIO_PAGE_INFO; 765 763 … … 784 782 * @param String $newPageName - new page name 785 783 * @param String $page_info_name - default page info name 786 * @return Array $response - array of response data 784 * @return Array $response - array of response data 787 785 */ 788 786 private function update_page($pageId, $newPageName, $page_info_name) … … 817 815 ); 818 816 819 // update page status 817 // update page status 820 818 update_option($page_info_name, serialize($page_info)); 821 819 return $response; 822 820 } 823 821 824 822 /** 825 823 * for checking new update of the plugin … … 835 833 if (isset($temp[0]) && is_numeric($temp[0])) { 836 834 if (isset($temp[1]) && !empty($temp[1])) { 837 835 838 836 839 837 $params['token'] = $token; … … 844 842 845 843 $res = $this->_helper->call_api($api_params); 846 844 847 845 $post_response = json_decode($res, true); 848 846 if (isset($post_response['statusCode'])) { … … 854 852 855 853 if (isset($post_response['response']['error']) && $post_response['response']['error'] == 'installed') { 856 $status = 'already_installed'; 854 $status = 'already_installed'; 857 855 } else { 858 856 $status = isset($post_response['response']['error']) ? $post_response['response']['error'] : ''; 859 } 857 } 860 858 } 861 859 … … 869 867 $this->_helper->activate_plugin($token); 870 868 } else { 871 $this->_helper->set_msg(__($status,"sr-partner"), false); 869 $this->_helper->set_msg(__($status,"sr-partner"), false); 872 870 } 873 871 … … 877 875 878 876 } else { 879 $this->_helper->set_msg(__("You do not have a valid token.","sr-partner"), false); 877 $this->_helper->set_msg(__("You do not have a valid token.","sr-partner"), false); 880 878 } 881 879 } else { … … 903 901 904 902 $params['version'] = SR_PARTNER_VERSION; 905 $params['token'] = $key; 903 $params['token'] = $key; 906 904 907 905 $api_params['url'] = SR_PARTNER_GENERATE_URL.'/check-updates'; … … 919 917 $message = $post_response['response']['error']; 920 918 } 921 $_SESSION['sr_partner_update_message'] = $message; 919 $_SESSION['sr_partner_update_message'] = $message; 922 920 } else { 923 921 $this->_helper->set_msg(__("Unknown error occured.","sr-partner"), false); 924 922 } 925 923 926 924 } 927 925 -
sr-partner/trunk/includes/class-sr-partner-activator.php
r1717421 r1751613 1 1 <?php 2 3 /**4 * Fired during plugin activation5 *6 * @link Author URI7 * @since 1.0.08 *9 * @package SR_Partner10 * @subpackage SR_Partner/includes11 */12 2 13 3 /** … … 18 8 * @since 1.0.0 19 9 * @package SR_Partner 20 * @subpackage SR_Partner/includes 21 * @author Ryan Magbanua <ryan@getreview.co> 10 * @subpackage SR_Partner/includes 22 11 */ 23 12 class SR_Partner_Activator extends SR_Partner_Core { 24 13 25 14 /** 26 15 * Widget Activvation functions … … 35 24 if (!empty($key)) { 36 25 37 $params = [];26 $params = array(); 38 27 $params['token'] = $key; 39 28 $params['check_install_status'] = 1; … … 44 33 $res = $this->_helper->call_api($api_params); 45 34 $post_response = json_decode($res, true); 46 47 //check if not installed already 35 36 //check if not installed already 48 37 $status = 'unknown_error'; 49 38 if (isset($post_response['statusCode'])) { … … 61 50 } else { 62 51 delete_option(SR_PARTNER_ADMIN_NOTICE); 63 $this->_helper->activate_plugin($key); 52 $this->_helper->activate_plugin($key); 64 53 } 65 54 66 55 } 67 56 68 57 } 69 58 } -
sr-partner/trunk/includes/class-sr-partner-core.php
r1717421 r1751613 2 2 3 3 /** 4 * Fired during plugin activation5 *6 * @link Author URI7 * @since 1.0.08 *9 * @package SR_Partner10 * @subpackage SR_Partner/includes11 */12 13 /**14 4 *Load the global database class 15 **/ 5 **/ 16 6 require_once plugin_dir_path( __FILE__ ) . 'class-sr-partner-db.php'; 17 7 … … 29 19 * @package SR_Partner 30 20 * @subpackage SR_Partner/includes 31 * @author Ryan Magbanua <ryan@getreview.co>32 21 */ 33 22 class SR_Partner_Core { … … 54 43 * Initialize the class and set its properties. 55 44 * 56 * @since 1.0.0 45 * @since 1.0.0 57 46 */ 58 47 public function __construct() 59 48 { 60 49 $this->_helper = new SR_Partner_Helper(); 61 $this->_db = new SR_Partner_Db(); 50 $this->_db = new SR_Partner_Db(); 62 51 } 63 52 -
sr-partner/trunk/includes/class-sr-partner-db.php
r1717421 r1751613 1 1 <?php 2 2 /** 3 * 3 * 4 4 * 5 5 * This class defines all code necessary to run database functions. … … 7 7 * @since 1.0.0 8 8 * @package SR_Partner 9 * @subpackage SR_Partner/includes 10 * @author Ryan Magbanua <ryan@getreview.co> 9 * @subpackage SR_Partner/includes 11 10 */ 12 11 class SR_Partner_Db { 13 12 14 13 /** 15 * Table name 14 * Table name 16 15 * 17 16 * @since 1.0.0 … … 24 23 * Initialize the class and set its properties. 25 24 * 26 * @since 1.0.0 25 * @since 1.0.0 27 26 */ 28 27 function __construct() … … 40 39 { 41 40 global $wpdb; 42 $sql = "CREATE TABLE if not exists$this->table_name (41 $sql = "CREATE TABLE IF NOT EXISTS $this->table_name ( 43 42 id int(11) NOT NULL AUTO_INCREMENT, 44 43 form_name varchar(255) NOT NULL, … … 58 57 { 59 58 global $wpdb; 60 $wpdb->query("DROP TABLE $this->table_name;");59 $wpdb->query("DROP TABLE IF EXISTS $this->table_name;"); 61 60 } 62 61 … … 157 156 * get ALL of the shortcodes the the table 158 157 * 159 * @since 1.0.0 158 * @since 1.0.0 160 159 * @return Array $data - array data of the shortcodes 161 160 */ … … 213 212 */ 214 213 public function the_slug_exists($post_name) 215 { 214 { 216 215 global $wpdb; 217 216 if($wpdb->get_row("SELECT post_name FROM $wpdb->posts WHERE post_name = '" . $post_name . "'", 'ARRAY_A')) { -
sr-partner/trunk/includes/class-sr-partner-deactivator.php
r1717421 r1751613 7 7 * @since 1.0.0 8 8 * @package SR_Partner 9 * @subpackage SR_Partner/includes 10 * @author Ryan Magbanua <ryan@getreview.co> 9 * @subpackage SR_Partner/includes 11 10 */ 12 11 class SR_Partner_Deactivator extends SR_Partner_Core { 13 12 14 13 /** 15 14 * deactivates the plugin … … 38 37 39 38 if (get_option(SR_PARTNER_GEN_KEY) !== false ) { 40 $this->_helper->tracker('uninstall'); 39 $this->_helper->tracker('uninstall'); 41 40 } 42 43 delete_option(SR_PARTNER_ADMIN_NOTICE); 44 delete_option(SR_PARTNER_DASHBOARD_PAGE_INFO); 41 42 delete_option(SR_PARTNER_ADMIN_NOTICE); 43 delete_option(SR_PARTNER_DASHBOARD_PAGE_INFO); 45 44 delete_option(SR_PARTNER_PORTFOLIO_PAGE_INFO); 46 45 delete_option(SR_PARTNER_DASHBOARD_STATUS); … … 50 49 51 50 delete_option(SR_PARTNER_ALERT_MESSAGES); 52 51 53 52 delete_option(SR_PARTNER_GEN_KEY); 54 53 } -
sr-partner/trunk/includes/class-sr-partner-helper.php
r1734093 r1751613 7 7 * @since 1.0.0 8 8 * @package SR_Partner 9 * @subpackage SR_Partner/includes 10 * @author Ryan Magbanua <ryan@getreview.co> 9 * @subpackage SR_Partner/includes 11 10 */ 12 11 class SR_Partner_Helper { … … 20 19 */ 21 20 protected $_db; 22 21 23 22 /** 24 23 * Initialize the class and set its properties. … … 28 27 public function __construct() 29 28 { 30 $this->_db = new SR_Partner_Db(); 29 $this->_db = new SR_Partner_Db(); 31 30 } 32 31 … … 35 34 * 36 35 * @since 1.0.0 37 * @return String $key - token of that need to use the plugin. 36 * @return String $key - token of that need to use the plugin. 38 37 */ 39 38 public function activate_plugin($token) … … 49 48 add_option(SR_PARTNER_LEAD_STATUS, 1, '', 'yes'); 50 49 51 $params = [];50 $params = array(); 52 51 $params['title'] = false; 53 $params['page_title'] = SR_PARTNER_DASHBOARD_PAGE_TITLE; 54 $params['page_info'] = SR_PARTNER_DASHBOARD_PAGE_INFO; 52 $params['page_title'] = SR_PARTNER_DASHBOARD_PAGE_TITLE; 53 $params['page_info'] = SR_PARTNER_DASHBOARD_PAGE_INFO; 55 54 56 55 $this->create_page($params); 57 56 58 $params = [];57 $params = array(); 59 58 $params['title'] = false; 60 $params['page_title'] = SR_PARTNER_PORTFOLIO_PAGE_TITLE; 59 $params['page_title'] = SR_PARTNER_PORTFOLIO_PAGE_TITLE; 61 60 $params['page_info'] = SR_PARTNER_PORTFOLIO_PAGE_INFO; 62 61 $this->create_page($params); … … 69 68 * 70 69 * @since 1.0.0 71 * @return String $key - token of that need to use the plugin. 70 * @return String $key - token of that need to use the plugin. 72 71 */ 73 72 public function get_key() … … 108 107 $messages = get_option(SR_PARTNER_ALERT_MESSAGES); 109 108 if ($messages !== false) { 110 $messages = unserialize($messages); 109 $messages = unserialize($messages); 111 110 } 112 111 … … 130 129 * @param Array $params - array of data that is needed to post. 131 130 * @return String $post_response - String of the response data 132 */ 131 */ 133 132 public function call_api($params) 134 133 { … … 150 149 if (is_object($response)) { 151 150 $response = $this->objectToArray($response); 152 } 151 } 153 152 154 153 if (isset($response['body'])) { … … 178 177 179 178 $temp_title = $page_title.$adde_name; 180 $page_check = get_page_by_title($temp_title); 179 $page_check = get_page_by_title($temp_title); 181 180 $adde_name = '-'.$ctr; 182 181 183 182 //create the slug and check 184 183 $page_slug = strtolower(str_replace(" ", "-", $temp_title)); 185 184 $slug_exists = $this->_db->the_slug_exists($page_slug); 186 185 187 186 $ctr++; 188 187 189 188 } while (isset($page_check->ID) && $slug_exists); 190 189 191 190 $page_title = $temp_title; 192 191 $page_slug = strtolower(str_replace(" ", "-", $temp_title)); … … 231 230 232 231 $is_portfolio_url_okay = true; 233 $portfolio_page_info = unserialize(get_option(SR_PARTNER_PORTFOLIO_PAGE_INFO)); 232 $portfolio_page_info = unserialize(get_option(SR_PARTNER_PORTFOLIO_PAGE_INFO)); 234 233 if (isset($portfolio_page_info['permalink']) && !empty($portfolio_page_info['permalink'])) { 235 234 $is_portfolio_url_okay = strpos($portfolio_page_info['permalink'], 'web-portfolio/' ); … … 258 257 { 259 258 $apiKey = $this->get_key(); 260 $apiKey = preg_replace('/\d+\//i', '', $apiKey); 259 $apiKey = preg_replace('/\d+\//i', '', $apiKey); 261 260 262 261 $params['token'] = $apiKey; … … 279 278 280 279 $params['white_label_dashboard'] = (isset($_POST['enable_dashboard_status']) && $_POST['enable_dashboard_status'] == 1 ) ? 1 : 0; 281 $params['web_design_portfolio'] = (isset($_POST['enable_portfolio_status']) && $_POST['enable_portfolio_status'] == 1 ) ? 1 : 0; 280 $params['web_design_portfolio'] = (isset($_POST['enable_portfolio_status']) && $_POST['enable_portfolio_status'] == 1 ) ? 1 : 0; 282 281 $params['audit_widget'] = (isset($_POST['enable_audit_status']) && $_POST['enable_audit_status'] == 1 ) ? 1 : 0; 283 282 $params['lead_tracker'] = (isset($_POST['enable_lead_status']) && $_POST['enable_lead_status'] == 1 ) ? 1 : 0; … … 295 294 296 295 $params['website'] = $website; 297 $params['track_type'] = $type; 296 $params['track_type'] = $type; 298 297 $params['version'] = SR_PARTNER_VERSION; 299 298 … … 305 304 306 305 return $response; 307 306 308 307 } 309 308 … … 311 310 * catch the lead from contact pages 312 311 * 313 * @since 1.0.0 312 * @since 1.0.0 314 313 * @param String $log - the log message 315 314 * @param String $type - the type of log message … … 317 316 public function catch_lead($form_data) 318 317 { 319 // log the data for debugging purposes 318 // log the data for debugging purposes 320 319 $this->log($form_data, 'catch_lead'); 321 320 … … 358 357 } 359 358 360 359 361 360 362 361 //check the status of data 363 if ( $status ) { 362 if ( $status ) { 364 363 $key = $this->get_key(); 365 $token = preg_replace('/\d+\//i', '', $key); 364 $token = preg_replace('/\d+\//i', '', $key); 366 365 367 366 //we check if the token is set 368 if (!empty($token)) { 367 if (!empty($token)) { 369 368 $get_data['token'] = $token; 370 $get_data['source'] = isset($_SERVER['HTTP_REFERER']) && ! empty($_SERVER['HTTP_REFERER']) 371 ? $_SERVER['HTTP_REFERER'] 372 : ((isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI'])) 369 $get_data['source'] = isset($_SERVER['HTTP_REFERER']) && ! empty($_SERVER['HTTP_REFERER']) 370 ? $_SERVER['HTTP_REFERER'] 371 : ((isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI'])) 373 372 ? $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] 374 373 : ''); … … 400 399 401 400 $this->log($form_data, 'form_data'); 402 $this->log($res, 'call_api'); 401 $this->log($res, 'call_api'); 403 402 } catch (Exception $e) { 404 403 //there is a problem saving lead 405 404 $this->log($e, 'Error Submit Lead'); 406 } 405 } 407 406 } 408 407 … … 426 425 * converts object to array 427 426 * 428 * @since 1.0.0 427 * @since 1.0.0 429 428 * @param Object $object - the object 430 * @return Array $array - 429 * @return Array $array - 431 430 */ 432 431 public function objectToArray ($object) { 433 432 if (!is_object($object) && !is_array($object)) { 434 433 return $object; 435 } 434 } 436 435 437 436 return array_map(array($this, 'objectToArray'), (array) $object); … … 441 440 * Clean and Map data 442 441 * 443 * @since 1.0.0 442 * @since 1.0.0 444 443 * @param Object $data - the log message 445 444 * @return Array $map_string - array of cleaned form data we needed … … 478 477 if ( filter_var($form_val, FILTER_VALIDATE_EMAIL) && $map_string['from_email'] == false ) { 479 478 if ($form_val != $map_string['email']) { 480 $map_string['from_email'] = $form_val; 479 $map_string['from_email'] = $form_val; 481 480 } 482 481 483 482 } 484 483 … … 489 488 } 490 489 } 491 490 492 491 // get name 493 if ( strpos(strtolower($form_key), "name") !== false && strlen($form_val) >= 3 && $map_string['name'] == false ) { 492 if ( strpos(strtolower($form_key), "name") !== false && strlen($form_val) >= 3 && $map_string['name'] == false ) { 494 493 $map_string['name'] = $form_val; 495 494 } … … 498 497 if ( strpos(strtolower($form_key), "from_name") !== false && strlen($form_val) >= 3 && $map_string['from_name'] == false ) { 499 498 if ($form_val != $map_string['name']) { 500 $map_string['from_name'] = $form_val; 499 $map_string['from_name'] = $form_val; 501 500 } 502 501 } … … 516 515 if ($form_val != $map_string['message']) { 517 516 $map_string['message2'] = $form_val; 518 } 517 } 519 518 } 520 519 … … 524 523 } 525 524 526 525 527 526 528 527 } 529 528 530 529 return $map_string; 531 530 … … 538 537 * Writes log to wordpress 539 538 * 540 * @since 1.0.0 539 * @since 1.0.0 541 540 * @param String $log - the log message 542 541 * @param String $type - the type of log message … … 552 551 error_log($log , 3, $log_dest); 553 552 } 554 } 553 } 555 554 } -
sr-partner/trunk/includes/class-sr-partner-i18n.php
r1717421 r1751613 8 8 * @since 1.0.0 9 9 * @package SR_Partner 10 * @subpackage SR_Partner/includes 11 * @author Ryan Magbanua <ryan@getreview.co> 10 * @subpackage SR_Partner/includes 12 11 */ 13 12 class SR_Partner_i18n { -
sr-partner/trunk/includes/class-sr-partner-loader.php
r1717421 r1751613 1 1 <?php 2 3 /**4 * Register all actions and filters for the plugin5 *6 * @link Author URI7 * @since 1.0.08 *9 * @package SR_Partner10 * @subpackage SR_Partner/includes11 */12 13 2 /** 14 3 * Register all actions and filters for the plugin. … … 20 9 * @package SR_Partner 21 10 * @subpackage SR_Partner/includes 22 * @author Ryan Magbanua <ryan@getreview.co>23 11 */ 24 12 class SR_Partner_Loader { -
sr-partner/trunk/includes/class-sr-partner-uninstall.php
r1717421 r1751613 7 7 * @since 1.0.0 8 8 * @package SR_Partner 9 * @subpackage SR_Partner/includes 10 * @author Ryan Magbanua <ryan@getreview.co> 9 * @subpackage SR_Partner/includes 11 10 */ 12 11 class SR_Partner_Uninstall extends SR_Partner_Core { 13 12 14 13 15 14 /** … … 17 16 * 18 17 * @since 1.0.0 19 */ 20 public function uninstall() { 18 */ 19 public function uninstall() { 21 20 $this->_db->drop_tb(); 22 21 } -
sr-partner/trunk/includes/class-sr-partner.php
r1717421 r1751613 11 11 * @since 1.0.0 12 12 * @package SR_Partner 13 * @subpackage SR_Partner/includes 14 * @author Ryan Magbanua <ryan@getreview.co> 13 * @subpackage SR_Partner/includes 15 14 */ 16 15 class SR_Partner extends SR_Partner_Core { … … 52 51 */ 53 52 protected $base_filename; 54 53 55 54 /** 56 55 * Define the core functionality of the plugin. … … 170 169 171 170 172 // Hook into Formidable Forms 171 // Hook into Formidable Forms 173 172 require_once $path . 'integrations/class-integrate-FormidableForms.php'; 174 173 $integration = new SR_Partner_Integrate_FormidableForms(); … … 227 226 228 227 229 228 230 229 231 230 } 232 231 233 232 } 234 233 /** … … 245 244 $this->loader->add_action( 'admin_notices', $plugin_admin, 'admin_notices' ); 246 245 $this->loader->add_action( 'admin_init', $plugin_admin, 'admin_init' ); 247 $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_admin_menu' ); 246 $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_admin_menu' ); 248 247 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 249 248 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 250 249 251 250 } 252 251 … … 265 264 $this->loader->add_action( 'wp_ajax_sr_partner_ajax', $plugin_public, 'sr_partner_ajax' ); 266 265 $this->loader->add_action( 'wp_ajax_nopriv_sr_partner_ajax', $plugin_public, 'sr_partner_ajax' ); 267 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); 266 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); 268 267 $this->loader->add_action( 'wp_footer', $plugin_public, 'hook_to_all_pages' ); 269 268 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); … … 324 323 return $this->base_filename; 325 324 } 326 327 328 325 } -
sr-partner/trunk/public/class-sr-partner-public.php
r1734093 r1751613 7 7 * 8 8 * @package SR_Partner 9 * @subpackage SR_Partner/public 10 * @author Ryan Magbanua <ryan@getreview.co> 9 * @subpackage SR_Partner/public 11 10 */ 12 11 class SR_Partner_Public extends SR_Partner_Core { … … 38 37 */ 39 38 public function __construct( $plugin_name, $version ) 40 { 39 { 41 40 parent::__construct(); 42 41 $this->plugin_name = $plugin_name; … … 45 44 } 46 45 47 46 48 47 /** 49 48 * WebAudit hook checker to all pages … … 68 67 $audit_is_active = $audit_is_active !== false ? $audit_is_active : false; 69 68 70 if ($audit_is_active == 1) { 69 if ($audit_is_active == 1) { 71 70 $js = ' 72 <script type="text/javascript"> 71 <script type="text/javascript"> 73 72 var sr_partner_localization = { 74 73 run_audit : "'. __("Run Audit","sr-partner") .'", … … 102 101 103 102 $audit_is_active = get_option(PARTNER_PLUGIN_STATUS); 104 $audit_is_active = $audit_is_active !== false ? $audit_is_active : 0; 103 $audit_is_active = $audit_is_active !== false ? $audit_is_active : 0; 105 104 if ($audit_is_active) { 106 105 if (isset($params['id'])) { … … 110 109 } 111 110 } 112 111 113 112 /** 114 113 * Add a shortcode listener to WP … … 164 163 //url ok here... do the API Call now 165 164 $key = $this->_helper->get_key(); 166 if (empty($key)) { 165 if (empty($key)) { 167 166 $has_error = true; 168 167 $err_msg = __("An error has occured. Please contact the administrator.","sr-partner"); … … 170 169 171 170 $key = preg_replace('/\d+\//i', '', $key); // this will remove the number that is prepend from the token 172 171 173 172 $params = array( 174 173 "email" => $email, … … 186 185 $post_response = json_decode($res, true); 187 186 } else { 188 $post_response = [187 $post_response = array( 189 188 'statusCode' => '422', 190 'response' => ['error' => __("There was a problem processing your request. Please try again.","sr-partner")] 191 ]; 189 'response' => array( 190 'error' => __("There was a problem processing your request. Please try again.", "sr-partner") 191 ) 192 ); 192 193 } 193 194 … … 197 198 } 198 199 199 200 200 201 } else { 201 202 $has_error = true; … … 206 207 $response['data']['error'] = $err_msg; 207 208 echo json_encode($response); 208 } 209 } 209 210 210 211 } else { 211 212 $response['data']['error'] = __("Invalid POST parameters.","sr-partner"); 212 213 echo json_encode($response); 213 } 214 } 214 215 wp_die(); 215 216 } … … 227 228 $token = !$token ? "" : $token; 228 229 $key = preg_replace('/\d+\//i', '', $token); // this will remove the number that is prepend from the token 229 230 230 231 if ($dashboard_info !== false || $portfolio_info !== false) { 231 232 … … 236 237 237 238 if (isset($dashboard_info['permalink']) && !empty($dashboard_info['permalink'])) { 238 $dashboard_permalink = $this->remove_http($dashboard_info['permalink']); 239 $dashboard_permalink = $this->remove_http($dashboard_info['permalink']); 239 240 240 241 if ($dashboard_permalink == $current_url) { 241 242 $params['page_id'] = $dashboard_info['id']; 242 243 $params['title'] = $dashboard_info['title']; 243 $params['url'] = SR_PARTNER_DASHBOARD_URL.$token; 244 $params['url'] = SR_PARTNER_DASHBOARD_URL.$token; 244 245 $this->output_custom_page($params); 245 246 } 246 247 } 247 248 248 249 } 249 250 … … 252 253 253 254 if (isset($portfolio_info['permalink']) && !empty($portfolio_info['permalink'])) { 254 $portfolio_permalink = $this->remove_http($portfolio_info['permalink']); 255 $portfolio_permalink = $this->remove_http($portfolio_info['permalink']); 255 256 256 257 if ($portfolio_permalink == $current_url) { … … 259 260 $params['title'] = $portfolio_info['title']; 260 261 $params['url'] = SR_PARTNER_PORTFOLIO_URL.$key.'/portfolio'; 261 262 262 263 $this->output_custom_page($params); 263 264 } … … 273 274 */ 274 275 public function enqueue_styles() 275 { 276 { 276 277 $audit_is_active = get_option(PARTNER_PLUGIN_STATUS); 277 278 $audit_is_active = $audit_is_active !== false ? $audit_is_active : false; 278 if ($audit_is_active == 1) { 279 if ($audit_is_active == 1) { 279 280 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/sr-partner-public.css', array(), $this->version, 'all' ); 280 281 } … … 290 291 $audit_is_active = get_option(PARTNER_PLUGIN_STATUS); 291 292 $audit_is_active = $audit_is_active !== false ? $audit_is_active : false; 292 if ($audit_is_active == 1) { 293 if ($audit_is_active == 1) { 293 294 wp_enqueue_script( $this->plugin_name . '-public', plugin_dir_url( __FILE__ ) . 'js/sr-partner-public.js', array( 'jquery' ), $this->version, true ); 294 295 wp_localize_script( $this->plugin_name . '-public', 'sr_partner_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); 295 296 } 296 297 297 298 298 299 } -
sr-partner/trunk/readme.txt
r1743107 r1751613 4 4 Requires at least: 4.6 5 5 Tested up to: 4.8.1 6 Stable tag: 1.1. 76 Stable tag: 1.1.8 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 27 27 = Manual Installation = 28 Install Partner via the plugin directory, or upload the files manually to your server and follow the on-screen instructions. If you need additional help, read our detailed instructions [here](http://helpcenter.seoreseller.com/ partner-tools/how-to-set-up-the-partner-plugin?from=wporg).28 Install Partner via the plugin directory, or upload the files manually to your server and follow the on-screen instructions. If you need additional help, read our detailed instructions [here](http://helpcenter.seoreseller.com/getting-started/setting-up-your-white-label-dashboard/set-up-your-white-label-dashboard-with-our-wordpress-plugin?from=wporg). 29 29 30 30 == Frequently Asked Questions == … … 48 48 49 49 == Changelog == 50 51 = 1.1.8 = 52 53 * Release date: October 24, 2017 54 55 **Bug fixes** 56 * Changed declaring PHP arrays from short syntax '[]' to 'array()'. 57 * Added 'IF EXISTS' in MySql query when dropping shor_codes table upon plugin deletion. 58 * Updated plugin minimum PHP version required from 5.0 to 5.2.4. 59 * Updated the plugin installation instructions link. 50 60 51 61 = 1.1.7 = -
sr-partner/trunk/sr-partner.php
r1743107 r1751613 17 17 * Plugin URI: https://www.seoreseller.com/ 18 18 * Description: SEOReseller's suite of tools for building, managing, and growing your digital marketing agency. 19 * Version: 1.1. 719 * Version: 1.1.8 20 20 * Author: SEOReseller Team 21 21 * Author URI: https://www.seoreseller.com/ … … 39 39 */ 40 40 41 defined('SR_PARTNER_MIN_PHP_VERSION_REQUIRED') || define('SR_PARTNER_MIN_PHP_VERSION_REQUIRED', '5. 0');41 defined('SR_PARTNER_MIN_PHP_VERSION_REQUIRED') || define('SR_PARTNER_MIN_PHP_VERSION_REQUIRED', '5.2.4'); 42 42 43 43 defined('SR_PARTNER_PLUGIN_NAME') || define('SR_PARTNER_PLUGIN_NAME', 'sr-partner'); 44 44 45 defined('SR_PARTNER_VERSION') || define('SR_PARTNER_VERSION', '1.1. 7');45 defined('SR_PARTNER_VERSION') || define('SR_PARTNER_VERSION', '1.1.8'); 46 46 defined('SR_PARTNER_DEBUG') || define('SR_PARTNER_DEBUG', false); 47 47
Note: See TracChangeset
for help on using the changeset viewer.