本文整理汇总了PHP中Mecha::GVR方法的典型用法代码示例。如果您正苦于以下问题:PHP Mecha::GVR方法的具体用法?PHP Mecha::GVR怎么用?PHP Mecha::GVR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mecha
的用法示例。
在下文中一共展示了Mecha::GVR方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($param = null, $fallback = false, $str_eval = true)
{
if (is_null($param)) {
return $_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET) && !empty($_GET) ? $str_eval ? Converter::strEval($_GET, false) : $_GET : $fallback;
}
$output = Mecha::GVR($_GET, $param, $fallback);
return $output === '0' || !empty($output) ? $str_eval ? Converter::strEval($output, false) : $output : $fallback;
}
示例2: inspect
public static function inspect($path, $output = null, $fallback = false)
{
$path = self::path($path);
$n = self::N($path);
$e = self::E($path);
$update = self::T($path);
$update_date = !is_null($update) ? date('Y-m-d H:i:s', $update) : null;
$results = array('path' => $path, 'name' => $n, 'url' => self::url($path), 'extension' => is_file($path) ? $e : null, 'update_raw' => $update, 'update' => $update_date, 'size_raw' => file_exists($path) ? filesize($path) : null, 'size' => file_exists($path) ? self::size($path) : null, 'is' => array('hidden' => strpos($n, '__') === 0 || strpos($n, '.') === 0, 'file' => is_file($path), 'folder' => is_dir($path)));
return !is_null($output) ? Mecha::GVR($results, $output, $fallback) : $results;
}
示例3: get
public static function get($session = null, $fallback = "")
{
if (is_null($session)) {
return $_SESSION;
}
if ($session === 'cookies') {
return Converter::strEval($_COOKIE);
}
if (strpos($session, 'cookie:') === 0) {
$name = substr($session, 7);
$cookie = isset($_COOKIE) ? Converter::strEval($_COOKIE) : $fallback;
$value = Mecha::GVR($cookie, $name, $fallback);
return !is_array($value) && !is_null(json_decode(base64_decode($value), true)) ? json_decode(base64_decode($value), true) : $value;
}
return Mecha::GVR($_SESSION, $session, $fallback);
}
示例4: get
/**
* =============================================================
* GET CONFIGURATION VALUE BY ITS KEY
* =============================================================
*
* -- CODE: ----------------------------------------------------
*
* echo Config::get('url');
*
* -------------------------------------------------------------
*
* echo Config::get('index')->slug;
*
* -------------------------------------------------------------
*
* echo Config::get('index.slug');
*
* -------------------------------------------------------------
*
* $config = Config::get();
*
* echo $config->url;
* echo $config->index->slug;
*
* -------------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------ | ---------------------------------------
* $key | string | Key of data to be called
* $fallback | mixed | Fallback value if data does not exist
* --------- | ------ | ---------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function get($key = null, $fallback = false)
{
if (is_null($key)) {
return Mecha::O(self::$bucket);
}
if (is_string($key) && strpos($key, '.') !== false) {
$output = Mecha::GVR(self::$bucket, $key, $fallback);
return is_array($output) ? Mecha::O($output) : $output;
}
return array_key_exists($key, self::$bucket) ? Mecha::O(self::$bucket[$key]) : $fallback;
}
示例5: inspect
/**
* ====================================================================
* INSPECT A ZIP FILE
* ====================================================================
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------ | ----------------------------------------------
* $key | string | Key of the resulted array data
* $fallback | mixed | Fallback value if array value is not available
* --------- | ------ | ----------------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function inspect($key = null, $fallback = false)
{
$results = array();
if (self::$zip->open(self::$open) === true) {
$results = array_merge(File::inspect(self::$open), array('status' => self::$zip->status, 'total' => self::$zip->numFiles));
for ($i = 0; $i < $results['total']; ++$i) {
$data = self::$zip->statIndex($i);
$data['name'] = str_replace(DS . DS, DS, File::path($data['name']));
$results['files'][$i] = $data;
}
self::$zip->close();
}
if (!is_null($key)) {
return Mecha::GVR($results, $key, $fallback);
}
return !empty($results) ? $results : $fallback;
}
示例6: wayback
/**
* ============================================================
* SPELL THE STORED DATA
* ============================================================
*
* -- CODE: ---------------------------------------------------
*
* echo Guardian::wayback('name');
*
* ------------------------------------------------------------
*
*/
public static function wayback($name = null, $fallback = "")
{
$memory = Session::get(self::$form);
self::forget($name);
return !is_null($name) ? Mecha::GVR($memory, $name, $fallback) : $memory;
}
示例7: wayback
/**
* ============================================================
* SPELL THE STORED DATA
* ============================================================
*
* -- CODE: ---------------------------------------------------
*
* echo Guardian::wayback('name');
*
* ------------------------------------------------------------
*
*/
public static function wayback($name = null, $fallback = "")
{
$form = Session::get(self::$form);
if (is_null($name)) {
self::forget();
return $form;
}
$value = Mecha::GVR($form, $name, $fallback);
Session::kill(self::$form . '.' . $name);
return $value;
}
示例8: array_slice
if ($file = File::exist(LANGUAGE . DS . Config::get('language') . DS . 'yapping' . DS . $key . '.txt')) {
$wizard = Text::toPage(File::open($file)->read(), 'content', 'wizard:');
return $wizard['content'];
} else {
if ($file = File::exist(ROOT . DS . $key . '.txt')) {
$wizard = Text::toPage(File::open($file)->read(), 'content', 'wizard:');
return $wizard['content'];
}
}
return "";
}
if (!is_array($vars)) {
$vars = array_slice(func_get_args(), 1);
}
if (strpos($key, '.') !== false) {
$value = Mecha::GVR($speak, $key, $fallback);
return vsprintf($value, $vars);
}
return isset($speak[$key]) ? vsprintf($speak[$key], $vars) : vsprintf($fallback, $vars);
});
/**
* =============================================================
* GET URL DATA
* =============================================================
*
* -- CODE: ----------------------------------------------------
*
* echo Config::url();
*
* -------------------------------------------------------------
*
示例9: get
/**
* =============================================================
* GET CONFIGURATION DATA BY ITS KEY
* =============================================================
*
* -- CODE: ----------------------------------------------------
*
* echo Config::get('url');
*
* -------------------------------------------------------------
*
* echo Config::get('index')->slug;
*
* -------------------------------------------------------------
*
* echo Config::get('index.slug');
*
* -------------------------------------------------------------
*
* $config = Config::get();
*
* echo $config->url;
* echo $config->index->slug;
*
* -------------------------------------------------------------
*
* $bucket = Config::get(array('foo', 'bar', 'baz'));
*
* -------------------------------------------------------------
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------ | ---------------------------------------
* $key | string | Key of data to be called
* $fallback | mixed | Fallback value if data does not exist
* --------- | ------ | ---------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function get($key = null, $fallback = false)
{
if (is_null($key)) {
return Mecha::O(self::$bucket);
}
if (is_array($key)) {
$results = array();
foreach ($key as $k => $v) {
$f = is_array($fallback) && array_key_exists($k, $fallback) ? $fallback[$k] : $fallback;
$results[$v] = self::get($v, $f);
}
return (object) $results;
}
if (is_string($key) && strpos($key, '.') !== false) {
$output = Mecha::GVR(self::$bucket, $key, $fallback);
return is_array($output) ? Mecha::O($output) : $output;
}
return array_key_exists($key, self::$bucket) ? Mecha::O(self::$bucket[$key]) : $fallback;
}
示例10: getInfo
/**
* ====================================================================
* INSPECT A ZIP FILE
* ====================================================================
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Parameter | Type | Description
* --------- | ------ | ----------------------------------------------
* $key | string | Key of the resulted array data
* $fallback | mixed | Fallback value if array value is not available
* --------- | ------ | ----------------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
public static function getInfo($key = null, $fallback = false)
{
$results = array();
$zip = new ZipArchive();
if (File::exist(self::$open) && $zip->open(self::$open)) {
$results = array_merge(File::inspect(self::$open), array('status' => $zip->status, 'total' => $zip->numFiles));
for ($i = 0; $i < $results['total']; ++$i) {
$results['files'][$i] = $zip->statIndex($i);
}
$zip->close();
}
if (!is_null($key)) {
return Mecha::GVR($results, $key, $fallback);
}
return !empty($results) ? $results : $fallback;
}
示例11: function
* $key | string | Key of language data to be called
* $vars | array | Array of value used in PHP `vsprintf()`
* --------- | ------ | ---------------------------------------
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
Config::plug('speak', function ($key = "", $vars = array()) {
if (!$key) {
return Config::get('speak');
}
if (!is_array($vars)) {
$vars = array_slice(func_get_args(), 1);
}
$speak = Mecha::A(Config::get('speak'));
if (strpos($key, '.') !== false) {
$value = Mecha::GVR($speak, $key, $key);
return vsprintf($value, $vars);
}
if (isset($speak[$key])) {
return !is_array($speak[$key]) ? vsprintf($speak[$key], $vars) : Mecha::O($speak[$key]);
}
return $key;
});
/**
* =============================================================
* GET URL DATA
* =============================================================
*
* -- CODE: ----------------------------------------------------
*
* echo Config::url();