Пример #1
0
 /**
  * We need the plugin version, it is used to set versions in styles/js and cant be hard coded
  */
 private function get_version()
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugin = get_plugin_data(PL_Platform()->config['plugin']);
     $version = $plugin['Version'];
     return $version;
 }
Пример #2
0
 function admin_scripts()
 {
     wp_enqueue_media();
     pl_enqueue_color_picker();
     pl_load_codemirror(pl_framework_url('plugins'));
     wp_enqueue_script('pl-admin', pl_framework_url('js') . '/admin.js', array('jquery', 'wp-color-picker'));
     wp_enqueue_style('pl-components', pl_framework_url('css') . '/components.css');
     wp_enqueue_style('pl-admin', pl_framework_url('css') . '/admin.css');
     global $plfactory;
     $config = apply_filters('pl_admin_json', array('ajaxurl' => pl_ajax_url(), 'baseURL' => $this->base_url, 'cachekey' => $this->cache_key . $this->current_admin_page(), 'sections' => $plfactory->section_ids, 'security' => wp_create_nonce('pl-ajax-nonce'), 'extendURL' => PL_Platform()->url('extend')));
     wp_localize_script('pl-admin', 'PLAdmin', $config);
 }
Пример #3
0
 /**
  * Work out the installed licence and display buttons accordingly
  */
 function version($data, $ui)
 {
     $domain_data = $ui->platform->oauth->get_domains_data();
     $registered = $ui->platform->oauth->is_site_registered();
     $local_pro = $ui->platform->oauth->is_local_and_has_pro();
     $can_register = $ui->platform->oauth->can_register_site();
     $grandfathered = $ui->platform->oauth->is_grandfathered();
     $grandfathered_txt = '';
     // if user has NOT registered this domain and is able to
     if (!$registered) {
         $version = __('Free', 'pl-platform');
         $desc = __('Only free features and extensions are available.', 'pl-platform');
         if ($can_register) {
             $args = array('domain' => $ui->platform->oauth->get_site_domain(), 'action' => 'add_domain');
             $domain_format = PL_Platform()->oauth->get_domain_data_format();
             $action_url = PL_Platform()->url('account', $args);
             $txt = __('Activate Pro ', 'pl-platform') . $domain_format;
             $action_txt = sprintf('<i class="pl-icon pl-icon-bolt"></i> %s', $txt);
         } else {
             $action_url = PL()->urls->purchase;
             $txt = __('<strong>Get Pro License Now</strong>', 'pl-platform');
             $action_txt = sprintf('<i class="pl-icon pl-icon-shopping-cart"></i> %s', $txt);
         }
         $thumb = pl_framework_url('images') . '/thumb-free.png';
     } else {
         $version = __('Professional', 'pl-platform');
         $desc = __('All features are available. Yay!', 'pl-platform');
         $desc .= $local_pro ? __('<p>(<strong>Localhost and at least one pro license detected in account.</strong>)</p>', 'pl-platform') : '';
         $action_url = PL_Platform()->url('extend');
         $action_txt = sprintf('<i class="pl-icon pl-icon-download"></i> %s', __('Install New Extensions', 'pl-platform'));
         $thumb = pl_framework_url('images') . '/thumb-pro.png';
     }
     // see if user is grandfathered in to platform.
     if (true == $grandfathered) {
         $grandfathered_txt = sprintf(' (%s)', __('Grandfathered', 'pl-platform'));
     }
     $desc .= sprintf('<p><strong>%s</strong> of <strong>%s total</strong> Pro licenses available in your account%s</p>', $domain_data->remaining, $domain_data->allowed, $grandfathered_txt);
     if (0 == $domain_data->allowed) {
         $desc = sprintf('<p>%s</p>', __('There are no Pro licenses available in your account.', 'pl-platform'));
     }
     $actions = sprintf('<div class="actions"><a class="button button-primary" href="%s">%s</a> &nbsp; <a class="button" href="%s">%s</a></div>', $action_url, $action_txt, PL()->urls->pro, __('Learn More', 'pl-platform'));
     echo $ui->banner(array('classes' => 'banner-dashboard', 'title' => __('PageLines Version', 'pl-platform'), 'suphead' => sprintf("PageLines Version"), 'header' => sprintf("<strong>%s</strong>", $version), 'subhead' => $desc, 'content' => $actions, 'src' => $thumb));
     if ($registered && !pl_is_local()) {
         $content = sprintf('<p class="banner-subheader">You will have %s %s after a successful handoff.</p>', $domain_data->remaining + 1, _n('slot', 'slots', $domain_data->remaining + 1, 'pl-platform'));
         echo $ui->banner(array('classes' => 'banner-dashboard', 'title' => __('Switching Accounts', 'pl-platform'), 'suphead' => sprintf("Need to handoff to a client?"), 'subhead' => sprintf('Get your professional slot back by activating pro with any other account.'), 'header' => 'Switch Accounts', 'content' => $content));
     }
 }
