コード例 #1
0
ファイル: filter_markdown.php プロジェクト: crick-ru/wolfcms
 function apply($text)
 {
     require_once 'classMarkdown.php';
     $markdown = new MarkdownExtra_Parser();
     $text = $markdown->transform($text);
     return SmartyPants($text);
 }
コード例 #2
0
 public function filter($text)
 {
     if (Options::get('typogrify__do_amp')) {
         $text = amp($text);
     }
     if (Options::get('typogrify__do_widont')) {
         $text = widont($text);
     }
     if (Options::get('typogrify__do_smartypants')) {
         // Standard options plus convert_quot ('w') to
         // convert " entities, that Habari might
         // already have converted '"' characters into.
         $text = SmartyPants($text, "qbdew");
     }
     if (Options::get('typogrify__do_caps')) {
         $text = caps($text);
     }
     if (Options::get('typogrify__do_initial_quotes')) {
         $text = initial_quotes($text);
     }
     if (Options::get('typogrify__do_guillemets')) {
         $text = initial_quotes($text, true);
     }
     if (Options::get('typogrify__do_dash')) {
         $text = dash($text);
     }
     return $text;
 }
コード例 #3
0
ファイル: TextRenderer.php プロジェクト: noix/qsprog
 function TextToHTML($string, $stringLanguage = false)
 {
     global $_JAM;
     // Look for Markdown preference
     if ($_JAM->projectConfig['useMarkdown']) {
         require_once 'engine/libraries/smartypants.php';
         require_once 'engine/libraries/markdown.php';
         return SmartyPants(Markdown($string));
     }
     // First find backticked portions and store them for later use
     $backtickmatch = '{`([^`]*)`}u';
     preg_match_all($backtickmatch, $string, $metaFillOutArray, PREG_PATTERN_ORDER);
     // Only index 1 is suitable for use
     $fillOutArray = $metaFillOutArray[1];
     // Replace matches with placeholders
     $string = preg_replace($backtickmatch, '%PLACEHOLDER', $string);
     $match = array('{\\r}u', '{^([^\\n]+)$}mu', '{<p>-(=)+-</p>}u', '{<p>([^\\n]+)</p>[\\n\\s]*<p>-*</p>}u', '{<p>[-·•]\\s?([^\\n]+)</p>(\\n{1}|$)}u', '{</ul>\\n<ul>}u', '{<p>(\\d)\\. ([^\\n]+)</p>(\\n{1}|$)}u', '{</ol>\\n<ol type="1" start="\\d">}u', '{</p>\\n<p>([^\\t])}u', "{(/?)>\\[([^\\s=>\\]]*)=([^\\s>\\]]*)\\]}u", '{<p>%PLACEHOLDER</p>}u');
     $replace = array('', e('p', '$1'), e('hr'), e('h2', '$1'), e('ul', e('li', '$1')) . "\n", "\n", e('ol', array('type' => 1, 'start' => '$1'), e('li', '$2')) . "\n", "\n", e('br') . "\n\$1", ' $2="$3"$1>', '%PLACEHOLDER');
     $smartizedString = TextRenderer::SmartizeText($string, $language);
     $HTMLString = preg_replace($match, $replace, $smartizedString);
     // Reinsert backticked portions
     while ($fillout = array_shift($fillOutArray)) {
         $HTMLString = preg_replace('{%PLACEHOLDER}u', $fillout, $HTMLString, 1);
     }
     return $HTMLString;
 }
コード例 #4
0
ファイル: smartypants.php プロジェクト: serverboy/Interchange
function execute_smartypants($data)
{
    static $smartypants;
    if (!$smartypants) {
        require IXG_PATH_PREFIX . "pipes/engines/smartypants/smartypants.php";
        $smartypants = true;
    }
    return SmartyPants($data);
}
コード例 #5
0
ファイル: Markdown_parser.php プロジェクト: nockout/tshpro
 function TextileThis($text, $lite = '', $encode = '')
 {
     if ($lite == '' && $encode == '') {
         $text = Markdown($text);
     }
     if (function_exists('SmartyPants')) {
         $text = SmartyPants($text);
     }
     return $text;
 }
