Plugin Directory

Changeset 1380034


Ignore:
Timestamp:
03/28/2016 02:21:32 AM (10 years ago)
Author:
chartbeat
Message:

Encoding updates, widget fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chartbeat/trunk/chartbeat.php

    r1375882 r1380034  
    3838function display_chartbeat_accountid_error() {
    3939        $class = 'notice notice-error';
    40         $message = 'You need to set your Chartbeat <a href="'.admin_url( esc_url('options-general.php?page=chartbeat-options' )).'">Account ID</a> in the Chartbeat options page';
     40        $message = 'You need to set your Chartbeat <a href="'.esc_url(admin_url('options-general.php?page=chartbeat-options')).'">Account ID</a> in the Chartbeat options page';
    4141
    4242        printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
     
    432432        <script type="text/javascript">
    433433        var options = { };
    434         new CBTopPagesWidget( <?php echo json_encode( json_decode( get_option('chartbeat_widgetconfig') ) ); ?> );
     434        new CBTopPagesWidget( <?php echo json_encode(get_option('chartbeat_widgetconfig')); ?> );
    435435        </script>
    436436        <?php
     
    451451    $url = 'https://api.chartbeat.com';
    452452    $url .= $_GET['url'];
    453     $url .= '&host=' . chartbeat_get_display_url(esc_js($domain)) .'&apikey=' . get_option('chartbeat_apikey');
     453    $url .= '&host=' . chartbeat_get_display_url(esc_js($domain)) .'&apikey=' . urlencode(get_option('chartbeat_apikey'));
    454454    $transient = 'cbproxy_' . md5($url);
    455     header( 'Content-Type: application/json' );
     455    header( 'Content-Type: application/jsonp' );
    456456    $response = get_transient( $transient );
    457457    if ( !$response ) {
     
    465465    }
    466466   
    467     echo json_encode( json_decode( $response ) );
     467    echo htmlspecialchars_decode( esc_js($response) );
    468468    exit;
    469469}
     
    582582
    583583    wp_enqueue_style( 'cbplugin_css' );
    584     // wp_enqueue_script( 'closure' );
    585     // wp_enqueue_script( 'deps' );
    586584    wp_enqueue_script( 'cbdashboard' );
    587585    wp_add_dashboard_widget('chartbeat_dashboard_widget', 'Chartbeat', 'chartbeat_dashboard_widget_function');
     
    590588function chartbeat_plugin_admin_init() {
    591589    wp_register_style('cbplugin_css',plugins_url('media/cb_plugin.css', __FILE__));
    592     // wp_register_script( 'closure','http://local.chartbeat.com/chartbeat/frontend/js/closure-library-read-only/closure/goog/base.js');
    593     // wp_register_script( 'deps','http://local.chartbeat.com/chartbeat/frontend/js/deps.js');
    594     // wp_register_script( 'cbdashboard','http://local.chartbeat.com/chartbeat/frontend/js/cmswidgets/cbdashboard.js');
    595590
    596591    wp_register_script( 'cbdashboard',plugins_url('media/cbdashboard.compiled.js', __FILE__));
Note: See TracChangeset for help on using the changeset viewer.