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


PHP wpautop函数代码示例

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


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

示例1: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $text = apply_filters('widget_text_morelink', empty($instance['text']) ? '' : $instance['text'], $instance);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        ?>
			<div class="textwidget"><?php 
        echo !empty($instance['filter']) ? wpautop($text) : $text;
        ?>
</div>
			<?php 
        if (!empty($instance['more_link']) && !empty($instance['more_link_text'])) {
            ?>
				<span class="sidebar-more"><a href="<?php 
            echo $instance['more_link'];
            ?>
"><?php 
            echo $instance['more_link_text'];
            ?>
</a></span>
			<?php 
        }
        ?>
		<?php 
        echo $after_widget;
    }
开发者ID:macressler,项目名称:caeruleum,代码行数:30,代码来源:widgets.php

示例2: check_get_post_response

 protected function check_get_post_response($response, $post_obj, $context = 'view')
 {
     $response = json_ensure_response($response);
     $response_data = $response->get_data();
     $this->assertEquals($post_obj->ID, $response_data['ID']);
     $this->assertEquals($post_obj->post_name, $response_data['slug']);
     $this->assertEquals($post_obj->post_status, $response_data['status']);
     $this->assertEquals($post_obj->post_author, $response_data['author']);
     $this->assertArrayHasKey('parent', $response_data);
     $this->assertEquals(get_permalink($post_obj->ID), $response_data['link']);
     $this->assertEquals($post_obj->menu_order, $response_data['menu_order']);
     $this->assertEquals($post_obj->comment_status, $response_data['comment_status']);
     $this->assertEquals($post_obj->ping_status, $response_data['ping_status']);
     $this->assertEquals($post_obj->post_password, $response_data['password']);
     $this->assertEquals(is_sticky($post_obj->ID), $response_data['sticky']);
     // Check post parent.
     if ($post_obj->post_parent) {
         if (is_int($response_data['parent'])) {
             $this->assertEquals($post_obj->post_parent, $response_data['parent']);
         } else {
             $this->assertEquals($post_obj->post_parent, $response_data['parent']['ID']);
             $this->check_get_post_response($response_data['parent'], get_post($response_data['parent']['ID']), 'view-parent');
         }
     } else {
         $this->assertEmpty($response_data['parent']);
     }
     // Check post format.
     $post_format = get_post_format($post_obj->ID);
     if (empty($post_format)) {
         $this->assertEquals('standard', $response_data['format']);
     } else {
         $this->assertEquals(get_post_format($post_obj->ID), $response_data['format']);
     }
     // Check post dates.
     if ($post_obj->post_date_gmt === '0000-00-00 00:00:00') {
         $this->assertNull($response_data['date']);
         $this->assertNull($response_data['date_gmt']);
     } else {
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date), $response_data['date']);
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_date_gmt), $response_data['date_gmt']);
     }
     if ($post_obj->post_modified_gmt === '0000-00-00 00:00:00') {
         $this->assertNull($response_data['modified']);
         $this->assertNull($response_data['modified_gmt']);
     } else {
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified), $response_data['modified']);
         $this->assertEquals(json_mysql_to_rfc3339($post_obj->post_modified_gmt), $response_data['modified_gmt']);
     }
     // Check filtered values.
     $this->assertEquals(get_the_title($post_obj->ID), $response_data['title']);
     // TODO: apply content filter for more accurate testing.
     $this->assertEquals(wpautop($post_obj->post_content), $response_data['content']);
     // TODO: apply excerpt filter for more accurate testing.
     $this->assertEquals(wpautop($post_obj->post_excerpt), $response_data['excerpt']);
     $this->assertEquals($post_obj->guid, $response_data['guid']);
     if ($context === 'edit') {
         $this->assertEquals($post_obj->post_content, $response_data['content_raw']);
         $this->assertEquals($post_obj->post_excerpt, $response_data['excerpt_raw']);
     }
 }
开发者ID:NicholasTaylorUK,项目名称:WP-API,代码行数:60,代码来源:test-json-posts.php

