本文整理汇总了PHP中Text::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::check方法的具体用法?PHP Text::check怎么用?PHP Text::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::check方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_minify
function do_minify($content)
{
global $config;
$c = File::open(__DIR__ . DS . 'states' . DS . 'config.txt')->unserialize();
$url = $config->protocol . $config->host;
// Minify HTML
if (isset($c['html_minifier'])) {
$config->html_minifier = true;
Config::set('html_minifier', $config->html_minifier);
$content = Converter::detractSkeleton($content);
}
// Minify URL
if (isset($c['url_minifier']) && Text::check($content)->has('="' . $url)) {
$content = str_replace(array('="' . $url . '"', '="' . $url . '/', '="' . $url . '?', '="' . $url . '#'), array('="/"', '="/', '="?', '="#'), $content);
}
// Minify Embedded CSS
if (isset($c['css_minifier'])) {
$content = preg_replace_callback('#<style(>| .*?>)([\\s\\S]*?)<\\/style>#i', function ($matches) use($config, $c, $url) {
$css = Converter::detractShell($matches[2]);
if (isset($c['url_minifier'])) {
$css = preg_replace('#(?<=[\\s:])(src|url)\\(' . preg_quote($url, '/') . '#', '$1(', $css);
}
return '<style' . $matches[1] . $css . '</style>';
}, $content);
}
// Minify Embedded JavaScript
if (isset($c['js_minifier'])) {
$content = preg_replace_callback('#<script(>| .*?>)([\\s\\S]*?)<\\/script>#i', function ($matches) {
$js = Converter::detractSword($matches[2]);
return '<script' . $matches[1] . $js . '</script>';
}, $content);
}
return $content;
}
示例2: construct_refueling_point
function construct_refueling_point($content)
{
if (!Text::check($content)->has('<!-- block:')) {
return $content;
}
global $config;
$form_tip = $config->language === 'id_ID' ? 'Menggunakan proyek kode sumber terbuka itu sangatlah menyenangkan dan murah, akan tetapi kita juga perlu biaya untuk memelihara dan menjaga mereka tetap ada di <code>www</code>.' : 'Using an open source project is incredibly fun and cheap, but we also need costs to maintain and keep them exist in the <code>www</code>.';
$form_donate = '---
<form class="form-donate" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input name="cmd" type="hidden" value="_s-xclick">
<input name="hosted_button_id" type="hidden" value="TNVGH7NQ7E4EU">
<input name="submit" type="image" class="help" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" alt="PayPal – The safer, easier way to pay online!" title="' . $form_tip . '">
<img alt="" src="https://www.paypalobjects.com/id_ID/i/scr/pixel.gif" width="1" height="1">
</form>';
return str_replace('<!-- block:donate -->', $form_donate, $content);
}
示例3: do_minify
function do_minify($content)
{
global $config;
$c_minify = $config->states->{'plugin_' . md5(File::B(__DIR__))};
$url = $config->protocol . $config->host;
// Minify HTML
if (isset($c_minify->html_minify)) {
Config::set('html_minify', true);
$content = Converter::detractSkeleton($content);
}
// Minify URL
if (isset($c_minify->url_minify) && Text::check($content)->has('="' . $url)) {
Config::set('url_minify', true);
$content = str_replace(array('="' . $url . '"', '="' . $url . '/', '="' . $url . '?', '="' . $url . '#'), array('="/"', '="/', '="?', '="#'), $content);
}
// Minify Embedded CSS
if (isset($c_minify->css_minify)) {
Config::set('css_minify', true);
$content = preg_replace_callback('#<style(>| .*?>)([\\s\\S]*?)<\\/style>#i', function ($matches) use($config, $c_minify, $url) {
$css = Converter::detractShell($matches[2]);
if (isset($c_minify->url_minify)) {
$css = preg_replace('#(?<=[\\s:])(src|url)\\(' . preg_quote($url, '/') . '#', '$1(', $css);
}
return '<style' . $matches[1] . $css . '</style>';
}, $content);
}
// Minify Embedded JavaScript
if (isset($c_minify->js_minify)) {
Config::set('js_minify', true);
$content = preg_replace_callback('#<script(>| .*?>)([\\s\\S]*?)<\\/script>#i', function ($matches) {
$js = Converter::detractSword($matches[2]);
return '<script' . $matches[1] . $js . '</script>';
}, $content);
}
return $content;
}
示例4: md5
<?php
$c_editor = $config->states->{'plugin_' . md5(File::B(__DIR__))};
?>
<div class="p">
<?php
foreach ($speak->MTE->buttons as $k => $v) {
?>
<?php
if (Text::check($k)->in(array('yes', 'no', 'ok', 'cancel', 'open', 'close'))) {
continue;
}
?>
<div><?php
echo Form::checkbox('buttons[' . $k . ']', 1, isset($c_editor->buttons->{$k}), sprintf($speak->manager->title_show__button, $v));
?>
</div>
<?php
}
?>
</div>
<p><?php
echo Jot::button('action', $speak->update);
?>
</p>
示例5: merge
public static function merge($path, $name = null, $addon = "", $call = null)
{
$path = is_string($path) && strpos($path, ';') !== false ? explode(';', $path) : (array) $path;
$the_path = ASSET . DS . File::path($name);
$the_path_log = SYSTEM . DS . 'log' . DS . 'asset.' . str_replace(array(ASSET . DS, DS), array("", '__'), $the_path) . '.log';
$is_valid = true;
if (!file_exists($the_path_log)) {
$is_valid = false;
} else {
$the_path_time = explode("\n", file_get_contents($the_path_log));
if (count($the_path_time) !== count($path)) {
$is_valid = false;
} else {
foreach ($the_path_time as $i => $time) {
$p = self::path($path[$i]);
if (!file_exists($p) || (int) filemtime($p) !== (int) $time) {
$is_valid = false;
break;
}
}
}
}
$time = "";
$content = "";
$e = File::E($name);
if (!file_exists($the_path) || !$is_valid) {
if (Text::check($e)->in(array('gif', 'jpeg', 'jpg', 'png'))) {
foreach ($path as $p) {
if (!self::ignored($p)) {
$p = self::path($p);
if (file_exists($p)) {
$time .= filemtime($p) . "\n";
}
}
}
File::write(trim($time))->saveTo($the_path_log);
Image::take($path)->merge()->saveTo($the_path);
} else {
foreach ($path as $p) {
if (!self::ignored($p)) {
$p = self::path($p);
if (file_exists($p)) {
$time .= filemtime($p) . "\n";
$c = file_get_contents($p);
if (strpos(File::B($p), '.min.') === false) {
if (strpos(File::B($the_path), '.min.css') !== false) {
$content .= Converter::detractShell($c) . "\n";
} else {
if (strpos(File::B($the_path), '.min.js') !== false) {
$content .= Converter::detractSword($c) . "\n";
} else {
$content .= $c . "\n\n";
}
}
} else {
$content .= $c . "\n\n";
}
}
}
}
File::write(trim($time))->saveTo($the_path_log);
File::write(trim($content))->saveTo($the_path);
}
}
if (is_null($call)) {
$call = Mecha::alter($e, array('css' => 'stylesheet', 'js' => 'javascript', 'gif' => 'image', 'jpeg' => 'image', 'jpg' => 'image', 'png' => 'image'));
}
return call_user_func_array('self::' . $call, array($the_path, $addon));
}
示例6: function
<?php
Filter::add(array('plugin:shortcode', 'shield:shortcode'), function ($content) use($config) {
if (!Text::check($content)->has('<!-- block:')) {
return $content;
}
$tip = $config->language === 'id_ID' ? 'Menggunakan proyek kode sumber terbuka itu sangatlah menyenangkan dan murah, akan tetapi kita juga perlu biaya untuk memelihara dan menjaga mereka tetap ada di <code>www</code>.' : 'Using an open source project is incredibly fun and cheap, but we also need costs to maintain and keep them exist in the <code>www</code>.';
$donate = '---
<form class="form-donate" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input name="cmd" type="hidden" value="_s-xclick">
<input name="hosted_button_id" type="hidden" value="TNVGH7NQ7E4EU">
<input name="submit" type="image" class="help" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" alt="PayPal – The safer, easier way to pay online!" title="' . $tip . '">
<img alt="" src="https://www.paypalobjects.com/id_ID/i/scr/pixel.gif" width="1" height="1">
</form>';
return str_replace('<!-- block:donate -->', $donate, $content);
});
示例7: array
<?php
$name = $_FILES['file']['name'];
$mime = $_FILES['file']['type'];
$extension = File::E($name);
$mime_accept = array('application/download', 'application/octet-stream', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip');
$extension_accept = array('zip');
$path = File::N($name);
if (!empty($name)) {
if (File::exist($task_connect_path . DS . $path)) {
Notify::error(Config::speak('notify_folder_exist', '<code>' . $path . '</code>'));
} else {
if (!Text::check($mime)->in($mime_accept) || !Text::check($extension)->in($extension_accept)) {
Notify::error(Config::speak('notify_invalid_file_extension', 'ZIP'));
}
}
} else {
Notify::error($speak->notify_error_no_file_selected);
}
示例8: merge
public static function merge($path, $name = null, $addon = "", $call = null)
{
$the_path = strpos($name, ROOT) === 0 ? File::path($name) : ASSET . DS . File::path($name);
$the_log = LOG . DS . 'asset.' . str_replace(array(ASSET . DS, DS), array("", '__'), $the_path) . '.log';
$is_valid = true;
if (!file_exists($the_log)) {
$is_valid = false;
} else {
$the_time = explode("\n", file_get_contents($the_log));
if (count($the_time) !== count($path)) {
$is_valid = false;
} else {
foreach ($the_time as $i => $unix) {
$p = self::path($path[$i]);
if (!file_exists($p) || (int) filemtime($p) !== (int) $unix) {
$is_valid = false;
break;
}
}
}
}
$unix = "";
$content = "";
$e = File::E($name);
if (!file_exists($the_path) || !$is_valid) {
if (Text::check($e)->in(array('gif', 'jpeg', 'jpg', 'png'))) {
foreach ($path as &$p) {
$p = Filter::colon('asset:source', $p);
if (!self::ignored($p) && ($p = Filter::colon('asset:path', self::path($p, false)))) {
$unix .= filemtime($p) . "\n";
}
}
File::write(trim($unix))->saveTo($the_log);
Image::take($path)->merge()->saveTo($the_path);
} else {
foreach ($path as $p) {
$p = Filter::colon('asset:source', $p);
if (!self::ignored($p) && ($p = Filter::colon('asset:path', self::path($p, false)))) {
$unix .= filemtime($p) . "\n";
$c = Filter::apply('asset:input', file_get_contents($p) . "\n", $p);
if (strpos(File::B($p), '.min.') === false) {
if (strpos(File::B($the_path), '.min.css') !== false) {
$c = Converter::detractShell($c);
} else {
if (strpos(File::B($the_path), '.min.js') !== false) {
$c = Converter::detractSword($c);
} else {
$c = $c . "\n";
}
}
$content .= Filter::apply('asset:output', $c, $p);
} else {
$content .= Filter::apply('asset:output', $c . "\n", $p);
}
}
}
File::write(trim($unix))->saveTo($the_log);
File::write(trim($content))->saveTo($the_path);
}
}
if (is_null($call)) {
$call = Mecha::alter($e, array('css' => 'stylesheet', 'js' => 'javascript', 'gif' => 'image', 'jpeg' => 'image', 'jpg' => 'image', 'png' => 'image'));
}
return call_user_func('self::' . $call, $the_path, $addon);
}