本文整理汇总了PHP中Text::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::parse方法的具体用法?PHP Text::parse怎么用?PHP Text::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: protect
public static function protect($value)
{
if (!is_string($value)) {
return $value;
}
return Text::parse($value, '->encoded_html');
}
示例2: do_markdown
function do_markdown($content, $results = array())
{
global $config;
$results = (object) $results;
if (!isset($results->content_type) || $results->content_type === 'Markdown' || $results->content_type === 'Markdown Extra') {
return Text::parse($content, '->html');
}
return $content;
}
示例3: info
public static function info($folder = null, $array = false)
{
$config = Config::get();
$speak = Config::speak();
// Check whether the localized "about" file is available
if (!($info = File::exist(PLUGIN . DS . $folder . DS . 'about.' . $config->language . '.txt'))) {
$info = PLUGIN . DS . $folder . DS . 'about.txt';
}
$default = 'Title' . S . ' ' . ucwords(Text::parse($folder, '->text')) . "\n" . 'Author' . S . ' ' . $speak->anon . "\n" . 'URL' . S . ' #' . "\n" . 'Version' . S . ' 0.0.0' . "\n" . "\n" . SEPARATOR . "\n" . "\n" . Config::speak('notify_not_available', $speak->description);
$info = Text::toPage(File::open($info)->read($default), 'content', 'plugin:');
return $array ? $info : Mecha::O($info);
}
示例4: do_facebook_open_graph
function do_facebook_open_graph()
{
$config = Config::get();
$T2 = str_repeat(TAB, 2);
echo O_BEGIN . $T2 . '<!-- Start Facebook Open Graph -->' . NL;
echo $T2 . '<meta property="og:title" content="' . Text::parse($config->page_title, '->text') . '"' . ES . NL;
echo $T2 . '<meta property="og:url" content="' . Filter::colon('og:url', $config->url_current) . '"' . ES . NL;
if (isset($config->{$config->page_type}->description)) {
$config->description = $config->{$config->page_type}->description;
}
echo $T2 . '<meta property="og:description" content="' . Text::parse($config->description, '->text') . '"' . ES . NL;
if ($config->page_type !== '404' && isset($config->{$config->page_type}->image)) {
echo $T2 . '<meta property="og:image" content="' . $config->{$config->page_type}->image . '"' . ES . NL;
} else {
echo $T2 . '<meta property="og:image" content="' . Filter::colon('favicon:url', $config->url . '/favicon.ico') . '"' . ES . NL;
}
echo $T2 . '<meta property="og:site_name" content="' . $config->title . '"' . ES . NL;
echo $T2 . '<meta property="og:type" content="' . ($config->page_type === 'article' ? 'article' : 'website') . '"' . ES . NL;
echo $T2 . '<!-- End Facebook Open Graph -->' . O_END;
}
示例5: query
/**
* ============================================================
* OVERWRITE HTTP URL QUERY
* ============================================================
*
* -- CODE: ---------------------------------------------------
*
* echo HTTP::query('offset', 4);
*
* ------------------------------------------------------------
*
*/
public static function query($query = null, $value = 1)
{
if (is_null($query)) {
return Config::get('url_query');
}
if (func_num_args() === 2) {
$query = array($query => $value);
}
$query = !empty($query) ? array_merge($_GET, $query) : $_GET;
$results = array();
foreach ($query as $k => $v) {
if ($v === false || is_array($v)) {
// TODO: accept array value
unset($_GET[$k]);
continue;
}
$value = $v !== true ? '=' . Text::parse(Converter::str($v), '->encoded_url') : "";
$results[] = $k . $value;
}
return !empty($results) ? '?' . implode('&', $results) : "";
}
示例6: do_twitter_cards
function do_twitter_cards()
{
$config = Config::get();
$twitter_cards_config = File::open(__DIR__ . DS . 'states' . DS . 'config.txt')->unserialize();
$T2 = str_repeat(TAB, 2);
echo O_BEGIN . $T2 . '<!-- Start Twitter Cards -->' . NL;
echo $T2 . '<meta name="twitter:card" content="' . (isset($config->{$config->page_type}->image) && $config->{$config->page_type}->image !== Image::placeholder() ? 'summary_large_image' : 'summary') . '"' . ES . NL;
echo $T2 . '<meta name="twitter:site" content="@' . $twitter_cards_config['twitter_site'] . '"' . ES . NL;
echo $T2 . '<meta name="twitter:creator" content="@' . $twitter_cards_config['twitter_creator'] . '"' . ES . NL;
echo $T2 . '<meta name="twitter:title" content="' . Text::parse($config->page_title, '->text') . '"' . ES . NL;
echo $T2 . '<meta name="twitter:url" content="' . Filter::colon('twitter:url', $config->url_current) . '"' . ES . NL;
if (isset($config->{$config->page_type}->description)) {
$config->description = $config->{$config->page_type}->description;
}
echo $T2 . '<meta name="twitter:description" content="' . Text::parse($config->description, '->text') . '"' . ES . NL;
if ($config->page_type !== '404' && isset($config->{$config->page_type}->image)) {
echo $T2 . '<meta name="twitter:image" content="' . $config->{$config->page_type}->image . '"' . ES . NL;
} else {
echo $T2 . '<meta name="twitter:image" content="' . $config->url . '/favicon.ico"' . ES . NL;
}
echo $T2 . '<!-- End Twitter Cards -->' . O_END;
}
示例7: array
<?php
return array(0 => array('name' => $speak->untagged, 'slug' => Text::parse($speak->untagged, '->slug'), 'description' => ""));
示例8: DS
public static function DS($text)
{
return str_replace(Text::parse(SEPARATOR, '->ascii'), SEPARATOR, $text);
}
示例9: str_repeat
$brush = Text::parse($brush, '->text');
if (is_numeric($brush) && $brush <= 0) {
$brush = false;
}
$_ = File::D(__DIR__) . DS . 'assets' . DS;
echo '<!DOCTYPE html>' . NL;
echo '<html dir="ltr">' . NL;
echo TAB . '<head>' . NL;
echo str_repeat(TAB, 2) . '<meta charset="' . $config->charset . '">' . NL;
echo str_repeat(TAB, 2) . '<title>' . File::B($snippet) . '</title>' . NL;
echo str_repeat(TAB, 2) . '<link href="' . Filter::colon('favicon:url', $config->url . '/favicon.ico') . '" rel="shortcut icon" type="image/x-icon">' . NL;
echo str_repeat(TAB, 2) . Asset::stylesheet(array($_ . 'shell' . DS . 'page.min.css', $_ . 'shell' . DS . 'brush.min.css'));
echo TAB . '</head>' . NL;
echo TAB . '<body>' . NL;
echo str_repeat(TAB, 2) . '<pre><code' . ($brush !== false ? ' data-language="' . $brush . '"' : "") . '>';
echo Filter::colon('snippet:content_raw', Text::parse($content, '->encoded_html'), $snippet);
echo '</code></pre>' . NL;
echo str_repeat(TAB, 2) . '<div>' . NL;
echo str_repeat(TAB, 3) . '<strong><a href="' . $config->url . '" title="' . $speak->home . '">' . $config->title . '</a></strong>' . NL;
echo str_repeat(TAB, 3) . '<a href="?raw=1" target="_blank">' . $speak->plugin_snippet_share_title_raw . '</a>' . NL;
echo str_repeat(TAB, 3) . '<a href="?file=1">' . $speak->download . '</a>' . NL;
echo str_repeat(TAB, 2) . '</div>' . NL;
echo str_repeat(TAB, 2) . Asset::javascript(array($_ . 'sword' . DS . 'brush.min.js', $_ . 'sword' . DS . 'brush.line.min.js'));
if ($brush !== false) {
echo str_repeat(TAB, 2) . Asset::javascript($_ . 'sword' . DS . 'brush' . DS . 'generic.min.js');
if ($brush !== 'generic' && ($f = File::exist($_ . 'sword' . DS . 'brush' . DS . $brush . '.min.js'))) {
echo str_repeat(TAB, 2) . Asset::javascript($f);
}
}
echo TAB . '</body>' . NL;
echo '</html>';
示例10: array
$info_path[] = $_path;
File::open($_path)->delete();
}
$P = array('data' => array('files' => $info_path));
Notify::success(Config::speak('notify_' . $is_folder_or_file . '_deleted', '<code>' . implode('</code>, <code>', $deletes) . '</code>'));
Weapon::fire('on_asset_update', array($P, $P));
Weapon::fire('on_asset_destruct', array($P, $P));
Guardian::kick($config->manager->slug . '/asset/1' . $p);
} else {
Notify::warning(count($deletes) === 1 ? Config::speak('notify_confirm_delete_', '<code>' . File::path($name) . '</code>') : $speak->notify_confirm_delete);
}
Shield::lot('segment', 'asset')->attach('manager', false);
});
/**
* Multiple Asset Killer
* ---------------------
*/
Route::accept($config->manager->slug . '/asset/kill', function ($path = "") use($config, $speak) {
if ($request = Request::post()) {
Guardian::checkToken($request['token']);
if (!isset($request['selected'])) {
Notify::error($speak->notify_error_no_files_selected);
Guardian::kick($config->manager->slug . '/asset/1');
}
$files = array();
foreach ($request['selected'] as $file) {
$files[] = str_replace('%2F', '/', Text::parse($file, '->encoded_url'));
}
Guardian::kick($config->manager->slug . '/asset/kill/files:' . implode(';', $files));
}
});
示例11: array
?>
</span>
<span class="grid span-5">
<?php
echo Form::text('title', Guardian::wayback('title', $default->title), $speak->manager->placeholder_title, array('class' => 'input-block'));
?>
</span>
</label>
<label class="grid-group">
<span class="grid span-1 form-label"><?php
echo $speak->slug;
?>
</span>
<span class="grid span-5">
<?php
echo Form::text('slug', Guardian::wayback('slug', $default->slug), Text::parse($speak->manager->placeholder_title, '->slug'), array('class' => 'input-block'));
?>
</span>
</label>
<?php
include 'unit.composer.1.php';
?>
<label class="grid-group">
<span class="grid span-1 form-label"><?php
echo $speak->description;
?>
</span>
<span class="grid span-5">
<?php
echo Form::textarea('description', Guardian::wayback('description', $default->description), Config::speak('manager.placeholder_description_', strtolower($speak->article)), array('class' => 'textarea-block'));
?>
示例12: array
$field = Request::post('fields', array());
include DECK . DS . 'workers' . DS . 'task.field.1.php';
// Temporarily disallow image(s) in comment to prevent XSS
$message = strip_tags($message, '<br><img>' . ($parser === 'HTML' ? '<a><abbr><b><blockquote><code><del><dfn><em><i><ins><p><pre><span><strong><sub><sup><time><u><var>' : ""));
$message = preg_replace('#(\\!\\[.*?\\]\\(.*?\\))#', '`$1`', $message);
$message = preg_replace('#<img(\\s[^<>]*?)>#', '<img$1>', $message);
Page::header(array('Name' => $name, 'Email' => $email, 'URL' => $url, 'Status' => Guardian::happy() ? 'pilot' : 'passenger', 'Content Type' => $parser, 'Fields' => !empty($field) ? Text::parse($field, '->encoded_json') : false, 'UA' => Get::UA(), 'IP' => Get::IP()))->content($message)->saveTo(RESPONSE . DS . $post . '_' . Date::format($id, 'Y-m-d-H-i-s') . '_' . ($parent ? Date::format($parent, 'Y-m-d-H-i-s') : '0000-00-00-00-00-00') . $extension);
Notify::success(Config::speak('notify_success_submitted', $speak->comment));
if ($extension === '.hold') {
Notify::info($speak->notify_info_comment_moderation);
}
Weapon::fire('on_comment_update', array($P, $P));
Weapon::fire('on_comment_construct', array($P, $P));
if ($config->comment_notification_email) {
$mail = '<p>' . Config::speak('comment_notification', $article->url . '#' . sprintf($comment_id, Date::format($id, 'U'))) . '</p>';
$mail .= '<p><strong>' . $name . ':</strong></p>';
$mail .= $parser !== 'HTML' ? Text::parse($message, '->html') : $message;
$mail .= '<p>' . Date::format($id, 'Y/m/d H:i:s') . '</p>';
// Sending email notification ...
if (!Guardian::happy()) {
if (Notify::send($request['email'], $config->author_email, $speak->comment_notification_subject, $mail, 'comment:')) {
Weapon::fire('on_comment_notification_construct', array($request, $config->author_email, $speak->comment_notification_subject, $mail));
}
}
}
Guardian::kick($config->url_current . (!Guardian::happy() && $config->comment_moderation ? '#' . $comment_form_id : '#' . sprintf($comment_id, Date::format($id, 'U'))));
} else {
Guardian::kick($config->url_current . '#' . $comment_form_id);
}
}
});
示例13: comment
/**
* ===========================================================================
* EXTRACT COMMENT FILE INTO LIST OF COMMENT DATA FROM ITS PATH/ID/TIME/NAME
* ===========================================================================
*
* -- CODE: ------------------------------------------------------------------
*
* var_dump(Get::comment(1399334470));
*
* ---------------------------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* ---------- | ------ | ----------------------------------------------------
* $reference | string | Comment path, ID, time or name
* ---------- | ------ | ----------------------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function comment($reference, $response_to = ARTICLE, $connector = null)
{
$FP = 'comment:';
$config = Config::get();
$results = array();
$path = false;
if (strpos(ROOT, $reference) === 0) {
// By comment path
$path = $reference;
} else {
foreach (self::comments(null, 'DESC', 'txt,hold') as $comment) {
$base = File::B($comment);
list($_post, $_time, $_parent) = explode('_', $base);
if (!is_numeric($reference) && (string) File::B($reference) === (string) $base || (int) Date::format($reference, 'U') === (int) Date::format($_time, 'U')) {
$path = $comment;
$results = self::commentExtract($comment);
break;
}
}
}
if (!$path || !file_exists($path)) {
return false;
}
$results['date'] = self::AMF(Date::extract($results['time']), $FP, 'date');
$results = $results + Text::toPage(File::open($path)->read(), 'message', 'comment:');
$results['email'] = Text::parse($results['email'], '->decoded_html');
$results['permalink'] = '#';
$posts = glob($response_to . DS . '*.txt', GLOB_NOSORT);
for ($i = 0, $count = count($posts); $i < $count; ++$i) {
list($time, $kind, $slug) = explode('_', File::N($posts[$i]), 3);
if ((int) Date::format($time, 'U') === $results['post']) {
$results['permalink'] = self::AMF($config->url . (is_null($connector) ? '/' . $config->index->slug . '/' : $connector) . $slug . '#comment-' . $results['id'], $FP, 'permalink');
break;
}
}
if (!isset($results['url'])) {
$results['url'] = self::AMF('#', $FP, 'url');
}
$fields = self::state_field(rtrim($FP, ':'), null, array(), false);
$init = array();
foreach ($fields as $key => $value) {
$init[$key] = $value['value'];
}
if (isset($results['fields']) && is_array($results['fields'])) {
foreach ($results['fields'] as $key => $value) {
if (is_array($value) && isset($value['type'])) {
// <= 1.1.3
$value = isset($value['value']) ? $value['value'] : false;
}
$init[$key] = self::AMF($value, $FP, 'fields.' . $key);
}
$results['fields'] = $init;
unset($fields, $init);
}
return Mecha::O($results);
}
示例14: array
?>
<?php
} else {
?>
<p><?php
echo Config::speak('notify_not_available', $speak->config);
?>
</p>
<?php
}
?>
</div>
<div class="tab-content hidden" id="tab-content-2">
<p class="about-author">
<?php
echo Cell::strong($speak->author . ':') . ' ' . Text::parse($file->author, '->encoded_html');
if (isset($file->url) && $file->url !== '#') {
?>
<?php
echo Cell::a($file->url, Jot::icon('external-link-square'), '_blank', array('class' => array('about-url', 'help'), 'title' => $speak->link, 'rel' => 'nofollow'));
?>
<?php
}
?>
</p>
<h3 class="about-title"><?php
echo $file->title;
if (isset($file->version)) {
?>
<code class="about-version"><?php
echo $file->version;
示例15: array
<?php
$hooks = array($files, $segment);
echo $messages;
if ($files) {
?>
<ul>
<?php
foreach ($files as $file) {
?>
<li><?php
echo ASSET . DS . File::path(Text::parse($file, '->decoded_url'));
?>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<form class="form-kill form-asset" id="form-kill" action="<?php
echo $config->url_current . str_replace('&', '&', $config->url_query);
?>
" method="post">
<?php
Weapon::fire('action_before', $hooks);
?>
<?php
echo Jot::button('action', $speak->yes);
?>