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


PHP get_the_password_form函数代码示例

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


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

示例1: italystrap_excerpt_password_form

function italystrap_excerpt_password_form($excerpt)
{
    if (post_password_required()) {
        $excerpt = get_the_password_form();
    }
    return $excerpt;
}
开发者ID:AndrGelmini,项目名称:ItalyStrap,代码行数:7,代码来源:password_protection.php

示例2: add_content

 public function add_content($content, $template, $position = 10)
 {
     if (!defined('ABSPATH')) {
         exit;
     }
     // Exit if accessed directly
     if (!in_the_loop()) {
         return;
     }
     // Return if not in main loop
     $content = '<div class="sp-post-content">' . $content . '</div>';
     ob_start();
     if ($position <= 0) {
         echo $content;
     }
     do_action('sportspress_before_single_' . $template);
     if (post_password_required()) {
         echo get_the_password_form();
         return;
     }
     if ($position > 0 && $position <= 5) {
         echo $content;
     }
     do_action('sportspress_single_' . $template . '_content');
     if ($position > 5 && $position <= 10) {
         echo $content;
     }
     do_action('sportspress_after_single_' . $template);
     if ($position > 10) {
         echo $content;
     }
     return ob_get_clean();
 }
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:33,代码来源:class-sp-template-loader.php

示例3: sunshine_content

 function sunshine_content($content)
 {
     global $post, $wp_query, $sunshine;
     if (!is_sunshine()) {
         return $content;
     }
     if (isset($_GET['sunshine_search'])) {
         $content = self::get_template('search-results');
     } elseif (isset(self::$current_image)) {
         if (post_password_required(self::$current_gallery)) {
             $content = get_the_password_form();
         } else {
             $content = self::get_template('image');
         }
     } elseif (isset(self::$current_gallery)) {
         if (post_password_required(self::$current_gallery)) {
             $content = get_the_password_form();
         } elseif (!current_user_can('sunshine_manage_options') && sunshine_gallery_requires_email(self::$current_gallery->ID)) {
             $content = sunshine_gallery_email_form();
         } else {
             $content = self::get_template('gallery');
         }
     } elseif (isset(self::$current_order)) {
         $content = self::get_template('order');
     } elseif (is_page($sunshine->options['page'])) {
         $content = $content . self::get_template('home');
     } elseif (is_page($sunshine->options['page_cart'])) {
         $content = $content . self::get_template('cart');
     } elseif (is_page($sunshine->options['page_checkout'])) {
         $content = $content . self::get_template('checkout');
     } elseif (is_page($sunshine->options['page_account'])) {
         $content = $content . self::get_template('account');
     }
     return apply_filters('sunshine_content', $content);
 }
开发者ID:sunshinephotocart,项目名称:sunshine-photo-cart,代码行数:35,代码来源:frontend.class.php

示例4: get_the_content

function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
{
    global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
    global $preview;
    global $pagenow;
    $output = '';
    if (!empty($post->post_password)) {
        // if there's a password
        if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) != $post->post_password) {
            // and it doesn't match the cookie
            $output = get_the_password_form();
            return $output;
        }
    }
    if ($more_file != '') {
        $file = $more_file;
    } else {
        $file = $pagenow;
    }
    //$_SERVER['PHP_SELF'];
    if ($page > count($pages)) {
        // if the requested page doesn't exist
        $page = count($pages);
    }
    // give them the highest numbered page that DOES exist
    $content = $pages[$page - 1];
    if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
        $content = explode($matches[0], $content, 2);
        if (!empty($matches[1]) && !empty($more_link_text)) {
            $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
        }
    } else {
        $content = array($content);
    }
    if (false !== strpos($post->post_content, '<!--noteaser-->') && (!$multipage || $page == 1)) {
        $stripteaser = 1;
    }
    $teaser = $content[0];
    if ($more && $stripteaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<span id="more-' . $id . '"></span>' . $content[1];
        } else {
            $output = balanceTags($output);
            if (!empty($more_link_text)) {
                $output .= ' <a href="' . get_permalink() . "#more-{$id}\" class=\"more-link\">{$more_link_text}</a>";
            }
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace('/\\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
    }
    return $output;
}
开发者ID:helmonaut,项目名称:owb-mirror,代码行数:58,代码来源:post-template.php

示例5: hw_woocommerce_before_single_product

/**
 * woocommerce_before_single_product hook
 *
 * @hooked wc_print_notices - 10
 */
