Example #1
0
 /**
  * is this localhost?
  * Must have at least one active subscription and be running local
  * $domain_data->allowed must be more than 0
  */
 function is_local_and_has_pro()
 {
     $domain_data = $this->get_domains_data();
     return $domain_data->allowed > 0 && pl_is_local() ? true : false;
 }
Example #2
0
 /**
  * Gets all config data in an array
  */
 function set_config_data()
 {
     global $wp;
     global $wp_query;
     global $pl_dynamic_templates;
     //print_r( $GLOBALS['wp_query']);
     $a['query'] = $GLOBALS['wp_query']->query;
     // ID of the currently active user
     $a['userID'] = wp_get_current_user()->ID;
     // URL of the current page
     $a['currentURL'] = add_query_arg($wp->query_string, '', home_url($wp->request));
     /** Should we save styles? set to 1 on change */
     $a['saveStyles'] = 0;
     /** Render mode is set on the fly as template is loaded */
     $a['tplRender'] = $pl_dynamic_templates;
     // Currently active page template
     $a['tplActive'] = $this->page->template();
     // The current template scope mode
     $a['tplMode'] = $this->page->template_mode();
     $a['editID'] = pl_edit_id();
     $a['editslug'] = pl_edit_slug();
     // The ID for the current page
     $a['pageID'] = $this->page->id;
     $a['pageslug'] = $this->page->meta_slug;
     // The ID for the current type
     $a['typeID'] = $this->page->typeid;
     $a['typeslug'] = $this->page->type_slug;
     // The ID for the current type
     $a['termID'] = $this->page->termid;
     $a['termslug'] = $this->page->term_slug;
     // The slug ID of the current type (?)
     $a['typename'] = $this->page->type;
     // Page Name and Slug Format
     $a['currentPageName'] = esc_attr($this->page->get_current_page_name());
     $a['currentPageSlug'] = $this->page->get_current_page_slug();
     $a['currentTaxonomy'] = $this->page->get_current_taxonomy();
     $a['themename'] = wp_get_theme()->name;
     // 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';
     // Is this page a WP special page: e.g. multi-post, 404, etc..
     $a['isSpecial'] = $this->page->is_special();
     $a['needsave'] = isset($_GET['needsave']) ? 1 : 0;
     $a['tplMap'] = $this->map->map;
     $a['templateOpts'] = pl_get_template_settings();
     $a['nonce'] = wp_create_nonce('pl-ajax-nonce');
     return array_merge($a, $this->additions);
 }
Example #3
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);
 }
Example #4
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));
     }
 }
Example #5
0
/**
 * Check if a site has been registered.
 * Return (bool)
 */
function pl_is_professional()
{
    if (true === pl_is_local()) {
        return true;
    } else {
        return get_site_option('pl_site_registered', false);
    }
}