Plugin Directory

Changeset 469209


Ignore:
Timestamp:
11/29/2011 08:40:01 PM (14 years ago)
Author:
ansimation
Message:

1.5.8

  • Fixed script and style enqueue issues with WordPress 3.3
  • Fixed issue with default_loader.gif when FORCE_SSL was set to true.
Location:
tb-testimonials/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tb-testimonials/trunk/readme.txt

    r452689 r469209  
    55Requires at least: 3.0
    66Tested up to: 3.1
    7 Stable tag: 1.5.7
     7Stable tag: 1.5.8
    88
    99Testimonial Management done right with Custom Post Types. Supports a testimonial.php template file for single testimonial pages. Testimonial Shortcode to insert testimonials in any post or page. Animated Sidebar Widget, Built in documentation and code examples. Customize output and tons of other options!
     
    4343
    4444== Changelog ==
     45
     46= 1.5.8 =
     47* Fixed script and style enqueue issues with WordPress 3.3
     48* Fixed issue with default_loader.gif when FORCE_SSL was set to true.
    4549
    4650= 1.5.7 =
  • tb-testimonials/trunk/tb-testimonials.php

    r452689 r469209  
    44*   Plugin URI: http://travisballard.com/wordpress/tb-testimonials/
    55*   Description: Testimonials managed by Custom Post Types. Supports a testimonial.php template file for single testimonial pages. Testimonial Shortcode to insert testimonials in any post. Scrolling Sidebar Widget
    6 *   Version: 1.5.7
     6*   Version: 1.5.8
    77*   Author: Travis Ballard
    88*   Author URI: http://www.travisballard.com
     
    4343    function __construct()
    4444    {
    45         global $pagenow;
    46 
    4745        # settings
    4846        add_action( 'init', array( &$this, 'init' ) );
     
    9189        add_filter( 'manage_edit-testimonial_columns', array( &$this, 'testimonial_listing_edit_columns' ) );
    9290        add_action( 'manage_pages_custom_column', array( &$this, 'testimonial_listing_columns' ) );
    93 
    94         # admin js
    95         $pages = array( 'edit.php', 'post-new.php', 'post.php' );
    96         if( in_array( $pagenow, $pages ) ){
    97             wp_enqueue_script( 'tbtestimonials_admin', plugins_url( 'inc/js/tbtestimonials.admin.js', __FILE__ ), array( 'jquery' ), '1.0' );
    98         }
    99 
    100         # admin css
    101         if( is_admin() ) wp_enqueue_style( 'tbtestimonials-admin-stylesheet', plugins_url( 'inc/css/tbtestimonials.admin.css', __FILE__ ), array(), '1.0', 'screen' );
    102 
    103         # jquery: we use the version on google's cdn because other plugins load the one bundled with WordPress in the header and this sometime
    104         # causes conflicts. Having 2 versions of jQuery will cause a conflict as well though so that's why we have the option to load in the header
    105         # or the footer depending on whichever one works for you. By default we try to load it in the footer for performance reasons.
    106         wp_register_script( 'jquery-footer', "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", false, '1.4.2', $this->load_js_in_footer ? 1 : 0 );
    107 
    108         # cycle
    109         $which_jq = (bool)$this->load_js_in_footer ? array( 'jquery-footer' ) : array( 'jquery' );
    110         wp_register_script( 'jquery-cycle', plugins_url( 'inc/js/jquery.cycle.all.min.js', __FILE__ ), $which_jq, '1.0', (bool)$this->load_js_in_footer );
    111 
    112         # documentation
    113         wp_register_script( 'tbt_documentation', plugins_url( 'inc/js/documentation.js', __FILE__ ), array( 'jquery-ui-tabs' ), '1.0' );
    114         wp_register_style( 'tbt_documentation', plugins_url( 'inc/css/documentation.css', __FILE__ ), array(), '1.0', 'screen' );
    115 
    116         # code mirror
    117         if( $pagenow == 'edit.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'testimonial' && isset( $_GET['page'] ) && $_GET['page'] == 'tbtestimonials-syntax-settings' ){
    118             wp_enqueue_script( 'CodeMirror', plugins_url( 'inc/js/codemirror.js', __FILE__ ), array(), '1.0' );
    119             add_action ('admin_footer', array( &$this, 'add_codemirror' ) );
    120         }
    121 
    122         # only call when widget is active
    123         if( is_active_widget( false, false, 'tbtestimonialswidget' ) )
    124         {
    125             # load js
    126             if( ! is_admin() ){
    127                 $requires = isset( $this->settings['disable_cycle'] ) && $this->settings['disable_cycle'] == 1 ? array() : array( 'jquery-cycle' );
    128                 wp_enqueue_script( 'tbtestimonials', plugins_url( 'inc/js/tbtestimonials.js', __FILE__ ), $requires, '1.0', $this->load_js_in_footer ? 1 : 0 );
    129             }
    130 
    131             # load css
    132             if( ! is_admin() && isset( $this->settings['use_stylesheet'] ) ) wp_enqueue_style( 'tbtestimonials-stylesheet', plugins_url( 'inc/css/tbtestimonials.css', __FILE__ ), array(), '1.0', 'screen' );
    133         }
    134     }
    135 
    136     /**
    137     * init funcitons. register taxonomy and post types
     91    }
     92
     93    /**
     94    * init funcitons. register scripts, styles, taxonomies and post types
    13895    *
    13996    */
    14097    function init()
    14198    {
     99        $this->register_scripts();
     100        $this->register_styles();
     101
    142102        # add testimonial post type
    143103        register_post_type(
     
    726686    }
    727687
     688    /**
     689    * register scripts used in plugin
     690    *
     691    */
     692    function register_scripts()
     693    {
     694        global $pagenow;
     695
     696        # admin js
     697        $pages = array( 'edit.php', 'post-new.php', 'post.php' );
     698        if( in_array( $pagenow, $pages ) ){
     699            wp_enqueue_script( 'tbtestimonials_admin', plugins_url( 'inc/js/tbtestimonials.admin.js', __FILE__ ), array( 'jquery' ), '1.0' );
     700        }
     701
     702        # jquery: we use the version on google's cdn because other plugins load the one bundled with WordPress in the header and this sometime
     703        # causes conflicts. Having 2 versions of jQuery will cause a conflict as well though so that's why we have the option to load in the header
     704        # or the footer depending on whichever one works for you. By default we try to load it in the footer for performance reasons.
     705        wp_register_script( 'jquery-footer', "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", false, '1.4.2', $this->load_js_in_footer ? 1 : 0 );
     706
     707        # cycle
     708        $which_jq = (bool)$this->load_js_in_footer ? array( 'jquery-footer' ) : array( 'jquery' );
     709        wp_register_script( 'jquery-cycle', plugins_url( 'inc/js/jquery.cycle.all.min.js', __FILE__ ), $which_jq, '1.0', (bool)$this->load_js_in_footer );
     710
     711        # documentation
     712        wp_register_script( 'tbt_documentation', plugins_url( 'inc/js/documentation.js', __FILE__ ), array( 'jquery-ui-tabs' ), '1.0' );
     713
     714        # code mirror
     715        if( $pagenow == 'edit.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'testimonial' && isset( $_GET['page'] ) && $_GET['page'] == 'tbtestimonials-syntax-settings' ){
     716            wp_enqueue_script( 'CodeMirror', plugins_url( 'inc/js/codemirror.js', __FILE__ ), array(), '1.0' );
     717            add_action ('admin_footer', array( &$this, 'add_codemirror' ) );
     718        }
     719
     720        # only call when widget is active
     721        if( is_active_widget( false, false, 'tbtestimonialswidget' ) )
     722        {
     723            # load js
     724            if( ! is_admin() ){
     725                $requires = isset( $this->settings['disable_cycle'] ) && $this->settings['disable_cycle'] == 1 ? array() : array( 'jquery-cycle' );
     726                wp_enqueue_script( 'tbtestimonials', plugins_url( 'inc/js/tbtestimonials.js', __FILE__ ), $requires, '1.0', $this->load_js_in_footer ? 1 : 0 );
     727            }
     728        }
     729    }
     730
     731    /**
     732    * register styles used in plugin
     733    *
     734    */
     735    function register_styles()
     736    {
     737        # admin css
     738        if( is_admin() ) wp_enqueue_style( 'tbtestimonials-admin-stylesheet', plugins_url( 'inc/css/tbtestimonials.admin.css', __FILE__ ), array(), '1.0', 'screen' );
     739
     740        # documentation
     741        wp_register_style( 'tbt_documentation', plugins_url( 'inc/css/documentation.css', __FILE__ ), array(), '1.0', 'screen' );
     742
     743        # only call when widget is active
     744        if( is_active_widget( false, false, 'tbtestimonialswidget' ) )
     745        {
     746            # load css
     747            if( ! is_admin() && isset( $this->settings['use_stylesheet'] ) ) wp_enqueue_style( 'tbtestimonials-stylesheet', plugins_url( 'inc/css/tbtestimonials.css', __FILE__ ), array(), '1.0', 'screen' );
     748        }
     749    }
    728750}
    729751
     
    943965                $preloader['path'] = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $preloader['url'] );
    944966            }
    945             else # not in loaders folder, error
    946             {
    947                 trigger_error( sprintf( '%s is not a valid file or url', $url ), E_USER_WARNING );
     967            else # not in loaders folder, return
    948968                return false;
    949             }
    950969        }
    951970    }
Note: See TracChangeset for help on using the changeset viewer.