function hw_woocommerce_before_single_product()
{
    if (is_singular('product')) {
        if (post_password_required()) {
            echo get_the_password_form();
            return;
        }
    }
}
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:14,代码来源:functions.php

示例6: post_content

 protected function post_content()
 {
     $post = get_post($this->post_id);
     if (!empty($post->post_password)) {
         if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) != $post->post_password) {
             return get_the_password_form();
         }
     }
     return strip_shortcodes($post->post_content);
 }
开发者ID:Jevuska,项目名称:extended-related-posts,代码行数:10,代码来源:class-extrp-excerpt.php

示例7: getPostContentAttribute

 public function getPostContentAttribute($value)
 {
     if (post_password_required($this->ID)) {
         $value = get_the_password_form($this->ID);
     }
     if (!$this->suppressPostContentFilters) {
         $value = apply_filters('the_content', $value);
     }
     $this->suppressPostContentFilters = false;
     if (!empty($value)) {
         return $value;
     }
 }
开发者ID:expresser,项目名称:posttype,代码行数:13,代码来源:Content.php

示例8: get_content

 function get_content()
 {
     // Get the content of current post. We like to have the entire
     // content. If we call get_the_content() we'll only get the teaser +
     // page 1.
     global $post;
     // Password checking copied from
     // template-functions-post.php/get_the_content()
     // Search shouldn't match a passworded entry anyway.
     if (post_password_required()) {
         return get_the_password_form();
     }
     return $post->post_content;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:14,代码来源:ylsy_search_excerpt.php

示例9: the_content

 function the_content($more_link_text = _WP_TPL_MORE, $stripteaser = 0, $more_file = '', $echo = true)
 {
     if (!empty($GLOBALS['post']->post_password)) {
         // if there's a password
         if ($_COOKIE['wp-postpass_' . $GLOBALS['cookiehash']] != $GLOBALS['post']->post_password) {
             // and it doesn't match the cookie
             $output = get_the_password_form(false);
             return _echo($output, $echo);
         }
     }
     $content = get_the_content($more_link_text, $stripteaser, $more_file);
     $content = apply_filters('the_content', $content);
     $content = str_replace(']]>', ']]&gt;', $content);
     return _echo($content, $echo);
 }
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:15,代码来源:template-functions-post.php

示例10: testPasswordedContentWhenEnabled

 function testPasswordedContentWhenEnabled()
 {
     add_filter('timber/post/content/show_password_form_for_protected', function ($maybe_show) {
         return true;
     });
     $quote = 'The way to do well is to do well.';
     $post_id = $this->factory->post->create();
     $post = new TimberPost($post_id);
     $post->post_content = $quote;
     $post->post_password = 'burrito';
     wp_update_post($post);
     $password_form = get_the_password_form($post->ID);
     $this->assertEquals($password_form, $post->content());
     $this->assertEquals($password_form, $post->get_content());
 }
开发者ID:jarednova,项目名称:timber,代码行数:15,代码来源:test-timber-post-password.php

示例11: tarski_excerpt

/**
 * tarski_excerpt() - Excerpts a la Tarski.
 * 
 * Code shamelessly borrowed from Kaf Oseo's 'the_excerpt Reloaded' plugin.
 * @link http://guff.szub.net/2005/02/26/the-excerpt-reloaded/
 * @since 1.2.1
 * @deprecated 2.2
 * @param $return boolean
 * @param string $excerpt_length
 * @return string
 */
function tarski_excerpt($return = false, $excerpt_length = 35)
{
    _deprecated_function(__FUNCTION__, '2.2', the_excerpt());
    global $post;
    if (!empty($post->post_password)) {
        // if there's a password
        if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
            // and it doesn't match cookie
            $output = get_the_password_form();
        }
        if ($return) {
            return $output;
        } else {
            echo $output;
            return;
        }
    }
    if (!($text = $post->post_excerpt)) {
        $text = $post->post_content;
    }
    if ($excerpt_length < 0) {
        $output = $text;
    } else {
        str_replace('<!--more-->', '', $text);
        $text = explode(' ', $text);
        if (count($text) > $excerpt_length) {
            $l = $excerpt_length;
            $ellipsis = '&hellip;';
        } else {
            $l = count($text);
            $ellipsis = false;
        }
        for ($i = 0; $i < $l; $i++) {
            $output .= $text[$i] . ' ';
        }
    }
    $output = rtrim($output, " \n\t\r\v");
    $output = strip_tags($output);
    $output .= $ellipsis;
    $output = apply_filters('get_the_excerpt', $output);
    $output = apply_filters('the_excerpt', $output);
    $output = apply_filters('tarski_excerpt', $output);
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:jeremylightsmith,项目名称:blog,代码行数:59,代码来源:deprecated.php

示例12: get_content

 public function get_content()
 {
     // Get the content of current post. We like to have the entire
     // content. If we call get_the_content() we'll only get the teaser +
     // page 1.
     $post = get_post($this->post_id);
     // Password checking copied from
     // template-functions-post.php/get_the_content()
     // Search shouldn't match a passworded entry anyway.
     if (!empty($post->post_password)) {
         // if there's a password
         if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) != $post->post_password) {
             // and it doesn't match the cookie
             return get_the_password_form();
         }
     }
     return $post->post_content;
 }
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:18,代码来源:class-stt2extat-searchexcerpt.php

