本文整理汇总了PHP中Package::get_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::get_folder方法的具体用法?PHP Package::get_folder怎么用?PHP Package::get_folder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::get_folder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($config = null)
{
if ($config) {
self::$config = $config;
} else {
self::$config = ini('base/attachment');
}
self::$attachment_dir = Package::get_folder(self::$config['attachment_dir']);
}
示例2: start
public static function start()
{
if (ini('base/SESSION/CUSTOM')) {
if (ini('base/SESSION/SAVE') == 'file') {
ini_set('session.save_path', Package::get_folder(ini('base/SESSION/DIR')));
}
}
@session_start();
self::$started = true;
}
示例3: is_available
public static function is_available($cache_backend_name)
{
switch ($cache_backend_name) {
case 'xcache':
return function_exists('xcache_set');
case 'file':
return is_dir(Package::get_folder(self::$config['cache_dir'])) && is_writeable(Package::get_folder(self::$config['cache_dir']));
case 'memcache':
return class_exists('Memcached');
}
return false;
}
示例4: check_available
public function check_available()
{
if (!$this->config['cache_dir']) {
$this->error_message = $this->config['cache_dir'];
return 1004;
}
$cache_dir = Package::get_folder($this->config['cache_dir']);
if (!is_writable($cache_dir)) {
$this->error_message = $this->config['cache_dir'];
return 1005;
}
return true;
}
示例5: smarty_function_get_gravatar
function smarty_function_get_gravatar($params, $tpl_obj)
{
RuntimeConfig::load_application_config('gravatar');
/*
* the params
*/
$email = md5($params['email']);
$size = $params['size'] ? $params['size'] : ini('gravatar_config/size');
$size = $size ? $size : '80';
$rating = $params['rating'] ? $params['rating'] : ini('gravatar_config/rating');
$rating = $rating ? $rating : 'G';
$default = $params['default'] ? $params['default'] : ini('gravatar_config/default');
$default = $default ? $default : 'wavatar';
/*
* Cache the remote avatar to local server
*/
$cache_dir = Package::get_folder(ini('gravatar_config/cache_dir'));
$cache_img = $cache_dir . DS . $email . '_' . $size . '.jpg';
if (is_file($cache_img) && filemtime($cache_img) + ini('gravatar_config/cache_life') > time()) {
$link = str_ireplace(BASE_DIR . DS, ini('base/BASE_URL'), $cache_img);
$link = str_ireplace(DS, '/', $link);
} else {
$link = sprintf('http://www.gravatar.com/avatar/%s?rating=%s&size=%s&default=%s', $email, $rating, $size, $default);
$content = @file_get_contents($link);
if (!$content) {
$link = $params['onerror'] ? $params['onerror'] : ini('gravatar_config/onerror_img');
} else {
if (ini('gravatar_config/caching') && $cache_dir && $params['email']) {
if (!is_dir($cache_dir)) {
@mkdir($cache_dir, 0777);
}
@file_put_contents($cache_img, $content);
}
}
}
return <<<EOF
<img src="{$link}" width="{$size}" height="{$size}" />
EOF;
}
示例6: use_i18n
private function use_i18n()
{
ini_set('date.timezone', ini('base/TIME_ZONE'));
if (!ini('base/USE_I18N')) {
define('USE_I18N', false);
return true;
}
define('USE_I18N', true);
self::$lang = $lang = ini('base/LANGUAGE_CODE');
if (!$lang) {
$lang = 'en_US';
}
$package = 'messages';
if (SERVER_OS == 'linux') {
$lang .= '.utf8';
setlocale(LC_ALL, $lang);
} else {
putenv("LANG=" . $lang);
setlocale(LC_ALL, $lang);
}
bindtextdomain($package, Package::get_folder('etc/locale.d'));
textdomain($package);
bind_textdomain_codeset($package, 'UTF-8');
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->template_dir = Package::get_folder('var/templates');
$this->compile_dir = Package::get_folder('tmp/tpl_compiled');
if (strtolower(ini('base/RUN_MODE')) == 'devel') {
$this->debugging = false;
$this->debug_tpl = Package::get_file('var/templates/smarty_debug', 'tpl');
$this->config_dir = Package::get_folder('etc/conf.d/smarty');
} else {
$this->caching = false;
$this->cache_lifetime = ini('runtime/template/cache_life');
$this->cache_dir = Package::get_folder('tmp/tpl_caches');
}
if (USE_I18N) {
import('system/share/web/smarty_plugins/gettext');
$this->registerPlugin('block', 'trans', 'smarty_translate');
}
import('system/share/web/smarty_plugins/common');
$this->registerPlugin('function', 'url', 'smarty_function_url');
$this->registerPlugin('function', 'load', 'smarty_function_load_dynamic_plugins');
$this->assign_public_tpl_vars();
return $this;
}
示例8: syncdb
public static function syncdb($apps = null, $drop_database = false, $append = true)
{
if (!self::$inited || !self::$connections) {
self::init();
}
if (!$apps) {
$apps = ini('base/INSTALLED_APPS');
}
if (!$apps) {
return true;
}
if ($drop_database) {
Doctrine_Core::dropDatabases();
Doctrine_Core::createDatabases();
}
foreach ((array) $apps as $k => $app) {
$app = str_replace('.', '/', $app);
try {
/*
* Generate the models
*/
if (isset($_GET['use_yaml'])) {
$schemas = Package::get_file(sprintf('applications/%s/%s', $app, 'schemas.yml'));
if (!is_file($schemas)) {
continue;
}
Doctrine_Core::generateModelsFromYaml($schemas, Package::get_folder(sprintf('applications/%s/models', $app)), self::$_generate_options);
} else {
try {
import(sprintf('applications/%s/models/generated/*', $app));
} catch (DoesNotExistsException $e) {
continue;
}
}
/*
* syncdb
*/
Doctrine_Core::createTablesFromModels(Package::get_folder(sprintf('applications/%s/models', $app)), self::$_generate_options);
/*
* Insert test data
*/
$dir = Package::get_folder(sprintf('applications/%s/fixtures', $app));
if (is_dir($dir)) {
Doctrine_Core::loadData($dir, $append);
}
} catch (PDOException $e) {
continue;
}
}
}