wp_register_script("codemirror-mode-htmlmixed", SLIDEDECK2_URLPATH . "/js/codemirror/mode/htmlmixed.js", array('codemirror'), '2.2.0', true);
        wp_register_script("codemirror-mode-javascript", SLIDEDECK2_URLPATH . "/js/codemirror/mode/javascript.js", array('codemirror'), '2.2.0', true);
        wp_register_script("codemirror-mode-clike", SLIDEDECK2_URLPATH . "/js/codemirror/mode/clike.js", array('codemirror'), '2.2.0', true);
        wp_register_script("codemirror-mode-php", SLIDEDECK2_URLPATH . "/js/codemirror/mode/php.js", array('codemirror', 'codemirror-mode-clike'), '2.2.0', true);
    }
    /**
     * Register styles used by this plugin for enqueuing elsewhere
     * 
     * @uses wp_register_style()
     */
    function wp_register_styles()
    {
        // Admin Stylesheet
        wp_register_style("{$this->namespace}-admin", SLIDEDECK2_URLPATH . "/css/{$this->namespace}-admin.css", array(), SLIDEDECK2_VERSION, 'screen');
        // Gplus How-to Modal Stylesheet
        wp_register_style("gplus-how-to-modal", SLIDEDECK2_URLPATH . "/css/gplus-how-to-modal.css", array(), SLIDEDECK2_VERSION, 'screen');
        // Public Stylesheet
        wp_register_style($this->namespace, SLIDEDECK2_URLPATH . "/css/slidedeck.css", array(), SLIDEDECK2_VERSION, 'screen');
        // CodeMirror Library
        wp_register_style("codemirror", SLIDEDECK2_URLPATH . "/css/codemirror.css", array(), '2.1.8', 'screen');
        // Fancy Form Elements library
        wp_register_style("fancy-form", SLIDEDECK2_URLPATH . '/css/fancy-form.css', array(), '1.0.0', 'screen');
        // jQuery MiniColors Color Picker
        wp_register_style("jquery-minicolors", SLIDEDECK2_URLPATH . '/css/jquery.minicolors.css', array(), '7d21e3c363', 'screen');
    }
}
if (!isset($SlideDeckPlugin)) {
    SlideDeckPlugin::instance();
}
register_activation_hook(__FILE__, array('SlideDeckPlugin', 'activate'));
register_deactivation_hook(__FILE__, array('SlideDeckPlugin', 'deactivate'));
 function slidedeck2_km($event = "", $properties = array(), $force = false)
 {
     global $SlideDeckPlugin;
     $options = get_option("slidedeck2_global_options", array());
     if ($force == false) {
         // If the user has not opted-in to anonymous stats, fail silently
         if (!isset($options['anonymous_stats_optin']) || !$options['anonymous_stats_optin']) {
             return false;
         }
     }
     // Setup for events that should be traccked once
     $once_events_option_name = SlideDeckPlugin::$st_namespace . "_completed_once_events";
     $once_events = array('SlideDeck Installed' => false);
     $completed_once_events = get_option($once_events_option_name, $once_events);
     $completed_once_events = array_merge($once_events, $completed_once_events);
     // If the event should only happen once and it has been logged as already happened, don't log it
     if (isset($completed_once_events[$event]) && $completed_once_events[$event] === true) {
         return false;
     }
     $params = array('_k' => SLIDEDECK2_KMAPI_KEY, '_p' => SLIDEDECK2_USER_HASH, '_n' => urlencode($event), 'license' => SLIDEDECK2_LICENSE, 'version' => SLIDEDECK2_VERSION, 'tier' => SlideDeckPlugin::highest_installed_tier());
     // Get the cohort data from the database
     $cohort = SlideDeckPlugin::get_cohort_data();
     foreach ($cohort as $key => $value) {
         $params['cohort_' . $key] = isset($cohort[$key]) && !empty($cohort[$key]) ? $cohort[$key] : '';
     }
     $params = array_merge($params, $properties);
     wp_remote_fopen("http://trk.kissmetrics.com/e?" . http_build_query($params));
     // Log one time events as completed
     if (isset($once_events[$event])) {
         $completed_once_events[$event] = true;
         update_option($once_events_option_name, $completed_once_events);
     }
 }
Esempio n. 3
0
 /**
  * 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.
         SlideDeckPlugin::$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';
 }