public static function install_page($is_active) { ?> <div id="install" class="perks plugins tab-container <?php echo self::show_splash() ? 'splash' : ''; ?> " <?php echo $is_active ? '' : 'style="display:none;"'; ?> > <?php if (self::show_splash()) { $generic_perk = new GWPerk(); ?> <div id="need-license-splash" style="display:none;"> <div class="perk-listing"> <div class="wrap"> <h3><?php _e('Want Access to All Perks? Buy a License!', 'gravityperks'); ?> </h3> <p><?php printf(__('Purchase a Gravity Perks license and install as many perks as you\'d like! If you\'ve already purchased a license you can register it via the "Register License" button below.', 'gravityperks'), '<a href="' . GW_REGISTER_LICENSE_URL . '">', '</a>'); ?> </p> <!--<p><?php _e('Keep your Gravity Perks license active for unlimited access to <strong>all current and future</strong> perks . You\'ll also get free automatic upgrades and premium support.', 'gravityperks'); ?> </p>--> <div class="gp-license-splash-actions"> <a href="<?php echo GW_BUY_GPERKS_URL; ?> " class="button-primary" target="_blank"><?php _e('Buy License', 'gravityperks'); ?> </a> <a href="<?php echo GW_REGISTER_LICENSE_URL; ?> ®ister=1" class="button-secondary"><?php _e('Register License', 'gravityperks'); ?> </a> <a href="javascript:void(0);" onclick="dismissLicenseSplash();" class="dismiss-link"><?php _e('dismiss', 'gravityperks'); ?> </a> </div> </div> </div> </div> <?php } ?> <div class="perk-listings"> <?php $available_perks = GWPerks::get_available_perks(); $i = 0; foreach ($available_perks as $perk) { if (!isset($perk->plugin_file) || empty($perk->plugin_file) || GWPerk::is_installed($perk->plugin_file)) { continue; } $generic_perk = new GWPerk($perk->plugin_file); ?> <div class="perk-listing install"> <div class="wrap"> <h3><?php echo $perk->name; ?> <span class="version">v.<?php echo $perk->version; ?> </span></h3> <div class="actions"> <?php if (GWPerks::has_valid_license()) { ?> <a href="<?php echo $generic_perk->get_link_for('install'); ?> " class="button"><?php _e('Install Perk', 'gravityperks'); ?> </a> <?php } else { ?> <a href="<?php echo GW_BUY_GPERKS_URL; ?> " class="button" target="_blank"><?php _e('Buy License', 'gravityperks'); ?> </a> <?php } ?> </div> <div class="perk-description"><?php echo $perk->sections['description']; ?> </div> </div> </div> <?php } if (!isset($generic_perk)) { ?> <div class="all-perks-installed"> <?php _e('Holy cow. You must really love perks.<br /><strong>You\'ve installed them all</strong>!', 'gravityperks'); ?> </div> <?php } unset($perk); $i++; ?> </div> <!-- / perk-listings --> </div> <?php }
public static function load_page() { // temporary fix for old perks relying on markdown if( ! function_exists( 'Markdown' ) ) require_once( GWPerks::get_base_path() . '/includes/markdown.php' ); self::load_perk_pointers(); add_action( 'admin_print_footer_scripts', array(__class__, 'output_tb_resize_script'), 11 ); $is_install = gwget('view') == 'install'; $installed_perks = GWPerks::get_installed_perks(); wp_enqueue_style( 'gf_tooltip', GFCommon::get_base_url() . '/css/tooltip.css', null, GFCommon::$version ); wp_print_styles( 'gf_tooltip' ); ?> <style type="text/css"> #gwp-header-links { float: right; margin-top: -36px; } #gwp-header-links li { display: inline; padding-left: 10px; } .gp-active-perks { overflow: hidden; } .perks { padding: 20px 0 0; } .perks .manage-perks-intro, .perks .install-perks-intro { border-bottom: 1px solid #eee; padding: 0 20px 20px; margin: 0 0 20px; } .perks .install-perks-intro h3 { margin-top: 0; } .perks .no-perks-installed { padding: 60px 20px 20px; margin: 0 0 20px; text-align: center; font-size: 24px; line-height: 36px; } .perks .no-perks-installed a { cursor: pointer; } .perks .all-perks-installed { padding: 60px 20px 20px; margin: 0 0 20px; text-align: center; font-size: 24px; line-height: 36px; } #install.tab-container { overflow: hidden; position: relative; } #install #need-license-splash { background-color: #fff; position: absolute; z-index: 99; top: 100px; left: 50%; margin-left: -25%; width: 44%; padding: 3%; box-shadow: 0 0 100px 100px #fff; } #install #need-license-splash .perk-listing { width: auto; } #install #need-license-splash .perk-listing .wrap { min-height: 0; } #install #need-license-splash h3 { margin: 0 0 18px; } #install #need-license-splash p { margin: 0 0 18px; } #install #need-license-splash .dismiss-link { float: right; line-height: 22px; } .perk-listing { background-color: #f4f8fc; box-shadow: 0 0 20px #D8E9FA inset; border: 1px solid #eee; float: left; margin: 0 10px 20px; width: 260px; } .perk-listing .wrap { padding: 15px; border: 4px solid #fff; min-height: 140px; margin: 0; position: relative; } .perk-listing h3 { margin: 0 0 4px; } .perk-listing p { margin: 0; padding: 0; } .perk-listing span.version { color: #6E9FB5; } .perk-listing .actions { margin: 0 0 12px; } .perks .perk-listing a.button-primary { color: #fff; } .perk-listing .network-activated-perk { background-color: #fff; padding: 5px 7px; line-height: 1; position: absolute; bottom: 0; right: 15px; border-top-left-radius: 4px; border-top-right-radius: 4px; } .perk-listing .network-activated-perk a { background: none repeat scroll 0 0 transparent; display: block; font-size: 10px; height: auto; text-decoration: none; text-indent: 0; text-transform: uppercase; width: auto; } .perk-listing .update-available { margin-top: 12px; text-align: center; } .qtip-content ul { margin: 0; } .perk-listing.install, .perk-listing.inactive { background-color: #f7f7f7; box-shadow: 0 0 20px #e7e7e7 inset; padding: 0; } .perk-listing.install .actions { position: absolute; bottom: 10px; } .perk-listing.install h3 { margin: 0 0 12px; } .perk-listing.install span.version, .perk-listing.inactive span.version { color: #999; } .perk-listing.failed-requirements { background-color: #FFEBE8; box-shadow: 0 0 20px #FCCCC8 inset; } .perk-listing.failed-requirements span.version { color: #999; } .perk-listing.failed-requirements a { color: #7F564D; } .perk-listing.failed-requirements a.gp-requirements { background-image: url(<?php echo GWPerks::get_base_url(); ?>/images/icon-exclamation.png); text-indent: -999em; display: inline-block; height: 16px; } .forms_page_gwp_perks .gwp_buy_license-pointer .wp-pointer-arrow { left: auto; right: 50px; } .forms_page_gwp_perks .gwp_register_license-pointer .wp-pointer-arrow { left: auto; right: 44px; } .forms_page_gwp_perks .gwp_get_support-pointer .wp-pointer-arrow { left: auto; right: 27px; } </style> <?php if( wp_script_is( 'gform_tooltip_init', 'registered' ) ) { wp_print_scripts( 'gform_tooltip_init' ); } else if( wp_script_is( 'gf_tooltip_init', 'registered' ) ) { wp_print_scripts( 'gf_tooltip_init' ); } ?> <script type="text/javascript"> jQuery(document).ready(function($){ // handle tabs var tab = <?php echo $is_install ? '"install"' : 'window.location.hash' ?>; /*if(tab) toggleTabs(false, tab);*/ $('h2.nav-tab-wrapper a').click(function(event){ event.preventDefault(); toggleTabs($(this)); }); // handle ajax activate/deactivate $(document).on('click', 'a.activate, a.deactivate, a.uninstall', function(event){ event.preventDefault(); var link = $(this ), confirmMessage = link.data( 'confirm-message' ); if( confirmMessage && ! confirm( confirmMessage ) ) { return; } var spinner = gperk.ajaxSpinner( link, gperk.baseUrl + '/images/ajax-loader-trans.gif' ); $.post(ajaxurl, { request_url: link.attr('href'), action: 'gwp_manage_perk', gwp_manage_perk: '<?php echo wp_create_nonce('gwp_manage_perk'); ?>' }, function(response){ spinner.destroy(); var response = $.parseJSON(response); if(response['success']) { link.parents('.perk-listing').after(response['listing_html']); link.parents('.perk-listing').remove(); jQuery( ".gf_tooltip" ).tooltip( { show: 500, hide: 1000, content: function () { return jQuery(this).prop('title'); } } ); } }); }); $(document).on('gperks_toggle_tabs', function() { sortPerks(); }); <?php if( self::show_splash() ): ?> if( tab != 'install' ) { $(document).one('gperks_toggle_tabs.splash', function() { showLicenseSplash(); }); } else { showLicenseSplash(); } <?php endif; ?> // adjust perk listing height setDynamicPerkHeight( $( '.gp-active-perks .perk-listing .wrap' ) ); setDynamicPerkHeight( $( '.gp-inactive-perks .perk-listing .wrap' ) ); setDynamicPerkHeight( $( '#install .perk-listing .wrap' ) ); }); function toggleTabs(elem, tab) { // assume tab is passed if(arguments.length == 2) { var link = jQuery('a.nav-tab[href="' + tab + '"]'); } else { var link = jQuery(elem); var tab = link.attr('href') } jQuery('h2.nav-tab-wrapper a').removeClass('nav-tab-active'); link.addClass('nav-tab-active'); jQuery('div.wrap .tab-container').hide(); jQuery(tab).show(); jQuery(document).trigger('gperks_toggle_tabs', tab); } function sortPerks() { jQuery('div#manage.perks div.perk-listing').each(function(){ var perkListing = jQuery(this); if(perkListing.hasClass('active')) { perkListing.appendTo('div.gp-active-perks'); } else { perkListing.appendTo('div.gp-inactive-perks'); } }); } function setDynamicPerkHeight( group ) { var maxHeight = 0; jQuery.each( group, function() { var height = jQuery( this ).height(); if( height > maxHeight ) maxHeight = height; } ); jQuery.each( group, function() { jQuery( this ).height( maxHeight ); } ); } function showLicenseSplash() { jQuery('#install .perk-listings').animate({'opacity': '0.3'}, 500, function(){ jQuery('#need-license-splash').fadeIn(); }); } function dismissLicenseSplash() { jQuery.post( ajaxurl, { pointer: 'need_license_splash', action: 'dismiss-wp-pointer' }); jQuery('#need-license-splash').fadeOut(function(){ jQuery('#install .perk-listings').animate({'opacity': '1.0'}, 500); }); } </script> <div class="wrap"> <div class="icon32" id="icon-themes"><br></div> <h2 class="nav-tab-wrapper"> <a class="nav-tab <?php echo !$is_install ? 'nav-tab-active' : ''; ?>" href="#manage">Manage Perks</a> <a class="nav-tab <?php echo $is_install ? 'nav-tab-active' : ''; ?>" href="#install">Install Perks</a> </h2> <?php self::display_header_links(); ?> <?php self::handle_message_code(); ?> <div id="manage" class="perks plugins tab-container" <?php echo $is_install ? 'style="display:none;"' : ''; ?> > <?php if(!empty($installed_perks)) { $active_perks = $inactive_perks = array(); foreach($installed_perks as $perk_file => $perk_data) { if( is_plugin_active($perk_file) ) { $active_perks[$perk_file] = $perk_data; } else { $inactive_perks[$perk_file] = $perk_data; } } if(!empty($active_perks)) { ?> <h3 class="gp-inline-header"><?php _e('Active Perks', 'gravityperks'); ?></h3> <div class="gp-active-perks"> <?php foreach($active_perks as $perk_file => $perk_data) { self::get_perk_listing($perk_file, $perk_data); } ?> </div> <?php } if(!empty($inactive_perks)) { ?> <h3 class="gp-inline-header"><?php _e('Inactive Perks', 'gravityperks'); ?></h3> <div class="gp-inactive-perks"> <?php foreach($inactive_perks as $perk_file => $perk_data) { self::get_perk_listing($perk_file, $perk_data); } ?> </div> <?php } unset($perk_file); unset($perk_data); } else { ?> <div class="no-perks-installed"> <?php printf( __('You don\'t have any perks installed.<br /> %sLet\'s go install some perks!%s', 'gravityperks'), '<a onclick="jQuery(\'a[href=\\\'#install\\\']\').click();">', '</a>'); ?> </div> <?php } ?> </div> <div id="install" class="perks plugins tab-container <?php echo self::show_splash() ? 'splash' : ''; ?>" <?php echo $is_install ? '' : 'style="display:none;"'; ?> > <?php if( self::show_splash() ): $generic_perk = new GWPerk(); ?> <div id="need-license-splash" style="display:none;"> <div class="perk-listing"> <div class="wrap"> <h3><?php _e('Want Access to All Perks? Buy a License!', 'gravityperks'); ?></h3> <p><?php printf( __('Purchase a Gravity Perks license and install as many perks as you\'d like! If you\'ve already purchased a license you can register it via the "Register License" button below.', 'gravityperks'), '<a href="' . GW_REGISTER_LICENSE_URL . '">', '</a>' ); ?></p> <!--<p><?php _e('Keep your Gravity Perks license active for unlimited access to <strong>all current and future</strong> perks . You\'ll also get free automatic upgrades and premium support.', 'gravityperks' ); ?></p>--> <div class="gp-license-splash-actions"> <a href="<?php echo GW_BUY_GPERKS_URL; ?>" class="button-primary" target="_blank"><?php _e('Buy License', 'gravityperks'); ?></a> <a href="<?php echo GW_REGISTER_LICENSE_URL; ?>®ister=1" class="button-secondary"><?php _e('Register License', 'gravityperks'); ?></a> <a href="javascript:void(0);" onclick="dismissLicenseSplash();" class="dismiss-link"><?php _e('dismiss', 'gravityperks'); ?></a> </div> </div> </div> </div> <?php endif; ?> <div class="perk-listings"> <?php $available_perks = GWPerks::get_available_perks(); $i = 0; foreach($available_perks as $perk): if( !isset($perk->plugin_file) || empty($perk->plugin_file) || GWPerk::is_installed( $perk->plugin_file ) ) continue; $generic_perk = new GWPerk($perk->plugin_file); ?> <div class="perk-listing install"> <div class="wrap"> <h3><?php echo $perk->name; ?> <span class="version">v.<?php echo $perk->version; ?></span></h3> <div class="actions"> <?php if( GWPerks::has_valid_license() ): ?> <a href="<?php echo $generic_perk->get_link_for('install'); ?>" class="button"><?php _e('Install Perk', 'gravityperks'); ?></a> <?php else: ?> <a href="<?php echo GW_BUY_GPERKS_URL; ?>" class="button" target="_blank"><?php _e('Buy License', 'gravityperks'); ?></a> <?php endif; ?> </div> <div class="perk-description"><?php echo $perk->sections['description']; ?></div> </div> </div> <?php endforeach; if(!isset($generic_perk)): ?> <div class="all-perks-installed"> <?php _e('Holy cow. You must really love perks.<br /><strong>You\'ve installed them all</strong>!', 'gravityperks'); ?> </div> <?php endif; unset($perk); $i++; ?> </div> <!-- / perk-listings --> </div> </div> <?php }