Пример #4
0
    /**
     * Main cards display function
     */
    function cards($args = array())
    {
        $search = isset($_GET['s']) ? esc_attr($_GET['s']) : '';
        $current_nav_item = isset($_GET['navitem']) ? $_GET['navitem'] : '';
        $args = wp_parse_args($args, array('hook' => '', 'navscheme' => array(), 'baseURL' => PL_Platform()->url(), 'sbitems' => array()));
        ?>
    <div class="pl-cards-ui" data-baseurl="<?php 
        echo $args['baseURL'];
        ?>
">
      <div class="pl-store-head fix">
        <h2 class="pl-store-title"></h2>
        <form class="search-form search-plugins" action="<?php 
        echo admin_url('admin-post.php');
        ?>
" method="post">
           <input type="hidden" name="action" value="storesearch" />
              <label><span class="screen-reader-text">Search</span>
            <input class="wp-filter-search" label="search" type="text" name="s" placeholder="<?php 
        _e('Search Extensions', 'pl-platform');
        ?>
" value="<?php 
        echo $search;
        ?>
"/>
          </label>
          <input type="submit" id="search-submit" class="button screen-reader-text" value="Search">
        </form>

      </div>

      <div class="pl-cards-wrap fix">
        <div class="pl-cards-nav">
          <ul class="pl-filter-links">
            <?php 
        foreach ($args['navscheme'] as $type => $items) {
            $name = isset($items['name']) ? $items['name'] : pl_ui_key($type);
            unset($items['name']);
            ?>
              <lh><span class="hdng"><?php 
            echo $name;
            ?>
</span></lh>
              <?php 
            foreach ($items as $cat => $details) {
                $navitem = $type . '_' . $cat;
                $class = $current_nav_item == $navitem ? 'current' : '';
                $details['q']['navitem'] = $navitem;
                $url = add_query_arg($details['q'], $args['baseURL']);
                ?>
                 <li><a href="<?php 
                echo $url;
                ?>
" class="<?php 
                echo $class . ' ' . $navitem;
                ?>
" title="<?php 
                echo $details['title'];
                ?>
"><?php 
                echo $details['name'];
                ?>
</a></li>
              <?php 
            }
            ?>

            <?php 
        }
        ?>


          </ul>
          <div class="card-nav-actions">
            <?php 
        if (!$this->platform->oauth->is_site_registered()) {
            ?>
              <p><a class="button button-primary" href="<?php 
            echo PL_Platform()->url('account');
            ?>
"><i class="pl-icon pl-icon-plus"></i> Upgrade to Pro</a></p>
            <?php 
        }
        ?>

            <p><a class="button button-refresh" href="<?php 
        echo add_query_arg(array('refresh' => 1), $args['baseURL']);
        ?>
"><i class="pl-icon pl-icon-refresh"></i> <?php 
        _e('Refresh Data', 'pl-platform');
        ?>
</a></p>
          </div>
        </div>

        <div class="pl-cards" data-hook="<?php 
        echo $args['hook'];
        ?>
">

        </div>

      </div>
    </div>
    <?php 
    }
