Plugin Directory

Changeset 1751613


Ignore:
Timestamp:
10/24/2017 04:34:14 AM (8 years ago)
Author:
itamarg
Message:

Bug fixes

  • Changed declaring PHP arrays from short syntax '[]' to 'array()'.
  • Added 'IF EXISTS' in MySql query when dropping shor_codes table upon plugin deletion.
  • Updated plugin minimum PHP version required from 5.0 to 5.2.4.
  • Updated the plugin installation instructions link.
Location:
sr-partner/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • sr-partner/trunk/admin/class-sr-partner-admin.php

    r1725925 r1751613  
    11<?php
     2
    23/**
    34 * The admin-specific functionality of the plugin.
     
    89 * @package    SR_Partner
    910 * @subpackage SR_Partner/admin
    10  * @author     Ryan Magbanua <ryan@getreview.co>
    1111 */
     12
    1213class SR_Partner_Admin  extends SR_Partner_Core {
    1314
     
    2829     * @var      string    $version    The current version of this plugin.
    2930     */
    30     private $version;   
     31    private $version;
    3132
    3233
     
    8283            */
    8384            add_menu_page(
    84                 'SEOReseller Partner', //page title 
    85                 'SEOReseller', //menu title 
     85                'SEOReseller Partner', //page title
     86                'SEOReseller', //menu title
    8687                'manage_options', //capability
    8788                $this->plugin_name, //menu slug,
     
    9192            );
    9293        }
    93        
     94
    9495
    9596    }
     
    101102     */
    102103    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';       
    106106    }
    107107
     
    129129     */
    130130    public function enqueue_scripts()
    131     {       
    132         wp_enqueue_script( $this->plugin_name . '-colorpicker', 
     131    {
     132        wp_enqueue_script( $this->plugin_name . '-colorpicker',
    133133            plugin_dir_url( __FILE__ ) . 'js/sr-partner-colorpicker.js', array( 'jquery' ), $this->version, false );
    134134
    135         wp_enqueue_script( $this->plugin_name . '-scripts', 
     135        wp_enqueue_script( $this->plugin_name . '-scripts',
    136136            plugin_dir_url( __FILE__ ) . 'js/sr-partner-scripts.js', array( 'jquery' ), $this->version, false );
    137137    }
     
    152152        } else if (isset($_POST['sr-partner-form-update-submit'])) {
    153153
    154             $this->generate_short_code('update', false);       
     154            $this->generate_short_code('update', false);
    155155
    156156        } else if (isset($_POST['sr-partner-form-install-to-all-submit'])) {
    157157
    158             $this->generate_short_code('add', true);       
     158            $this->generate_short_code('add', true);
    159159            $this->update_audit_status();
    160160            $this->_helper->tracker('post');
     
    182182
    183183            $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'));
    185185        } else if (isset($_POST['sr-partner-form-activate-plugin-submit'])) {
    186186            $this->activate_plugin();
     
    223223
    224224            $this->deactivate_plugin();
    225            
    226         }       
     225
     226        }
    227227    }
    228228
     
    251251     *
    252252     * @since       1.0.0
    253      * @param       String      $key - post key 
     253     * @param       String      $key - post key
    254254     * @param       String      $default - default value of the post data.
    255      * @return      String     
     255     * @return      String
    256256     */
    257257    private function get_post_value($key, $default = "")
     
    267267     *
    268268     * @since    1.0.0
    269      * @param       String      $key - post key 
     269     * @param       String      $key - post key
    270270     * @param       String      $index - indext in post data
    271271     * @param       String      $default  - default value of the post data.
     
    293293            $types['calltoaction']  = __("Call to Action","sr-partner");
    294294        }
    295        
     295
    296296        $types['notification']  = __("Notification Bar","sr-partner");
    297297        $types['takeover']      = __("Page Takeover","sr-partner");
     
    337337
    338338        $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);
    340340        $form_parameters    = $this->get_type_parameters($form_type);
    341341        $params             = $form_parameters;
    342        
    343        
    344        
     342
    345343        foreach ($params as $key => $value) {
    346344            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;
    349347            }
    350348            $params[$key] = sanitize_text_field($_POST['sr_partner_' . $key]);
     
    357355
    358356        $res            = $this->_helper->call_api($api_params);
    359        
     357
    360358        $response   = json_decode($res, true);
    361359
     
    374372                    $unique_code = md5(time().rand());
    375373                    $embedded_code = '
    376                         <!--Begin WebAuditGen-->                       
     374                        <!--Begin WebAuditGen-->
    377375                        <div id="sr-partner-code-'.$unique_code.'" '.$attrib_data.' class="sr-partner-audit-widget" ></div>
    378376                        <!--End WebAuditGen-->
     
    389387                    $data['attributes'] = serialize($params);
    390388                    $data['embed_code'] = html_entity_decode($embedded_code);
    391                    
     389
    392390                    if ($type == 'add') {
    393391                        $id = $this->_db->save_shortcode($data);
     
    407405
    408406                    } 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);
    410408                        if ($install_all_status==$id ) {
    411409                            delete_option(SR_PARTNER_INSTALL_TO_ALL_PAGES);
     
    422420
    423421                 } 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) {
    427425                $message = isset($response['response']['error']) ?  $response['response']['error'] : 'Unknown error occured.';
    428426                $this->_helper->set_msg(__($message,"sr-partner"), false);
     
    461459                'heading'                       => __("Heading Text","sr-partner"),
    462460                'subheading'                    => __("Sub Heading Text","sr-partner"),
    463                
     461
    464462                'button_background_color'       => __("Form Button Background Color","sr-partner"),
    465463                'button_text_color'             => __("Form Button Text Color","sr-partner"),
     
    549547     * @since    1.0.0
    550548     * @param       String     $string
    551      * @return      Boolean 
     549     * @return      Boolean
    552550     */
    553551    private function is_not_empty($string)
     
    581579            update_option(PARTNER_PLUGIN_STATUS, $status);
    582580        }
    583     }   
     581    }
    584582
    585583    /**
     
    614612    private function update_dashboard()
    615613    {
    616         if ($_POST) {           
     614        if ($_POST) {
    617615            if (!isset($_POST['enable_dashboard_status'])) {
    618616
    619617                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
    623621                update_option(SR_PARTNER_DASHBOARD_STATUS, 0);
    624622
     
    634632                    );
    635633
    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));
    638636                }
    639637                //delete
     
    674672                            // seems that dashboard page is not yet created, lets create one
    675673                            $params['title']        = $_POST['dashboard-page'];
    676                             $params['page_title']   = SR_PARTNER_DASHBOARD_PAGE_TITLE;                           
     674                            $params['page_title']   = SR_PARTNER_DASHBOARD_PAGE_TITLE;
    677675                            $params['page_info']    = SR_PARTNER_DASHBOARD_PAGE_INFO;
    678676
     
    683681                        $this->_helper->set_msg(SR_PARTNER_DASHBOARD_PAGE_TITLE. __(" Page Title is required.","sr-partner"), false);
    684682                    }
    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']))
    688686        } //if post
    689        
     687
    690688    }
    691689
     
    719717                    );
    720718
    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));
    723721                }
    724722                //delete
     
    761759                            // seems that portfolio page is not yet created, lets create one
    762760                            $params['title']        = $post['portfolio-page'];
    763                             $params['page_title']   = SR_PARTNER_PORTFOLIO_PAGE_TITLE;                           
     761                            $params['page_title']   = SR_PARTNER_PORTFOLIO_PAGE_TITLE;
    764762                            $params['page_info']    = SR_PARTNER_PORTFOLIO_PAGE_INFO;
    765763
     
    784782     * @param       String      $newPageName - new page name
    785783     * @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
    787785     */
    788786    private function update_page($pageId, $newPageName, $page_info_name)
     
    817815        );
    818816
    819         // update page status 
     817        // update page status
    820818        update_option($page_info_name, serialize($page_info));
    821819        return $response;
    822820    }
    823      
     821
    824822    /**
    825823     * for checking new update of the plugin
     
    835833            if (isset($temp[0]) && is_numeric($temp[0])) {
    836834                if (isset($temp[1]) && !empty($temp[1])) {
    837                    
     835
    838836
    839837                    $params['token']                = $token;
     
    844842
    845843                    $res            = $this->_helper->call_api($api_params);
    846                    
     844
    847845                    $post_response  = json_decode($res, true);
    848846                    if (isset($post_response['statusCode'])) {
     
    854852
    855853                            if (isset($post_response['response']['error']) && $post_response['response']['error'] == 'installed') {
    856                                 $status = 'already_installed';   
     854                                $status = 'already_installed';
    857855                            } else {
    858856                                $status = isset($post_response['response']['error']) ? $post_response['response']['error'] : '';
    859                             }                           
     857                            }
    860858                        }
    861859
     
    869867                            $this->_helper->activate_plugin($token);
    870868                        } else {
    871                             $this->_helper->set_msg(__($status,"sr-partner"), false);   
     869                            $this->_helper->set_msg(__($status,"sr-partner"), false);
    872870                        }
    873871
     
    877875
    878876                } 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);
    880878                }
    881879            } else {
     
    903901
    904902        $params['version'] = SR_PARTNER_VERSION;
    905         $params['token']   = $key;       
     903        $params['token']   = $key;
    906904
    907905        $api_params['url']          = SR_PARTNER_GENERATE_URL.'/check-updates';
     
    919917                $message = $post_response['response']['error'];
    920918            }
    921             $_SESSION['sr_partner_update_message'] = $message;           
     919            $_SESSION['sr_partner_update_message'] = $message;
    922920        } else {
    923921            $this->_helper->set_msg(__("Unknown error occured.","sr-partner"), false);
    924922        }
    925        
     923
    926924    }
    927925
  • sr-partner/trunk/includes/class-sr-partner-activator.php

    r1717421 r1751613  
    11<?php
    2 
    3 /**
    4  * Fired during plugin activation
    5  *
    6  * @link       Author URI
    7  * @since      1.0.0
    8  *
    9  * @package    SR_Partner
    10  * @subpackage SR_Partner/includes
    11  */
    122
    133/**
     
    188 * @since      1.0.0
    199 * @package    SR_Partner
    20  * @subpackage SR_Partner/includes
    21  * @author     Ryan Magbanua <ryan@getreview.co>
     10 * @subpackage SR_Partner/includes
    2211 */
    2312class SR_Partner_Activator extends SR_Partner_Core {
    24    
     13
    2514    /**
    2615     * Widget Activvation functions
     
    3524        if (!empty($key)) {
    3625
    37             $params = [];
     26            $params = array();
    3827            $params['token']                = $key;
    3928            $params['check_install_status'] = 1;
     
    4433            $res            = $this->_helper->call_api($api_params);
    4534            $post_response  = json_decode($res, true);
    46            
    47             //check if not installed already           
     35
     36            //check if not installed already
    4837            $status = 'unknown_error';
    4938            if (isset($post_response['statusCode'])) {
     
    6150            } else {
    6251                delete_option(SR_PARTNER_ADMIN_NOTICE);
    63                 $this->_helper->activate_plugin($key);               
     52                $this->_helper->activate_plugin($key);
    6453            }
    65            
     54
    6655        }
    67        
     56
    6857    }
    6958}
  • sr-partner/trunk/includes/class-sr-partner-core.php

    r1717421 r1751613  
    22
    33/**
    4  * Fired during plugin activation
    5  *
    6  * @link       Author URI
    7  * @since      1.0.0
    8  *
    9  * @package    SR_Partner
    10  * @subpackage SR_Partner/includes
    11  */
    12 
    13 /**
    144*Load the global database class
    15 **/     
     5**/
    166require_once plugin_dir_path( __FILE__ )  . 'class-sr-partner-db.php';
    177
     
    2919 * @package    SR_Partner
    3020 * @subpackage SR_Partner/includes
    31  * @author     Ryan Magbanua <ryan@getreview.co>
    3221 */
    3322class SR_Partner_Core  {
     
    5443     * Initialize the class and set its properties.
    5544     *
    56      * @since    1.0.0     
     45     * @since    1.0.0
    5746     */
    5847    public function __construct()
    5948    {
    6049        $this->_helper  = new SR_Partner_Helper();
    61         $this->_db      = new SR_Partner_Db();   
     50        $this->_db      = new SR_Partner_Db();
    6251    }
    6352
  • sr-partner/trunk/includes/class-sr-partner-db.php

    r1717421 r1751613  
    11<?php
    22/**
    3  * 
     3 *
    44 *
    55 * This class defines all code necessary to run database functions.
     
    77 * @since      1.0.0
    88 * @package    SR_Partner
    9  * @subpackage SR_Partner/includes
    10  * @author     Ryan Magbanua <ryan@getreview.co>
     9 * @subpackage SR_Partner/includes
    1110 */
    1211class SR_Partner_Db {
    1312
    1413    /**
    15      * Table name 
     14     * Table name
    1615     *
    1716     * @since    1.0.0
     
    2423     * Initialize the class and set its properties.
    2524     *
    26      * @since    1.0.0     
     25     * @since    1.0.0
    2726     */
    2827    function __construct()
     
    4039    {
    4140        global $wpdb;
    42         $sql = "CREATE TABLE if not exists $this->table_name (
     41        $sql = "CREATE TABLE IF NOT EXISTS $this->table_name (
    4342            id  int(11) NOT NULL AUTO_INCREMENT,
    4443            form_name   varchar(255) NOT NULL,
     
    5857    {
    5958        global $wpdb;
    60         $wpdb->query("DROP TABLE $this->table_name;");
     59        $wpdb->query("DROP TABLE IF EXISTS $this->table_name;");
    6160    }
    6261
     
    157156     * get ALL of the shortcodes the the table
    158157     *
    159      * @since       1.0.0     
     158     * @since       1.0.0
    160159     * @return      Array           $data - array data of the shortcodes
    161160     */
     
    213212     */
    214213    public function the_slug_exists($post_name)
    215     {       
     214    {
    216215        global $wpdb;
    217216        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  
    77 * @since      1.0.0
    88 * @package    SR_Partner
    9  * @subpackage SR_Partner/includes
    10  * @author     Ryan Magbanua <ryan@getreview.co>
     9 * @subpackage SR_Partner/includes
    1110 */
    1211class SR_Partner_Deactivator extends SR_Partner_Core {
    13    
     12
    1413    /**
    1514     * deactivates the plugin
     
    3837
    3938        if (get_option(SR_PARTNER_GEN_KEY) !== false ) {
    40             $this->_helper->tracker('uninstall');   
     39            $this->_helper->tracker('uninstall');
    4140        }
    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);
    4544        delete_option(SR_PARTNER_PORTFOLIO_PAGE_INFO);
    4645        delete_option(SR_PARTNER_DASHBOARD_STATUS);
     
    5049
    5150        delete_option(SR_PARTNER_ALERT_MESSAGES);
    52        
     51
    5352        delete_option(SR_PARTNER_GEN_KEY);
    5453    }
  • sr-partner/trunk/includes/class-sr-partner-helper.php

    r1734093 r1751613  
    77 * @since      1.0.0
    88 * @package    SR_Partner
    9  * @subpackage SR_Partner/includes
    10  * @author     Ryan Magbanua <ryan@getreview.co>
     9 * @subpackage SR_Partner/includes
    1110 */
    1211class SR_Partner_Helper {
     
    2019     */
    2120    protected $_db;
    22    
     21
    2322    /**
    2423     * Initialize the class and set its properties.
     
    2827    public function __construct()
    2928    {
    30         $this->_db = new SR_Partner_Db();       
     29        $this->_db = new SR_Partner_Db();
    3130    }
    3231
     
    3534     *
    3635     * @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.
    3837     */
    3938    public function activate_plugin($token)
     
    4948        add_option(SR_PARTNER_LEAD_STATUS, 1, '', 'yes');
    5049
    51         $params                 = [];
     50        $params                 = array();
    5251        $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;
    5554
    5655        $this->create_page($params);
    5756
    58         $params                 = [];
     57        $params                 = array();
    5958        $params['title']        = false;
    60         $params['page_title']   = SR_PARTNER_PORTFOLIO_PAGE_TITLE;           
     59        $params['page_title']   = SR_PARTNER_PORTFOLIO_PAGE_TITLE;
    6160        $params['page_info']    = SR_PARTNER_PORTFOLIO_PAGE_INFO;
    6261        $this->create_page($params);
     
    6968     *
    7069     * @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.
    7271     */
    7372    public function get_key()
     
    108107        $messages = get_option(SR_PARTNER_ALERT_MESSAGES);
    109108        if ($messages !== false) {
    110             $messages   = unserialize($messages);           
     109            $messages   = unserialize($messages);
    111110        }
    112111
     
    130129     * @param       Array        $params -  array of data that is needed to post.
    131130     * @return      String       $post_response -  String of the response data
    132      */ 
     131     */
    133132    public function call_api($params)
    134133    {
     
    150149        if (is_object($response)) {
    151150          $response =  $this->objectToArray($response);
    152         }       
     151        }
    153152
    154153        if (isset($response['body'])) {
     
    178177
    179178            $temp_title   = $page_title.$adde_name;
    180             $page_check   = get_page_by_title($temp_title);           
     179            $page_check   = get_page_by_title($temp_title);
    181180            $adde_name    = '-'.$ctr;
    182            
     181
    183182            //create the slug and check
    184183            $page_slug    = strtolower(str_replace(" ", "-", $temp_title));
    185184            $slug_exists  = $this->_db->the_slug_exists($page_slug);
    186            
     185
    187186            $ctr++;
    188187
    189188        } while (isset($page_check->ID) && $slug_exists);
    190        
     189
    191190        $page_title = $temp_title;
    192191        $page_slug  = strtolower(str_replace(" ", "-", $temp_title));
     
    231230
    232231          $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));
    234233          if (isset($portfolio_page_info['permalink']) && !empty($portfolio_page_info['permalink'])) {
    235234            $is_portfolio_url_okay = strpos($portfolio_page_info['permalink'], 'web-portfolio/' );
     
    258257    {
    259258        $apiKey = $this->get_key();
    260         $apiKey = preg_replace('/\d+\//i', '', $apiKey); 
     259        $apiKey = preg_replace('/\d+\//i', '', $apiKey);
    261260
    262261        $params['token']                    = $apiKey;
     
    279278
    280279            $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;
    282281            $params['audit_widget']             = (isset($_POST['enable_audit_status']) && $_POST['enable_audit_status'] == 1 ) ? 1 : 0;
    283282            $params['lead_tracker']             = (isset($_POST['enable_lead_status']) && $_POST['enable_lead_status'] == 1 ) ? 1 : 0;
     
    295294
    296295        $params['website']    = $website;
    297         $params['track_type'] = $type;       
     296        $params['track_type'] = $type;
    298297        $params['version']    = SR_PARTNER_VERSION;
    299298
     
    305304
    306305        return $response;
    307        
     306
    308307    }
    309308
     
    311310     * catch the lead from contact pages
    312311     *
    313      * @since       1.0.0     
     312     * @since       1.0.0
    314313     * @param       String          $log - the log message
    315314     * @param       String          $type - the type of log message
     
    317316    public function catch_lead($form_data)
    318317    {
    319         // log the data for debugging purposes   
     318        // log the data for debugging purposes
    320319        $this->log($form_data, 'catch_lead');
    321320
     
    358357        }
    359358
    360        
     359
    361360
    362361        //check the status of data
    363         if ( $status ) {           
     362        if ( $status ) {
    364363            $key = $this->get_key();
    365             $token = preg_replace('/\d+\//i', '', $key); 
     364            $token = preg_replace('/\d+\//i', '', $key);
    366365
    367366            //we check if the token is set
    368             if (!empty($token)) {               
     367            if (!empty($token)) {
    369368                $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']))
    373372                                              ? $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']
    374373                                              : '');
     
    400399
    401400            $this->log($form_data, 'form_data');
    402             $this->log($res, 'call_api');           
     401            $this->log($res, 'call_api');
    403402        } catch (Exception $e) {
    404403            //there is a problem saving lead
    405404            $this->log($e, 'Error Submit Lead');
    406         }   
     405        }
    407406    }
    408407
     
    426425     * converts object to array
    427426     *
    428      * @since       1.0.0     
     427     * @since       1.0.0
    429428     * @param       Object          $object - the object
    430      * @return      Array           $array - 
     429     * @return      Array           $array -
    431430     */
    432431    public function objectToArray ($object) {
    433432        if (!is_object($object) && !is_array($object)) {
    434433            return $object;
    435         }           
     434        }
    436435
    437436        return array_map(array($this, 'objectToArray'), (array) $object);
     
    441440     * Clean and Map data
    442441     *
    443      * @since       1.0.0     
     442     * @since       1.0.0
    444443     * @param       Object          $data - the log message
    445444     * @return      Array           $map_string - array of cleaned form data we needed
     
    478477                    if ( filter_var($form_val, FILTER_VALIDATE_EMAIL) && $map_string['from_email'] == false ) {
    479478                        if ($form_val != $map_string['email']) {
    480                             $map_string['from_email'] = $form_val;   
     479                            $map_string['from_email'] = $form_val;
    481480                        }
    482                        
     481
    483482                    }
    484483
     
    489488                        }
    490489                    }
    491                    
     490
    492491                    // 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 ) {
    494493                            $map_string['name'] = $form_val;
    495494                    }
     
    498497                    if ( strpos(strtolower($form_key), "from_name") !== false && strlen($form_val) >= 3 && $map_string['from_name'] == false ) {
    499498                        if ($form_val != $map_string['name']) {
    500                             $map_string['from_name'] = $form_val;   
     499                            $map_string['from_name'] = $form_val;
    501500                        }
    502501                    }
     
    516515                        if ($form_val != $map_string['message']) {
    517516                            $map_string['message2'] = $form_val;
    518                         }                       
     517                        }
    519518                    }
    520519
     
    524523                    }
    525524
    526                    
     525
    527526
    528527                }
    529                
     528
    530529                return $map_string;
    531530
     
    538537     * Writes log to wordpress
    539538     *
    540      * @since       1.0.0     
     539     * @since       1.0.0
    541540     * @param       String          $log - the log message
    542541     * @param       String          $type - the type of log message
     
    552551            error_log($log , 3, $log_dest);
    553552        }
    554     }   
     553    }
    555554}
  • sr-partner/trunk/includes/class-sr-partner-i18n.php

    r1717421 r1751613  
    88 * @since      1.0.0
    99 * @package    SR_Partner
    10  * @subpackage SR_Partner/includes
    11  * @author     Ryan Magbanua <ryan@getreview.co>
     10 * @subpackage SR_Partner/includes
    1211 */
    1312class SR_Partner_i18n {
  • sr-partner/trunk/includes/class-sr-partner-loader.php

    r1717421 r1751613  
    11<?php
    2 
    3 /**
    4  * Register all actions and filters for the plugin
    5  *
    6  * @link       Author URI
    7  * @since      1.0.0
    8  *
    9  * @package    SR_Partner
    10  * @subpackage SR_Partner/includes
    11  */
    12 
    132/**
    143 * Register all actions and filters for the plugin.
     
    209 * @package    SR_Partner
    2110 * @subpackage SR_Partner/includes
    22  * @author     Ryan Magbanua <ryan@getreview.co>
    2311 */
    2412class SR_Partner_Loader {
  • sr-partner/trunk/includes/class-sr-partner-uninstall.php

    r1717421 r1751613  
    77 * @since      1.0.0
    88 * @package    SR_Partner
    9  * @subpackage SR_Partner/includes
    10  * @author     Ryan Magbanua <ryan@getreview.co>
     9 * @subpackage SR_Partner/includes
    1110 */
    1211class SR_Partner_Uninstall extends SR_Partner_Core {
    13        
     12
    1413
    1514    /**
     
    1716     *
    1817     * @since    1.0.0
    19      */   
    20     public function uninstall() {       
     18     */
     19    public function uninstall() {
    2120        $this->_db->drop_tb();
    2221    }
  • sr-partner/trunk/includes/class-sr-partner.php

    r1717421 r1751613  
    1111 * @since      1.0.0
    1212 * @package    SR_Partner
    13  * @subpackage SR_Partner/includes
    14  * @author     Ryan Magbanua <ryan@getreview.co>
     13 * @subpackage SR_Partner/includes
    1514 */
    1615class SR_Partner extends SR_Partner_Core {
     
    5251     */
    5352    protected $base_filename;
    54    
     53
    5554    /**
    5655     * Define the core functionality of the plugin.
     
    170169
    171170
    172             // Hook into Formidable Forms 
     171            // Hook into Formidable Forms
    173172            require_once $path . 'integrations/class-integrate-FormidableForms.php';
    174173            $integration = new SR_Partner_Integrate_FormidableForms();
     
    227226
    228227
    229            
     228
    230229
    231230        }
    232        
     231
    233232    }
    234233    /**
     
    245244        $this->loader->add_action( 'admin_notices', $plugin_admin, 'admin_notices' );
    246245        $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' );
    248247        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
    249248        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
    250        
     249
    251250    }
    252251
     
    265264        $this->loader->add_action( 'wp_ajax_sr_partner_ajax', $plugin_public, 'sr_partner_ajax' );
    266265        $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' );
    268267        $this->loader->add_action( 'wp_footer', $plugin_public, 'hook_to_all_pages' );
    269268        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
     
    324323        return $this->base_filename;
    325324    }
    326 
    327    
    328325}
  • sr-partner/trunk/public/class-sr-partner-public.php

    r1734093 r1751613  
    77 *
    88 * @package    SR_Partner
    9  * @subpackage SR_Partner/public
    10  * @author     Ryan Magbanua <ryan@getreview.co>
     9 * @subpackage SR_Partner/public
    1110 */
    1211class SR_Partner_Public extends SR_Partner_Core {
     
    3837     */
    3938    public function __construct( $plugin_name, $version )
    40     {       
     39    {
    4140        parent::__construct();
    4241        $this->plugin_name = $plugin_name;
     
    4544    }
    4645
    47    
     46
    4847    /**
    4948     * WebAudit hook checker to all pages
     
    6867        $audit_is_active = $audit_is_active !== false ? $audit_is_active : false;
    6968
    70         if ($audit_is_active == 1) { 
     69        if ($audit_is_active == 1) {
    7170            $js = '
    72                 <script type="text/javascript">   
     71                <script type="text/javascript">
    7372                var sr_partner_localization = {
    7473                    run_audit           : "'. __("Run Audit","sr-partner") .'",
     
    102101
    103102        $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;
    105104        if ($audit_is_active) {
    106105            if (isset($params['id'])) {
     
    110109        }
    111110    }
    112    
     111
    113112    /**
    114113     * Add a shortcode listener to WP
     
    164163                    //url ok here... do the API Call now
    165164                    $key = $this->_helper->get_key();
    166                     if (empty($key)) {                       
     165                    if (empty($key)) {
    167166                        $has_error  = true;
    168167                        $err_msg    = __("An error has occured. Please contact the administrator.","sr-partner");
     
    170169
    171170                    $key = preg_replace('/\d+\//i', '', $key); // this will remove the number that is prepend from the token
    172                    
     171
    173172                    $params = array(
    174173                      "email" => $email,
     
    186185                        $post_response  = json_decode($res, true);
    187186                    } else {
    188                         $post_response = [
     187                        $post_response = array(
    189188                            '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                        );
    192193                    }
    193194
     
    197198                }
    198199
    199                
     200
    200201            } else {
    201202                $has_error  = true;
     
    206207                $response['data']['error'] = $err_msg;
    207208                echo json_encode($response);
    208             }       
     209            }
    209210
    210211        } else {
    211212            $response['data']['error'] = __("Invalid POST parameters.","sr-partner");
    212213            echo json_encode($response);
    213         }       
     214        }
    214215        wp_die();
    215216    }
     
    227228        $token              = !$token ? "" : $token;
    228229        $key                = preg_replace('/\d+\//i', '', $token); // this will remove the number that is prepend from the token
    229        
     230
    230231        if ($dashboard_info !== false || $portfolio_info !== false) {
    231232
     
    236237
    237238                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']);
    239240
    240241                    if ($dashboard_permalink == $current_url) {
    241242                        $params['page_id']  = $dashboard_info['id'];
    242243                        $params['title']    = $dashboard_info['title'];
    243                         $params['url']      = SR_PARTNER_DASHBOARD_URL.$token;                   
     244                        $params['url']      = SR_PARTNER_DASHBOARD_URL.$token;
    244245                        $this->output_custom_page($params);
    245246                    }
    246247                }
    247                
     248
    248249            }
    249250
     
    252253
    253254                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']);
    255256
    256257                    if ($portfolio_permalink == $current_url) {
     
    259260                        $params['title']    = $portfolio_info['title'];
    260261                        $params['url']      = SR_PARTNER_PORTFOLIO_URL.$key.'/portfolio';
    261                        
     262
    262263                        $this->output_custom_page($params);
    263264                    }
     
    273274     */
    274275    public function enqueue_styles()
    275     {       
     276    {
    276277        $audit_is_active = get_option(PARTNER_PLUGIN_STATUS);
    277278        $audit_is_active = $audit_is_active !== false ? $audit_is_active : false;
    278         if ($audit_is_active == 1) {           
     279        if ($audit_is_active == 1) {
    279280            wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/sr-partner-public.css', array(), $this->version, 'all' );
    280281        }
     
    290291        $audit_is_active = get_option(PARTNER_PLUGIN_STATUS);
    291292        $audit_is_active = $audit_is_active !== false ? $audit_is_active : false;
    292         if ($audit_is_active == 1) {           
     293        if ($audit_is_active == 1) {
    293294            wp_enqueue_script( $this->plugin_name . '-public', plugin_dir_url( __FILE__ ) . 'js/sr-partner-public.js', array( 'jquery' ), $this->version, true );
    294295            wp_localize_script( $this->plugin_name . '-public', 'sr_partner_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
    295296        }
    296        
     297
    297298
    298299    }
  • sr-partner/trunk/readme.txt

    r1743107 r1751613  
    44Requires at least: 4.6
    55Tested up to: 4.8.1
    6 Stable tag: 1.1.7
     6Stable tag: 1.1.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626
    2727= 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).
     28Install 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).
    2929
    3030== Frequently Asked Questions ==
     
    4848
    4949== 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.
    5060
    5161= 1.1.7 =
  • sr-partner/trunk/sr-partner.php

    r1743107 r1751613  
    1717 * Plugin URI:        https://www.seoreseller.com/
    1818 * Description:       SEOReseller's suite of tools for building, managing, and growing your digital marketing agency.
    19  * Version:           1.1.7
     19 * Version:           1.1.8
    2020 * Author:            SEOReseller Team
    2121 * Author URI:        https://www.seoreseller.com/
     
    3939*/
    4040
    41 defined('SR_PARTNER_MIN_PHP_VERSION_REQUIRED') || define('SR_PARTNER_MIN_PHP_VERSION_REQUIRED', '5.0');
     41defined('SR_PARTNER_MIN_PHP_VERSION_REQUIRED') || define('SR_PARTNER_MIN_PHP_VERSION_REQUIRED', '5.2.4');
    4242
    4343defined('SR_PARTNER_PLUGIN_NAME') || define('SR_PARTNER_PLUGIN_NAME', 'sr-partner');
    4444
    45 defined('SR_PARTNER_VERSION') || define('SR_PARTNER_VERSION', '1.1.7');
     45defined('SR_PARTNER_VERSION') || define('SR_PARTNER_VERSION', '1.1.8');
    4646defined('SR_PARTNER_DEBUG')   || define('SR_PARTNER_DEBUG', false);
    4747
Note: See TracChangeset for help on using the changeset viewer.