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


PHP Format::autop方法代码示例

本文整理汇总了PHP中Format::autop方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::autop方法的具体用法?PHP Format::autop怎么用?PHP Format::autop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Format的用法示例。


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

示例1: filter_comment_content_out

 public function filter_comment_content_out($content, $comment)
 {
     if ($this->should_pee('C-' . $comment->typename)) {
         $content = Format::autop($content);
     }
     return $content;
 }
开发者ID:ringmaster,项目名称:selectivep,代码行数:7,代码来源:selectivep.plugin.php

示例2: test_autop

 public function test_autop()
 {
     $data = $this->autop_data_provider();
     foreach ($data as $index => $datum) {
         $result = trim($datum['want']) === trim(Format::autop($datum['in'])) ? true : false;
         if (!$result) {
             $this->output(sprintf('<h2>Test %s</h2><br><strong>Input:</strong><br><textarea>%s</textarea><br><strong>Expected:</strong><br><textarea>%s</textarea><br><strong>Got:</strong><br><textarea>%s</textarea>', $index, Utils::htmlspecialchars($datum['in']), Utils::htmlspecialchars($datum['want']), Utils::htmlspecialchars(Format::autop($datum['in']))));
         }
         $this->assert_true($result, sprintf("Output does not match desired output in %s", $index));
     }
 }
开发者ID:habari,项目名称:tests,代码行数:11,代码来源:test_format.php

示例3: test_autop

	public function test_autop()
	{
		$data = $this->autop_data_provider();
		foreach( $data as $index => $datum ) {
			$this->assert_equal( trim( $datum['want'] ), trim( Format::autop( $datum['in'] ) ), 
				sprintf( 'Test %d<br><strong>Expected:</strong><br>%s<br><strong>Got:</strong><br> %s',
					$index,
					nl2br( Utils::htmlspecialchars( $datum['want'] ) ),
					nl2br( Utils::htmlspecialchars( Format::autop( $datum['in'] ) ) )
				)
			);
		}
	}
开发者ID:rynodivino,项目名称:tests,代码行数:13,代码来源:test_format.php