Пример #5
0
 /**
  * helper function to refresh users data from the oauth server.
  */
 function refresh_userdata()
 {
     $rand = PL_Platform()->config['rand'];
     $refresh_token = $this->get_refresh_token();
     if (false == $refresh_token) {
         $this->logout();
         return;
     }
     $token_data = $this->refresh_token($this->get_refresh_token());
     // fetch error..do not continue, do not write any data.
     if ('error' == $token_data) {
         return;
     }
     if (!isset($token_data->access_token)) {
         $this->logout();
         return;
     }
     $data = $this->request('me', array('access_token' => $token_data->access_token, 'rnd' => $rand), 'GET', true);
     if (!isset($data->error) && is_object($data)) {
         $authdata = new stdClass();
         $authdata->user = $data;
         $authdata->user->token = $token_data->access_token;
         $authdata->user->token_expire = time() + $token_data->expires_in;
         $authdata->user->refresh_token = $token_data->refresh_token;
         $this->save_cache_data($authdata);
         update_user_meta(wp_get_current_user()->ID, '_card_fav', (array) $data->fav);
         // checking if the user has a valid reason to have site activated.
         // if domains allowed = 0 then the users sub has probably expired.
         if (!isset($data->domain_data->allowed) || $data->domain_data->allowed == 0) {
             $this->update_site_registered(false);
         } else {
         }
     }
 }
Пример #6
0
 /**
  * Clear the cache
  */
 function clear_cache()
 {
     return PL_Platform()->functions->cache_clear($this->cache_slug);
 }
Пример #7
0
 /**
  * Redirect store search
  */
 function storesearch()
 {
     if (isset($_REQUEST['s'])) {
         $query = array('special' => 'search', 's' => $_REQUEST['s']);
         wp_redirect(add_query_arg($query, PL_Platform()->url('extend')));
         die;
     }
 }
Пример #8
0
 /**
  * Get the number of PageLines plugins
  */
 function pl_plugins_count()
 {
     // get array of PageLines plugins.
     $plugins = PL_Platform()->functions->pl_get_plugins(true);
     return count($plugins);
 }
Пример #9
0
 /**
  * Add a PageLines sorting method to plugins page.
  */
 function add_sorting($views)
 {
     $pl_plugins = PL_Platform()->functions->pl_get_plugins(true);
     $count = count($pl_plugins);
     $current = isset($_GET['s']) && 'pagelines' == $_GET['s'] ? 'current' : '';
     $views['pl'] = sprintf("<a class='%s' href='%s'>PageLines <span class='count'>(%s)</span><a>", $current, admin_url('plugins.php?s=pagelines'), $count);
     return $views;
 }
