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


PHP Text::toHtml方法代码示例

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


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

示例1: _content

 /**
  * Returns block content for shortcode {block get="blockname"}
  *
  * @param array $attributes block filename
  */
 public static function _content($attributes)
 {
     if (isset($attributes['get'])) {
         $name = (string) $attributes['get'];
     } else {
         $name = '';
     }
     $block_path = STORAGE . DS . 'blocks' . DS . $name . '.block.html';
     if (File::exists($block_path)) {
         ob_start();
         include $block_path;
         $block_contents = ob_get_contents();
         ob_end_clean();
         return Filter::apply('content', Text::toHtml($block_contents));
     } else {
         if (Session::exists('admin') && Session::get('admin') == true) {
             return __('<b>Block <u>:name</u> is not found!</b>', 'blocks', array(':name' => $name));
         }
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:25,代码来源:blocks.plugin.php

示例2: content

 /**
  * Get pages contents
  *
  * @return string
  */
 public static function content($slug = '')
 {
     if (!empty($slug)) {
         $page = Table::factory('pages')->select('[slug="' . $slug . '"]', null);
         if (!empty($page)) {
             $content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
             $content = Filter::apply('content', $content);
             return $content;
         } else {
             return '';
         }
     } else {
         return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:20,代码来源:pages.plugin.php

示例3: header

            @unlink('install.php');
            // Redirect to main page
            header('location: index.php');
        }
    } else {
        include 'install.php';
    }
} else {
    // Load Engine init file
    require_once ROOT . DS . 'engine' . DS . '_init.php';
    // Check for maintenance mod
    if ('on' == Option::get('maintenance_status')) {
        // Set maintenance mode for all except admin and editor
        if (Session::exists('user_role') and (Session::get('user_role') == 'admin' or Session::get('user_role') == 'editor')) {
            // Monstra show this page :)
        } else {
            header('HTTP/1.1 503 Service Temporarily Unavailable');
            header('Status: 503 Service Temporarily Unavailable');
            header('Retry-After: 600');
            die(Text::toHtml(Option::get('maintenance_message')));
        }
    }
    // Frontend pre render
    Action::run('frontend_pre_render');
    // Load site template
    require MINIFY . DS . 'theme.' . Site::theme() . '.' . Site::template() . '.template.php';
    // Frontend pre render
    Action::run('frontend_post_render');
    // Flush (send) the output buffer and turn off output buffering
    ob_end_flush();
}
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:index.php

示例4: main


//.........这里部分代码省略.........
                             if (Request::post('add_blocks_and_exit')) {
                                 Request::redirect('index.php?id=blocks');
                             } else {
                                 Request::redirect('index.php?id=blocks&action=edit_block&filename=' . Security::safeName(Request::post('name')));
                             }
                         }
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 // Save fields
                 if (Request::post('name')) {
                     $name = Request::post('name');
                 } else {
                     $name = '';
                 }
                 if (Request::post('editor')) {
                     $content = Request::post('editor');
                 } else {
                     $content = '';
                 }
                 // Display view
                 View::factory('box/blocks/views/backend/add')->assign('content', $content)->assign('name', $name)->assign('errors', $errors)->display();
                 break;
                 // Edit Block
                 // -------------------------------------
             // Edit Block
             // -------------------------------------
             case "edit_block":
                 // Save current block action
                 if (Request::post('edit_blocks') || Request::post('edit_blocks_and_exit')) {
                     if (Security::check(Request::post('csrf'))) {
                         if (trim(Request::post('name')) == '') {
                             $errors['blocks_empty_name'] = __('Required field', 'blocks');
                         }
                         if (file_exists($blocks_path . Security::safeName(Request::post('name')) . '.block.html') and Security::safeName(Request::post('blocks_old_name')) !== Security::safeName(Request::post('name'))) {
                             $errors['blocks_exists'] = __('This block already exists', 'blocks');
                         }
                         // Save fields
                         if (Request::post('editor')) {
                             $content = Request::post('editor');
                         } else {
                             $content = '';
                         }
                         if (count($errors) == 0) {
                             $block_old_filename = $blocks_path . Request::post('blocks_old_name') . '.block.html';
                             $block_new_filename = $blocks_path . Security::safeName(Request::post('name')) . '.block.html';
                             if (!empty($block_old_filename)) {
                                 if ($block_old_filename !== $block_new_filename) {
                                     rename($block_old_filename, $block_new_filename);
                                     $save_filename = $block_new_filename;
                                 } else {
                                     $save_filename = $block_new_filename;
                                 }
                             } else {
                                 $save_filename = $block_new_filename;
                             }
                             // Save block
                             File::setContent($save_filename, XML::safe(Request::post('editor')));
                             Notification::set('success', __('Your changes to the block <i>:name</i> have been saved.', 'blocks', array(':name' => basename($save_filename, '.block.html'))));
                             if (Request::post('edit_blocks_and_exit')) {
                                 Request::redirect('index.php?id=blocks');
                             } else {
                                 Request::redirect('index.php?id=blocks&action=edit_block&filename=' . Security::safeName(Request::post('name')));
                             }
                         }
                     } else {
                         die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                     }
                 }
                 if (Request::post('name')) {
                     $name = Request::post('name');
                 } else {
                     $name = File::name(Request::get('filename'));
                 }
                 if (Request::post('editor')) {
                     $content = Request::post('editor');
                 } else {
                     $content = File::getContent($blocks_path . Request::get('filename') . '.block.html');
                 }
                 // Display view
                 View::factory('box/blocks/views/backend/edit')->assign('content', Text::toHtml($content))->assign('name', $name)->assign('errors', $errors)->display();
                 break;
             case "delete_block":
                 if (Security::check(Request::get('token'))) {
                     File::delete($blocks_path . Request::get('filename') . '.block.html');
                     Notification::set('success', __('Block <i>:name</i> deleted', 'blocks', array(':name' => File::name(Request::get('filename')))));
                     Request::redirect('index.php?id=blocks');
                 } else {
                     die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
                 }
                 break;
         }
     } else {
         // Get blocks
         $blocks_list = File::scan($blocks_path, '.block.html');
         // Display view
         View::factory('box/blocks/views/backend/index')->assign('blocks_list', $blocks_list)->display();
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:101,代码来源:blocks.admin.php

示例5:

    echo $post['title'];
    ?>
</title>
<link><?php 
    echo Option::get('siteurl') . '/blog/' . $post['slug'];
    ?>
</link>
<guid><?php 
    echo Option::get('siteurl') . '/blog/' . $post['slug'];
    ?>
</guid>
<pubDate><?php 
    echo Date::format($post['date'], 'd M Y');
    ?>
</pubDate>
<description><![CDATA[<?php 
    echo Text::toHtml(Text::cut(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt'), 300));
    ?>
]]></description>
<author><?php 
    echo $post['author'];
    ?>
</author>
</item>
<?php 
}
?>
</channel>
</rss>
<?php 
Response::status(200);
开发者ID:cmroanirgo,项目名称:monstra,代码行数:31,代码来源:rss.php

示例6: getPostAfterCut

 /** 
  *  Get post content after cut
  * 
  *  <code> 
  *      echo Blog::getPostAfterCut('home');
  *  </code>
  *
  * @return string
  */
 public static function getPostAfterCut($slug)
 {
     $page = Pages::$pages->select('[slug="' . $slug . '"]', null);
     // Get post
     $post = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt')));
     // Apply content filter
     $post_content = Filter::apply('content', $post[1]);
     // Return post
     return $post_content;
 }
开发者ID:cmroanirgo,项目名称:monstra,代码行数:19,代码来源:blog.plugin.php

示例7: main


//.........这里部分代码省略.........
                     if (Request::post('page_name')) {
                         $slug_to_edit = Request::post('page_name');
                     } else {
                         $slug_to_edit = $page['slug'];
                     }
                     if (Request::post('page_title')) {
                         $title_to_edit = Request::post('page_title');
                     } else {
                         $title_to_edit = $page['title'];
                     }
                     if (Request::post('page_meta_title')) {
                         $meta_title_to_edit = Request::post('page_meta_title');
                     } else {
                         $meta_title_to_edit = isset($page['meta_title']) ? $page['meta_title'] : '';
                     }
                     if (Request::post('page_description')) {
                         $description_to_edit = Request::post('page_description');
                     } else {
                         $description_to_edit = $page['description'];
                     }
                     if (Request::post('page_keywords')) {
                         $keywords_to_edit = Request::post('page_keywords');
                     } else {
                         $keywords_to_edit = $page['keywords'];
                     }
                     if (Request::post('page_tags')) {
                         $tags_to_edit = Request::post('page_tags');
                     } else {
                         $tags_to_edit = isset($page['tags']) ? $page['tags'] : '';
                     }
                     if (Request::post('editor')) {
                         $to_edit = Request::post('editor');
                     } else {
                         $to_edit = Text::toHtml($page_content);
                     }
                     if (Request::post('robots_index')) {
                         $post_robots_index = true;
                     } else {
                         if ($page['robots_index'] == 'noindex') {
                             $post_robots_index = true;
                         } else {
                             $post_robots_index = false;
                         }
                     }
                     if (Request::post('robots_follow')) {
                         $post_robots_follow = true;
                     } else {
                         if ($page['robots_follow'] == 'nofollow') {
                             $post_robots_follow = true;
                         } else {
                             $post_robots_follow = false;
                         }
                     }
                     if (Request::post('pages')) {
                         // Get pages parent
                         if (Request::post('pages') == '-none-') {
                             $parent_page = '';
                         } else {
                             $parent_page = Request::post('pages');
                         }
                         // Save field
                         $parent_page = Request::post('pages');
                     } else {
                         $parent_page = $page['parent'];
                     }
                     if (Request::post('templates')) {
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:67,代码来源:pages.admin.php

示例8: _readmeLoadAjax

 /**
  * _readmeLoadAjax
  */
 public static function _readmeLoadAjax()
 {
     if (Request::post('readme_plugin')) {
         if (File::exists($file = PLUGINS . DS . Request::post('readme_plugin') . DS . 'README.md')) {
             echo Text::toHtml(markdown(Html::toText(File::getContent($file))));
         } else {
             echo __('README.md not found', 'plugins');
         }
         Request::shutdown();
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:14,代码来源:plugins.admin.php


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