示例13: get_the_content

function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
{
    global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
    global $preview;
    global $pagenow;
    $output = '';
    if (!empty($post->post_password)) {
        // if there's a password
        if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) != $post->post_password) {
            // and it doesn't match the cookie
            $output = get_the_password_form();
            return $output;
        }
    }
    if ($more_file != '') {
        $file = $more_file;
    } else {
        $file = $pagenow;
    }
    //$_SERVER['PHP_SELF'];
    $content = $pages[$page - 1];
    $content = explode('<!--more-->', $content, 2);
    if (preg_match('/<!--noteaser-->/', $post->post_content) && (!$multipage || $page == 1)) {
        $stripteaser = 1;
    }
    $teaser = $content[0];
    if ($more && $stripteaser) {
        $teaser = '';
    }
    $output .= $teaser;
    if (count($content) > 1) {
        if ($more) {
            $output .= '<a id="more-' . $id . '"></a>' . $content[1];
        } else {
            $output .= ' <a href="' . get_permalink() . "#more-{$id}\">{$more_link_text}</a>";
        }
    }
    if ($preview) {
        // preview fix for javascript bug with foreign languages
        $output = preg_replace('/\\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
    }
    return $output;
}
开发者ID:robertlange81,项目名称:Website,代码行数:43,代码来源:template-functions-post.php

示例14: spyropress_get_the_content

function spyropress_get_the_content($post_id = '')
{
    if (class_exists('SpyropressBuilder') && spyropress_has_builder_content($post_id)) {
        $post = get_post();
        // If post password required and it doesn't match the cookie.
        if (post_password_required($post)) {
            return '<div class="container">' . get_the_password_form($post) . '</div>';
        }
        return spyropress_get_the_builder_content($post_id);
    } elseif (is_singular()) {
        ob_start();
        echo '<div class="container">';
        the_content(__('Continue reading <span class="meta-nav">&rarr;</span>', 'spyropress'));
        echo '</div>';
        return ob_get_clean();
    } else {
        return get_the_excerpt();
    }
}
开发者ID:rinodung,项目名称:myfreetheme,代码行数:19,代码来源:spyropress-template.php

示例15: get_excerpt

 function get_excerpt()
 {
     global $post;
     global $hemingwayEx_options;
     //modified by Nalin. Added option to allow user to specify length of excerpt
     if (!is_null($hemingwayEx_options['excerpt_length']) || $hemingwayEx_options['excerpt_length'] != 0) {
         $max_length = $hemingwayEx_options['excerpt_length'];
     } else {
         $max_length = 75;
         // Maximum words.
     }
     // If they've manually put in an excerpt, and allowed it to be used let it go!
     if ($post->post_excerpt && $hemingwayEx_options['use_WP_excerpt'] != 0) {
         return $post->post_excerpt;
     }
     // Check to see if it's a password protected post
     if ($post->post_password) {
         if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
             if (is_feed()) {
                 return __('This is a protected post');
             } else {
                 return get_the_password_form();
             }
         }
     }
     if (strpos($post->post_content, '<!--more-->')) {
         // There's a more link
         $temp_ex = explode('<!--more-->', $post->post_content, 2);
         $excerpt = $temp_ex[0];
     } else {
         $temp_ex = explode(' ', $post->post_content);
         // Split up the spaces
         $length = count($temp_ex) < $max_length ? count($temp_ex) : $max_length;
         for ($i = 0; $i < $length; $i++) {
             $excerpt .= $temp_ex[$i] . ' ';
         }
     }
     $excerpt = balanceTags($excerpt);
     $excerpt = apply_filters('the_excerpt', $excerpt);
     return $excerpt;
 }
开发者ID:nullin,项目名称:hemingwayex,代码行数:41,代码来源:functions.php


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