當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。