/** * PageLines Option * * Uses controls to find and retrieve the appropriate option value * * @package PageLines Framework * * @since ... * * @link http://www.pagelines.com/wiki/Ploption * * @param 'key' the id of the option * @param array $args * * @uses is_pagelines_special * @uses plspecial * @uses plmeta * @uses pldefault * @uses get_ploption * @uses plnewkey * * @return bool|mixed */ function ploption($key, $args = array()) { $d = array('subkey' => null, 'post_id' => null, 'setting' => null, 'clone_id' => null, 'type' => '', 'translate' => false, 'key' => $key); $o = wp_parse_args($args, $d); if (has_filter("ploption_{$key}")) { return apply_filters("ploption_{$key}", $key, $o); } if (is_pagelines_special($o) && plspecial($key, $o)) { return pagelines_magic_parse(plspecial($key, $o), $o); } elseif (isset($o['post_id']) && plmeta($key, $args)) { return pagelines_magic_parse(plmeta($key, $o), $o); } elseif (pldefault($key, $o)) { return pldefault($key, $o); } elseif (get_ploption($key, $o)) { return pagelines_magic_parse(get_ploption($key, $o), $o); } elseif (get_ploption($key, $o) === null) { if ($newkey = plnewkey($key)) { return $newkey; } else { return false; } } }
/** * PageLines Option * * Uses controls to find and retrieve the appropriate option value * * @package PageLines DMS * * @since ... * * @link http://www.pagelines.com/wiki/Ploption * * @param 'key' the id of the option * @param array $args * * @uses is_pagelines_special * @uses plspecial * @uses plmeta * @uses pldefault * @uses get_ploption * @uses plnewkey * * @return bool|mixed */ function ploption($key, $args = array()) { _pl_deprecated_function(__FUNCTION__, '1.1', 'pl_setting()'); $d = array('subkey' => null, 'post_id' => null, 'setting' => null, 'clone_id' => null, 'type' => '', 'translate' => false, 'key' => $key); $o = wp_parse_args($args, $d); if (has_filter("ploption_{$key}")) { return apply_filters("ploption_{$key}", $key, $o); } if (class_exists('PageLinesTemplateHandler') && pl_setting($key, $o)) { return pagelines_magic_parse(pl_setting($key, $o), $o); } elseif (is_pagelines_special($o) && plspecial($key, $o)) { return pagelines_magic_parse(plspecial($key, $o), $o); } elseif (isset($o['post_id']) && plmeta($key, $args)) { return pagelines_magic_parse(plmeta($key, $o), $o); } elseif (pldefault($key, $o)) { return pldefault($key, $o); } elseif (get_ploption($key, $o)) { return pagelines_magic_parse(get_ploption($key, $o), $o); } elseif (get_ploption($key, $o) === null) { if ($newkey = plnewkey($key)) { return $newkey; } else { return false; } } }
/** * * Adds PageLines to Admin Bar * * @package PageLines Framework * @subpackage Functions Library * @since 1.3.0 * */ function pagelines_settings_menu_link() { global $wp_admin_bar; global $pagelines_template; if (!current_user_can('edit_theme_options')) { return; } $wp_admin_bar->add_menu(array('id' => 'pl_settings', 'title' => __('PageLines', 'pagelines'), 'href' => admin_url(PL_DASH_URL))); $wp_admin_bar->add_menu(array('id' => 'pl_dashboard', 'parent' => 'pl_settings', 'title' => __('Dashboard', 'pagelines'), 'href' => admin_url(PL_DASH_URL))); $wp_admin_bar->add_menu(array('id' => 'pl_main_settings', 'parent' => 'pl_settings', 'title' => __('Site Options', 'pagelines'), 'href' => admin_url(PL_SETTINGS_URL))); $wp_admin_bar->add_menu(array('id' => 'pl_special', 'parent' => 'pl_settings', 'title' => __('Page Options', 'pagelines'), 'href' => admin_url(PL_SPECIAL_OPTS_URL))); $wp_admin_bar->add_menu(array('id' => 'pl_templates', 'parent' => 'pl_settings', 'title' => __('Drag & Drop', 'pagelines'), 'href' => admin_url(PL_TEMPLATE_SETUP_URL))); $wp_admin_bar->add_menu(array('id' => 'pl_extend', 'parent' => 'pl_settings', 'title' => __('Store', 'pagelines'), 'href' => admin_url(PL_ADMIN_STORE_URL))); $template_name = isset($pagelines_template->template_name) ? $pagelines_template->template_name : false; if ($template_name) { $page_type = __('Template: ', 'pagelines') . ucfirst($template_name); $wp_admin_bar->add_menu(array('id' => 'template_type', 'title' => $page_type, 'href' => admin_url(PL_TEMPLATE_SETUP_URL))); } $spurl = pl_special_url($template_name); if ($template_name && is_pagelines_special() && $spurl) { $wp_admin_bar->add_menu(array('id' => 'special_settings', 'title' => __('Edit Meta', 'pagelines'), 'href' => $spurl)); } if (is_pl_debug() && !is_admin()) { $wp_admin_bar->add_menu(array('id' => 'pl_flush', 'title' => __('Flush LESS', 'pagelines'), 'href' => get_pl_reset_less_url())); } }
/** * Show section control? * On some template areas, e.g. posts, single, 404, they have their own interface.. so none is needed */ function show_sc($t) { return is_pagelines_special(array('type' => $t)) ? false : true; }
/** * Unset section based on Section Control */ function unset_section($sid, $template_slug, $sc, $dsc) { global $post; $post_id = isset($post) ? $post->ID : null; $oset = array('post_id' => $post_id); // Global Section Control Array $general_hide = isset($dsc['hide']) ? true : false; // Meta Controls if (is_pagelines_special()) { $special_type = $this->template_type; $meta_reverse = isset($sc[$special_type]['show']) && $sc[$special_type]['show'] ? true : false; $meta_hide = isset($sc[$special_type]['hide']) && $sc[$special_type]['hide'] ? true : false; } else { $meta_reverse = plmeta(meta_option_name(array('show', $template_slug, $sid)), $oset) ? true : false; $meta_hide = plmeta(meta_option_name(array('hide', $template_slug, $sid)), $oset) ? true : false; } return $general_hide && !$meta_reverse || !$general_hide && $meta_hide ? true : false; }
/** * * @TODO document * */ function pl_meta_set_url($tab = null) { global $post; $tab = isset($tab) ? '#' . $tab : ''; $url = is_pagelines_special() ? admin_url(PL_SPECIAL_OPTS_URL) : get_edit_post_link($post->ID); return $url . $tab; }