示例3: widget

 /**
  * Echo the widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $text = '';
     if (!empty($instance['alignment'])) {
         $text .= '<span class="align' . esc_attr($instance['alignment']) . '">';
     }
     $text .= get_avatar($instance['user'], $instance['size']);
     if (!empty($instance['alignment'])) {
         $text .= '</span>';
     }
     if ('text' === $instance['author_info']) {
         $text .= $instance['bio_text'];
     } else {
         $text .= get_the_author_meta('description', $instance['user']);
     }
     $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : '';
     //* Echo $text
     echo wpautop($text);
     //* If posts link option checked, add posts link to output
     if ($instance['posts_link']) {
         printf('<div class="posts_link posts-link"><a href="%s">%s</a></div>', get_author_posts_url($instance['user']), __('View My Blog Posts', 'genesis'));
     }
     echo $after_widget;
 }
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:37,代码来源:user-profile-widget.php

示例4: add_notice

 /**
  * @see wm_add_notice
  */
 public static function add_notice($message, $type = 'info', $title = null, $backtrace = false)
 {
     $message = rtrim(ucfirst(trim((string) $message)), '.') . '.';
     $content = wpautop($title ? "<strong class=\"wm-notice-title\">{$title}</strong><br />{$message}" : $message);
     if (false !== $backtrace) {
         if (is_array($backtrace)) {
             $content .= self::get_backtrace($backtrace);
         } else {
             if ($stack = array_slice(debug_backtrace(), 2)) {
                 if (true === $backtrace) {
                     $content .= "<ol start=\"0\" class=\"wm-notice-backtrace\">";
                     foreach ($stack as $i => $backtrace) {
                         $content .= "<li>" . self::get_backtrace($backtrace) . "</li>";
                     }
                     $content .= "</ol>";
                 } else {
                     if (isset($stack[$backtrace])) {
                         $content .= self::get_backtrace($stack[$backtrace]);
                     }
                 }
             }
         }
     }
     self::$notices[] = "<div class=\"wm-notice notice {$type}\">{$content}</div>";
     // Cache alerts until they're shown
     set_transient('wm_notices', self::$notices);
 }
开发者ID:WebMaestroFr,项目名称:wm-notices,代码行数:30,代码来源:plugin.php

示例5: widget

 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $numberposts = isset($instance['numberposts']) ? $instance['numberposts'] : 1;
     $termargs = array('post_type' => 'glossary', 'post_status' => 'publish', 'numberposts' => $numberposts, 'orderby' => 'rand');
     if ($group = $instance['group']) {
         $termargs['tax_query'] = array(array('taxonomy' => 'wpglossarygroup', 'field' => 'slug', 'terms' => $group));
     }
     $terms = get_posts($termargs);
     if ($terms && count($terms)) {
         echo '<ul class="wpglossary widget-list">';
         foreach ($terms as $term) {
             setup_postdata($term);
             $title = '<a href="' . apply_filters('wpg_term_link', get_post_permalink($term->ID)) . '">' . get_the_title($term->ID) . '</a>';
             $desc = '';
             $display = $instance['display'];
             if ($display && $display != 'title') {
                 $desc = $display == 'full' ? apply_filters('the_content', get_the_content(), $main = false) : wpautop(get_the_excerpt());
                 $desc = '<br>' . $desc;
             }
             echo '<li>' . $title . $desc . '</li>';
         }
         wp_reset_postdata();
         echo '</ul>';
     } else {
         echo '<em>' . __('No terms available', 'wp-glossary') . '</em>';
     }
     echo $after_widget;
 }
开发者ID:s3rgiosan,项目名称:WP-Glossary,代码行数:34,代码来源:wpg-widget-random-term.class.php

示例6: ebor_top_left_icon_block_shortcode

/**
 * The Shortcode
 */
function ebor_top_left_icon_block_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('duration' => '1', 'icon' => '', 'delay' => '0', 'layout' => 'on-top'), $atts));
    if ('behind' == $layout) {
        $output = '
			<div class="process">
				<div class="content wow fadeIn" data-wow-duration="' . esc_attr($duration) . 's" data-wow-delay="' . esc_attr($delay) . 's">
					<span class="icon">
						<i class="' . esc_attr($icon) . '"></i>
					</span>
					' . wpautop(do_shortcode(htmlspecialchars_decode($content))) . '
				</div>
			</div>
		';
    } else {
        $output = '
			<div class="services">
				<div class="service wow fadeInUp" data-wow-duration="' . esc_attr($duration) . 's" data-wow-delay="' . esc_attr($delay) . 's">
					<span class="icon icon-s">
						<i class="' . esc_attr($icon) . '"></i>
					</span>
					' . wpautop(do_shortcode(htmlspecialchars_decode($content))) . '
				</div>
			</div>
		';
    }
    return $output;
}
开发者ID:tommusrhodus,项目名称:Ebor-Framework,代码行数:31,代码来源:vc_top_left_icon_block.php

示例7: format_custom_field

function format_custom_field($field, $format = '', $date_format = 'F j, Y')
{
    $fetch = get_post_custom_values($field);
    $fetch = $fetch[0];
    // Test if anything was fetched or return false.
    if (!$fetch) {
        return false;
    }
    switch ($format) {
        case 'date':
            return date($date_format, $fetch);
            break;
        case 'text_block':
            return wpautop($fetch);
            break;
        case 'link':
            return '<a href="' . $fetch . '" class="custom_link">' . $fetch . '</a>';
            break;
        case 'html':
            return html_entity_decode($fetch);
            break;
        case 'google_map':
            return display_google_map($fetch);
            break;
        default:
            // If you're not processing(formatting) the var at all
            // why even use this function? Just use the WP custom field funcs.
            return $fetch;
    }
}
开发者ID:rigelstpierre,项目名称:Everlovin-Press,代码行数:30,代码来源:custom_field_functions.php