Пример #10
0
 function workarea_config()
 {
     global $pl_medialib, $pl_notifications;
     $a = array('siteName' => get_bloginfo('name'), 'siteDescription' => get_bloginfo('description'), 'plURL' => get_template_directory_uri(), 'siteURL' => do_shortcode('[pl_site_url]'), 'homeURL' => do_shortcode('[pl_home_url]'), 'uploadsURL' => do_shortcode('[pl_uploads_url]'), 'adminURL' => admin_url(), 'PLUI' => pl_framework_url('ui'), 'frontPage' => get_option('show_on_front', 'posts'), 'ajaxURL' => pl_ajax_url(), 'security' => wp_create_nonce('pl-ajax-nonce'), 'models' => array());
     $a['factory'] = $this->set_factory();
     // Edit current post URL
     $a['editPost'] = plns_edit_post_link();
     // Add menus URL
     $a['menus'] = admin_url("nav-menus.php");
     // Add/edit widgets URL
     $a['widgets'] = admin_url("widgets.php");
     // URL of core framework
     $a['CoreURL'] = get_template_directory_uri();
     // URL of parent theme
     $a['ParentStyleSheetURL'] = get_template_directory_uri();
     // URL of child theme, if active
     $a['ChildStyleSheetURL'] = get_stylesheet_directory_uri();
     $a['extendURL'] = function_exists('PL_Platform') ? PL_Platform()->url('extend') : '';
     // Media library link for use in iFrame
     $a['mediaLibrary'] = $pl_medialib->pl_media_library_link();
     //  Media library videos link for use in iFrame
     $a['mediaLibraryVideo'] = $pl_medialib->pl_media_library_link("video");
     // Add media link
     $a['addMediaURL'] = admin_url("media-new.php");
     // ID of the currently active user
     $a['userID'] = wp_get_current_user()->ID;
     // A cache key for various settings
     $a['CacheKey'] = pl_cache_key();
     // Is the user on localhost
     $a['LocalHost'] = pl_is_local();
     // Is developer mode activated?
     $a['debug'] = pl_dev_mode() ? 'true' : 'false';
     $a['btns'] = pl_btn_classes();
     $a['btnSizes'] = pl_button_sizes();
     $a['imgSizes'] = get_intermediate_image_sizes();
     $a['animations'] = pl_animations();
     $a['taxes'] = pl_get_taxonomies();
     $a['icons'] = pl_icons();
     $a['menus'] = pl_get_menus();
     $a['sidebars'] = pl_get_sidebars();
     $a['notifications'] = $pl_notifications;
     $a['urls'] = pl_get_system_urls();
     $a['translate'] = array();
     $a['locale'] = get_locale();
     return apply_filters('pl_workarea_json', $a);
 }
