Plugin Directory

Changeset 1668421


Ignore:
Timestamp:
06/01/2017 07:50:37 AM (9 years ago)
Author:
chartspms
Message:

Added Key to shortcodes and widgets. IframeResizer function included.

Location:
chartsbeds/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • chartsbeds/trunk/admin_widget_bar.php

    r1648713 r1668421  
    2626        $title = apply_filters('widget_title', $instance['title'] );
    2727        $show_info = isset( $instance['show_info'] ) ? $instance['show_info'] : false;
     28        $key = isset( $instance['key'] ) ? $instance['key'] : '';
    2829
    2930        echo $before_widget."<div class='cb-widget'>";
     
    3536
    3637        // Use shortcode in a PHP file (outside the post editor).
    37         echo do_shortcode( '[chartsbeds-review-bar]' );
     38        echo do_shortcode( '[chartsbeds-review-bar key="'.$key.'"]' );
    3839
    3940        echo $after_widget."</div>";
     
    4748        $instance['title'] = strip_tags( $new_instance['title'] );
    4849        $instance['show_info'] = $new_instance['show_info'];
     50        $instance['key'] = $new_instance['key'];
    4951
    5052        return $instance;
     
    6365        echo '<input id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" value="'.$instance['title'].'" style="width:100%;" />';
    6466        echo '</p>';
     67       
     68        echo "<p>";
     69        echo '<label for="'.$this->get_field_id( 'key' ).'">';
     70        _e('Key:', 'wreviews');
     71        echo '</label>';
     72        echo '<input id="'.$this->get_field_id( 'key' ).'" name="'.$this->get_field_name( 'key' ).'" value="'.$instance['key'].'" style="width:100%;" />';
     73        echo '</p>';
    6574    }
    6675}
  • chartsbeds/trunk/admin_widget_review.php

    r1648713 r1668421  
    2727        $title = apply_filters('widget_title', $instance['title'] );
    2828        $show_info = isset( $instance['show_info'] ) ? $instance['show_info'] : false;
     29        $key = isset( $instance['key'] ) ? $instance['key']:'';
    2930
    3031        echo $before_widget."<div class='cb-widget'>";
     
    3637
    3738        // Use shortcode in a PHP file (outside the post editor).
    38         echo do_shortcode( '[chartsbeds-review-recent]' );
     39        echo do_shortcode( '[chartsbeds-review-recent key="'.$key.'"]' );
    3940
    4041        echo $after_widget."</div>";
     
    4950        $instance['title'] = strip_tags( $new_instance['title'] );
    5051        $instance['show_info'] = $new_instance['show_info'];
    51 
     52        $instance['key'] = $new_instance['key'];
    5253        return $instance;
    5354    }
     
    6768        echo '<input id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" value="'.$instance['title'].'" style="width:100%;" />';
    6869        echo '</p>';
     70       
     71        echo '<p>';
     72        echo '<label for="'.$this->get_field_id( 'key' ).'">';
     73        _e('Key:', 'reviews');
     74        echo '</label>';
     75        echo '<input id="'.$this->get_field_id( 'key' ).'" name="'.$this->get_field_name( 'key' ).'" value="'.$instance['key'].'" style="width:100%;" />';
     76        echo '</p>';
    6977    }
    7078}
  • chartsbeds/trunk/chartsbeds-plugin-circle.php

    r1648713 r1668421  
    33if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    44
    5 function cbeds_circles_func(){
    6 
    7     $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'');
     5function cbeds_circles_func($atts){
     6    $cbc = shortcode_atts( array(
     7        'key' => esc_attr($cbc['key']),
     8    ), $atts );
     9   
     10    if(empty($cbc['key'])){
     11        $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'');
     12    }else{
     13        $ekey = 'http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.$cbc['key'].'';
     14        $json = file_get_contents($ekey);
     15    }
     16   
    817    $obj = json_decode($json, true);
    918
  • chartsbeds/trunk/chartsbeds-plugin-page.php

    r1650855 r1668421  
    1111    $cbh = shortcode_atts( array(
    1212        'limit' => esc_attr($cbh['limit']),
     13        'key' => esc_attr($cbh['key']),
    1314    ), $atts );
    1415
     
    1617        $cbh['limit'] = 200;
    1718    }
     19   
     20    if(empty($cbh['key'])){
     21        $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cbh['limit']).'');
     22    }else{
     23        $ekey = 'http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.$cbh['key'].'&limit='.esc_attr($cbh['limit']).'';
     24        $json = file_get_contents($ekey);
     25    }
    1826
    19     $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cbh['limit']).'');
     27    //$json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cbh['limit']).'');
    2028    $obj = json_decode($json, true);
    2129
  • chartsbeds/trunk/chartsbeds-widget-bar.php

    r1648713 r1668421  
    33if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    44
    5 function cbeds_widget_bar_creation(){
     5function cbeds_widget_bar_creation($atts){
     6   
     7    $cbb = shortcode_atts( array(
     8        'key' => esc_attr($cbb['key']),
     9    ), $atts );
     10   
     11    if(empty($cbb['key'])){
     12        $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'');
     13    }else{
     14        $ekey = 'http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.$cbb['key'].'';
     15        $json = file_get_contents($ekey);
     16    }
    617
    7     $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'');
     18    //$json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'');
    819    $obj = json_decode($json, true);
    920
  • chartsbeds/trunk/chartsbeds-widget-review.php

    r1665961 r1668421  
    66    $cba = shortcode_atts( array(
    77        'limit' => esc_attr($cba['limit']),
     8        'key' => esc_attr($cba['key']),
    89    ), $atts );
    910
     
    1516        }
    1617    }
     18   
     19    if(empty($cba['key'])){
     20        $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cba['limit']).'');
     21    }else{
     22        $ekey = 'http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.$cba['key'].'&limit='.esc_attr($cba['limit']).'';
     23        $json = file_get_contents($ekey);
     24    }
    1725
    1826    echo '<script>';
     
    3240            echo '<ul class="media-list">';
    3341
    34                  $json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cba['limit']).'');
     42                 //$json = file_get_contents('http://dashboard.chartspms.com/REVIEWS.json.php?apiKey='.get_option("charts_key").'&limit='.esc_attr($cba['limit']).'');
    3543                 $obj = json_decode($json, true);
    3644
  • chartsbeds/trunk/hotelrev.php

    r1665959 r1668421  
    33* Plugin Name: Chartsbeds
    44* Description: Chartsbeds reviews plugin.
    5 * Version: 1.0.4
     5* Version: 1.0.5
    66* Author: ChartsBeds
    77* Author URI: https://chartsbeds.com
     
    2626add_action('wp_head', 'cbeds_add_header_mc');
    2727function cbeds_add_header_mc() {
    28 
    29     wp_enqueue_style( 'rvmain-css', plugins_url( 'styles/style.css', __FILE__ ) );
     28    wp_enqueue_style( 'rvmain-css', plugins_url( 'styles/style.css', __FILE__ ) );
    3029    wp_register_style( 'rvmain-css', plugins_url( 'styles/style.css', __FILE__ ) );
    3130    if(!empty(get_option("dark_on"))){
     
    4140    wp_enqueue_script( 'circles', plugins_url( 'scripts/circles.js', __FILE__ ) );
    4241    wp_enqueue_script( 'shorten', plugins_url( 'scripts/shorten.js', __FILE__ ) );
     42}
    4343
    44 }
     44function wpb_adding_scripts() {
     45    wp_register_script( 'iframe-resizer', 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.14/iframeResizer.min.js', '', '', false);
     46wp_enqueue_script( 'iframe-resizer');}
     47add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
     48
     49
     50add_action( 'wp_footer', function () {
     51?>
     52   
     53    <script language="javascript" type="text/javascript">
     54        iFrameResize({log:false});
     55    </script>
     56
     57<?php } );
    4558
    4659/*Adding settings page to Admin Panel*/
Note: See TracChangeset for help on using the changeset viewer.