/**
  *
  * @TODO document
  *
  */
 function _get_background_image_control($oid, $o)
 {
     $bg = $this->_background_image_array();
     $oset = array('post_id' => $o['pid'], 'setting' => $this->settings_field);
     // set value, id, name
     foreach ($bg as $k => $i) {
         $bgid = $oid . $k;
         if ($this->settings_field == 'meta') {
             $bg[$k]['val'] = plmeta($bgid, $oset);
             $bg[$k]['input_name'] = $bgid;
             $bg[$k]['input_id'] = get_pagelines_option_id($bgid);
         } elseif ($this->settings_field == PAGELINES_SPECIAL) {
             $oset['subkey'] = $bgid;
             $bg[$k]['val'] = ploption($o['special'], $oset);
             $bg[$k]['input_name'] = plname($o['special'], $oset);
             $bg[$k]['input_id'] = plid($o['special'], $oset);
         } else {
             $bg[$k]['val'] = ploption($bgid, $oset);
             $bg[$k]['input_id'] = plid($bgid, $oset);
             $bg[$k]['input_name'] = plname($bgid, $oset);
         }
         $bg[$k] = wp_parse_args($bg[$k], $o);
     }
     $this->_get_image_upload_option($oid . '_url', $bg['_url']);
     $this->_get_select_option($oid . '_repeat', $bg['_repeat']);
     $this->_get_count_select_option($oid . '_pos_vert', $bg['_pos_vert']);
     $this->_get_count_select_option($oid . '_pos_hor', $bg['_pos_hor']);
     $this->_get_select_option($oid . '_attach', $bg['_attach']);
 }
示例#2
0
/**
 * 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;
        }
    }
}
示例#3
0
 /**
  *
  * @TODO document
  *
  */
 function draw_boxes($p, $args)
 {
     setup_postdata($p);
     $oset = array('post_id' => $p->ID);
     $box_link = plmeta('the_box_icon_link', $oset);
     $box_icon = plmeta('the_box_icon', $oset);
     $box_target = plmeta('the_box_icon_target', $oset) ? 'target="_blank"' : '';
     $class = plmeta('box_class', $oset) ? plmeta('box_class', $oset) : null;
     $image = $box_icon ? self::_get_box_image($p, $box_icon, $box_link, $this->thumb_size, $box_target) : '';
     $title_text = $box_link ? sprintf('<a %s href="%s">%s</a>', $box_target, $box_link, $p->post_title) : $p->post_title;
     $title = do_shortcode(sprintf('<div class="fboxtitle"><h3>%s</h3></div>', $title_text));
     if (plmeta('box_more_text', $oset)) {
         $more_text = plmeta('box_more_text', $oset);
     } elseif (ploption('box_more_text', $this->oset)) {
         $more_text = ploption('box_more_text', $this->oset);
     } else {
         $more_text = false;
     }
     $more_link = $box_link && $more_text ? sprintf('<span class="fboxmore-wrap"><a class="fboxmore" href="%s" %s>%s</a></span>', $box_link, $box_target, $more_text) : '';
     $more_link = apply_filters('box_more_link', $more_link);
     $content = sprintf('<div class="fboxtext">%s %s %s</div>', do_shortcode($p->post_content), pledit($p->ID), $more_link);
     $info = $this->thumb_type != 'only_thumbs' ? sprintf('<div class="fboxinfo fix bd">%s%s</div>', $title, $content) : '';
     return sprintf('<div id="%s" class="fbox %s"><div class="media box-media %s"><div class="blocks box-media-pad">%s%s</div></div></div>', 'fbox_' . $p->ID, $class, $this->thumb_type, $image, $info);
 }
