Plugin Directory

Changeset 1105508


Ignore:
Timestamp:
03/04/2015 11:10:54 PM (11 years ago)
Author:
primetimejas
Message:

1.5.5 update

Location:
buddypress-profile-tabs/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • buddypress-profile-tabs/trunk/admin/assets/js/admin.js

    r958692 r1105508  
    11(function($) {
    22  "use strict";
    3 
    43  $(function() {
    54
     5    $(document).ready(
     6      function load_bp_profile_tabs() {
     7        $( "div#tabs" ).tabs();
     8      }
     9    );
     10
    611  });
    7 
    812}(jQuery));
  • buddypress-profile-tabs/trunk/admin/class-bp-profile-tabs-admin.php

    r961874 r1105508  
    4444        $this->plugin_name = $plugin->get_plugin_name();
    4545        $this->version = $plugin->get_plugin_version();
     46        $this->jquery_ui_version = $plugin->get_jquery_ui_version();
    4647
    4748        // Add the options page and menu item.
     
    6667        add_action( 'admin_init', array( $this, 'settings_import' ) );
    6768
     69        add_action( 'admin_init', array( $this, 'admin_register_bpt_script' ) );
     70        add_action( 'admin_head', array( $this, 'load_admin_scripts' ) );
     71
    6872    }
    6973
     
    189193        require_once( plugin_dir_path( __FILE__ ) . 'includes/CMBF/init.php' );
    190194    }
     195    public function load_admin_scripts(){
     196        if ( $_GET['page'] === 'bp-profile-tabs' ) {
     197            wp_enqueue_style( $this->plugin_slug . '-jquery-ui-style' );
     198            wp_enqueue_script( $this->plugin_slug . '-script' );
     199        }
     200    }
     201    public function admin_register_bpt_script() {
     202        wp_register_script( $this->plugin_slug . '-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-tabs' ), $this->version );
     203        $bpt_theme = isset( $_POST['bpt_theme'] ) ? $_POST['bpt_theme'] : '';
     204        $bpt_options = get_option("bp_profile_tabs_option");
     205        if ( empty( $bpt_theme ) ) {
     206            $bpt_theme = $bpt_options["bpt_theme"];
     207        }
     208
     209        $protocol = is_ssl() ? 'https' : 'http';
     210        $jquery_ui_version = $this->jquery_ui_version;
     211        if ( $bpt_options['bpt_cdn'] == 'google' ) {
     212                $jquery_ui_css_url = $protocol . '://ajax.googleapis.com/ajax/libs/jqueryui/'.$jquery_ui_version.'/themes/'.$bpt_theme.'/jquery-ui.css';
     213                                    //http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css
     214        }
     215        if ( $bpt_options['bpt_cdn'] == 'microsoft' ) {
     216            $jquery_ui_css_url = $protocol . '://ajax.aspnetcdn.com/ajax/jquery.ui/'.$jquery_ui_version.'/themes/'.$bpt_theme.'/jquery-ui.css';
     217                                        //http://ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/themes/blitzer/jquery-ui.css
     218                                        //http://ajax.aspnetcdn.com/ajax/jquery.ui/1.11.3/jquery-ui.min.js
     219        }
     220        if ( $bpt_options['bpt_cdn'] == 'jquery' ) {
     221            $jquery_ui_css_url = $protocol . '://code.jquery.com/ui/'.$jquery_ui_version.'/themes/'.$bpt_theme.'/jquery-ui.css';
     222        }
     223        wp_register_style( $this->plugin_slug . '-jquery-ui-style', $jquery_ui_css_url, array(), $this->version );
     224    }
    191225   
    192226
  • buddypress-profile-tabs/trunk/admin/views/admin.php

    r958692 r1105508  
    77 * @copyright 2014 Jacob Schweitzer
    88 */
    9 
    109?>
    1110
     
    7776
    7877       
    79        
     78    <br/><br/>
     79   
     80    <h2><?php _e( 'Example Tabs', $this->plugin_slug ) ?></h2>
     81
     82    <div id="tabs">
     83        <ul>
     84            <li>
     85                <a href="#tabs-1"><?php _e( 'Tab 1', $this->plugin_slug ) ?></a>
     86            </li>
     87            <li>
     88                <a href="#tabs-2"><?php _e( 'Tab 2', $this->plugin_slug ) ?></a>
     89            </li>
     90        </ul>
     91
     92        <div id="tabs-1" >
     93            <div class="bp-widget base">
     94                <h3><?php _e( 'Tab 1', $this->plugin_slug ) ?></h3>
     95                <?php _e( 'Example data...', $this->plugin_slug ) ?>
     96            </div>
     97        </div>
     98        <div id="tabs-2" >
     99            <div class="bp-widget base">
     100                <h4><?php _e( 'Tab 2', $this->plugin_slug ) ?></h4>
     101                <?php _e( 'More example data...', $this->plugin_slug ) ?>
     102            </div>
     103        </div>
     104    </div> 
    80105       
    81106       
  • buddypress-profile-tabs/trunk/bp-profile-tabs.php

    r970687 r1105508  
    3232
    3333/*
    34  * Load Language wrapper function for WPML/Ceceppa Multilingua/Polylang
    35  */
    36 require_once( plugin_dir_path( __FILE__ ) . 'includes/language.php' );
    37 
    38 /*
    3934 * Register hooks that are fired when the plugin is activated or deactivated.
    4035 * When the plugin is deleted, the uninstall.php file is loaded.
  • buddypress-profile-tabs/trunk/public/class-bp-profile-tabs.php

    r958692 r1105508  
    4444    protected static $instance = null;
    4545
    46    
    4746   
    4847    /**
     
    337336        wp_enqueue_style( $this->plugin_slug . '-jquery-ui-style' );
    338337        wp_enqueue_script( $this->plugin_slug . '-script' );
    339 
     338        //echo $this->get_jquery_ui_version();
    340339    }
    341340     /**
     
    348347
    349348        $bpt_options = get_option("bp_profile_tabs_option");
     349        $protocol = is_ssl() ? 'https' : 'http';
     350        $jquery_ui_version = $this->get_jquery_ui_version();
    350351        if ( $bpt_options['bpt_cdn'] == 'google' ) {
    351                 $jquery_ui_css_url = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
     352            $jquery_ui_css_url = $protocol . '://ajax.googleapis.com/ajax/libs/jqueryui/'.$jquery_ui_version.'/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
    352353        }
    353354        if ( $bpt_options['bpt_cdn'] == 'microsoft' ) {
    354             $jquery_ui_css_url = 'http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
     355            $jquery_ui_css_url = $protocol . '://ajax.aspnetcdn.com/ajax/jquery.ui/'.$jquery_ui_version.'/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
    355356        }
    356357        if ( $bpt_options['bpt_cdn'] == 'jquery' ) {
    357             $jquery_ui_css_url = 'http://code.jquery.com/ui/1.11.0/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
     358            $jquery_ui_css_url = $protocol . '://code.jquery.com/ui/'.$jquery_ui_version.'/themes/'.$bpt_options["bpt_theme"].'/jquery-ui.css';
    358359        }
    359360
     
    361362    }
    362363
     364
     365    public function get_jquery_ui_version() {
     366
     367        global $wp_scripts;
     368
     369        if( !$wp_scripts instanceof WP_Scripts )
     370            $wp_scripts = new WP_Scripts();
     371
     372        $jquery_ui_core = $wp_scripts->query( 'jquery-ui-core' );
     373
     374        if( !$jquery_ui_core instanceof _WP_Dependency )
     375            return $this->ui_version;
     376
     377        if( !isset( $jquery_ui_core->ver ) )
     378            return $this->ui_version;
     379
     380        return $jquery_ui_core->ver;
     381    }
     382
    363383}
  • buddypress-profile-tabs/trunk/readme.txt

    r970687 r1105508  
    44Tags: BuddyPress, jQuery, jQueryUI, Profile, Tabs
    55Requires at least: 3.4.2
    6 Tested up to: 3.9.1
     6Tested up to: 4.1.1
    77Stable tag: 1.5.4
    88License: GPLv2 or later
     
    4141
    4242== Changelog ==
     43= 1.5.4 =
     44* Using the same version of the jQuery UI theme as the jQuery UI installed in the current version of WordPress on the server.
     45* Added example tabs in the admin section.
     46* Registering scripts based on http or https protocol to avoid https errors.
     47
    4348= 1.5.1 =
    4449* Fixed anonymous function issue ( for WordPress installs running on PHP version < 5.3 )
Note: See TracChangeset for help on using the changeset viewer.