Changeset 834419
- Timestamp:
- 01/07/2014 04:00:16 PM (12 years ago)
- Location:
- apppresser/trunk
- Files:
-
- 1 added
- 6 edited
-
apppresser.php (modified) (7 diffs)
-
css/appp-admin-styles.css (added)
-
inc/admin-settings.php (modified) (10 diffs)
-
inc/theme-switcher.php (modified) (3 diffs)
-
js/appp.js (modified) (1 diff)
-
js/appp.min.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apppresser/trunk/apppresser.php
r825882 r834419 6 6 Text Domain: apppresser 7 7 Domain Path: /languages 8 Version: 1.0. 38 Version: 1.0.4 9 9 Author: AppPresser Team 10 10 Author URI: http://apppresser.com … … 30 30 class AppPresser { 31 31 32 const VERSION = '1.0. 3';32 const VERSION = '1.0.4'; 33 33 const SETTINGS_NAME = 'appp_settings'; 34 34 public static $settings = 'false'; … … 91 91 // Hook in all our important pieces 92 92 add_action( 'plugins_loaded', array( $this, 'includes' ) ); 93 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );93 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ), 8 ); 94 94 add_action( 'wp_head', array( $this, 'do_appp_script' ), 1 ); 95 95 … … 190 190 } 191 191 192 /** 193 * Strip query var from enqueued cordova script 194 * @since 1.0.3 195 * @param string $src URL 196 * @return string Modified URL 197 */ 192 198 function remove_query_arg( $src ) { 193 199 if ( false !== strpos( $src, 'cordova.js' ) ) … … 199 205 * Utility method for getting our plugin's settings 200 206 * @since 1.0.0 201 * @param string $key Optional key to get a specific option 202 * @return mixed Array of all options, a specific option, or false if specific option not found. 203 */ 204 public static function settings( $key = false ) { 207 * @param string $key Optional key to get a specific option 208 * @param string $fallback Fallback option if none is found. 209 * @return mixed Array of all options, a specific option, or false if specific option not found. 210 */ 211 public static function settings( $key = false, $fallback = false ) { 205 212 if ( self::$settings === 'false' ) { 206 213 self::$settings = get_option( self::SETTINGS_NAME ); … … 209 216 $setting = isset( self::$settings[ $key ] ) ? self::$settings[ $key ] : false; 210 217 // Override value or supply fallback 211 return apply_filters( 'apppresser_setting_default', $setting, $key, self::$settings ); 218 $return = apply_filters( 'apppresser_setting_default', $setting, $key, self::$settings, $fallback ); 219 return $return ? $return : $fallback; 220 212 221 } 213 222 return self::$settings; … … 246 255 * Function wrapper for AppPresser::settings() 247 256 * @since 1.0.0 248 * @param string $key Optional key to get a specific option 249 * @return mixed Array of all options, a specific option, or false if specific option not found. 257 * @param string $key Optional key to get a specific option 258 * @param string $fallback Fallback option if none is found. 259 * @return mixed Array of all options, a specific option, or false if specific option not found. 250 260 */ 251 function appp_get_setting( $key = false ) {252 return AppPresser::settings( $key );261 function appp_get_setting( $key = false, $fallback = false ) { 262 return AppPresser::settings( $key, $fallback ); 253 263 } -
apppresser/trunk/inc/admin-settings.php
r825875 r834419 16 16 public static $instance = null; 17 17 public static $page_slug = 'apppresser_settings'; 18 public static $extensions_slug = 'apppresser_sub_extensions'; 18 19 public static $help_slug = 'apppresser_sub_help_support'; 19 20 public static $menu_slug = ''; 21 public static $extensions_menu_slug = ''; 20 22 public static $help_menu_slug = ''; 21 23 public static $image_inputs = array(); … … 41 43 */ 42 44 function __construct() { 43 add_action( 'admin_menu', array( $this, 'plugin_menu' ) );45 add_action( 'admin_menu', array( $this, 'plugin_menu' ), 9 ); 44 46 add_filter( 'sanitize_option_'. AppPresser::SETTINGS_NAME, array( $this, 'maybe_reset_license_statuses' ), 99 ); 45 47 add_action( 'admin_init', array( $this, 'register_settings' ) ); … … 83 85 */ 84 86 function plugin_menu() { 85 // Create main menu 87 // Create main menu and settings page 86 88 self::$menu_slug = add_menu_page( __( 'AppPresser', 'apppresser' ), __( 'AppPresser', 'apppresser' ), 'manage_options', self::$page_slug, array( $this, 'settings_page' ) ); 87 89 // Create submenu items 90 91 // Extensions page 92 self::$extensions_menu_slug = add_submenu_page( self::$page_slug, __( 'Extensions', 'apppresser' ), __( 'Extensions', 'apppresser' ), 'manage_options', self::$extensions_slug, array( $this, 'extensions_page' ) ); 93 // Help page 88 94 self::$help_menu_slug = add_submenu_page( self::$page_slug, __( 'Help / Support', 'apppresser' ), __( 'Help / Support', 'apppresser' ), 'manage_options', self::$help_slug, array( $this, 'help_support_page' ) ); 89 95 90 // enqueue our js91 96 add_action( 'admin_head-' . self::$menu_slug, array( $this, 'admin_head' ) ); 92 add_action( 'admin_print_scripts-' . self::$menu_slug, array( $this, 'admin_scripts' ) ); 97 98 // enqueue 99 foreach ( array( self::$menu_slug, self::$extensions_menu_slug, self::$help_menu_slug ) as $slug ) 100 add_action( 'admin_print_scripts-' . $slug, array( $this, 'admin_scripts' ) ); 93 101 94 102 } … … 102 110 wp_enqueue_script( 'appp-admin', self::$js_url . 'appp-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-tooltip' ), self::VERSION ); 103 111 wp_enqueue_style( 'jquery-ui-smoothness', self::$css_url . 'smoothness/smoothness.custom.min.css' ); 104 } 105 106 /** 107 * Apply some settings for our tooltip hover spot 112 wp_enqueue_style( 'appp-admin-styles', self::$css_url . 'appp-admin-styles.css', null, self::VERSION.time() ); 113 } 114 115 /** 116 * Easy hook for adding to the admin_head on the AppPresser settings page 108 117 * @since 1.0.0 109 118 */ 110 119 function admin_head() { 111 ?>112 <style>.apppresser_settings .help { background: rgb(220,220,220); border-radius: 50%; color: rgb(0, 0, 0); display: inline-block; height: 15px; margin-left: 5px; text-align: center; text-decoration: none; text-shadow: none; width: 15px; font-weight: normal; } .apppresser_settings.mp6 .help { line-height: 15px; } .form-table .appp-section-title { padding-bottom: 0; } .appp-section-title h3 { margin: 0; } .apppresser_settings .form-table { display: none; padding-top: .6em; } .apppresser_settings .form-table.nav-tab-active { display: block; } .appp-ajax-results-help { display:none; margin: 10px 0 -8px 7px !important; } .submit .appp-tabs { margin: 0 10px; display: none; } .appp-tabs.nav-tab-active { display: inline; } .license_key.description span {113 color: white; display: block; background: #49C749; text-align: center; font-weight: bold; font-style: normal; text-transform: uppercase; margin: -5px 1px; width: 25em; } .mp6 .license_key.description span { font-size: 14px; } .license_key.description span.inactive {114 background: #F14949; } .license_key.description span.inactive a { color: #fff; }115 </style>116 <?php117 118 // Easy hook for adding to the admin_head on the AppPresser settings page119 120 do_action( 'appp_admin_settings_head', self::run() ); 120 121 } … … 207 208 <div class="wrap <?php echo $class; ?>"> 208 209 <?php 209 $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : array_shift( array_keys( self::$admin_tabs ) ); 210 $keys = array_keys( self::$admin_tabs ); 211 $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : array_shift( $keys ); 210 212 $current_tab = preg_replace('/tab-/', '', $current_tab, 1 ); 211 213 … … 264 266 self::add_setting_tab( __( 'AppPresser', 'apppresser' ), 'general' ); 265 267 self::add_setting_label( __( 'AppPresser Core Settings', 'apppresser' ) ); 266 self::add_setting( 'mobile_browser_theme_switch', __( 'Load AppPresser for mobile browsers', 'apppresser' ), array( 'type' => 'checkbox', 'helptext' => __( 'Whether or not you want to load the application layer for mobile users.', 'apppresser' ) ) ); 268 269 // For now... 270 if ( appp_get_setting( 'mobile_browser_theme_switch' ) ) { 271 self::add_setting( 'mobile_browser_theme_switch', __( 'Load AppPresser for mobile browsers', 'apppresser' ), array( 'type' => 'checkbox', 'helptext' => __( 'Display AppPresser in mobile browsers such as Safari and Chrome, instead of your normal theme.', 'apppresser' ) ) ); 272 } 273 267 274 self::add_setting( 'admin_theme_switch', __( 'Load AppPresser for Admins Only', 'apppresser' ), array( 'type' => 'checkbox', 'helptext' => __( 'Check this if you want to test your AppPresser app without loading it for visitors to your site.', 'apppresser' ), 'description' => __( '(for testing purposes)', 'apppresser' ) ) ); 268 self::add_setting( 'appp_theme', __( 'A dmin only theme', 'apppresser' ), array( 'type' => 'select', 'options' => $this->themes, 'helptext' => __( 'Select which theme you want to be loaded with your testing of AppPresser.', 'apppresser' ), 'description' => __( 'must be enabled above', 'apppresser' ) ) );275 self::add_setting( 'appp_theme', __( 'App only theme', 'apppresser' ), array( 'type' => 'select', 'options' => $this->themes, 'helptext' => __( 'Select which theme you want to be loaded inside the app, such as the AppPresser theme.', 'apppresser' ), 'description' => __( 'must be enabled above', 'apppresser' ) ) ); 269 276 self::add_setting( 'appp_home_page', __( 'Use a unique homepage for your app.', 'apppresser' ), array( 'helptext' => __( 'Allows you to specify which page users will see first when they load up you AppPresser app.', 'apppresser' ), 'description' => __( 'Start typing to search for a page', 'apppresser' ) ) ); 270 277 … … 310 317 311 318 /** 312 * Help and Support settings page313 * @since 1.0.0314 */315 function help_support_page() {316 $class = self::$page_slug;317 $class .= self::is_mp6() ? ' mp6' : '';318 ?>319 <div class="wrap <?php echo $class; ?>">320 <h2>AppPresser <?php _e( 'Help and Support', 'apppresser' ); ?></h2>321 <p><strong><?php _e( 'Resources', 'apppresser' ); ?>:</strong> <a href="https://github.com/WebDevStudios/AppPresser/" target="_blank">AppPresser <?php _e( 'Core on Github', 'apppresser' ); ?></a> | <a href="http://wordpress.org/support/plugin/apppresser" target="_blank"><?php _e( 'Support Forums', 'apppresser' ); ?></a> | <a href="http://apppresser.com/docs/" target="_blank">AppPresser <?php _e( 'Documentation', 'apppresser' ); ?></a></p>322 <p><strong>AppPresser <?php _e( 'Online', 'apppresser' ); ?>:</strong> <a href="http://twitter.com/apppresser" target="_blank"><?php _e( 'Twitter', 'apppresser' ); ?></a> | <a href="http://facebook.com/apppresser" target="_blank"><?php _e( 'Facebook', 'apppresser' ); ?></a> | <a href="http://youtube.com/user/apppresser" target="_blank"><?php _e( 'YouTube', 'apppresser' ); ?></a></p>323 <h3><?php _e( 'About AppPresser', 'apppresser' ); ?></h3>324 <p><?php _e( 'AppPresser was created by Scott Bolinger, Brad Williams, Brian Messenlehner, and Lisa Sabin-Wilson', 'apppresser' ); ?>.</p>325 </div>326 <?php327 }328 329 /**330 319 * Adds a setting section to AppPresser's settings 331 320 * @since 1.0.0 … … 337 326 public static function add_setting( $key, $label, $args = array() ) { 338 327 328 $keys = array_keys( self::$admin_tabs ); 339 329 $defaults = array( 340 330 'type' => 'text', … … 342 332 'description' => '', 343 333 'options' => array(), 344 'tab' => array_shift( array_keys( self::$admin_tabs )),334 'tab' => array_shift( $keys ), 345 335 'echo' => false, 346 336 ); … … 518 508 } 519 509 510 /** 511 * Help and Support settings page 512 * @since 1.0.0 513 */ 514 function help_support_page() { 515 $class = self::$page_slug; 516 $class .= self::is_mp6() ? ' mp6' : ''; 517 ?> 518 <div class="wrap <?php echo $class; ?>"> 519 <h2>AppPresser <?php _e( 'Help and Support', 'apppresser' ); ?></h2> 520 <p><strong><?php _e( 'Resources', 'apppresser' ); ?>:</strong> <a href="https://github.com/WebDevStudios/AppPresser/" target="_blank">AppPresser <?php _e( 'Core on Github', 'apppresser' ); ?></a> | <a href="http://wordpress.org/support/plugin/apppresser" target="_blank"><?php _e( 'Support Forums', 'apppresser' ); ?></a> | <a href="http://apppresser.com/docs/" target="_blank">AppPresser <?php _e( 'Documentation', 'apppresser' ); ?></a></p> 521 <p><strong>AppPresser <?php _e( 'Online', 'apppresser' ); ?>:</strong> <a href="http://twitter.com/apppresser" target="_blank"><?php _e( 'Twitter', 'apppresser' ); ?></a> | <a href="http://facebook.com/apppresser" target="_blank"><?php _e( 'Facebook', 'apppresser' ); ?></a> | <a href="http://youtube.com/user/apppresser" target="_blank"><?php _e( 'YouTube', 'apppresser' ); ?></a></p> 522 <h3><?php _e( 'About AppPresser', 'apppresser' ); ?></h3> 523 <p><?php _e( 'AppPresser was created by Scott Bolinger, Brad Williams, Brian Messenlehner, and Lisa Sabin-Wilson', 'apppresser' ); ?>.</p> 524 </div> 525 <?php 526 } 527 528 /** 529 * AppPresser extensions page output 530 * @since 1.0.4 531 */ 532 function extensions_page() { 533 $class = self::$page_slug; 534 $class .= self::is_mp6() ? ' mp6' : ''; 535 ?> 536 <div class="wrap <?php echo $class; ?>"> 537 <h2><?php printf( 'AppPresser ' .__( 'Extensions — %s', 'apppresser' ), '<a href="http://apppresser.com/extensions/?ref=appp" class="button-primary" target="_blank">' . __( 'Browse All Extensions', 'apppresser' ) . '</a>' ); ?></h2> 538 <p><?php _e( 'These extensions extend the functionality of AppPresser.', 'apppresser' ); ?></p> 539 540 <?php 541 // Attempt to pull back our cached feed 542 $feed = get_transient( 'appp_extensions_feed' ); 543 $fallback = '<div class="error"><p>' . __( 'There was an error retrieving the extensions list. Please try again later.', 'apppresser' ) . '</div>'; 544 545 // If we don't have a cached feed, pull back fresh data 546 if ( empty( $feed ) ) { 547 // Retrieve and parse our feed 548 $feed = wp_remote_get( 'http://apppresser.com/?feed=addons', array( 'sslverify' => false ) ); 549 if ( ! is_wp_error( $feed ) ) { 550 if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { 551 $feed = wp_remote_retrieve_body( $feed ); 552 // Cache our feed for 1 hour 553 set_transient( 'appp_extensions_feed', $feed, HOUR_IN_SECONDS ); 554 } 555 } 556 } 557 558 // display the feed or error message 559 echo $feed && ! is_wp_error( $feed ) ? $feed : $fallback; 560 ?> 561 </div> 562 <?php 563 564 } 565 566 /** 567 * Returns url to the AppPresser settings page 568 * @since 1.0.4 569 * @return string AppPresser settings page url 570 */ 571 public static function url() { 572 return add_query_arg( 'page', self::$page_slug, admin_url( 'admin.php' ) ); 573 } 574 520 575 } 521 576 AppPresser_Admin_Settings::run(); -
apppresser/trunk/inc/theme-switcher.php
r825873 r834419 34 34 add_filter( 'pre_option_show_on_front', array( $this, 'pre_show_on_front' ) ); 35 35 add_filter( 'pre_option_page_on_front', array( $this, 'pre_page_on_front' ) ); 36 add_action( 'template_redirect', array( $this, 'check_appaware' ) ); 37 36 38 $this->theme = wp_get_theme(); 37 39 } … … 46 48 if ( is_admin() ) 47 49 return; 48 49 50 // Set cookie from querystring if request is coming from an app 50 51 if ( self::is_app() ) { … … 116 117 } 117 118 119 /** 120 * Checks if selected theme supports apppresser. Theme should have `add_theme_support( 'apppresser' );` 121 * If not, dies with a message and link to the AppPresser settings page. 122 * 123 * @since 1.0.4 124 */ 125 public function check_appaware() { 126 if ( ! current_theme_supports( 'apppresser' ) ) { 127 wp_die( '<p style="text-align:center;font-size:1.1em"><strong>'. __( 'This theme does not support AppPresser.', 'apppresser' ) . '</strong><br>' . sprintf( __( 'Please change your %s to an AppAware theme.', 'apppresser' ), '<a href="'. AppPresser_Admin_Settings::url() .'">'. __( '"App only theme?" setting', 'apppresser' ) .'</a>' ) .'</p>' ); 128 } 129 } 130 131 118 132 } 119 133 AppPresser_Theme_Switcher::go(); -
apppresser/trunk/js/appp.js
r825873 r834419 19 19 apppCore.log( 'apppCore', apppCore ); 20 20 21 if ( ! apppCore.is_appp_true && ! apppCore.QueryVars('appp') && apppCore.isApp() && apppCore.isMobile() ) {21 if ( ! apppCore.is_appp_true && ! apppCore.QueryVars('appp') && ! apppCore._isApp && apppCore.isApp() && apppCore.isMobile() ) { 22 22 23 23 // Redirect to query var-ed version -
apppresser/trunk/js/appp.min.js
r825873 r834419 1 1 window.apppCore=typeof window.apppCore!=="undefined"?window.apppCore:{};apppCore.init=function(){apppCore._isApp=typeof apppCore.mobile_browser_theme_switch!=="undefined"&&apppCore.mobile_browser_theme_switch==="on"?true:"not set"; 2 apppCore.queryVars=false;apppCore.log("apppCore",apppCore);if(!apppCore.is_appp_true&&!apppCore.QueryVars("appp")&& apppCore.isApp()&&apppCore.isMobile()){window.location.href=apppCore.AddQueryVar(window.location.href,"appp",1);2 apppCore.queryVars=false;apppCore.log("apppCore",apppCore);if(!apppCore.is_appp_true&&!apppCore.QueryVars("appp")&&!apppCore._isApp&&apppCore.isApp()&&apppCore.isMobile()){window.location.href=apppCore.AddQueryVar(window.location.href,"appp",1); 3 3 }else{if(apppCore.QueryVars("appp")){apppCore.log("apppCore.is_appp_true",!!apppCore.is_appp_true);apppCore.log("apppCore.QueryVars('appp')",!!apppCore.QueryVars("appp")); 4 4 apppCore.log("apppCore.isApp()",!!apppCore.isApp());apppCore.log("apppCore.isMobile()",!!apppCore.isMobile());}}};apppCore.ReadCookie=function(b){var e=b+"="; -
apppresser/trunk/readme.txt
r825873 r834419 5 5 Requires at least: 3.5 6 6 Tested up to: 3.8 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 90 90 == Changelog == 91 91 92 = 1.0.4 = 93 * Extensions submenu highlighting available AppPresser add-ons 94 92 95 = 1.0.3 = 93 96 * Bug Fix: `plugins_loaded` firing too early causing conflicts with other plugins. … … 109 112 == Upgrade Notice == 110 113 114 = 1.0.4 = 115 * Extensions submenu highlighting available AppPresser add-ons 116 111 117 = 1.0.3 = 112 118 * Bug Fix: `plugins_loaded` firing too early causing conflicts with other plugins.
Note: See TracChangeset
for help on using the changeset viewer.