当前位置: 首页>>代码示例>>PHP>>正文


PHP yarpp_get_option函数代码示例

本文整理汇总了PHP中yarpp_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP yarpp_get_option函数的具体用法?PHP yarpp_get_option怎么用?PHP yarpp_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了yarpp_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget

 function widget($args, $instance)
 {
     global $post;
     if (!is_singular()) {
         return;
     }
     extract($args);
     $instance['post_type'] = $post->post_type == 'page' ? array('page') : array('post');
     if (yarpp_get_option('cross_relate')) {
         $instance['post_type'] = array('post', 'page');
     }
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!$instance['use_template']) {
         echo $before_title;
         if ($title) {
             echo $title;
         } else {
             _e('Related Posts (YARPP)', 'yarpp');
         }
         echo $after_title;
     }
     $instance['domain'] = 'widget';
     echo yarpp_related(null, $instance, false);
     echo $after_widget;
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:26,代码来源:class-widget.php

示例2: yarpp_make_optin_classy

function yarpp_make_optin_classy($classes)
{
    if (!yarpp_get_option('optin')) {
        $classes[] = 'yarpp_attention';
    }
    return $classes;
}
开发者ID:WackoMako,项目名称:stonedape,代码行数:7,代码来源:yarpp_meta_boxes_hooks.php

示例3: related_pages_exist

