Plugin Directory

Changeset 1978868


Ignore:
Timestamp:
11/22/2018 02:51:13 PM (7 years ago)
Author:
siteattention
Message:

function callApi updated

Location:
siteattention
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • siteattention/tags/2.0.1/README.txt

    r1868112 r1978868  
    66Requires at least: 4.5
    77Tested up to: 4.9
    8 Stable tag: 2.0.0
     8Stable tag: 2.0.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    41413. SiteAttention SEO Plugin Settings
    42424. SiteAttention SEO Plugin Tab (left side menu)
    43 5. SiteAttention Dashboard Google Rank
    44 6. SiteAttention Dashboard - TRending and Falling Ranks
    45 7. SiteAttention Dashboard Single Page Statistics
    4643
    4744== Changelog ==
  • siteattention/tags/2.0.1/includes/class-siteattention.php

    r1864021 r1978868  
    9696
    9797    public static function callApi($route,$body){
    98         $options = get_option(self::NAME);
    99         $response = wp_remote_post( self::URL . $route, [
    100             'headers'       => [
    101                 'Content-Type'      => 'application/json',
    102                 'X-SiteAttention'   => $options['key'],
    103                 'Referer'           => get_site_url() . '/siteattention-wordpress',
    104             ],
     98
     99        //URL = https://test.siteattention.com/ $route = customer/instance/page/publish
     100        $response = wp_remote_post(self::URL.$route, array(
    105101            'method'        => 'POST',
    106102            'body'          => json_encode($body),
    107103            'timeout'       => 15,
     104            'headers'       => array(
     105                'Content-Type'      => 'application/json',
     106                'X-SiteAttention'   => siteattention_get_option('license_key', siteattention_get_option('key', '')),
     107                'Referer'           => get_site_url() . '/siteattention-wordpress'
     108            )
     109
    108110            // 'blocking'      => false,
    109111            // 'sslverify'     => false,
    110112            // 'redirection'   => 0,
    111113            // 'httpversion'   => '1.1',
    112         ]);
     114        ));
    113115
    114116        if (is_wp_error($response))
     
    122124        }
    123125    }
     126
    124127
    125128    public static function write_log( $log ){
  • siteattention/tags/2.0.1/siteattention.php

    r1864129 r1978868  
    1616 * Plugin Name:       SiteAttention
    1717 * Description:       Simple and intuitive SEO tool to help improve seach ranking.
    18  * Version:           2.0.0
     18 * Version:           2.0.1
    1919 * Author:            siteattention
    2020 * Author URI:        https://siteattention.com
     
    3333 // register a new setting for "siteattention" page
    3434 register_setting( 'siteattention', 'siteattention_options', 'siteattention_validate_inputs');
    35  
     35
    3636 // register a new field in the "siteattention_section_license" section, inside the "siteattention" page
    3737 add_settings_field(
     
    4747 ]
    4848 );
    49  
     49
    5050 // Provide e-mail field for resending lost license key to customer.
    5151/* add_settings_field(
     
    6161 ]
    6262 );
    63 */ 
     63*/
    6464 add_settings_field(
    6565 'iid', // as of WP 4.6 this value is used only internally
     
    7474 ]
    7575 );
    76  
     76
    7777 add_settings_field(
    7878 'iname', // as of WP 4.6 this value is used only internally
     
    8888 );
    8989 // ------ New Form Section here ------ //
    90  
     90
    9191 // register a new field in the "siteattention_section_register" section, inside the "siteattention" page
    9292 add_settings_field(
     
    102102 ]
    103103 );
    104  
     104
    105105 // register a new field in the "siteattention_section_register" section, inside the "siteattention" page
    106106 add_settings_field(
     
    116116 ]
    117117 );
    118  
     118
    119119// if(!siteattention_registered()) {
    120120 // register a new section for the customer registration in the "siteattention" page
     
    147147    // Create our array for storing the validated options
    148148    $output = array();
    149      
     149
    150150    // Loop through each of the incoming options
    151151    foreach( $input as $key => $value ) {
    152152        // Check to see if the current option has a value. If so, process it.
    153153        if( isset( $input[$key] ) ) {
    154          
     154
    155155            // Strip all HTML and PHP tags and properly handle quoted strings
    156156            $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );
    157              
     157
    158158        } // end if
    159          
     159
    160160    } // end foreach
    161      
     161
    162162    // Return the array processing any additional functions filtered by this action
    163163    return apply_filters( 'siteattention_validate_inputs', $output, $input );
    164  
    165 }
    166 
    167 
    168  
     164
     165}
     166
     167
     168
    169169/**
    170170 * register our siteattention_settings_init to the admin_init action hook
    171171 */
    172172add_action( 'admin_init', 'siteattention_settings_init' );
    173  
     173
    174174/**
    175175 * custom option and settings:
    176176 * callback functions
    177177 */
    178  
     178
    179179// developers section cb
    180  
     180
    181181// section callbacks can accept an $args parameter, which is an array.
    182182// $args have the following keys defined: title, id, callback.
     
    202202 <?php
    203203}
    204  
     204
    205205function siteattention_get_option($option_key, $default_value = '') {
    206206    $all_option_values = get_option( 'siteattention_options' );
     
    219219        $rs_list = array('TcJGali4iC');
    220220    }
    221    
     221
    222222    return $rs_list;
    223223}
    224224
    225225// pill field cb
    226  
     226
    227227// field callbacks can accept an $args parameter, which is an array.
    228228// $args is defined at the add_settings_field() function.
     
    234234 // get the value of the setting we've registered with register_setting()
    235235 $license_key_value = siteattention_get_option( 'license_key' );
    236  
     236
    237237 // output the field
    238238 ?>
     
    309309 <?php
    310310}
    311  
     311
    312312/**
    313313 * top level menu
     
    324324 );
    325325}
    326  
     326
    327327/**
    328328 * register our siteattention_options_page to the admin_menu action hook
    329329 */
    330330add_action( 'admin_menu', 'siteattention_options_page' );
    331  
     331
    332332$siteattention_info_assoc = null;
    333333function siteattention_get_acccount_info() {
     
    362362      $siteattention_info_assoc = $resp_body;
    363363  }
    364  
     364
    365365  return $siteattention_info_assoc;
    366366}
     
    376376   else {
    377377       return false;
    378    } 
     378   }
    379379}
    380380
     
    388388 return;
    389389 }
    390  
     390
    391391 // add the filter
    392392add_filter( 'siteattention_form_submit_button', 'filter_siteattention_form_submit_button', 10, 2 );
    393  
     393
    394394 // add error/update messages
    395  
     395
    396396 // check if the user have submitted the settings
    397397 // wordpress will add the "settings-updated" $_GET parameter to the url
     
    402402 }
    403403
    404  
     404
    405405 // show error/update messages
    406406 settings_errors( 'siteattention_messages' );
     
    411411      <?php if(siteattention_registered()) { ?>
    412412 <div class="info-wrap" style="display:block;width:45%;margin-left:5%;margin-bottom:5%;float:right;">
    413      <h2 style="font-size:1.8em">Your Account information</h2>
     413     <h2 style="font-size:1.8em">Your Account informations</h2>
    414414     <?php
    415415        $sa_all_info = siteattention_get_acccount_info();
     
    448448      <?php if ( $section['callback'] )
    449449            call_user_func( $section['callback'], $section );
    450  
     450
    451451        if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
    452452            continue;
     
    466466        </div>
    467467        <?php } ?>
    468  
     468
    469469 <?php
    470470 $site_url_noschema = get_site_url();
     
    481481           jQuery('form#siteattention_settings').submit();
    482482       });
    483          
     483
    484484       jQuery('#siteattention_btn_register').on('click', function(e) {
    485485         jQuery('#siteattention_settings').find("input[type=text]").attr("disabled", false);
     
    496496             else {
    497497                 var register_msg_class = "error";
    498                  if(typeof data['error']['email'] != 'undefined') { 
     498                 if(typeof data['error']['email'] != 'undefined') {
    499499                     data['error'] = data['error']['email'];
    500500                 }
     
    508508             }
    509509             })
    510         return false;   
     510        return false;
    511511     });
    512      
     512
    513513     jQuery('#siteattention_license_key_get_info').on('click', function(e) {
    514514         jQuery('form#siteattention_settings').submit();
     
    532532        <p><?php echo $msg; ?></p>
    533533    </div>
    534    
     534
    535535<?php }
    536536// Only show the message on post/page edit views.
  • siteattention/trunk/README.txt

    r1868112 r1978868  
    55Tags: SEO, Content analysis, Readability
    66Requires at least: 4.5
    7 Tested up to: 4.9
    8 Stable tag: 2.0.0
     7Tested up to: 4.9.2
     8Stable tag: 2.0.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    41413. SiteAttention SEO Plugin Settings
    42424. SiteAttention SEO Plugin Tab (left side menu)
    43 5. SiteAttention Dashboard Google Rank
    44 6. SiteAttention Dashboard - TRending and Falling Ranks
    45 7. SiteAttention Dashboard Single Page Statistics
    4643
    4744== Changelog ==
  • siteattention/trunk/includes/class-siteattention.php

    r1864021 r1978868  
    9696
    9797    public static function callApi($route,$body){
    98         $options = get_option(self::NAME);
    99         $response = wp_remote_post( self::URL . $route, [
    100             'headers'       => [
    101                 'Content-Type'      => 'application/json',
    102                 'X-SiteAttention'   => $options['key'],
    103                 'Referer'           => get_site_url() . '/siteattention-wordpress',
    104             ],
     98
     99        //URL = https://test.siteattention.com/ $route = customer/instance/page/publish
     100        $response = wp_remote_post(self::URL.$route, array(
    105101            'method'        => 'POST',
    106102            'body'          => json_encode($body),
    107103            'timeout'       => 15,
     104            'headers'       => array(
     105                'Content-Type'      => 'application/json',
     106                'X-SiteAttention'   => siteattention_get_option('license_key', siteattention_get_option('key', '')),
     107                'Referer'           => get_site_url() . '/siteattention-wordpress'
     108            )
     109
    108110            // 'blocking'      => false,
    109111            // 'sslverify'     => false,
    110112            // 'redirection'   => 0,
    111113            // 'httpversion'   => '1.1',
    112         ]);
     114        ));
    113115
    114116        if (is_wp_error($response))
     
    122124        }
    123125    }
     126
    124127
    125128    public static function write_log( $log ){
  • siteattention/trunk/siteattention.php

    r1864129 r1978868  
    1616 * Plugin Name:       SiteAttention
    1717 * Description:       Simple and intuitive SEO tool to help improve seach ranking.
    18  * Version:           2.0.0
     18 * Version:           2.0.1
    1919 * Author:            siteattention
    2020 * Author URI:        https://siteattention.com
     
    3333 // register a new setting for "siteattention" page
    3434 register_setting( 'siteattention', 'siteattention_options', 'siteattention_validate_inputs');
    35  
     35
    3636 // register a new field in the "siteattention_section_license" section, inside the "siteattention" page
    3737 add_settings_field(
     
    4747 ]
    4848 );
    49  
     49
    5050 // Provide e-mail field for resending lost license key to customer.
    5151/* add_settings_field(
     
    6161 ]
    6262 );
    63 */ 
     63*/
    6464 add_settings_field(
    6565 'iid', // as of WP 4.6 this value is used only internally
     
    7474 ]
    7575 );
    76  
     76
    7777 add_settings_field(
    7878 'iname', // as of WP 4.6 this value is used only internally
     
    8888 );
    8989 // ------ New Form Section here ------ //
    90  
     90
    9191 // register a new field in the "siteattention_section_register" section, inside the "siteattention" page
    9292 add_settings_field(
     
    102102 ]
    103103 );
    104  
     104
    105105 // register a new field in the "siteattention_section_register" section, inside the "siteattention" page
    106106 add_settings_field(
     
    116116 ]
    117117 );
    118  
     118
    119119// if(!siteattention_registered()) {
    120120 // register a new section for the customer registration in the "siteattention" page
     
    147147    // Create our array for storing the validated options
    148148    $output = array();
    149      
     149
    150150    // Loop through each of the incoming options
    151151    foreach( $input as $key => $value ) {
    152152        // Check to see if the current option has a value. If so, process it.
    153153        if( isset( $input[$key] ) ) {
    154          
     154
    155155            // Strip all HTML and PHP tags and properly handle quoted strings
    156156            $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );
    157              
     157
    158158        } // end if
    159          
     159
    160160    } // end foreach
    161      
     161
    162162    // Return the array processing any additional functions filtered by this action
    163163    return apply_filters( 'siteattention_validate_inputs', $output, $input );
    164  
    165 }
    166 
    167 
    168  
     164
     165}
     166
     167
     168
    169169/**
    170170 * register our siteattention_settings_init to the admin_init action hook
    171171 */
    172172add_action( 'admin_init', 'siteattention_settings_init' );
    173  
     173
    174174/**
    175175 * custom option and settings:
    176176 * callback functions
    177177 */
    178  
     178
    179179// developers section cb
    180  
     180
    181181// section callbacks can accept an $args parameter, which is an array.
    182182// $args have the following keys defined: title, id, callback.
     
    202202 <?php
    203203}
    204  
     204
    205205function siteattention_get_option($option_key, $default_value = '') {
    206206    $all_option_values = get_option( 'siteattention_options' );
     
    219219        $rs_list = array('TcJGali4iC');
    220220    }
    221    
     221
    222222    return $rs_list;
    223223}
    224224
    225225// pill field cb
    226  
     226
    227227// field callbacks can accept an $args parameter, which is an array.
    228228// $args is defined at the add_settings_field() function.
     
    234234 // get the value of the setting we've registered with register_setting()
    235235 $license_key_value = siteattention_get_option( 'license_key' );
    236  
     236
    237237 // output the field
    238238 ?>
     
    309309 <?php
    310310}
    311  
     311
    312312/**
    313313 * top level menu
     
    324324 );
    325325}
    326  
     326
    327327/**
    328328 * register our siteattention_options_page to the admin_menu action hook
    329329 */
    330330add_action( 'admin_menu', 'siteattention_options_page' );
    331  
     331
    332332$siteattention_info_assoc = null;
    333333function siteattention_get_acccount_info() {
     
    362362      $siteattention_info_assoc = $resp_body;
    363363  }
    364  
     364
    365365  return $siteattention_info_assoc;
    366366}
     
    376376   else {
    377377       return false;
    378    } 
     378   }
    379379}
    380380
     
    388388 return;
    389389 }
    390  
     390
    391391 // add the filter
    392392add_filter( 'siteattention_form_submit_button', 'filter_siteattention_form_submit_button', 10, 2 );
    393  
     393
    394394 // add error/update messages
    395  
     395
    396396 // check if the user have submitted the settings
    397397 // wordpress will add the "settings-updated" $_GET parameter to the url
     
    402402 }
    403403
    404  
     404
    405405 // show error/update messages
    406406 settings_errors( 'siteattention_messages' );
     
    411411      <?php if(siteattention_registered()) { ?>
    412412 <div class="info-wrap" style="display:block;width:45%;margin-left:5%;margin-bottom:5%;float:right;">
    413      <h2 style="font-size:1.8em">Your Account information</h2>
     413     <h2 style="font-size:1.8em">Your Account informations</h2>
    414414     <?php
    415415        $sa_all_info = siteattention_get_acccount_info();
     
    448448      <?php if ( $section['callback'] )
    449449            call_user_func( $section['callback'], $section );
    450  
     450
    451451        if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
    452452            continue;
     
    466466        </div>
    467467        <?php } ?>
    468  
     468
    469469 <?php
    470470 $site_url_noschema = get_site_url();
     
    481481           jQuery('form#siteattention_settings').submit();
    482482       });
    483          
     483
    484484       jQuery('#siteattention_btn_register').on('click', function(e) {
    485485         jQuery('#siteattention_settings').find("input[type=text]").attr("disabled", false);
     
    496496             else {
    497497                 var register_msg_class = "error";
    498                  if(typeof data['error']['email'] != 'undefined') { 
     498                 if(typeof data['error']['email'] != 'undefined') {
    499499                     data['error'] = data['error']['email'];
    500500                 }
     
    508508             }
    509509             })
    510         return false;   
     510        return false;
    511511     });
    512      
     512
    513513     jQuery('#siteattention_license_key_get_info').on('click', function(e) {
    514514         jQuery('form#siteattention_settings').submit();
     
    532532        <p><?php echo $msg; ?></p>
    533533    </div>
    534    
     534
    535535<?php }
    536536// Only show the message on post/page edit views.
Note: See TracChangeset for help on using the changeset viewer.