コード例 #6
0
 function run($string)
 {
     if (!function_exists('Markdown')) {
         include_once EXTENSIONS . '/markdown/lib/markdown_extra.php';
     }
     if (!function_exists('SmartyPants')) {
         include_once EXTENSIONS . '/markdown/lib/smartypants.php';
     }
     $result = stripslashes(Markdown($string));
     return SmartyPants($result);
 }
 function run($string)
 {
     if (!self::$_parser) {
         include_once EXTENSIONS . '/markdown/lib/markdown.php';
         self::$_parser = new MarkdownExtra_Parser();
     }
     if (!function_exists('SmartyPants')) {
         include_once EXTENSIONS . '/markdown/lib/smartypants.php';
     }
     return SmartyPants(stripslashes(self::$_parser->transform($string)));
 }
コード例 #8
0
ファイル: text_assistant.php プロジェクト: searchfirst/Lenore
 function htmlFormatted($text, $media = false, $model = null, $media_link_attributes = null)
 {
     $text = $this->sanitiseText($text, false);
     $text = SmartyPants(Markdown($text));
     if ($media && count($media)) {
         $text = $this->_formatTextFragments($text, $media, $model, $media_link_attributes);
     } else {
         $text = $this->_stripTextFragments($text);
     }
     return $text;
 }
コード例 #9
0
 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'frontend_display':
                 if ($this->get_config('SMARTYPANTS_INSTEAD', false)) {
                     include_once dirname(__FILE__) . '/smartypants.php';
                     foreach ($this->markup_elements as $temp) {
                         if (serendipity_db_bool($this->get_config($temp['name'], true)) && !empty($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
                             $element = $temp['element'];
                             $eventData[$element] = SmartyPants($eventData[$element]);
                         }
                     }
                 } else {
                     foreach ($this->markup_elements as $temp) {
                         if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && !$eventData['properties']['ep_disable_markup_' . $this->instance] && !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
                             $element = $temp['element'];
                             # First find all the tags... We want to keep straight quotes in them.
                             # So we remember all the tags, and replace them temporarily
                             preg_match_all("/<[^>]*>/", $eventData[$element], $matches);
                             $count = count($matches[0]);
                             for ($i = 0; $i < $count; $i++) {
                                 $temp = $matches[0][$i];
                                 $new = "<!-- tag number {$i} -->";
                                 $eventData[$element] = str_replace($temp, $new, $eventData[$element]);
                             }
                             # Now we perform our replacements...  All sets of quotes turned smart, then single quotes are dealt with...
                             $eventData[$element] = preg_replace("/\"(.*?)\"/", "&#8220;\\1&#8221;", $eventData[$element]);
                             $eventData[$element] = preg_replace("/&quot;(.*?)&quot;/", "&#8220;\\1&#8221;", $eventData[$element]);
                             $eventData[$element] = preg_replace("/(?<! )' /", "&#8217; ", $eventData[$element]);
                             $eventData[$element] = preg_replace("/(?<! )'(?! )/", "&#8217;", $eventData[$element]);
                             $eventData[$element] = preg_replace("/ '(?! )/", " &#8216;", $eventData[$element]);
                             #Finally we add the tags back into the body of our entry.
                             for ($i = 0; $i < $count; $i++) {
                                 $tag_body = $matches[0][$i];
                                 $old = "<!-- tag number {$i} -->";
                                 $eventData[$element] = str_replace($old, $tag_body, $eventData[$element]);
                             }
                         }
                     }
                 }
                 return true;
                 break;
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
 public function run($string)
 {
     if (!self::$_parser) {
         include_once EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.4/markdown.php';
         self::$_parser = new Markdown_Parser();
     }
     // Markdown transformation
     $result = stripslashes(self::$_parser->transform($string));
     if (!function_exists('SmartyPants')) {
         include_once EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1e/smartypants.php';
     }
     // Apply "Smarty Pants" formatting
     $result = SmartyPants(stripslashes(self::$_parser->transform($string)));
     return $result;
 }
