Changeset 1105508
- Timestamp:
- 03/04/2015 11:10:54 PM (11 years ago)
- Location:
- buddypress-profile-tabs/trunk
- Files:
-
- 6 edited
-
admin/assets/js/admin.js (modified) (1 diff)
-
admin/class-bp-profile-tabs-admin.php (modified) (3 diffs)
-
admin/views/admin.php (modified) (2 diffs)
-
bp-profile-tabs.php (modified) (1 diff)
-
public/class-bp-profile-tabs.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
buddypress-profile-tabs/trunk/admin/assets/js/admin.js
r958692 r1105508 1 1 (function($) { 2 2 "use strict"; 3 4 3 $(function() { 5 4 5 $(document).ready( 6 function load_bp_profile_tabs() { 7 $( "div#tabs" ).tabs(); 8 } 9 ); 10 6 11 }); 7 8 12 }(jQuery)); -
buddypress-profile-tabs/trunk/admin/class-bp-profile-tabs-admin.php
r961874 r1105508 44 44 $this->plugin_name = $plugin->get_plugin_name(); 45 45 $this->version = $plugin->get_plugin_version(); 46 $this->jquery_ui_version = $plugin->get_jquery_ui_version(); 46 47 47 48 // Add the options page and menu item. … … 66 67 add_action( 'admin_init', array( $this, 'settings_import' ) ); 67 68 69 add_action( 'admin_init', array( $this, 'admin_register_bpt_script' ) ); 70 add_action( 'admin_head', array( $this, 'load_admin_scripts' ) ); 71 68 72 } 69 73 … … 189 193 require_once( plugin_dir_path( __FILE__ ) . 'includes/CMBF/init.php' ); 190 194 } 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 } 191 225 192 226 -
buddypress-profile-tabs/trunk/admin/views/admin.php
r958692 r1105508 7 7 * @copyright 2014 Jacob Schweitzer 8 8 */ 9 10 9 ?> 11 10 … … 77 76 78 77 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> 80 105 81 106 -
buddypress-profile-tabs/trunk/bp-profile-tabs.php
r970687 r1105508 32 32 33 33 /* 34 * Load Language wrapper function for WPML/Ceceppa Multilingua/Polylang35 */36 require_once( plugin_dir_path( __FILE__ ) . 'includes/language.php' );37 38 /*39 34 * Register hooks that are fired when the plugin is activated or deactivated. 40 35 * When the plugin is deleted, the uninstall.php file is loaded. -
buddypress-profile-tabs/trunk/public/class-bp-profile-tabs.php
r958692 r1105508 44 44 protected static $instance = null; 45 45 46 47 46 48 47 /** … … 337 336 wp_enqueue_style( $this->plugin_slug . '-jquery-ui-style' ); 338 337 wp_enqueue_script( $this->plugin_slug . '-script' ); 339 338 //echo $this->get_jquery_ui_version(); 340 339 } 341 340 /** … … 348 347 349 348 $bpt_options = get_option("bp_profile_tabs_option"); 349 $protocol = is_ssl() ? 'https' : 'http'; 350 $jquery_ui_version = $this->get_jquery_ui_version(); 350 351 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'; 352 353 } 353 354 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'; 355 356 } 356 357 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'; 358 359 } 359 360 … … 361 362 } 362 363 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 363 383 } -
buddypress-profile-tabs/trunk/readme.txt
r970687 r1105508 4 4 Tags: BuddyPress, jQuery, jQueryUI, Profile, Tabs 5 5 Requires at least: 3.4.2 6 Tested up to: 3.9.16 Tested up to: 4.1.1 7 7 Stable tag: 1.5.4 8 8 License: GPLv2 or later … … 41 41 42 42 == 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 43 48 = 1.5.1 = 44 49 * Fixed anonymous function issue ( for WordPress installs running on PHP version < 5.3 )
Note: See TracChangeset
for help on using the changeset viewer.