function related_pages_exist($args = array(), $reference_ID = false)
{
    $args['post_type'] = array('page');
    if (yarpp_get_option('cross_relate')) {
        $args['post_type'] = array('post', 'page');
    }
    return yarpp_related_exist($reference_ID, $args);
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:8,代码来源:related-functions.php

示例4: display

 public function display()
 {
     global $yarpp;
     echo "<div style='overflow:auto'>";
     echo '<div class="yarpp_code_display"';
     if (!$yarpp->get_option('code_display')) {
         echo ' style="display: none;"';
     }
     echo '><strong>' . __("Website display code example", 'yarpp') . '</strong><br /><small>' . __("(Update options to reload.)", 'yarpp') . "</small><br/><div id='display_demo_web'></div></div>";
     echo "<div class='yarpp_form_row yarpp_form_post_types'><div>";
     echo 'Automatically display related content from YARPP Basic on: ';
     echo " <span class='yarpp_help' data-help='" . esc_attr(__("This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pages()</code> and <code>related_entries()</code>) into your theme files.", 'yarpp')) . "'>&nbsp;</span>&nbsp;&nbsp;";
     echo "</div><div>";
     $post_types = yarpp_get_option('auto_display_post_types');
     foreach ($yarpp->get_post_types('objects') as $post_type) {
         echo "<label for='yarpp_post_type_{$post_type->name}'><input id='yarpp_post_type_{$post_type->name}' name='auto_display_post_types[{$post_type->name}]' type='checkbox' ";
         checked(in_array($post_type->name, $post_types));
         echo "/> {$post_type->labels->name}</label> ";
     }
     echo "</div></div>";
     $this->checkbox('auto_display_archive', __("Also display in archives", 'yarpp'));
     $this->textbox('limit', __('Maximum number of related posts:', 'yarpp'));
     $this->template_checkbox(false);
     echo "</div>";
     $chosen_template = yarpp_get_option("template");
     $choice = false === $chosen_template ? 'builtin' : ($chosen_template == 'thumbnails' ? 'thumbnails' : 'custom');
     echo "<div class='postbox yarpp_subbox template_options_custom'";
     if ($choice != 'custom') {
         echo ' style="display: none;"';
     }
     echo ">";
     echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
     $this->template_file(false);
     echo "</div>";
     echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
     if ($choice != 'thumbnails') {
         echo ' style="display: none;"';
     }
     echo ">";
     $this->textbox('thumbnails_heading', __('Heading:', 'yarpp'), 40);
     $this->textbox('thumbnails_default', __('Default image (URL):', 'yarpp'), 40);
     $this->textbox('no_results', __('Default display if no results:', 'yarpp'), 40, 'sync_no_results');
     echo "</div>";
     echo "<div class='postbox yarpp_subbox template_options_builtin'";
     if ($choice != 'builtin') {
         echo ' style="display: none;"';
     }
     echo ">";
     $this->beforeafter(array('before_related', 'after_related'), __("Before / after related entries:", 'yarpp'), 15, '', __("For example:", 'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ', 'yarpp') . '&lt;div&gt;&lt;/div&gt;');
     $this->beforeafter(array('before_title', 'after_title'), __("Before / after each related entry:", 'yarpp'), 15, '', __("For example:", 'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ', 'yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
     $this->checkbox('show_excerpt', __("Show excerpt?", 'yarpp'), 'show_excerpt');
     $this->textbox('excerpt_length', __('Excerpt length (No. of words):', 'yarpp'), 10, 'excerpted');
     $this->beforeafter(array('before_post', 'after_post'), __("Before / after (excerpt):", 'yarpp'), 10, 'excerpted', __("For example:", 'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ', 'yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
     $this->textbox('no_results', __('Default display if no results:', 'yarpp'), 40, 'sync_no_results');
     echo "</div>";
     $this->displayorder('order');
     $this->checkbox('promote_yarpp', __("Help promote Yet Another Related Posts Plugin?", 'yarpp') . '<span class="yarpp_help" data-help="' . 'This option will add the line &ldquo;powered by AdBistro&rdquo; beneath the related posts section. ' . 'This link is greatly appreciated."></span>');
 }
开发者ID:slavic18,项目名称:cats,代码行数:58,代码来源:YARPP_Meta_Box_Display_Web.php

示例5: display

 public function display()
 {
     $output = '<p>' . 'Enable the free <a href="http://www.yarpp.com" target="_blank">YARPP Pro enhancements</a> to add even ' . 'more power to your blog or website!' . '<br/><br/>' . '<a href="' . plugins_url('/', dirname(__FILE__)) . 'includes/yarpp_switch.php" class="yarpp_switch_button button" data-go="pro">Turn them on now</a>&nbsp;&nbsp;' . '<a href="http://www.yarpp.com" target="_blank" style="float:right;text-decoration:underline">Learn more</a>' . '</p>' . '<p>' . 'We can continue to improve the YARPP product for you if we know how it&#39;s used. Please help us by ' . 'allowing usage data to be sent back.' . '<br/>' . '</p>' . '<input
             type="checkbox"
             id="yarpp-optin"
             name="optin"
             value="true" ' . checked(yarpp_get_option('optin') == 1, true, false) . ' ' . '/>' . '<label for="yarpp-optin">Send usage data back.</label>' . '<a href="#" id="yarpp-optin-learnmore" style="float:right;text-decoration:underline">Learn More</a>';
     echo $output;
 }
开发者ID:slavic18,项目名称:cats,代码行数:9,代码来源:YARPP_Meta_Box_Optin.php

示例6: yarpp_ajax_display_demo_rss

function yarpp_ajax_display_demo_rss()
{
    global $wpdb, $post, $userdata, $yarpp_demo_time, $wp_query, $id, $page, $pages, $yarpp_limit;
    header("Content-Type: text/html; charset=utf-8");
    $yarpp_limit = yarpp_get_option('rss_limit');
    $return = yarpp_related(array('post'), array(), false, false, 'demo_rss');
    unset($yarpp_limit);
    echo ereg_replace("[\n\r]", '', nl2br(htmlspecialchars($return)));
    exit;
}
开发者ID:812studio,项目名称:812studio,代码行数:10,代码来源:services.php

示例7: where_filter

 function where_filter($arg)
 {
     global $wpdb;
     $threshold = yarpp_get_option('threshold');
     if ($this->yarpp_time) {
         $arg = str_replace("{$wpdb->posts}.ID = ", "yarpp.score >= {$threshold} and yarpp.reference_ID = ", $arg);
         if (yarpp_get_option("recent_only")) {
             $arg .= " and post_date > date_sub(now(), interval " . yarpp_get_option("recent_number") . " " . yarpp_get_option("recent_units") . ") ";
         }
     }
     return $arg;
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:12,代码来源:cache-tables.php

示例8: displayorder

    public function displayorder($option, $class = null)
    {
        echo "<div class='yarpp_form_row yarpp_form_select {$class}'><div class='yarpp_form_label'>";
        _e("Order results:", 'yarpp');
        echo "</div><div><select name='{$option}' id='<?php echo {$option}; ?>'>";
        $order = yarpp_get_option($option);
        ?>
                <option value="score DESC" <?php 
        echo $order == 'score DESC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("score (high relevance to low)", 'yarpp');
        ?>
</option>
                <option value="score ASC" <?php 
        echo $order == 'score ASC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("score (low relevance to high)", 'yarpp');
        ?>
</option>
                <option value="post_date DESC" <?php 
        echo $order == 'post_date DESC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("date (new to old)", 'yarpp');
        ?>
</option>
                <option value="post_date ASC" <?php 
        echo $order == 'post_date ASC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("date (old to new)", 'yarpp');
        ?>
</option>
                <option value="post_title ASC" <?php 
        echo $order == 'post_title ASC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("title (alphabetical)", 'yarpp');
        ?>
</option>
                <option value="post_title DESC" <?php 
        echo $order == 'post_title DESC' ? ' selected="selected"' : '';
        ?>
><?php 
        _e("title (reverse alphabetical)", 'yarpp');
        ?>
</option>
                <?php 
        echo "</select></div></div>";
    }
开发者ID:slavic18,项目名称:cats,代码行数:52,代码来源:YARPP_Meta_Box.php

示例9: where_filter

 public function where_filter($arg)
 {
     global $wpdb;
     $threshold = yarpp_get_option('threshold');
     if ($this->yarpp_time) {
         $arg = str_replace("{$wpdb->posts}.ID = ", "yarpp.score >= {$threshold} and yarpp.reference_ID = ", $arg);
         $recent = yarpp_get_option('recent');
         if (!!$recent) {
             $arg .= " and post_date > date_sub(now(), interval {$recent}) ";
         }
     }
     return $arg;
 }
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:13,代码来源:cache-tables.php

示例10: yarpp_ajax_display_distags

function yarpp_ajax_display_distags()
{
    global $wpdb;
    header("HTTP/1.1 200");
    header("Content-Type: text/html; charset=UTF-8");
    $distags = explode(',', yarpp_get_option('distags'));
    array_unshift($distags, ' ');
    foreach ($wpdb->get_results("select {$wpdb->terms}.term_id, name from {$wpdb->terms} natural join {$wpdb->term_taxonomy} where {$wpdb->term_taxonomy}.taxonomy = 'post_tag' order by name") as $tag) {
        echo "<input type='checkbox' name='distags[{$tag->term_id}]' value='true'" . (array_search($tag->term_id, $distags) ? ' checked="checked"' : '') . "  /> <label>{$tag->name}</label> ";
        // for='distags[$tag->term_id]'
    }
    exit;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:13,代码来源:services.php

示例11: where_filter

 /**
  * MAGIC FILTERS
  */
 public function where_filter($arg)
 {
     global $wpdb;
     // modify the where clause to use the related ID list.
     if (!count($this->related_IDs)) {
         $this->related_IDs = array(0);
     }
     $arg = preg_replace("!{$wpdb->posts}.ID = \\d+!", "{$wpdb->posts}.ID in (" . join(',', $this->related_IDs) . ")", $arg);
     // if recent is set, add an additional condition
     $recent = yarpp_get_option('recent');
     if (!!$recent) {
         $arg .= " and post_date > date_sub(now(), interval {$recent}) ";
     }
     return $arg;
 }
开发者ID:ni-hao,项目名称:myhomework,代码行数:18,代码来源:cache-postmeta.php

示例12: where_filter

 /**
  * MAGIC FILTERS
  */
 public function where_filter($arg)
 {
     global $wpdb;
     $threshold = yarpp_get_option('threshold');
     // modify the where clause to use the related ID list.
     if (!count($this->related_IDs)) {
         $this->related_IDs = array(0);
     }
     $arg = preg_replace("!{$wpdb->posts}.ID = \\d+!", "{$wpdb->posts}.ID in (" . join(',', $this->related_IDs) . ")", $arg);
     // if we have "recent only" set, add an additional condition
     if (yarpp_get_option("recent_only")) {
         $arg .= " and post_date > date_sub(now(), interval " . yarpp_get_option("recent_number") . " " . yarpp_get_option("recent_units") . ") ";
     }
     return $arg;
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:18,代码来源:cache-postmeta.php

示例13: display

 public function display()
 {
     global $yarpp;
     echo "<div style='overflow:auto'>";
     echo '<div class="rss_displayed yarpp_code_display"';
     if (!$yarpp->get_option('code_display')) {
         echo ' style="display: none;"';
     }
     echo '><b>' . __("RSS display code example", 'yarpp') . '</b><br /><small>' . __("(Update options to reload.)", 'yarpp') . "</small><br/><div id='display_demo_rss'></div></div>";
     $this->checkbox('rss_display', __("Display related posts in feeds?", 'yarpp') . " <span class='yarpp_help' data-help='" . esc_attr(__("This option displays related posts at the end of each item in your RSS and Atom feeds. No template changes are needed.", 'yarpp')) . "'>&nbsp;</span>", '');
     $this->checkbox('rss_excerpt_display', __("Display related posts in the descriptions?", 'yarpp') . " <span class='yarpp_help' data-help='" . esc_attr(__("This option displays the related posts in the RSS description fields, not just the content. If your feeds are set up to only display excerpts, however, only the description field is used, so this option is required for any display at all.", 'yarpp')) . "'>&nbsp;</span>", 'rss_displayed');
     $this->textbox('rss_limit', __('Maximum number of related posts:', 'yarpp'), 2, 'rss_displayed');
     $this->template_checkbox(true, 'rss_displayed');
     echo "</div>";
     $chosen_template = yarpp_get_option("rss_template");
     $choice = false === $chosen_template ? 'builtin' : ($chosen_template == 'thumbnails' ? 'thumbnails' : 'custom');
     echo "<div class='postbox yarpp_subbox template_options_custom rss_displayed'";
     if ($choice != 'custom') {
         echo ' style="display: none;"';
     }
     echo ">";
     echo '<div class="yarpp_form_row"><div>' . $this->template_text . '</div></div>';
     $this->template_file(true);
     echo "</div>";
     echo "<div class='postbox yarpp_subbox template_options_thumbnails'";
     if ($choice != 'thumbnails') {
         echo ' style="display: none;"';
     }
     echo ">";
     $this->textbox('rss_thumbnails_heading', __('Heading:', 'yarpp'), 40);
     $this->textbox('rss_thumbnails_default', __('Default image (URL):', 'yarpp'), 40);
     $this->textbox('rss_no_results', __('Default display if no results:', 'yarpp'), 40, 'sync_rss_no_results');
     echo "</div>";
     echo "<div class='postbox yarpp_subbox template_options_builtin rss_displayed'";
     if ($choice != 'builtin') {
         echo ' style="display: none;"';
     }
     echo ">";
     $this->beforeafter(array('rss_before_related', 'rss_after_related'), __("Before / after related entries:", 'yarpp'), 15, '', __("For example:", 'yarpp') . ' &lt;ol&gt;&lt;/ol&gt;' . __(' or ', 'yarpp') . '&lt;div&gt;&lt;/div&gt;');
     $this->beforeafter(array('rss_before_title', 'rss_after_title'), __("Before / after each related entry:", 'yarpp'), 15, '', __("For example:", 'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ', 'yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
     $this->checkbox('rss_show_excerpt', __("Show excerpt?", 'yarpp'), 'show_excerpt');
     $this->textbox('rss_excerpt_length', __('Excerpt length (No. of words):', 'yarpp'), 10, 'excerpted');
     $this->beforeafter(array('rss_before_post', 'rss_after_post'), __("Before / after (excerpt):", 'yarpp'), 10, 'excerpted', __("For example:", 'yarpp') . ' &lt;li&gt;&lt;/li&gt;' . __(' or ', 'yarpp') . '&lt;dl&gt;&lt;/dl&gt;');
     $this->textbox('rss_no_results', __('Default display if no results:', 'yarpp'), 40, 'sync_rss_no_results');
     echo "</div>";
     $this->displayorder('rss_order', 'rss_displayed');
     $this->checkbox('rss_promote_yarpp', __("Help promote Yet Another Related Posts Plugin?", 'yarpp') . " <span class='yarpp_help' data-help='" . esc_attr(sprintf(__("This option will add the code %s. Try turning it on, updating your options, and see the code in the code example to the right. These links and donations are greatly appreciated.", 'yarpp'), "<code>" . htmlspecialchars(sprintf(__("Related posts brought to you by <a href='%s'>Yet Another Related Posts Plugin</a>.", 'yarpp'), 'http://www.yarpp.com')) . "</code>")) . "'>&nbsp;</span>", 'rss_displayed');
 }
开发者ID:slavic18,项目名称:cats,代码行数:48,代码来源:YARPP_Meta_Box_Display_Feed.php

示例14: exclude

 public function exclude($taxonomy, $string)
 {
     global $yarpp;
     echo "<div class='yarpp_form_row yarpp_form_exclude'><div class='yarpp_form_label'>";
     echo $string;
     echo "</div><div class='yarpp_scroll_wrapper'><div class='exclude_terms' id='exclude_{$taxonomy}'>";
     $exclude_tt_ids = wp_parse_id_list(yarpp_get_option('exclude'));
     $exclude_term_ids = $yarpp->admin->get_term_ids_from_tt_ids($taxonomy, $exclude_tt_ids);
     if (count($exclude_term_ids)) {
         $terms = get_terms($taxonomy, array('include' => $exclude_term_ids));
         foreach ($terms as $term) {
             echo "<input type='checkbox' name='exclude[{$term->term_taxonomy_id}]' id='exclude_{$term->term_taxonomy_id}' value='true' checked='checked' /> <label for='exclude_{$term->term_taxonomy_id}'>" . esc_html($term->name) . "</label> ";
         }
     }
     echo "</div></div></div>";
 }
开发者ID:WackoMako,项目名称:stonedape,代码行数:16,代码来源:YARPP_Meta_Box_Pool.php

示例15: yarpp_related_exist

function yarpp_related_exist($type, $args)
{
    global $wpdb, $post;
    $options = array('threshold' => 'threshold', 'show_pass_post' => 'show_pass_post', 'past_only' => 'past_only');
    $optvals = array();
    foreach (array_keys($options) as $option) {
        if (isset($args[$option])) {
            $optvals[$option] = stripslashes($args[$option]);
        } else {
            $optvals[$option] = stripslashes(stripslashes(yarpp_get_option($options[$option])));
        }
    }
    extract($optvals);
    $result = $wpdb->get_var(yarpp_sql($type, $args, false, $domain));
    return $result > 0 ? true : false;
}
开发者ID:jcbozonier,项目名称:master,代码行数:16,代码来源:magic.php


注:本文中的yarpp_get_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。