コード例 #11
0
ファイル: text-control.php プロジェクト: brian3t/orchidmate
function tc_post_process($text, $do_text = '', $do_char = '')
{
    if ($do_text == 'textile2') {
        require_once 'text-control/textile2.php';
        $t = new Textile();
        $text = $t->process($text);
    } else {
        if ($do_text == 'textile1') {
            require_once 'text-control/textile1.php';
            $text = textile($text);
        } else {
            if ($do_text == 'markdown') {
                require_once 'text-control/markdown.php';
                $text = Markdown($text);
            } else {
                if ($do_text == 'wpautop') {
                    $text = wpautop($text);
                } else {
                    if ($do_text == 'nl2br') {
                        $text = nl2br($text);
                    } else {
                        if ($do_text == 'none') {
                            $text = $text;
                        } else {
                            $text = wpautop($text);
                        }
                    }
                }
            }
        }
    }
    if ($do_char == 'smartypants') {
        require_once 'text-control/smartypants.php';
        $text = SmartyPants($text);
    } else {
        if ($do_char == 'wptexturize') {
            $text = wptexturize($text);
        } else {
            if ($do_char == 'none') {
                $text = $text;
            } else {
                $text = wptexturize($text);
            }
        }
    }
    return $text;
}
コード例 #12
0
 public static function transform($string)
 {
     $path = dirname(__FILE__) . '/../vendor/' . sfConfig::get('app_majaxMarkdown_style', 'markdown_extra') . '/markdown.php';
     require_once $path;
     $string = Markdown($string);
     if (sfConfig::get('app_majaxMarkdown_smartypants_enabled', true)) {
         $style = sfConfig::get('app_majaxMarkdown_smartypants_style', 'smartypants_typographer');
         $path = dirname(__FILE__) . '/../vendor/' . $style . '/smartypants.php';
         require_once $path;
         $string = SmartyPants($string, sfConfig::get('app_majaxMarkdown_smartypants_options', 1));
     }
     if (sfConfig::get('app_majaxMarkdown_post_render', false)) {
         $render = sfConfig::get('app_majaxMarkdown_post_render');
         $string = call_user_func($render, $string);
     }
     return $string;
 }
function google_docs_markdown_parse($url)
{
    include_once 'markdown.php';
    include_once 'smartypants.php';
    $doc = curl_get_contents($url);
    $start_of_div = strpos($doc, '<div id="doc-contents">');
    $end_of_div = strpos($doc, '<div id="google-view-footer">');
    if ($start_of_div === false) {
        return 'Sorry, cannot retrieve content at this time.';
    }
    // get just the content div
    $content = substr($doc, $start_of_div, $end_of_div - $start_of_div);
    // strip new lines, replace div's with new lines
    // strip remaining tags, trim the ends
    $content = trim(strip_tags(str_replace(array("\n", '<div>'), array('', "\n"), $content)));
    // format with Markdown and return
    return SmartyPants(Markdown($content));
}
コード例 #14
0
ファイル: text_assistant.php プロジェクト: searchfirst/ODN
 function htmlFormatted($text, $media = false, $model = null, $media_link_attributes = null)
 {
     $text = $this->sanitiseText($text, false);
     if (!preg_match('/{\\[markdown\\]}/', $text)) {
         $txtl = new Textile();
         $text = SmartyPants($txtl->TextileThis($text), 1);
         $text = $txtl->TextileThis($text);
     } else {
         $text = str_replace('{[markdown]}', '', $text);
         $text = SmartyPants(Markdown($text), 1);
     }
     if ($media && count($media)) {
         $text = $this->_formatTextFragments($text, $media, $model, $media_link_attributes);
     } else {
         $text = $this->_stripTextFragments($text);
     }
     return $text;
 }