示例#4
0
 /**
  *
  * @TODO document
  *
  */
 function _get_banner_media($oset)
 {
     if (plmeta('the_banner_image', $oset)) {
         $banner_media = '<img src="' . plmeta('the_banner_image', $oset) . '" alt="' . esc_attr(get_the_title($oset['post_id'])) . '" />';
     } elseif (plmeta('the_banner_media', $oset)) {
         $banner_media = do_shortcode(plmeta('the_banner_media', $oset));
     } else {
         $banner_media = '';
     }
     // Filter output
     return apply_filters('pl_banner_image', $banner_media, $oset);
 }
示例#5
0
    /**
     *
     * @TODO document
     *
     */
    function draw_features($f, $class, $clone_id = null)
    {
        // Setup
        global $post;
        global $pagelines_ID;
        global $pagelines_layout;
        $current_page_post = $post;
        if (empty($f)) {
            echo setup_section_notify($this, __("No Feature posts matched this page's criteria", 'pagelines'));
            return;
        }
        // Options
        $feature_source = ploption('feature_source', $this->oset);
        $timeout = ploption('timeout', $this->oset);
        $playpause = ploption('feature_playpause', $this->oset);
        $feature_nav_type = ploption('feature_nav_type', $this->oset);
        // Refine
        $no_nav = isset($f) && count($f) == 1 ? ' nonav' : '';
        $footer_nav_class = $class . ' ' . $feature_nav_type . $no_nav;
        $cycle_selector = "fclone" . $clone_id;
        ?>
	<div id="feature_slider" class="<?php 
        echo $cycle_selector . '_wrap ' . $class;
        ?>
 fix">
		<div id="feature-area" class="fset_height">
			<div id="cycle" class="<?php 
        echo $cycle_selector;
        ?>
">
			<?php 
        foreach ($f as $post) {
            // Setup For Std WP functions
            setup_postdata($post);
            $oset = array('post_id' => $post->ID);
            $target = apply_filters('pagelines_features_target', '', $post);
            $feature_style = ploption('feature-style', $oset) ? ploption('feature-style', $oset) : 'text-left';
            $feature_style = apply_filters('pagelines-feature-style', $feature_style);
            $flink_text = ploption('feature-link-text', $oset) ? __(ploption('feature-link-text', $oset)) : __('More', 'pagelines');
            if ($feature_source == 'posts' || $feature_source == 'posts_all') {
                $feature_background_image = '';
                if (plmeta('feature-background-image', $oset)) {
                    $feature_background_image = plmeta('feature-background-image', $oset);
                } elseif (has_post_thumbnail($post->ID)) {
                    $feature_background_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
                    $feature_background_image = $feature_background_image[0];
                } else {
                    $feature_background_image = apply_filters('pagelines-feature-cat-default-image', $this->base_url . '/images/feature1.jpg', $post);
                }
                $background_class = 'bg_cover';
            } else {
                $feature_background_image = ploption('feature-background-image', $oset);
                $background_class = 'bg_cover';
            }
            $feature_design = ploption('feature-design', $oset) ? ploption('feature-design', $oset) : '';
            if ($feature_source == 'posts' || $feature_source == 'posts_all') {
                setup_postdata($post);
            }
            if (plmeta('feature-link-url', $oset)) {
                $action = plmeta('feature-link-url', $oset);
            } elseif (ploption('feature-link-url', $oset)) {
                $action = ploption('feature-link-url', $oset);
            } elseif ($feature_source == 'posts' || $feature_source == 'posts_all') {
                $action = get_permalink();
            } else {
                $action = '';
            }
            $fcontent_class = ploption('fcontent-bg', $oset) ? ploption('feature-bg', $oset) : '';
            $media_image = ploption('feature-media-image', $oset);
            $feature_media = ploption('feature-media', $oset);
            $feature_media_full = ploption('feature-media-full', $oset);
            $feature_wrap_markup = $feature_style == 'text-none' && $action ? 'a' : 'div';
            $feature_wrap_link = $feature_style == 'text-none' && $action ? sprintf('href="%s"', $action) : '';
            $more_link = $feature_style != 'text-none' && $action ? sprintf(' <a %s class="plmore" href="%s" >%s</a>', $target, $action, $flink_text) : '';
            $background_css = $feature_background_image ? sprintf('style="background-image: url(\'%s\');"', $feature_background_image) : '';
            printf('<div id="%s" class="fcontainer %s %s fix" >', 'feature_' . $post->ID, $feature_style, $feature_design);
            printf('<%s class="feature-wrap fset_height %s" %s %s >', $feature_wrap_markup, $background_class, $feature_wrap_link, $background_css);
            if ($feature_wrap_markup != 'a') {
                if ($feature_media && $feature_media_full) {
                    echo $feature_media;
                } else {
                    ?>

								<div class="feature-pad fset_height fix">
									<div class="fcontent scale_text fset_height <?php 
                    echo $fcontent_class;
                    ?>
">
										<div class="fcontent-pad fix">
												<?php 
                    pagelines_register_hook('pagelines_feature_text_top', $this->id);
                    // Hook
                    $link = $feature_source == 'posts' || $feature_source == 'posts_all' ? sprintf('<a %s href="%s">%s</a>', $target, $action, $post->post_title) : $post->post_title;
                    $title = sprintf('<div class="fheading"> <h2 class="ftitle">%s</h2> </div>', $link);
                    $content = $feature_source == 'posts' || $feature_source == 'posts_all' ? apply_filters('pagelines_feature_output', custom_trim_excerpt(get_the_excerpt(), '30')) : do_shortcode(get_the_content());
                    printf('%s<div class="ftext"><div class="fexcerpt">%s%s%s</div></div>', $title, $content, $more_link, pledit($post->ID));
                    pagelines_register_hook('pagelines_fcontent_after', $this->id);
                    // Hook
                    ?>
										</div>
									</div>

									<div class="fmedia fset_height" style="">
										<div class="fmedia-pad">
											<?php 
                    pagelines_register_hook('pagelines_feature_media_top', $this->id);
                    // Hook
                    if ($media_image) {
                        printf('<div class="media-frame"><img src="%s" /></div>', $media_image);
                    } elseif ($feature_media) {
                        echo do_shortcode($feature_media);
                    }
                    ?>
										</div>
									</div>
									<?php 
                    pagelines_register_hook('pagelines_feature_after', $this->id);
                    // Hook
                    ?>
									<div class="clear"></div>
								</div>

							<?php 
                }
            }
            printf('</%s>', $feature_wrap_markup);
            echo '</div>';
        }
        $post = $current_page_post;
        ?>
			</div>
		</div>
			<?php 
        pagelines_register_hook('pagelines_feature_nav_before', $this->id);
        // Hook
        $playpause = $timeout != 0 && $playpause ? sprintf('<span class="playpause pause %s"><span>&nbsp;</span></span>', $cycle_selector) : '';
        $nav = sprintf('<div id="featurenav" class="%s subtext fix"></div>', $cycle_selector);
        printf('<div id="feature-footer" class="%s fix"><div class="feature-footer-pad">%s%s<div class="clear"></div></div></div>', $footer_nav_class, $playpause, $nav);
        ?>
	</div>
	<div class="clear"></div>
<?php 
    }
 /**
  * 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;
 }
/**
 * Grab from global defaults panel
 *
 * @param 'key' the id of the option
 *
 **/
function pldefault($key, $args = array(), $mode = '')
{
    global $pagelines_special_meta;
    $sp = $pagelines_special_meta;
    $slug = 'default';
    $reverse_key = $key . '_reverse';
    $default_value = isset($sp[$slug]) && is_array($sp[$slug]) && isset($sp[$slug][$key]) ? $sp[$slug][$key] : false;
    // check if on default option is reversed by meta
    $reverse_value = $mode != 'val' && (plmeta($reverse_key, $args) || plspecial($reverse_key, $args)) ? true : false;
    if (!$reverse_value) {
        return $default_value;
    } else {
        return false;
    }
}