示例4: testAutop

 /**
  * @dataProvider autopDataProvider
  */
 public function testAutop($in, $out)
 {
     $this->assertEquals(trim($out), trim(Format::autop($in)));
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:7,代码来源:formatTest.php

示例5: dirname

<?php

require dirname(__FILE__) . '../../../../../habari-trunk/htdocs/system/classes/format.php';
echo Format::autop(file_get_contents($_SERVER['argv'][1]));
开发者ID:psaintlaurent,项目名称:Habari,代码行数:4,代码来源:render_autopregex.php

示例6: theme_colophon

 /**
  * Assigns output code to the template variables
  * @param Theme $theme The theme that will display the template
  */
 function theme_colophon($theme)
 {
     $theme->colophon_text = Format::autop(Options::get('colophon__text'));
     $theme->colophon_title = Options::get('colophon__title');
     return $theme->fetch('colophon');
 }
开发者ID:habari-extras,项目名称:colophon,代码行数:10,代码来源:colophon.plugin.php

示例7: add_posts

 /**
  * Add posts as items in the provided xml structure
  * @param SimpleXMLElement $xml The document to add to
  * @param array $posts An array of Posts to add to the XML
  * @return SimpleXMLElement The resultant XML with added posts
  *
  * @TODO replace post podcast markers with a url
  */
 public function add_posts($xml, $posts, $feed_name)
 {
     $items = $xml->channel;
     foreach ($posts as $post) {
         if ($post instanceof Post) {
             // remove Podpress detritus
             $content = preg_replace('%\\[display_podcast\\]%', '', $post->content);
             // eliminate podcast links from feed
             preg_match_all('%<a href="(.*)(" rel="enclosure">)(.*)</a>%i', $content, $matches);
             $count = count($matches[1]);
             for ($i = 0; $i < $count; $i++) {
                 $content = str_ireplace($matches[0][$i], '', $content);
             }
             $item = $items->addChild('item');
             $title = $item->addChild('title', $post->title);
             $link = $item->addChild('link', $post->permalink);
             $description = $item->addChild('description', Format::autop($content));
             $pubdate = $item->addChild('pubDate', $post->pubdate->format('r'));
             $guid = $item->addChild('guid', $post->guid);
             $guid->addAttribute('isPermaLink', 'false');
             extract((array) $post->info->{$feed_name});
             // create a url
             $episode = URL::get('podcast_media', array('podcast_name' => $feed_name, 'post_name' => $post->slug, 'method' => 'feed', 'filename' => rawurlencode(basename($enclosure))));
             $itunes_enclosure = $item->addChild('enclosure');
             $itunes_enclosure->addAttribute('url', $episode);
             $itunes_enclosure->addAttribute('length', $size);
             $itunes_enclosure->addAttribute('type', 'audio/mpeg');
             $itunes_author = $item->addChild('xmlns:itunes:author', $post->author->displayname);
             $itunes_subtitle = $item->addChild('xmlns:itunes:subtitle', $subtitle);
             $itunes_summary = $item->addChild('xmlns:itunes:summary', $summary);
             $itunes_duration = $item->addChild('xmlns:itunes:duration', $duration);
             $itunes_explicit = $item->addChild('xmlns:itunes:explicit', $rating);
             if (count($post->tags)) {
                 $itunes_keywords = $item->addChild('xmlns:itunes:keywords', implode(', ', (array) $post->tags));
             }
             $itunes_block = $item->addChild('xmlns:itunes:block', $block ? 'Yes' : 'No');
             Plugins::act('podcast_add_post', $item, $post);
         }
     }
     return $xml;
 }
开发者ID:habari-extras,项目名称:podcast,代码行数:49,代码来源:podcasthandler.php

示例8: post_itunes_form

 /**
  * Modify the publish form to include the iTunes settings for 
  * a specific post
  *
  * @param FormUI $form The form being modified
  * @param Post $post The post being edited
  * @param string $feed The name of the feed for which the form is being modified
  *
  */
 protected function post_itunes_form($form, $post, $feed)
 {
     $postfields = $form->publish_controls->enclosures;
     if (isset($post->info->{$feed})) {
         $options = $post->info->{$feed};
     }
     $control_id = md5($feed);
     $fieldname = "{$control_id}_player_settings";
     $player = $postfields->append('fieldset', $fieldname, _t('Display Settings'));
     $player->class = 'podcast-settings';
     $fieldname = "show_player_{$control_id}";
     $field = $player->append('checkbox', $fieldname, 'null:null', _t('Show player instead of link', 'podcast'), 'tabcontrol_checkbox');
     $field->value = isset($options['show_player']) ? $options['show_player'] : TRUE;
     $fieldname = "show_download_{$control_id}";
     $field = $player->append('checkbox', $fieldname, 'null:null', _t('Show download link under player', 'podcast'), 'tabcontrol_checkbox');
     $field->value = isset($options['show_download']) ? $options['show_download'] : TRUE;
     $fieldname = "{$control_id}_settings";
     $feed_fields = $postfields->append('fieldset', $fieldname, _t('Settings for ', 'podcast') . $feed);
     $feed_fields->class = 'podcast-settings';
     $fieldname = "enclosure_{$control_id}";
     $customfield = $feed_fields->append('text', $fieldname, 'null:null', _t('Podcast Enclosure * :', 'podcast'), 'tabcontrol_text');
     $customfield->value = isset($options['enclosure']) ? $options['enclosure'] : '';
     $customfield->add_validator('validate_required');
     $fieldname = "subtitle_{$control_id}";
     $customfield = $feed_fields->append('text', $fieldname, 'null:null', _t('Subtitle:', 'podcast'), 'tabcontrol_text');
     $customfield->value = isset($options['subtitle']) ? $options['subtitle'] : '';
     $fieldname = "explicit_{$control_id}";
     $customfield = $feed_fields->append('select', $fieldname, 'null:null', _t('Content Rating:', 'podcast'));
     $customfield->template = 'tabcontrol_select';
     $customfield->options = $this->itunes_rating;
     $customfield->value = isset($options['rating']) ? $this->itunes_rating[array_search($options['rating'], $this->itunes_rating)] : $this->itunes_rating['No'];
     $fieldname = "summary_{$control_id}";
     $customfield = $feed_fields->append('textarea', $fieldname, 'null:null', _t('Summary:', 'podcast'), 'tabcontrol_textarea');
     $customfield->value = isset($options['summary']) ? $options['summary'] : strip_tags(Format::summarize(Format::autop($post->content)));
     $fieldname = "block_{$control_id}";
     $customfield = $feed_fields->append('checkbox', $fieldname, 'null:null', _t('Block:', 'podcast'), 'tabcontrol_checkbox');
     $customfield->value = isset($options['block']) ? $options['block'] : 0;
 }
开发者ID:habari-extras,项目名称:podcast,代码行数:47,代码来源:podcast.plugin.php

示例9: action_add_template_vars

 /**
  * Assigns output code to the template variables
  * @param Theme $theme The theme that will display the template	
  */
 function action_add_template_vars($theme)
 {
     $theme->colophon = Format::autop(Options::get('colophon:colophon_text'));
     $theme->colophon_title = Options::get('colophon:colophon_title');
 }
开发者ID:stan,项目名称:habari-plugins,代码行数:9,代码来源:colophon.plugin.php

示例10: get_xml_text

 /**
  * Get the text associated to an info xml node, possibly using an href parameter
  * @param string $filename The filename of the xml file
  * @param \SimpleXMLElement $node The text node with value children to sift through
  * @return mixed|string The result text
  */
 public static function get_xml_text($filename, \SimpleXMLElement $node)
 {
     $values = $node->xpath('value[not(@lang)]');
     $value = reset($values);
     $filename = (string) $filename;
     if ($value['href']) {
         $href = dirname($filename) . '/' . str_replace('..', '', $value['href']);
         if (file_exists($href)) {
             $initial = file_get_contents($href);
             $result = Plugins::filter('get_xml_text', $initial, $filename);
             if ($initial == $result) {
                 $result = Format::autop($initial);
             }
             return $result;
         }
     }
     return (string) $value;
 }
开发者ID:habari,项目名称:system,代码行数:24,代码来源:pluggable.php


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