Exemplo n.º 1
0
 /**
  * Generate a URL for request
  */
 function url($endpoint = '', $args = array())
 {
     if ('store' == $endpoint && !pl_dev_mode()) {
         $url = $this->cache_url;
         $defaults = array('store-cached' => 1);
     } else {
         $url = $this->base_url;
         $defaults = array('access_token' => $this->get_user_token(), 'rnd' => $this->get_cache_key());
     }
     if ('' !== $endpoint) {
         $url = sprintf('%s/%s', $url, $endpoint);
     }
     $args = wp_parse_args($args, $defaults);
     $url = add_query_arg($args, $url);
     return $url;
 }
Exemplo n.º 2
0
 /**
  * If we are in dev mode, strip cdn code..
  */
 function format_thumb($thumb)
 {
     if (pl_dev_mode()) {
         // need to strip the replace the cdn with www and add a cachebusting random number.
         $thumb = str_replace('wpecdn', 'www', $thumb);
         return add_query_arg(array('rnd' => PL_Platform()->config['rand']), $thumb);
     }
     return $thumb;
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
 }