本文整理汇总了PHP中add::config方法的典型用法代码示例。如果您正苦于以下问题:PHP add::config方法的具体用法?PHP add::config怎么用?PHP add::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类add
的用法示例。
在下文中一共展示了add::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: require_dir_exists
/**
* Require existence of a directory
*
* @since ADD MVC 0.5
*/
public static function require_dir_exists($dir, $writable = null)
{
if (!file_exists($dir)) {
throw new e_system("Directory {$dir} is not existing", add::config());
}
if (!is_writable($dir)) {
throw new e_system("Directory {$dir} is not writable", add::config());
}
}
示例2: process
/**
* The pre-view process
*
* @since ADD MVC 0.0
*/
public function process()
{
# Required Directories
self::require_dir_exists(add::config()->incs_dir);
self::require_dir_exists(add::config()->caches_dir, true);
$this->require_dir($this->view()->compile_dir, true);
$this->require_dir($this->view()->cache_dir, true);
# Other essential directories
$this->check_dir_exists(add::config()->classes_dir);
$this->check_dir_exists(add::config()->assets_dir);
$this->check_dir_exists(add::config()->css_dir);
$this->check_dir_exists(add::config()->js_dir);
}
示例3: __construct
/**
* Smarty construct
*
* @since ADD MVC 0.0
*/
public function __construct()
{
$C = add::config();
parent::__construct();
if (is_array($C->views_dir)) {
$this->setTemplateDir(array_merge($C->views_dir, array($C->add_dir . '/views/')));
} else {
$this->setTemplateDir(array($C->views_dir, $C->add_dir . '/views/'));
}
$this->compile_dir = $C->caches_dir . '/smarty_compile/';
$this->config_dir = $C->configs_dir . '/smarty/';
$this->cache_dir = $C->caches_dir . '/smarty_cache/';
}
示例4: process_mode_login
/**
* Login
*
* @param array $gpc - contains $gpc['username'] and $gpc['password']
*
*/
public function process_mode_login($gpc)
{
# validation on controller
if (empty($gpc['username'])) {
throw new e_user_input("Blank username");
}
if (empty($gpc['password'])) {
throw new e_user_input("Blank password");
}
# login the session user class
if (member::login($gpc['username'], $gpc['password']) instanceof member) {
add::redirect(add::config()->path);
}
}
示例5: __construct
/**
* Smarty construct
*
* @since ADD MVC 0.0
*/
public function __construct()
{
$C = add::config();
parent::__construct();
if (is_array($C->views_dir)) {
$this->setTemplateDir(array_merge($C->views_dir, array($C->add_dir . '/views/')));
} else {
$this->setTemplateDir(array($C->views_dir, $C->add_dir . '/views/'));
}
$this->compile_dir = $C->caches_dir . '/smarty_compile/';
$this->config_dir = $C->configs_dir . '/smarty/';
$this->cache_dir = $C->caches_dir . '/smarty_cache/';
if (add::is_development()) {
foreach (array($this->compile_dir, $this->cache_dir) as $dir) {
if (!is_dir($dir)) {
$this->_dir_perms = 0777;
} else {
if (!is_writable($dir)) {
# Do something
}
}
}
}
}
示例6: __construct
/**
* Settings and stuffs
*
* @since ADD MVC 0.8-data_mining
*/
public function __construct()
{
if (!isset($this->cookie_dir)) {
$this->cookie_dir = add::config()->caches_dir . '/' . preg_replace('/\\W+/', '_', get_called_class()) . '.class.cookies';
}
if ($this->enable_cache) {
$this->cache_dir = add::config()->caches_dir . '/' . preg_replace('/\\W+/', '_', get_called_class()) . '.class.cache';
if (!file_exists($this->cache_dir)) {
mkdir($this->cache_dir, 0777);
}
}
$this->set_curl_options();
if ($this->curl_options[CURLOPT_HTTPPROXYTUNNEL] && empty($this->curl_options[CURLOPT_PROXY]) && !empty($this->proxies) && is_array($this->proxies)) {
$this->curl_options[CURLOPT_PROXY] = $this->proxies[array_rand($this->proxies)];
$this->cookie_dir = add::config()->caches_dir . '/cookies_' . preg_replace('/\\W+/', '_', __FILE__) . "_" . preg_replace("/\\W+/", "_", $this->curl_options[CURLOPT_PROXY]);
}
}
示例7: login_redirect
/**
* login_redirect()
*
* @since ADD MVC 0.0
*/
static function login_redirect()
{
add::redirect(add::config()->path . 'login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
}
示例8: is_developer
/**
* is_developer()
*
* Checks if the user is developer according to his/her IP
*
* @since ADD MVC 0.7.2
*/
public static function is_developer()
{
return in_array(current_user_ip(), add::config()->developer_ips) || current_ip_in_network();
}
示例9: is_developer
/**
* is_developer()
*
* Checks if the user is developer according to his/her IP
*
* @since ADD MVC 0.7.2
*/
public static function is_developer()
{
# Fix for issue #6
if (current_ip_in_network()) {
return true;
}
if (isset(add::config()->developer_ips)) {
return in_array(current_user_ip(), (array) add::config()->developer_ips);
} else {
return false;
}
}
示例10: fetch_view
public function fetch_view()
{
$this->view()->assign('C', add::config());
return $this->view()->fetch(static::view_filepath());
}
示例11: die
}
if (!isset($C)) {
die("No config found");
}
require $C->add_dir . '/classes/add.class.php';
$GLOBALS[add::CONFIG_VARNAME] = add::config($C);
spl_autoload_register('add::load_class');
set_exception_handler('add::handle_exception');
set_error_handler('add::handle_error');
register_shutdown_function('add::handle_shutdown');
$C->incs_dir = $C->root_dir . '/includes';
$C->classes_dirs = array_merge(array($C->incs_dir . '/classes', $C->add_dir . '/classes'), isset($C->classes_dirs) && is_array($C->classes_dirs) ? $C->classes_dirs : array());
$C->configs_dir = $C->incs_dir . '/configs';
$C->views_dir = $C->incs_dir . '/views';
$C->caches_dir = $C->incs_dir . '/caches';
add::environment_status(add::config()->environment_status);
if (add::is_development() && !is_writeable($C->caches_dir)) {
$C->caches_dir = sys_get_temp_dir() . '/add_mvc_caches';
if (!file_exists($C->caches_dir)) {
mkdir($C->caches_dir, 0700);
}
}
$C->assets_dir = $C->root_dir . '/assets';
$C->images_dir = $C->assets_dir . '/images';
$C->css_dir = $C->assets_dir . '/css';
$C->js_dir = $C->assets_dir . '/js';
$C->domain = ($C->sub_domain ? "{$C->sub_domain}." : "") . $C->super_domain;
$C->base_url = "http://{$C->domain}" . $C->path;
set_include_path($C->incs_dir);
/**
* assets
示例12: array
<?php
require '../config.php';
require_once "{$C->add_dir}/init.php";
add::config()->environment_status = 'live';
$email = $_GET['email'];
if ($email) {
e_add::$email_addresses = $email;
$exceptions = array('e_developer', 'e_syntax', 'e_hack', 'e_spam', 'e_system');
$rand_excemption = $exceptions[array_rand($exceptions)];
throw new $rand_excemption('ERROR! ' . $rand_excemption);
}
?>
<form method="GET">
<input type="text" name="email" />
<input type="submit" />
</form>
示例13: handle_exception
/**
* Handle exception
*
*/
public function handle_exception()
{
$this->message = str_replace(add::config()->root_dir, '< mvc-path >', $this->data->message);
return parent::handle_exception();
}
示例14:
<?php
require 'config.php';
#echo "ADD DIR: ".$C->add_dir;
require $C->add_dir . '/init.php';
#date_default_timezone_set(add::config()->default_timezone);
if (add::config()->debug_sql && add::is_development() && add::is_developer()) {
locust_mule_db::singleton()->debug = true;
}
示例15: error_reporting
*/
$C->assets_path = $C->base_url . 'assets/';
$C->css_path = $C->assets_path . 'css/';
$C->js_path = $C->assets_path . 'js/';
$C->images_path = $C->assets_path . 'images/';
$C->assets_libs_path = $C->assets_path . 'libs/';
/**
* No errors if live
*
* @since ADD MVC 0.7.2
*/
if (add::is_live()) {
error_reporting(0);
} else {
error_reporting(E_ALL);
/**
* When development, record the time spent on script execution
*
* @since ADD MVC 0.7.2
*/
if (add::is_development()) {
$GLOBALS['add_mvc_root_timer'] = add_development_timer::start("Framework Configuration");
add::config()->root_timer = $GLOBALS['add_mvc_root_timer'];
}
}
add::load_functions('common');
/**
* Libraries
*/
add::load_lib('adodb');
add::load_lib('smarty');