示例8: cuisine_intro

function cuisine_intro($atts, $content = null)
{
    $html = '<div class="intro">';
    $html .= do_shortcode(wpautop($content));
    $html .= '</div>';
    return $html;
}
开发者ID:chefduweb,项目名称:cuisine,代码行数:7,代码来源:shortcode-columns.php

示例9: st_remove_wpautop

 function st_remove_wpautop($content)
 {
     if (function_exists('wpb_js_remove_wpautop')) {
         $content = wpautop(preg_replace('/<\\/?p\\>/', "\n", $content) . "\n");
         return do_shortcode(shortcode_unautop($content));
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:7,代码来源:class.sthelper.php

示例10: display

    /**
     * Display meta in a formatted list.
     *
     * @param bool $flat (default: false)
     * @param bool $return (default: false)
     * @param string $hideprefix (default: _)
     * @param  string $delimiter Delimiter used to separate items when $flat is true
     * @return string|void
     */
    public function display($flat = false, $return = false, $hideprefix = '_', $delimiter = ", \n")
    {
        $output = '';
        $formatted_meta = $this->get_formatted($hideprefix);
        if (!empty($formatted_meta)) {
            $meta_list = array();
            foreach ($formatted_meta as $meta) {
                if ($flat) {
                    $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
                } else {
                    $meta_list[] = '
						<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post($meta['label']) . ':</dt>
						<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post(wpautop(make_clickable($meta['value']))) . '</dd>
					';
                }
            }
            if (!empty($meta_list)) {
                if ($flat) {
                    $output .= implode($delimiter, $meta_list);
                } else {
                    $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
                }
            }
        }
        $output = apply_filters('woocommerce_order_items_meta_display', $output, $this);
        if ($return) {
            return $output;
        } else {
            echo $output;
        }
    }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:40,代码来源:class-wc-order-item-meta.php

示例11: widget

    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        if ($this->get_cached_widget($args)) {
            return;
        }
        ob_start();
        extract($args);
        $title = $instance['title'];
        $color = $instance['color'];
        $description = $instance['description'];
        echo $before_widget;
        ?>

		<div class="pricing-table-widget-title" style="background-color: <?php 
        echo esc_attr($color);
        ?>
">
			<?php 
        echo esc_attr($title);
        ?>
		</div>

		<div class="pricing-table-widget-description">
			<?php 
        echo wpautop(apply_filters('jobify_price_option_description', $description));
        ?>
		</div>

		<?php 
        echo $after_widget;
        $content = apply_filters('jobify_widget_price_option', ob_get_clean(), $instance, $args);
        echo $content;
        $this->cache_widget($args, $content);
    }
开发者ID:Josizzle,项目名称:VisitLift,代码行数:43,代码来源:class-widget-price-option.php

示例12: widget

 /**
  * Generate the output for the widget.
  * @action eventspot_output Triggers the action to generate the output for the events.
  * @filter constant_contact_event_widget_ouput Modify widget output. Passes $output and $instance.
  * @uses CTCT_EventSpot::events_output()
  * @param  array       $args     Widget args
  * @param  array       $instance Widget settings
  * @return void
  */
 function widget($args = array(), $instance = array())
 {
     $output = '';
     extract($instance);
     $widget_title = $title;
     $widget_description = $description;
     extract($args);
     $output .= isset($before_widget) ? $before_widget : '';
     if (!empty($widget_title)) {
         $output .= isset($before_title, $after_title) ? $before_title : '<h2>';
         $output .= isset($widget_title) ? esc_html($widget_title) : '';
         $output .= isset($after_title, $before_title) ? $after_title : '</h2>';
     }
     $output .= !empty($widget_description) ? "\n\t" . '<div class="cc_event_description">' . "\n\t\t" . wpautop(wptexturize($widget_description)) . '</div>' : '';
     // Get the output from CTCT_EventSpot::events_output()
     ob_start();
     $instance['sidebar'] = true;
     do_action('eventspot_output', $instance, true);
     $output .= ob_get_clean();
     $output .= isset($after_widget) ? $after_widget : '';
     // Modify the output by calling add_filter('constant_contact_event_widget', 'your_function');
     // Passes the output to the function, needs return $output coming from the function.
     $output = apply_filters('constant_contact_event_widget_ouput', $output, $instance);
     echo $output;
     return;
 }
开发者ID:johnmanlove,项目名称:JMMC_Corp-Site,代码行数:35,代码来源:widget-events.php

示例13: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = array_key_exists('title', $instance) ? apply_filters('widget_title', empty($instance['title']) ? __('Jaiminho') : $instance['title']) : '';
        $jaiminho_text = array_key_exists('jaiminho_text', $instance) ? apply_filters('widget_text', $instance['jaiminho_text'], $instance) : '';
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        if (array_key_exists('jaiminho_id', $instance) && ($jaiminho_id = (int) $instance['jaiminho_id'])) {
            ?>
		
			<div class="jaiminho">
				<div class="jaiminho-excerpt"><?php 
            echo wpautop($jaiminho_text);
            ?>
</div>
			
				<?php 
            jaiminho($jaiminho_id);
            ?>
			</div><!-- .jaiminho -->
			
		<?php 
        } else {
            if (current_user_can('manage_options')) {
                echo '<em>' . __('Não foi informado o ID da lista do Jaiminho. Preencha corretamente o campo do ID dentro do
			widget. Você pode encontrar o ID dentro do campo <code>value</code>, na primeira linha do
			formulário.', 'jaiminho') . '</em>';
            }
        }
        echo $after_widget;
    }
开发者ID:cabelotaina,项目名称:redelivre,代码行数:33,代码来源:jaiminho-widget.php

示例14: icl_get_job_original_field_content

function icl_get_job_original_field_content()
{
    global $iclTranslationManagement;
    if (!wpml_is_action_authenticated('icl_get_job_original_field_content')) {
        die('Wrong Nonce');
    }
    $job_id = filter_input(INPUT_POST, 'tm_editor_job_id', FILTER_SANITIZE_NUMBER_INT);
    $field = filter_input(INPUT_POST, 'tm_editor_job_field');
    $data = array();
    $job = $job_id !== null && $field !== null ? $job = $iclTranslationManagement->get_translation_job($job_id) : null;
    $elements = $job && isset($job->elements) ? $job->elements : array();
    foreach ($elements as $element) {
        $sanitized_type = sanitize_title($element->field_type);
        if ($field === 'icl_all_fields' || $sanitized_type === $field) {
            // if we find a field by that name we need to decode its contents according to its format
            $field_contents = TranslationManagement::decode_field_data($element->field_data, $element->field_format);
            if (is_scalar($field_contents)) {
                $field_contents = strpos($field_contents, "\n") !== false ? wpautop($field_contents) : $field_contents;
                $data[] = array('field_type' => $sanitized_type, 'field_data' => $field_contents);
            }
        }
    }
    if ((bool) $data !== false) {
        wp_send_json_success($data);
    } else {
        wp_send_json_error(0);
    }
}
开发者ID:ryuqing,项目名称:cake,代码行数:28,代码来源:ajax.php

示例15: add_builder_content_wrapper

    function add_builder_content_wrapper($content)
    {
        if (!et_pb_is_pagebuilder_used(get_the_ID()) && !is_et_pb_preview()) {
            return $content;
        }
        // Divi builder layout should only be used in singular template
        if (!is_singular()) {
            // get_the_excerpt() for excerpt retrieval causes infinite loop; thus we're using excerpt from global $post variable
            global $post;
            $read_more = sprintf(' <a href="%1$s" title="%2$s" class="more-link">%3$s</a>', esc_url(get_permalink()), sprintf(esc_attr__('Read more on %1%s', 'et_builder'), esc_html(get_the_title())), esc_html__('read more', 'et_builder'));
            // Use post excerpt if there's any. If there is no excerpt defined,
            // Generate from post content by stripping all shortcode first
            if (!empty($post->post_excerpt)) {
                return wpautop($post->post_excerpt . $read_more);
            } else {
                $shortcodeless_content = preg_replace('/\\[[^\\]]+\\]/', '', $content);
                return wpautop(et_wp_trim_words($shortcodeless_content, 270, $read_more));
            }
        }
        $outer_class = apply_filters('et_builder_outer_content_class', array('et_builder_outer_content'));
        $outer_classes = implode(' ', $outer_class);
        $outer_id = apply_filters("et_builder_outer_content_id", "et_builder_outer_content");
        $inner_class = apply_filters('et_builder_inner_content_class', array('et_builder_inner_content'));
        $inner_classes = implode(' ', $inner_class);
        $content = sprintf('<div class="%2$s" id="%4$s">
				<div class="%3$s">
					%1$s
				</div>
			</div>', $content, esc_attr($outer_classes), esc_attr($inner_classes), esc_attr($outer_id));
        return $content;
    }
开发者ID:anthonymiyoro,项目名称:jobs-board,代码行数:31,代码来源:divi-builder.php


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