コード例 #15
0
ファイル: Markdown.php プロジェクト: hscale/curator
 /**
  * Handle $data, and return the results.
  *
  * @param string data The data to handle.
  * @return string
  * @access public
  */
 public function input($data, $options = array())
 {
     include_once CURATOR_APP_DIR . DS . 'Vendors' . DS . 'php-markdown' . DS . 'dist' . DS . 'markdown.php';
     include_once CURATOR_APP_DIR . DS . 'Vendors' . DS . 'php-smartypants' . DS . 'dist' . DS . 'smartypants.php';
     $result = null;
     try {
         if (strpos($data, NL) === false && is_file($data)) {
             $data = file_get_contents($data);
             if ($data === false) {
                 throw new \Exception('Could not load file: ' . $data);
             }
         }
         $result = \SmartyPants(\Markdown($data));
     } catch (\Exception $e) {
         \Curator\Console::stderr('** Could not handle Mardkwon data:');
         \Curator\Console::stderr('   ' . $e->getMessage());
     }
     return $result;
 }
コード例 #16
0
ファイル: content.php プロジェクト: nob/joi
 /**
  * Render content via a given $content_type
  *
  * @param string  $content  Content to render
  * @param mixed  $content_type  Content type to use (overrides configured content_type)
  * @return string
  */
 public static function transform($content, $content_type = NULL)
 {
     $content_type = Helper::pick($content_type, Config::getContentType());
     // render HTML from the given $content_type
     switch (strtolower($content_type)) {
         case "markdown":
         case "md":
             $content = Markdown($content);
             break;
         case "text":
         case "txt":
             $content = nl2br(strip_tags($content));
             break;
         case "textile":
             $textile = new Textile();
             $content = $textile->TextileThis($content);
     }
     if (Config::get('_enable_smartypants', TRUE) == TRUE) {
         $content = SmartyPants($content, 2);
     }
     return trim($content);
 }
コード例 #17
0
ファイル: resources.php プロジェクト: johnholdun/currents
function twitter_get_toot($username)
{
    $url = "http://twitter.com/statuses/user_timeline.json?count=25&screen_name={$username}";
    $toots = json_decode_file($url);
    foreach ($toots as $toot) {
        $toot = $toot->text;
        # Find the first toot that starts with "I" (or "I'm" etc.) and isn't all caps
        if (preg_match('/^I[^A-Za-z]/', $toot) and $toot != strtoupper($toot)) {
            $toot = SmartyPants($toot);
            # Turns *asterisized* text into <em>emphasized</em> text
            # This could be more complex but (bold, underline) but it works for me
            $toot = preg_replace('/\\*(.+?)\\*/', '<em>\\1</em>', $toot);
            # Add a hyperlink to text that ends in a URL
            if (preg_match('/http:\\/\\/[^ ]+/', $toot, $urls)) {
                $url = $urls[0];
                # Pull that guy outta there
                $toot = trim(str_replace($url, '', $toot));
                $toot = "<a href=\"{$url}\" rel=\"nofollow\">{$toot}</a>";
            }
            return $toot;
        }
    }
}
コード例 #18
0
    /**
     * Constructor.
     *
     * @access  public
     * @param   string      $tagdata    The tagdata to process.
     * @return  void
     */
    public function __construct($tagdata = '')
    {
        $ee         =& get_instance();
        $config     = $ee->config;
        $functions  = $ee->functions;
        $tmpl       = $ee->TMPL;

        $default_smartquotes    = '2';
        $this->return_data      = '';

        if ($tagdata)
        {
            // Fieldtype.
            $encode         = $config->item('smartdown:ee_tags:encode') == 'yes';
            $fix_images     = !($config->item('smartdown:ee_tags:fix_transplanted_images') == 'no');
            $smart_quotes   = $config->item('smartdown:smart_quotes') ? $config->item('smartdown:smart_quotes') : $default_smartquotes;
        }
        else
        {
            // Template tag.
            $tagdata        = $tmpl->tagdata;
            $encode         = ($tmpl->fetch_param('ee_tags:encode') == 'yes') OR ($tmpl->fetch_param('encode_ee_tags') == 'yes');
            $fix_images     = !($tmpl->fetch_param('ee_tags:fix_transplanted_images') == 'no');
            $smart_quotes   = $tmpl->fetch_param('smart_quotes') ? $tmpl->fetch_param('smart_quotes') : $default_smartquotes;
        }

        if ($encode)
        {
            $tagdata = Markdown($functions->encode_ee_tags($tagdata, TRUE));

            // Fix EE code samples.
            $tagdata = preg_replace_callback(
                '|' .preg_quote('<code>') .'(.*?)' .preg_quote('</code>') .'|s',
                array($this, '_fix_encoded_ee_code_samples'),
                $tagdata
            );

            // Fix {path=} URLs.
            $tagdata = preg_replace('/&#123;(path=.*?)&#125;/i', '{$1}', $tagdata);

            // Play nicely with NSM Transplant and the {image_xx} technique.
            if ($fix_images)
            {
                $tagdata = preg_replace('/&#123;(image_[0-9]+)&#125;/i', '{$1}', $tagdata);
            }
        }
        else
        {
            $tagdata = Markdown($tagdata);
        }
        
        $this->return_data  = SmartyPants($tagdata, $smart_quotes);
    }
