/**
  * The admin section upgrades page rendering method
  *
  * @uses current_user_can()
  * @uses wp_die()
  */
 function page_upgrades()
 {
     if (!current_user_can($this->roles['view_more_features'])) {
         wp_die(__("You do not have privileges to access this page", $this->namespace));
     }
     $namespace = $this->namespace;
     $plugins = array();
     $license_key = slidedeck2_get_license_key();
     /**
      * Here let's set the I'm back variable to true. This allows us to
      * know that they user is expecting a dialog showing the big install
      * button.
      * In this case, we don't need to immediately show the page, we can just
      * wait for a load.
      */
     if (isset($_REQUEST['imback']) && $_REQUEST['imback'] === 'true') {
         $this->user_is_back = true;
     }
     if (isset($_GET['install']) && !empty($_GET['install'])) {
         // We're doing a SlideDeck addon install.
         SlideDeckLitePlugin::$slidedeck_addons_installing = true;
         include 'lib/slidedeck-plugin-install.php';
         if (isset($_GET['package']) && !empty($_GET['package'])) {
             foreach ((array) $_GET['package'] as $package) {
                 /**
                  * Some servers don't allow http or https in a querystring.
                  * Understandable, but since we're logged in for this action, I think 
                  * it's relatively safe. The woraround is to add the protocol here.
                  */
                 if (!preg_match('/^http|https/', $package)) {
                     $package = 'http://' . $package;
                 }
                 $plugins[] = $package;
             }
         }
         $ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '';
         $port = $_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '';
         $url = sprintf('http%s://%s%s%s', $ssl, $_SERVER['SERVER_NAME'], $port, $_SERVER['REQUEST_URI']);
         $type = '';
         $title = '';
         $nonce = '';
         $skin = new SlideDeckPluginInstallSkin(compact('type', 'title', 'nonce', 'url'));
         $skin->sd_header = isset($data['body_header']) ? $data['body_header'] : '';
         $skin->sd_footer = isset($data['body_footer']) ? $data['body_footer'] : '';
         $Installer = new SlideDeckPluginInstall($skin);
         $Installer->install($plugins);
         exit;
     }
     if (isset($_REQUEST['referrer']) && !empty($_REQUEST['referrer'])) {
         slidedeck2_km("Visit Addons", array('cta' => $_REQUEST['referrer']));
     }
     include SLIDEDECK2_DIRNAME . '/views/admin-upgrades.php';
 }
Esempio n. 2
0
        <div id="slidedeck-option-wrapper">
            <p class="intro"><?php 
_e("These options are for situations where SlideDeck might not be working correctly. Only change them if you are having difficulty with your SlideDeck installation, <em>or if you are certain of what they do</em>.", $namespace);
?>
</p>
            <form action="" method="post" id="overview_options_form">
                <formset>
                    <div class="inner">
                        <?php 
wp_nonce_field("{$this->namespace}-update-options");
?>
                        <ul>
                            <li>
                                <div class="slidedeck-license-key-wrapper">
                                	<?php 
slidedeck2_html_input('data[license_key]', slidedeck2_get_license_key(), array('type' => 'password', 'attr' => array('class' => 'fancy license-key-text-field'), 'label' => "Your SlideDeck License Key"));
?>
                                	<?php 
wp_nonce_field("{$this->namespace}_verify_license_key", 'verify_license_nonce');
?>
                                	<a href="#verify" class="verify-license-key button">Verify</a>
                                	<div class="license-key-verification-response"><span class="waiting">Waiting...</span></div>
                                </div>
                            </li>
                            <li>
                                <?php 
slidedeck2_html_input('data[always_load_assets]', $data['always_load_assets'], array('attr' => array('class' => 'fancy'), 'type' => 'radio', 'label' => "Always load SlideDeck JavaScript/CSS on every page?"));
?>
<br />
                            </li>
                            <li>
 function slidedeck2_get_renewal_url()
 {
     return SLIDEDECK2_RENEWAL_URL . '&renewal_keyhash=' . md5(slidedeck2_get_license_key());
 }
Esempio n. 4
0
 /**
  * Upgrade Button
  * 
  * Outputs the green upgrade button that displays contextually.
  * 
  * @param string $message_text The button area subtitle
  * 
  * @param string $button_text The main button text CTA
  *      */
 function upgrade_button($context = 'manage')
 {
     $tier = self::highest_installed_tier();
     // Here's the defaults
     $defaults = array('context' => 'manage', 'cta_text' => 'Upgrade', 'message_text' => 'Get more from SlideDeck', 'cta_url' => slidedeck2_action("/upgrades"));
     $array_data = array('tier_5' => array('manage' => array('message_text' => 'Get more lenses!'), 'edit' => array('message_text' => 'Get more sources!'), 'lenses' => array('message_text' => 'Copy and edit lenses!')), 'tier_10' => array('manage' => array('message_text' => 'Get more custom slides'), 'edit' => array('message_text' => 'Get the Classic lens'), 'lenses' => array('message_text' => 'Copy and edit lenses!')), 'tier_20' => array('manage' => array('message_text' => 'Get more custom slides'), 'edit' => array('message_text' => 'Use SlideDeck on more sites'), 'lenses' => array('message_text' => 'Copy and edit lenses!')));
     // Fetch the data (using cache!)
     $url = SLIDEDECK2_UPDATE_SITE . '/upgrade-buttons.json?v=' . SLIDEDECK2_VERSION;
     $response = slidedeck2_cache_read($url);
     if (!$response) {
         $response = wp_remote_get($url, array('sslverify' => false));
         if (!is_wp_error($response)) {
             slidedeck2_cache_write($url, $response, 60 * 60 * 24);
             // Decode the data
             $array_data = json_decode($response['body'], true);
         } else {
             slidedeck2_cache_write($url, '', 60 * 60 * 24);
         }
     }
     /**
      * Use the default values if all else fails.
      * If the found data isn't empty, replace the defaults.
      */
     $values = $defaults;
     if (isset($array_data[$tier][$context]) && !empty($array_data[$tier][$context])) {
         $values = array_merge($defaults, $array_data[$tier][$context]);
         $values['tier'] = $tier;
         $values['context'] = $context;
     }
     // Overrides for license renewal
     $renewal_message = self::get_license_key_expiry_message();
     $license_key = slidedeck2_get_license_key();
     // If this is the developer tier, and there's no expiry message...
     if ($tier == 'tier_30' && $renewal_message['type'] == 'unspecified') {
         return '';
     }
     // don't return a button in this case
     switch ($renewal_message['type']) {
         case 'nearing-expiration':
             $values['cta_text'] = "Renew Now";
             $values['cta_url'] = slidedeck2_get_renewal_url() . '&when=warning';
             $values['message_text'] = "<strong>License expiring soon.</strong> Upgrade to continue getting updates and support.";
             if ($context == 'manage') {
                 $values['message_text'] = "<strong>License expiring soon.</strong> Upgrade to<br>continue getting updates and support.";
             }
             break;
         case 'expired':
             $values['cta_text'] = "Expired - Renew Now";
             $values['cta_url'] = slidedeck2_get_renewal_url() . '&when=expired';
             $values['message_text'] = "Your license is <strong>expired</strong>. Renew to resume updates and support";
             if ($context == 'manage') {
                 $values['message_text'] = "Your license is <strong>expired</strong>. Renew to<br>resume updates and support";
             }
             break;
     }
     // Render the button!
     ob_start();
     include SLIDEDECK2_DIRNAME . '/views/elements/_upgrade_button.php';
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }