本文整理匯總了PHP中Config::speak方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::speak方法的具體用法?PHP Config::speak怎麽用?PHP Config::speak使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Config
的用法示例。
在下文中一共展示了Config::speak方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ago
/**
* ==========================================================
* DATE AGO CALCULATOR
* ==========================================================
*
* -- CODE: -------------------------------------------------
*
* $input = '2014-05-30 09:22:42';
*
* var_dump(Date::ago($input));
*
* ----------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------- | -----------------------------------
* $input | mixed | The date input
* $output | string | Optional to output single data
* $compact | boolean | Remove empty leading offset(s)?
* --------- | ------- | -----------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function ago($input, $output = null, $compact = true)
{
$speak = Config::speak();
$date = new DateTime();
$date->setTimestamp((int) self::format($input, 'U'));
$interval = $date->diff(new DateTime('now'));
$time = $interval->format('%y.%m.%d.%h.%i.%s');
$time = explode('.', $time);
$time = Converter::strEval($time);
$data = array('year' => $time[0], 'month' => $time[1], 'day' => $time[2], 'hour' => $time[3], 'minute' => $time[4], 'second' => $time[5]);
if ($compact) {
foreach ($data as $k => $v) {
if ($v === 0) {
unset($data[$k]);
} else {
break;
}
}
}
$results = array();
foreach ($data as $k => $v) {
$text = array($speak->{$k}, $speak->{$k . 's'});
$results[$k] = $v . ' ' . ($v === 1 ? $text[0] : $text[1]);
}
unset($data);
return !is_null($output) ? $results[$output] : $results;
}
示例2: ago
/**
* ==========================================================
* DATE AGO CALCULATOR
* ==========================================================
*
* -- CODE: -------------------------------------------------
*
* $input = '2014-05-30 09:22:42';
*
* var_dump(Date::ago($input));
*
* ----------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------- | -----------------------------------
* $input | mixed | The date input
* $output | string | Optional to output single data
* $compact | boolean | Remove empty leading offset(s)?
* --------- | ------- | -----------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function ago($input, $output = null, $compact = true)
{
$speak = Config::speak();
$date = new DateTime();
$date->setTimestamp((int) self::format($input, 'U'));
$interval = $date->diff(new DateTime('now'));
$time = $interval->format('%y.%m.%d.%h.%i.%s');
$time = explode('.', $time);
$time = Converter::strEval($time);
$data = array($speak->year . '|' . $speak->years => $time[0], $speak->month . '|' . $speak->months => $time[1], $speak->day . '|' . $speak->days => $time[2], $speak->hour . '|' . $speak->hours => $time[3], $speak->minute . '|' . $speak->minutes => $time[4], $speak->second . '|' . $speak->seconds => $time[5]);
if ($compact) {
foreach ($data as $k => $v) {
if ($offset === 0) {
unset($data[$k]);
} else {
break;
}
}
}
$results = array();
foreach ($data as $k => $v) {
$text = explode('|', $k);
$results[strtolower($text[0])] = $v . ' ' . ($v === 1 ? $text[0] : $text[1]);
}
unset($data);
return !is_null($output) ? $results[$output] : $results;
}
示例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: array
$menus[$speak->error] = array('icon' => 'exclamation-triangle', 'url' => $config->manager->slug . '/error', 'count' => $total, 'stack' => 9.130000000000001);
}
}
if ($config->page_type !== '404' && $config->is->post) {
$type = $config->page_type;
$id = $config->{$type}->id;
$text = Config::speak($type);
$text_repair = Config::speak('manager._this_', array($speak->edit, $text));
$text_kill = Config::speak('manager._this_', array($speak->delete, $text));
$bars[$text] = array('icon' => 'plus', 'url' => $config->manager->slug . '/' . $type . '/ignite', 'description' => Config::speak('manager.title_new_', $text), 'stack' => 9.029999999999999);
$bars[$speak->edit] = array('icon' => 'pencil', 'url' => $config->manager->slug . '/' . $type . '/repair/id:' . $id, 'description' => $text_repair, 'stack' => 9.039999999999999);
$bars[$speak->delete] = array('icon' => 'times', 'url' => $config->manager->slug . '/' . $type . '/kill/id:' . $id, 'description' => $text_kill, 'stack' => 9.050000000000001);
} else {
$link = Cell::a($config->manager->slug . '/article/ignite', Config::speak('manager.title_new_', $speak->article));
$link .= ' · ';
$link .= Cell::a($config->manager->slug . '/page/ignite', Config::speak('manager.title_new_', $speak->page));
$bars[$speak->add] = array('icon' => 'plus', 'url' => $config->manager->slug . '/article/ignite', 'description' => $link, 'stack' => 9.029999999999999);
}
Config::merge('manager_menu', $menus);
Config::merge('manager_bar', $bars);
});
}
// Loading frontend task(s) and route(s)
Weapon::add('routes_before', function () use($config, $speak) {
require __DIR__ . DS . 'workers' . DS . 'task.comment.ignite.php';
require __DIR__ . DS . 'workers' . DS . 'route.login.php';
});
// Add log in/out link in shield footer
function do_footer_manager_link($content, $path)
{
global $config, $speak;
示例5: array
?>
"><?php
echo $page->date->FORMAT_3;
?>
</time>
</span>
</div>
<div class="page-body"><?php
echo $page->description;
?>
</div>
<div class="page-footer">
<?php
Weapon::fire('page_footer', array($page));
?>
</div>
</li>
<?php
}
?>
</ol>
<?php
include DECK . DS . 'workers' . DS . 'unit.pager.1.php';
} else {
?>
<p><?php
echo Config::speak('notify_empty', strtolower($speak->pages));
?>
</p>
<?php
}
示例6: function
<?php
/**
* Shortcode Manager
* -----------------
*/
Route::accept($config->manager->slug . '/shortcode', function () use($config, $speak) {
if (!Guardian::happy(1)) {
Shield::abort();
}
$shortcodes = Get::state_shortcode(null, array(), false);
$G = array('data' => $shortcodes);
Config::set(array('page_title' => $speak->shortcodes . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.shortcode.php'));
if ($request = Request::post()) {
$request = Filter::apply('request:__shortcode', $request);
Guardian::checkToken($request['token']);
$data = array();
for ($i = 0, $keys = $request['key'], $count = count($keys); $i < $count; ++$i) {
if (trim($keys[$i]) !== "") {
$data[$keys[$i]] = $request['value'][$i];
}
}
$P = array('data' => $data);
File::serialize($data)->saveTo(STATE . DS . 'shortcode.txt', 0600);
Notify::success(Config::speak('notify_success_updated', $speak->shortcode));
Weapon::fire('on_shortcode_update', array($G, $P));
Guardian::kick($config->url_current);
}
Shield::lot(array('segment' => 'shortcode', 'files' => Mecha::O($shortcodes)))->attach('manager');
});
示例7: foreach
<?php
foreach ($field as $k => $v) {
$f = $v['type'] === 'file' || $v['type'] === 'f';
// Remove asset field value and data
if (isset($v['remove']) && $f) {
File::open(SUBSTANCE . DS . $v['remove'])->delete();
Weapon::fire(array('on_substance_update', 'on_substance_destruct'), array($G, $P));
Notify::success(Config::speak('notify_file_deleted', '<code>' . $v['remove'] . '</code>'));
unset($field[$k]);
}
// Remove empty field value
if (!isset($v['value']) || $v['value'] === "") {
unset($field[$k]);
} else {
$e = File::E($v['value']);
if (!file_exists(SUBSTANCE . DS . $e . DS . $v['value']) && $f) {
unset($field[$k]);
} else {
$field[$k] = $v['value'];
}
}
}
示例8: attach
/**
* ==========================================================
* RENDER A PAGE
* ==========================================================
*
* -- CODE: -------------------------------------------------
*
* Shield::attach('article');
*
* ----------------------------------------------------------
*
*/
public static function attach($name, $fallback = false, $buffer = true)
{
$path__ = File::path($name);
$s = explode('-', File::N($name), 2);
$G = array('data' => array('name' => $name, 'name_base' => $s[0]));
if (strpos($path__, ROOT) === 0 && file_exists($path__) && is_file($path__)) {
// do nothing ...
} else {
if ($_path = File::exist(self::path($path__, $fallback))) {
$path__ = $_path;
} else {
if ($_path = File::exist(self::path($s[0], $fallback))) {
$path__ = $_path;
} else {
Guardian::abort(Config::speak('notify_file_not_exist', '<code>' . $path__ . '</code>'));
}
}
}
$lot__ = self::cargo();
$path__ = Filter::apply('shield:path', $path__);
$G['data']['lot'] = $lot__;
$G['data']['path'] = $path__;
$G['data']['path_base'] = $s[0];
$out = "";
// Begin shield
Weapon::fire('shield_lot_before', array($G, $G));
extract(Filter::apply('shield:lot', $lot__));
Weapon::fire('shield_lot_after', array($G, $G));
Weapon::fire('shield_before', array($G, $G));
if ($buffer) {
ob_start(function ($content) use($path__, &$out) {
$content = Filter::apply('shield:input', $content, $path__);
$out = Filter::apply('shield:output', $content, $path__);
return $out;
});
require $path__;
ob_end_flush();
} else {
require $path__;
}
$G['data']['content'] = $out;
// Reset shield lot
self::$lot = array();
// End shield
Weapon::fire('shield_after', array($G, $G));
exit;
}
示例9: 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 ($request = Request::post()) {
Guardian::checkToken($request['token']);
// [2]
File::write('test!')->saveTo(__DIR__ . DS . 'states' . DS . 'config.txt', 0600);
Notify::success(Config::speak('notify_success_updated', $speak->plugin));
// [3]
Guardian::kick(File::D($config->url_current));
// [4]
}
});
示例10: array
<div class="tab-content-area">
<?php
echo $messages;
?>
<div class="tab-content" id="tab-content-1">
<?php
if ($file->configurator) {
?>
<?php
include $file->configurator;
?>
<?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'));
?>
示例11: function
<?php
$post = 'page';
$response = 'comment';
// Repair
if (strpos($config->url_path, '/id:') !== false) {
Weapon::add('tab_button_before', function ($page, $segment) use($config, $speak) {
include __DIR__ . DS . 'unit' . DS . 'tab' . DS . 'button' . DS . 'new.php';
}, 0.9);
Weapon::add('tab_content_1_before', function ($page, $segment) use($config, $speak) {
include __DIR__ . DS . 'unit' . DS . 'form' . DS . 'date.hidden.php';
}, 0.9);
}
// You can't use index, tag, archive, search, manager and feed slug URL for page(s)
if ($slug = Request::post('slug')) {
$s = array($config->index->slug => 1, $config->tag->slug => 1, $config->archive->slug => 1, $config->search->slug => 1, $config->manager->slug => 1, 'feed' => 1);
if (isset($s[$slug])) {
Notify::error(Config::speak('notify_error_slug_exist', $slug));
}
}
require __DIR__ . DS . 'route.post.php';
示例12: array
<?php
echo Form::hidden('token', $token);
?>
<p><?php
echo Form::textarea('content', Guardian::wayback('content'), $speak->manager->placeholder_content, array('class' => array('textarea-block', 'textarea-expand', 'code')));
?>
</p>
<p><?php
echo Form::text('name', Guardian::wayback('name'), $speak->manager->placeholder_file_name);
?>
<?php
echo Jot::button('construct', $speak->create);
?>
</p>
<p><?php
echo Form::checkbox('redirect', 1, Request::method('get') ? false : Guardian::wayback('redirect', false), Config::speak('manager.description_redirect_to_', $speak->file));
?>
</p>
</form>
</div>
<div class="tab-content hidden" id="tab-content-2">
<?php
$_files = array();
foreach (File::open(CACHE . DS . 'plugin.snippet.cache')->unserialize() as $_file) {
$e = File::E($_file);
if (!file_exists(ASSET . DS . '__snippet' . DS . $e . DS . $_file)) {
continue;
}
$_files[] = File::url($_file);
}
?>
示例13: array
if (!Guardian::happy(1) && Guardian::get('author') !== $post->author) {
Shield::abort();
}
Config::set(array('page_title' => $speak->deleting . ': ' . $post->title . $config->title_separator . $config->manager->title, 'page' => $post, 'cargo' => 'kill.post.php'));
$G = array('data' => Mecha::A($post));
if ($request = Request::post()) {
Guardian::checkToken($request['token']);
File::open($post->path)->delete();
// Deleting response(s) ...
if ($responses = call_user_func('Get::' . $response . 's', 'DESC', 'post:' . $id, 'txt,hold')) {
foreach ($responses as $v) {
File::open($v)->delete();
}
}
$P = array('data' => $request);
include __DIR__ . DS . 'task.kill.substance.php';
// Deleting custom CSS and JavaScript file of post ...
File::open(CUSTOM . DS . Date::slug($id) . '.txt')->delete();
File::open(CUSTOM . DS . Date::slug($id) . '.draft')->delete();
Weapon::fire(array('on_custom_update', 'on_custom_destruct'), array($G, $P));
// Deleting custom PHP file of post ...
File::open(File::D($post->path) . DS . $post->slug . '.php')->delete();
Notify::success(Config::speak('notify_success_deleted', $post->title));
Weapon::fire(array('on_' . $segment . '_update', 'on_' . $segment . '_destruct'), array($G, $G));
Guardian::kick($config->manager->slug . '/' . $segment);
} else {
Notify::warning(Config::speak('notify_confirm_delete_', '<strong>' . $post->title . '</strong>'));
Notify::warning(Config::speak('notify_confirm_delete_page', strtolower($speak->{$segment}), strtolower($speak->{$response . 's'})));
}
Shield::lot(array('segment' => $segment))->attach('manager');
});
示例14: array
<?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'));
?>
</span>
</label>
<?php
$tags = array();
$tags_wayback = ',' . implode(',', Guardian::wayback('kind', Mecha::A($default->kind))) . ',';
foreach (Get::tags() as $tag) {
if ($tag && $tag->id !== 0) {
$tags[] = '<div>' . Form::checkbox('kind[]', $tag->id, strpos($tags_wayback, ',' . $tag->id . ',') !== false, $tag->name) . '</div>';
}
}
?>
<?php
if (count($tags) > 0) {
?>
示例15: foreach
?>
</h3>
<?php
echo Jot::uploader($config->manager->slug . '/shield', 'zip');
?>
<hr>
<?php
echo Guardian::wizard($segment);
?>
</div>
<?php
if (count($folders) > 1) {
?>
<div class="tab-content hidden" id="tab-content-3">
<h3><?php
echo Config::speak('manager.title_your_', $speak->shields);
?>
</h3>
<?php
foreach ($folders as $folder) {
$folder = File::B($folder);
?>
<?php
if ($config->shield !== $folder && strpos($folder, '__') !== 0) {
?>
<?php
$r = SHIELD . DS . $folder . DS;
$c = File::exist($r . 'capture.png');
?>
<?php
$page = Shield::info($folder);