コード例 #19
0
ファイル: index.php プロジェクト: johnholdun/scattered-feed
  <body>
    <header>
      <h1>Scattered Feed</h1>
      <p>I&rsquo;m scattering feed for the chickens. Now it&rsquo;s all scattered.</p>
    </header>
        
    <ul class="feed">
<?php 
foreach ($items as $item) {
    ?>
      <li>
        <h2><a href="<?php 
    echo $item['link'];
    ?>
"><span><?php 
    echo SmartyPants($item['title']);
    ?>
</span></a></h2>
        <p><?php 
    echo $item['description'];
    ?>
</p>
        <p class="date"><?php 
    echo date('F j', $item['published_at']);
    ?>
</p>
      </li>
<?php 
}
?>
    </ul>
コード例 #20
0
ファイル: makepdf.php プロジェクト: BackupTheBerlios/oos-svn
	$content = $purifier->purify($content, $config);
	// run through Tidy one last time (TODO: check if this step can be avoided)
	$tidy = tidy_parse_string($content, $tidy_config, 'UTF8');
	$tidy->cleanRepair();
	$content = $tidy->value;
	// a little additional cleanup...
	$content = str_replace('<p><br /></p>', '<br />', $content);
	$content = preg_replace('!<br />\s*<(/?(h2|p))>!', '<$1>', $content);
	//$content = preg_replace('!<br />\s*</p>!', '</p>', $content);
	$content = preg_replace('!\s*<br />\s*!', '<br />', $content);
	$content = preg_replace('!</(p|blockquote)>\s*<br />\s*!', '</$1>', $content);
	$content = str_replace('<p>&nbsp;</p>', '', $content);
	//$content = preg_replace('/\s+/', ' ', $content);
	// run content through SmartyPants to make things pretty
	$content = SmartyPants($content);
	$title = SmartyPants($item->get_title());
	$story .= $content;
	// add enclosure link
	if ($enclosure = $item->get_enclosure()) {
		$story = '<p><a href="'.$enclosure->get_link().'">Click here to view or listen to the audio/video.</a></p>'.$story;
	}
	//die($story);
	//die($purifier->purify($item->get_content()));
	$pdf->addItem('<a href="'.$item->get_permalink().'">'.$title.'</a>', $story, (int)$item->get_date('U'));
}
// make PDF
$pdf->makePdf();
// output PDF
$pdf->Output($cache_file, 'F');
$pdf->Output('news.pdf', 'I');
コード例 #21
0
ファイル: markdown.php プロジェクト: searchfirst/ODN
 function text($text)
 {
     return SmartyPants(Markdown($text));
 }
