本文整理汇总了PHP中File::B方法的典型用法代码示例。如果您正苦于以下问题:PHP File::B方法的具体用法?PHP File::B怎么用?PHP File::B使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File::B方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_private_post
function do_private_post($content, $results)
{
global $config, $speak;
$results = Mecha::O($results);
$results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false;
if ($results === false) {
return $speak->plugin_private_post->description;
}
$s = isset($results->fields->pass) ? $results->fields->pass : "";
if (strpos($s, ':') !== false) {
$s = explode(':', $s, 2);
if (isset($s[1])) {
$speak->plugin_private_post->hint = ltrim($s[1]);
}
// override password hint
$s = $s[0];
}
$hash = md5($s . PRIVATE_POST_SALT);
$html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL;
$html .= TAB . Form::hidden('token', Guardian::token()) . NL;
$html .= TAB . Form::hidden('_', $hash) . NL;
$html .= TAB . Form::hidden('kick', $config->url_current) . NL;
$html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL;
$html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL;
$html .= '</form>' . O_END;
if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") {
if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) {
return $html;
}
}
return $content;
}
示例2: do_response_ping
function do_response_ping($message, $results = array())
{
$results = (object) $results;
if (isset($results->parent) && !is_null($results->parent)) {
$prefix = File::B(File::D($results->path));
$name = is_callable('Get::' . $prefix . 'Anchor') ? call_user_func('Get::' . $prefix . 'Anchor', $results->parent)->name : $results->parent;
$to = '<a href="#' . $prefix . '-' . $results->parent . '">@' . $name . '</a>';
return strpos($message, '<p>') === 0 ? str_replace('^<p>', '<p>' . $to . ' ', '^' . $message) : $message . '<p>' . $to . '</p>';
}
return $message;
}
示例3: load
/**
* ==========================================================
* LOADING PLUGIN(S)
* ==========================================================
*
* -- CODE: -------------------------------------------------
*
* $plugins = Plugin::load();
*
* ----------------------------------------------------------
*
*/
public static function load($cache = true, $name = 'plugins.order.cache')
{
if ($cache && ($plugins = File::exist(CACHE . DS . $name))) {
return File::open($plugins)->unserialize();
}
$plugins = array();
foreach (glob(PLUGIN . DS . '*', GLOB_NOSORT | GLOB_ONLYDIR) as $plugin) {
$plugin = File::B($plugin);
$plugins[$plugin] = (double) File::open(PLUGIN . DS . $plugin . DS . '__stack.txt')->read(10);
}
asort($plugins);
File::serialize($plugins)->saveTo(CACHE . DS . $name, 0600);
return $plugins;
}
示例4: files
/**
* ==========================================================================
* GET ALL FILE(S) RECURSIVELY
* ==========================================================================
*
* -- CODE: -----------------------------------------------------------------
*
* $files = Get::files(
* 'some/path',
* 'txt',
* 'ASC',
* 'update'
* );
*
* $files = Get::files(
* 'some/path',
* 'gif,jpg,jpeg,png',
* 'ASC',
* 'update'
* );
*
* $files = Get::files(
* 'some/path',
* 'txt',
* 'ASC',
* null,
* 'key:path' // output only the `path` data
* );
*
* --------------------------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Desription
* ---------- | ------- | --------------------------------------------------
* $folder | string | Path to folder of file(s) you want to be listed
* $e | string | The file extension(s)
* $order | string | Ascending or descending? ASC/DESC?
* $sorter | string | The key of array item as sorting reference
* $filter | string | Filter the resulted array by a keyword
* $recursive | boolean | Get file(s) from a folder recursively?
* ---------- | ------- | --------------------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function files($folder = ASSET, $e = '*', $order = 'ASC', $sorter = 'path', $filter = "", $recursive = true)
{
$results = array();
$folder = rtrim(File::path($folder), DS);
$e = $e ? explode(',', str_replace(' ', "", $e)) : true;
if ($files = File::explore($folder, $recursive, true, false)) {
if (strpos($filter, 'key:') === 0) {
$s = explode(' ', substr($filter, 4), 2);
$output = $s[0];
$filter = isset($s[1]) ? $s[1] : "";
$sorter = null;
} else {
$output = null;
}
foreach ($files as $k => $v) {
$_k = File::B($k);
$_kk = DS . str_replace($folder . DS, "", $k);
if (!$filter || strpos(File::N($k), $filter) !== false) {
if ($v === 1) {
if ($e === true || $e === array('*') || Mecha::walk($e)->has(File::E($k))) {
$o = File::inspect($k, $output);
if (is_null($output)) {
$o['is']['hidden'] = strpos($_k, '__') === 0 || strpos($_k, '.') === 0 || strpos($_kk, DS . '__') !== false || strpos($_kk, DS . '.') !== false;
}
$results[] = $o;
}
} else {
if ($e === true || $e === array('/')) {
$results[] = File::inspect($k, $output);
}
}
}
}
unset($files, $_k, $_kk);
return !empty($results) ? Mecha::eat($results)->order($order, $sorter)->vomit() : false;
}
return false;
}
示例5: 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;
}
示例6: 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);
}
示例7: function
<?php
$scopes = Mecha::walk(glob(POST . DS . '*', GLOB_NOSORT | GLOB_ONLYDIR), function ($v) {
return File::B($v);
});
return array('pass' => array('title' => $speak->password, 'type' => 'text', 'scope' => implode(',', $scopes), 'description' => $speak->plugin_private_post->__description));
示例8: function
<?php
// The `__launch.php` file will be included only in the backend
Route::accept($config->manager->slug . '/plugin/' . File::B(__DIR__) . '/update', function () use($config, $speak) {
if (!Guardian::happy()) {
Shield::abort();
// [1]
}
if ($request = Request::post()) {
Guardian::checkToken($request['token']);
// [2]
File::write('test!')->saveTo(PLUGIN . DS . File::B(__DIR__) . DS . 'states' . DS . 'config.txt', 0600);
Notify::success(Config::speak('notify_success_updated', array($speak->plugin)));
// [3]
Guardian::kick(File::D($config->url_current));
// [4]
}
});
示例9: array
File::open($custom_ . $extension_o)->renameTo(Date::slug($date) . $extension);
Weapon::fire('on_custom_repair', array($G, $P));
}
} else {
if (!empty($css) && $css !== $config->defaults->{$segment . '_css'} || !empty($js) && $js !== $config->defaults->{$segment . '_js'}) {
File::write(Converter::ES($css) . "\n\n" . SEPARATOR . "\n\n" . Converter::ES($js))->saveTo(CUSTOM . DS . Date::slug($date) . $extension_o);
Weapon::fire(array('on_custom_update', 'on_custom_construct'), array($G, $P));
}
}
if ($post->slug !== $slug && ($php_file = File::exist(File::D($post->path) . DS . $post->slug . '.php'))) {
File::open($php_file)->renameTo($slug . '.php');
}
// Rename all response file(s) related to post if post date has been changed
if ((string) $date !== (string) $post->date->W3C && ($responses = call_user_func('Get::' . $response . 's', 'DESC', 'post:' . $id, 'txt,hold'))) {
foreach ($responses as $v) {
$parts = explode('_', File::B($v));
$parts[0] = Date::slug($date);
File::open($v)->renameTo(implode('_', $parts));
}
}
}
Notify::success(Config::speak('notify_success_' . ($id ? 'updated' : 'created'), $title) . ($extension === '.txt' ? ' <a class="pull-right" href="' . call_user_func('Get::' . $segment . 'Anchor', $_)->url . '" target="_blank"><i class="fa fa-eye"></i> ' . $speak->view . '</a>' : ""));
Weapon::fire(array('on_' . $segment . '_update', 'on_' . $segment . '_' . ($id ? 'repair' : 'construct')), array($G, $P));
Guardian::kick($config->manager->slug . '/' . $segment . '/repair/id:' . Date::format($date, 'U'));
}
}
Shield::lot(array('segment' => $segment))->attach('manager');
});
/**
* Post Killer
* -----------
示例10: str_repeat
<?php
$brush = Request::get('brush', $x === 'php' ? 'php' : 'generic');
$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);
}
示例11: foreach
echo $messages;
?>
<?php
Weapon::fire('tab_content_before', $hooks);
?>
<div class="tab-content" id="tab-content-1">
<h3><?php
echo Config::speak('manager.title_your_', $speak->plugins);
?>
</h3>
<?php
if ($folders) {
?>
<?php
foreach ($folders as $folder) {
$folder = File::B($folder->path);
?>
<?php
$r = PLUGIN . DS . $folder . DS;
$c = File::exist($r . 'capture.png');
?>
<?php
$page = Plugin::info($folder);
?>
<div class="media<?php
if (!$c) {
?>
no-capture<?php
}
?>
" id="plugin:<?php
示例12: array
<span class="grid span-4">
<?php
echo Form::select('language_direction', array('ltr' => 'Left to Right (LTR)', 'rtl' => 'Right to Left (RTL)'), Guardian::wayback('language_direction', $config->language_direction), array('class' => 'select-block'));
?>
</span>
</label>
<label class="grid-group">
<span class="grid span-2 form-label"><?php
echo $speak->shield;
?>
</span>
<span class="grid span-4">
<?php
$info = array();
foreach (glob(SHIELD . DS . '*', GLOB_ONLYDIR) as $folder) {
$s = File::B($folder);
if (strpos($s, '__') !== 0) {
$info[$s] = Shield::info($s)->title;
}
}
echo Form::select('shield', $info, Guardian::wayback('shield', $config->shield), array('class' => 'select-block'));
?>
</span>
</label>
<label class="grid-group">
<span class="grid span-2 form-label"><?php
echo $speak->manager->title_per_page;
?>
(<?php
echo $speak->all;
?>
示例13: function
Route::accept($config->manager->slug . '/cache/kill/(file|files):(:all)', function ($prefix = "", $file = "") use($config, $speak) {
if (!Guardian::happy(1)) {
Shield::abort();
}
$path = File::path($file);
if (strpos($path, ';') !== false) {
$deletes = explode(';', $path);
} else {
if (!File::exist(CACHE . DS . $path)) {
Shield::abort();
// File not found!
} else {
$deletes = array($path);
}
}
Config::set(array('page_title' => $speak->deleting . ': ' . (count($deletes) === 1 ? File::B($path) : $speak->caches) . $config->title_separator . $config->manager->title, 'cargo' => 'kill.cache.php'));
if ($request = Request::post()) {
$request = Filter::apply('request:__cache', $request, $file);
Guardian::checkToken($request['token']);
$info_path = Mecha::walk($deletes, function ($v) {
$_path = CACHE . DS . $v;
File::open($_path)->delete();
return $_path;
});
$P = array('data' => array('files' => $info_path));
Notify::success(Config::speak('notify_file_deleted', '<code>' . implode('</code>, <code>', $deletes) . '</code>'));
Weapon::fire(array('on_cache_update', 'on_cache_destruct'), array($P, $P));
Guardian::kick($config->manager->slug . '/cache/1');
} else {
Notify::warning(count($deletes) === 1 ? Config::speak('notify_confirm_delete_', '<code>' . $path . '</code>') : $speak->notify_confirm_delete);
}
示例14: foreach
<tbody>
<?php
if ($files) {
?>
<?php
foreach ($files as $file) {
?>
<?php
$url = File::url(str_replace($c_path, "", $file->path));
?>
<tr<?php
echo Session::get('recent_file_update') === File::B($file->path) ? ' class="active"' : "";
?>
>
<td><?php
echo strpos($url, '/') !== false ? Jot::span('fade', File::D($url) . '/') . File::B($url) : $url;
?>
</td>
<td class="td-icon">
<?php
echo isset($c_url_repair) && $c_url_repair !== false ? Jot::a('construct', $c_url_repair . $url, Jot::icon('pencil'), array('title' => $speak->edit)) : Jot::icon('pencil');
?>
</td>
<td class="td-icon">
<?php
echo isset($c_url_kill) && $c_url_kill !== false ? Jot::a('destruct', $c_url_kill . $url, Jot::icon('times'), array('title' => $speak->delete)) : Jot::icon('times');
?>
</td>
</tr>
<?php
}
示例15: function
/**
* Comment Manager
* ---------------
*/
Route::accept(array($config->manager->slug . '/comment', $config->manager->slug . '/comment/(:num)'), function ($offset = 1) use($config, $speak) {
if (Guardian::get('status') !== 'pilot') {
Shield::abort();
}
$offset = (int) $offset;
File::write($config->total_comments_backend)->saveTo(SYSTEM . DS . 'log' . DS . 'comments.total.log', 0600);
if ($files = Get::comments(null, 'DESC', 'txt,hold')) {
$comments = array();
$comments_id = array();
foreach ($files as $file) {
$parts = explode('_', File::B($file));
$comments_id[] = $parts[1];
}
rsort($comments_id);
foreach (Mecha::eat($comments_id)->chunk($offset, $config->manager->per_page)->vomit() as $comment) {
$comments[] = Get::comment($comment);
}
unset($comments_id, $files);
} else {
$comments = false;
}
Config::set(array('page_title' => $speak->comments . $config->title_separator . $config->manager->title, 'offset' => $offset, 'responses' => $comments, 'pagination' => Navigator::extract(Get::comments(null, 'DESC', 'txt,hold'), $offset, $config->manager->per_page, $config->manager->slug . '/comment'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.comment.php'));
Shield::lot('segment', 'comment')->attach('manager', false);
});
/**
* Comment Repair