Пример #11
0
    function welcome_message()
    {
        $store_url = sprintf('<a href="%s">%s</a>', PL_Platform()->url('store'), __('Extension Engine', 'pl-platform'));
        ob_start();
        ?>
    <div class="intro clearfix">
      <img class="theme-screen" src="<?php 
        echo pl_framework_url('images') . '/PL5.png';
        ?>
" />
      <h3><?php 
        _e('Welcome to PageLines', 'pl-platform');
        ?>
</h3>
      <p><?php 
        _e('Congratulations! You\'re running PageLines.<br/>PageLines adds insanely-fast editing and customization tools to your site.<br/> ', 'pl-platform');
        ?>
</p>
      <div class="clear" ></div>
    </div>

    <?php 
        if (PL_Platform()->is_oriented() && !PL_Platform()->is_pro()) {
            ?>

      <h3><?php 
            _e('You are using the free version.', 'pl-platform');
            ?>
</h3>
      <ul class="reference-list">
        <li>
          <div class="list-icon"><i class="pl-icon pl-icon-pagelines"></i></div>
          <h4><?php 
            _e('Get the most from PageLines with Pro.', 'pl-platform');
            ?>
</h4>
          <p>
            <?php 
            _e('Get all pro extensions plus more every month. Also updates, options &amp; support.', 'pl-platform');
            ?>
          </p>
          <p>
            <?php 
            if (!PL_Platform()->oauth->can_register_site()) {
                $getclass = 'primary';
                $actclass = 'disabled';
            } else {
                $getclass = 'secondary';
                $actclass = 'primary';
            }
            $domains = PL_Platform()->oauth->get_domain_data_format();
            ?>
            <a class="button button-<?php 
            echo $getclass;
            ?>
" target="_blank" href="<?php 
            echo PL()->urls->purchase;
            ?>
"><i class="pl-icon pl-icon-shopping-cart"></i>&nbsp;<?php 
            _e('Purchase Pro License', 'pl-platform');
            ?>
 <i class="pl-icon pl-icon-caret-right"></i></a>

            <a class="button button-<?php 
            echo $actclass;
            ?>
" target="_blank" href="<?php 
            echo PL_Platform()->url('account');
            ?>
">
              <i class="pl-icon pl-icon-bolt"></i>&nbsp;
              <?php 
            _e('Activate Pro', 'pl-platform');
            ?>
              <?php 
            printf('%s', $domains);
            ?>
              </a>
          </p>
        </li>
      </ul>

    <?php 
        }
        ?>

    <h3><?php 
        _e('What can you do with PageLines? Everything.', 'pl-platform');
        ?>
</h3>
    <ul class="reference-list">
      <li>
        <div class="list-icon"><i class="pl-icon pl-icon-bolt"></i></div>
        <h4><?php 
        _e('Quick Start: "Insanely Fast Design &amp; Editing"', 'pl-platform');
        ?>
</h4>
        <p>
          <?php 
        _e('Quickly learn how to customize in real time with no coding, debugging or frustration.', 'pl-platform');
        ?>
        </p>
        <p>
          <a class="button button-primary" target="_blank" href="<?php 
        echo PL()->urls->quickstart;
        ?>
"><i class="pl-icon pl-icon-video-camera"></i>&nbsp;<?php 
        _e('Quick Start Video', 'pl-platform');
        ?>
</a>
        </p>
      </li>
      <li>
        <div class="list-icon"><i class="pl-icon pl-icon-plug"></i></div>
        <h4><?php 
        _e('Do anything with the extension engine. Really.', 'pl-platform');
        ?>
</h4>
        <p>
          <?php 
        printf(__('PageLines is built to be extended. Add some with the %s.', 'pl-platform'), $store_url);
        ?>
        </p>
        <p>
          <a class="button button-secondary" href="<?php 
        echo PL_Platform()->url('extend');
        ?>
"><i class="pl-icon pl-icon-plug"></i> <?php 
        _e('Install New Extensions', 'pl-platform');
        ?>
</a>
        </p>
      </li>
      <li>
        <div class="list-icon"><i class="pl-icon pl-icon-slack"></i></div>
        <h4><?php 
        _e('Connect with the community.', 'pl-platform');
        ?>
</h4>
        <p>
          <?php 
        printf(__('Join the PageLines community channels for help, updates, and great conversation.', 'pl-platform'), $store_url);
        ?>
        </p>
        <p>
          <a class="button" target="_blank" href="http://www.pagelines.com/community"><i class="pl-icon pl-icon-slack"></i> <?php 
        _e('Community Overview', 'pl-platform');
        ?>
</a>
        </p>
      </li>
      <li>
        <div class="list-icon"><i class="pl-icon pl-icon-smile-o"></i></div>
        <h4><?php 
        _e('We love to help.', 'pl-platform');
        ?>
</h4>
        <p>
          <?php 
        printf(__('Check out the PageLines Forums or documentation resources.', 'pl-platform'), $store_url);
        ?>
        </p>
        <p>
          <a class="button" href="http://www.pagelines.com/support" target="_blank"><i class="pl-icon pl-icon-smile-o"></i> <?php 
        _e('Support Overview', 'pl-platform');
        ?>
</a>
        </p>
      </li>
      <li>
        <div class="list-icon"><img src="<?php 
        echo pl_framework_url('images') . '/avatar-powers.jpg';
        ?>
" /></div>
        <h4><?php 
        _e('A note from me...', 'pl-platform');
        ?>
</h4>
        <p><?php 
        _e("Good luck with your site. We're happy and excited for you. Don't forget that we're here to help and your feedback is always welcome.", 'pl-platform');
        ?>
 <a href="http://www.pagelines.com/about" target="_blank">About PageLines</a></p>
        <div class="signature">
          <p><?php 
        _e('Sincerely', 'pl-platform');
        ?>
,</p>
          <img src="<?php 
        echo pl_framework_url('images') . '/signature-founder.png';
        ?>
" />
          <div class="citation"><?php 
        _e('Andrew Powers, Founder', 'pl-platform');
        ?>
</div>
        </div>
      </li>
    </ul>
    
    <?php 
        return ob_get_clean();
    }