本文整理匯總了PHP中Modules::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Modules::all方法的具體用法?PHP Modules::all怎麽用?PHP Modules::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Modules
的用法示例。
在下文中一共展示了Modules::all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Class Constructor
*
* @param Config $configs Konfigurasi
*/
public function __construct(Config $conf = null)
{
// Menerapkan konfigurasi
$this->conf = $conf;
// Menerapkan konfigurasi (@link http://php.net/manual/en/function.ob-get-level.php)
$this->buffer = ob_get_level();
self::$instance =& $this;
// Default konfigurasi $baseurl
if ($this->conf('baseurl') == '' && isset($_SERVER['HTTP_HOST'])) {
$this->conf('baseurl', '//' . $_SERVER['HTTP_HOST'] . '/');
}
session_name($this->conf('basename'));
session_start();
// Inisiasi routing container
$this->add('routes', function ($c) {
return [];
});
// Inisiasi uri container
$this->add('uri', function ($c) {
return new Uri();
});
// Inisiasi modules container
$this->add('modules', function ($c, $name) {
$modules = new Modules($name);
// Menyimpan sementara semua modules yang ada dalam cache
$c->add($name, $modules->all());
return $modules;
});
}
示例2: __construct
/**
* Class Constructor
*
* @param Config $configs Konfigurasi
*/
public function __construct(Config $conf = null)
{
// Menerapkan konfigurasi
$this->conf = $conf;
// Menerapkan konfigurasi (@link http://php.net/manual/en/function.ob-get-level.php)
$this->buffer = ob_get_level();
self::$instance =& $this;
// Default konfigurasi $baseurl
if ($this->conf('baseurl') == '' && isset($_SERVER['HTTP_HOST'])) {
$this->conf('baseurl', '//' . $_SERVER['HTTP_HOST'] . '/');
}
session_name($this->conf('basename'));
session_start();
// Inisiasi routing container
$this->add('errors', function () {
if (!class_exists('Error')) {
require_once __DIR__ . '/Error.php';
}
return new Error();
});
// Inisiasi routing container
$this->add('routes', function () {
return [];
});
// Inisiasi uri container
$this->add('uri', function () {
return new Uri();
});
$this->conf('asset.css', ['asset/lib/jquery-ui.css', 'asset/reset.css', 'asset/style.css']);
$this->conf('asset.js', ['asset/lib/jquery.min.js', 'asset/lib/jquery-ui.min.js', 'asset/lib/jquery-validate.min.js', 'asset/lib/nicedit.js', 'asset/script.js']);
// Inisiasi modules container
$this->add('modules', function ($c, $name) {
$modules = new Modules($name);
// Menyimpan sementara semua modules yang ada dalam cache
$c->add($name, $modules->all());
return $modules;
});
}
示例3: add_filter
}
$uploads['basedir'] = ROOT . '/data/uploads/media';
$uploads['path'] = $uploads['basedir'] . $uploads['subdir'];
if ($upload_url_path) {
$uploads['baseurl'] = $upload_url_path;
$uploads['url'] = $uploads['baseurl'] . $uploads['subdir'];
}
return $uploads;
});
//解決上傳文件名中文亂碼問題
add_filter('sanitize_file_name', function ($filename) {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$newname = date('YmdHis') . floor(microtime() * 1000) . substr(md5($filename), 16) . ($ext ? ".{$ext}" : '');
return $newname;
}, 10);
show_admin_bar(false);
/**
* @see http://zmingcx.com/wordpress-4-2-edition-problem.html
*/
function init_smilies()
{
global $wpsmiliestrans;
$wpsmiliestrans = array(':mrgreen:' => 'icon_mrgreen.gif', ':neutral:' => 'icon_neutral.gif', ':twisted:' => 'icon_twisted.gif', ':arrow:' => 'icon_arrow.gif', ':shock:' => 'icon_eek.gif', ':smile:' => 'icon_smile.gif', ':???:' => 'icon_confused.gif', ':cool:' => 'icon_cool.gif', ':evil:' => 'icon_evil.gif', ':grin:' => 'icon_biggrin.gif', ':idea:' => 'icon_idea.gif', ':oops:' => 'icon_redface.gif', ':razz:' => 'icon_razz.gif', ':roll:' => 'icon_rolleyes.gif', ':wink:' => 'icon_wink.gif', ':cry:' => 'icon_cry.gif', ':eek:' => 'icon_surprised.gif', ':lol:' => 'icon_lol.gif', ':mad:' => 'icon_mad.gif', ':sad:' => 'icon_sad.gif', '8-)' => 'icon_cool.gif', '8-O' => 'icon_eek.gif', ':-(' => 'icon_sad.gif', ':-)' => 'icon_smile.gif', ':-?' => 'icon_confused.gif', ':-D' => 'icon_biggrin.gif', ':-P' => 'icon_razz.gif', ':-o' => 'icon_surprised.gif', ':-x' => 'icon_mad.gif', ':-|' => 'icon_neutral.gif', ';-)' => 'icon_wink.gif', '8O' => 'icon_eek.gif', ':(' => 'icon_sad.gif', ':)' => 'icon_smile.gif', ':?' => 'icon_confused.gif', ':D' => 'icon_biggrin.gif', ':P' => 'icon_razz.gif', ':o' => 'icon_surprised.gif', ':x' => 'icon_mad.gif', ':|' => 'icon_neutral.gif', ';)' => 'icon_wink.gif', ':!:' => 'icon_exclaim.gif', ':?:' => 'icon_question.gif');
}
add_action('init', 'init_smilies', 5);
//require __DIR__.'/extra/remove-category-parents.php';
/** @type \YCMS\Modules\Module $module */
foreach (\Modules::all() as $module) {
\register_theme_directory(dirname($module->getPath()));
}
View::addLocation(realpath(get_template_directory() . '/Resources/views') ?: get_template_directory());