コード例 #22
0
ファイル: EE_Typography.php プロジェクト: realfluid/umbaugh
 /**
  * Parse content to Markdown
  * @param  string $str     String to parse
  * @param  array  $options Associative array containing options
  *                         - encode_ee_tags (yes/no) can be used to disable
  *                         	ee tag encoding
  *                         - smartypants (yes/no) enable or disable
  *                         	smartypants
  *                         - no_markup (TRUE/FALSE) set to TRUE to disable
  *                          the parsing of markup in Markdown
  * @return string          Parsed Markdown content
  */
 public function markdown($str, $options = array())
 {
     require_once APPPATH . 'libraries/typography/Markdown/markdown.php';
     // Encode EE Tags
     if (!isset($options['encode_ee_tags']) or $options['encode_ee_tags'] == 'yes') {
         $str = ee()->functions->encode_ee_tags($str);
     }
     // Ignore [code]
     $code_blocks = array();
     preg_match_all("/\\[code\\](.*?)\\[\\/code\\]/uis", $str, $matches);
     foreach ($matches[0] as $match) {
         $hash = random_string('md5');
         $code_blocks[$hash] = $match;
         $str = str_replace($match, $hash, $str);
     }
     $parser = new Markdown_Parser();
     // Disable other markup if this is set
     if (isset($options['no_markup']) && $options['no_markup'] === TRUE) {
         $parser->no_markup = TRUE;
     }
     // Protect any quotes in EE tags from the Markdown and SmartyPants
     // processors.
     $str = $this->protect_quotes_in_tags($str);
     // Parse the Markdown
     $str = $parser->transform($str);
     // Run everything through SmartyPants
     if (!isset($options['smartypants']) or $options['smartypants'] == 'yes') {
         require_once APPPATH . 'libraries/typography/SmartyPants/smartypants.php';
         $str = SmartyPants($str);
     }
     // Restore the quotes we protected earlier.
     $str = $this->restore_quotes_in_tags($str);
     // Replace <pre><code> with [code]
     // Only relevant IF being called by typography parser
     $backtrace = debug_backtrace();
     if (!in_array($backtrace[1]['class'], array('EE_Typography', 'Markdown'))) {
         $str = preg_replace("/<pre><code>(.*?)<\\/code><\\/pre>/uis", "[code]\$1[/code]", $str);
     }
     // Replace [code]
     foreach ($code_blocks as $hash => $code_block) {
         $str = str_replace($hash, $code_block, $str);
     }
     return $str;
 }
コード例 #23
0
ファイル: smartypants.php プロジェクト: postpostmodern/phooey
function smarty_modifier_smartypants($text, $attr = NULL)
{
    return SmartyPants($text, $attr);
}
コード例 #24
0
 function niceHTML($text)
 {
     $html = SmartyPants(Markdown($text));
     return $html;
 }
コード例 #25
0
ファイル: textile2.php プロジェクト: brian3t/orchidmate
 /**
  * @private
  */
 function process_quotes($str)
 {
     if (!$this->options['do_quotes'] || !function_exists('SmartyPants')) {
         return $str;
     }
     return SmartyPants($str, $this->options['smarty_mode']);
 }
コード例 #26
0
 function fs_MarkdownAndSmartyPants($content)
 {
     $content = MarkDown($content);
     $content = SmartyPants($content);
     return $content;
 }
コード例 #27
0
ファイル: Post.php プロジェクト: natealmeida/secondcrack
 public function write_index_sequence($dest_path, $title, $type, array $posts, $template = 'main.html', $archive_array = false, $posts_per_page = 20)
 {
     $sequence = 0;
     $new_dest_path = $dest_path;
     // $dest_uri = substring_after(substring_before($dest_path, '.', true), Updater::$dest_path);
     $dest_uri = substring_after(substring_after($dest_path, '/', true), Updater::$dest_path);
     $total_sequences = ceil(count($posts) / $posts_per_page);
     while ($posts) {
         $sequence++;
         $seq_array = array_splice($posts, 0, $posts_per_page);
         if ($sequence == 1) {
             continue;
         }
         // skip writing the redundant "-1" page
         $new_dest_path = $dest_path . '-' . $sequence . '.html';
         $posts_data = array();
         foreach ($seq_array as $p) {
             $posts_data[] = $p->array_for_template();
         }
         $t = new Template($template);
         $t->content = array('page-title' => html_entity_decode(SmartyPants($title), ENT_QUOTES, 'UTF-8'), 'blog-title' => html_entity_decode(SmartyPants(self::$blog_title), ENT_QUOTES, 'UTF-8'), 'blog-url' => self::$blog_url, 'blog-description' => html_entity_decode(SmartyPants(self::$blog_description), ENT_QUOTES, 'UTF-8'), 'page-type' => $type, 'posts' => $posts_data, 'previous_page_url' => $sequence != 1 ? $sequence == 2 ? $dest_uri : $dest_uri . '-' . ($sequence - 1) : false, 'next_page_url' => $sequence < $total_sequences ? $dest_uri . '-' . ($sequence + 1) : false, 'archives' => $archive_array ? $archive_array : array());
         $output_html = $t->outputHTML();
         $output_path = dirname($new_dest_path);
         if (!file_exists($output_path)) {
             mkdir_as_parent_owner($output_path, 0755, true);
         }
         file_put_contents_as_dir_owner($new_dest_path, $output_html);
     }
     return $total_sequences;
 }
コード例 #28
0
 /**
  * Constructor.
  *
  * @access  public
  * @param   string      $tagdata        The tagdata to process.
  * @return  void
  */
 public function __construct($tagdata = '')
 {
     global $REGX, $TMPL;
     
     $this->return_data = '';
     
     if ( ! $tagdata)
     {
         $tagdata = $TMPL->tagdata;
     }
     
     if ($TMPL->fetch_param('encode_ee_tags') == 'yes')
     {
         $tagdata = Markdown($REGX->encode_ee_tags($tagdata, TRUE));
         
         $tagdata = preg_replace_callback(
             '|' .preg_quote('<code>') .'(.*?)' .preg_quote('</code>') .'|s',
             create_function(
                 '$matches',
                 'return str_replace(
                     array(
                         "&amp;#123;&amp;#47;",
                         "&amp;#123;",
                         "&amp;#125;"
                     ),
                     array(
                         "&#123;&#47;",
                         "&#123;",
                         "&#125;"
                     ),
                     $matches[0]
                 );'
             ),
             $tagdata
         );
     }
     else
     {
         $tagdata = Markdown($tagdata);
     }
     
     // Apply SmartyPants.
     $smart_quotes = $TMPL->fetch_param('smart_quotes') ? $TMPL->fetch_param('smart_quotes') : '2';
     $this->return_data = SmartyPants($tagdata, $smart_quotes);
 }
コード例 #29
0
ファイル: Post.php プロジェクト: nickwynja/continental
 public function write_archive($posts)
 {
     $template = Updater::$archive_page_template;
     $t = new Template($template);
     $t->content = array('post-title' => 'Archive', 'post-type' => 'archive', 'page-type' => 'archive', 'page-title' => 'Archive', 'blog-title' => html_entity_decode(SmartyPants(self::$blog_title), ENT_QUOTES, 'UTF-8'));
     foreach ($posts as $post) {
         $t->content['posts'][] = array('title' => html_entity_decode(SmartyPants($post->title), ENT_QUOTES, 'UTF-8'), 'timestamp' => $post->timestamp, 'uri' => '/' . $post->year . '/' . str_pad($post->month, 2, '0', STR_PAD_LEFT) . '/' . $post->slug, 'tags' => $post->tags);
         $output_html = $t->outputHTML();
     }
     if (!file_exists(Updater::$dest_path)) {
         mkdir_as_parent_owner(Updater::$dest_path, 0755, true);
     }
     file_put_contents_as_dir_owner(Updater::$dest_path . '/archive.html', $output_html);
 }
コード例 #30
0
ファイル: markdown.php プロジェクト: rkern21/videoeditor
		function TextileThis($text, $lite='', $encode='', $noimage='', $strict='') {
			if ($lite == '' && $encode == '')   $text = Markdown($text);
			if (function_exists('SmartyPants')) $text = SmartyPants($text);
			return $text;
		}