本文整理汇总了PHP中Settings::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::init方法的具体用法?PHP Settings::init怎么用?PHP Settings::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: basic
/** Basic initialization - preload settings and locales
* @return void
*/
public static function basic()
{
Loader::init();
Status::init();
Settings::init();
Locales::init();
Router::update_rewrite();
}
示例2: __construct
public function __construct() { // the constructor function
$this->settings = Settings::init(); // load settings file
new SessionSaveHandler(getrootdirsrv().$this->settings->sessionsavepath);
date_default_timezone_set($this->settings->timezone); // set the default timezone. may be we need to customize it for particular user
$this->model = new Model($this->settings); // instantiate the Model class
$this->less = new lessc;
$this->StringForge = new StringForge($this->settings);
}
示例3: PerformClean
/**
* Perform the cleaning
*
* @return void
* @author Franck Royer
*/
public static function PerformClean()
{
if (!isset(Settings::$photos_dir) || !isset(Settings::$thumbs_dir)) {
Settings::init();
}
if (!is_dir(Settings::$photos_dir) || !is_dir(Settings::$thumbs_dir)) {
error_log("ERROR/Cleaning::PerformClean: " . $photos_dir . " or " . $thumbs_dir . " do not exit, cannot proceed.");
return;
}
//TODO Windows
// Clean Old thumbnails
exec("cd " . Settings::$thumbs_dir . " && find . -type f -iregex '.*[^\\(xml\\)\\(job\\)]\$' 2>&1", $output, $ret_var);
if ($ret_var != 0) {
error_log("ERROR/Cleaning::PerformClean: Execution failed: " . print_r($output));
}
foreach ($output as $file) {
if (!file_exists(Settings::$photos_dir . '/' . $file)) {
error_log('DEBUG/Cleaning::PerformClean: erase ' . Settings::$thumbs_dir . '/' . $file . "\n");
unlink(Settings::$thumbs_dir . '/' . $file);
}
}
// Now cleaning Pending jobs
unset($output);
unset($ret_var);
exec("cd " . Settings::$thumbs_dir . " && find . -type f -name '*job' 2>&1", $output, $ret_var);
if ($ret_var != 0) {
error_log("ERROR/Cleaning::PerformClean: Execution failed: " . print_r($output));
return;
}
foreach ($output as $jobfilename) {
// need the absolute path of the video file
//error_log('DEBUG/Cleaning::PerformClean: processing job '.$jobfilename."\n");
$jobfile = new File(Settings::$thumbs_dir . '/' . $jobfilename);
$filename_no_ext = Settings::$photos_dir . '/' . dirname($jobfilename) . '/' . $jobfile->name;
$files = glob($filename_no_ext . '.*');
if (empty($files)) {
error_log("ERROR/Cleaning::PerformClean: no file found for job " . $jobfilename . ", deleting\n");
unlink(Settings::$thumbs_dir . '/' . $jobfilename);
continue;
}
//error_log('DEBUG/Cleaning::PerformClean: calling NoJob with '.$files[0]."\n");
Video::NoJob($files[0]);
}
// Finally clean empty files
unset($output);
unset($ret_var);
exec("cd " . Settings::$thumbs_dir . " && find . -size 0b 2>&1", $output, $ret_var);
if ($ret_var != 0) {
error_log("ERROR/Cleaning::PerformClean: Execution failed: " . print_r($output));
return;
}
foreach ($output as $emptyfile) {
unlink(Settings::$thumbs_dir . '/' . $emptyfile);
}
}
示例4: __construct
function __construct()
{
require_once dirname(__FILE__) . '/../XRL/src/Autoload.php';
/// Initialize variables
Settings::init();
/// Initialize CurrentUser
CurrentUser::init();
$this->server = new XRL_Server();
$this->server["XRL_DecoderFactoryInterface"] = new XRL_NonValidatingDecoderFactory();
foreach (get_class_methods('API') as $c) {
if ($c == '__construct') {
continue;
}
$this->server->{$c} = array('API', $c);
}
$this->server->foo = array('API', 'foo');
$this->server->handle()->publish();
}
示例5: tab_work_days
return $tabs;
}
/**
* Render the workdays tab
*
* @return void
*/
public function tab_work_days()
{
include WPERP_HRM_VIEWS . '/settings/tab-workdays.php';
}
/**
* Save work days from settings
*
* @return void
*/
public function save_work_days()
{
if (!wp_verify_nonce($_POST['_wpnonce'], 'erp-settings')) {
die;
}
$company_id = erp_get_current_company_id();
$option_key = 'erp_hr_work_days_' . $company_id;
$days = array_map('absint', $_POST['day']);
if (count($days) == 7) {
update_option($option_key, $days);
}
}
}
Settings::init();
示例6: avo_add_options_page
/**
* Display the settings panel
*
*/
function avo_add_options_page()
{
$options = new Settings();
// width field
$options->add_field(array('name' => 'width', 'label' => __('Embed Width', 'avo'), 'type' => 'text'));
// height field
$options->add_field(array('name' => 'height', 'label' => __('Embed Height', 'avo'), 'type' => 'text'));
// Render the page
$options->init();
}
示例7: __construct
function __construct()
{
/// Initialize variables
Settings::init();
/// Initialize CurrentUser
try {
CurrentUser::init();
} catch (Exception $e) {
$page = new RegisterPage(true);
$page->toHTML();
return;
}
/// Check what to do
switch (CurrentUser::$action) {
case "Judge":
// Same as page
// Same as page
case "Page":
$page = new MainPage();
$page->toHTML();
break;
case "Log":
$page = new LoginPage();
$page->toHTML();
break;
case "Reg":
$page = new RegisterPage();
$page->toHTML();
break;
case "JS":
$page = new JS();
break;
case "Img":
Provider::Image(CurrentUser::$path);
break;
case "BDl":
Provider::Image(CurrentUser::$path, false, true, true, true);
break;
case "Big":
Provider::Image(CurrentUser::$path, false, true);
break;
case "Thb":
Provider::Image(CurrentUser::$path, true);
break;
case "Zip":
Provider::Zip(CurrentUser::$path);
break;
case "Acc":
if (CurrentUser::$admin && isset($_POST['login'])) {
$acc = new Account($_POST['login']);
} else {
$acc = CurrentUser::$account;
}
$acc->toHTML();
break;
case "Adm":
$page = new Admin();
$page->toHTML();
break;
}
}
示例8: header
$db->debug = $config['db']['debug'];
$db->persistent = $config['db']['persistent'];
$db->file = $config['db']['file'];
$db->user = $config['db']['user'];
$db->pass = $config['db']['pass'];
$db->name = $config['db']['name'];
$db->socket = $config['db']['socket'];
$db->host = $config['db']['host'];
if (!$db->init()) {
header('HTTP/1.1 500 Internal Server Error');
die('DBE');
}
/* read settings, determine virtual host */
require classes_dir . 'settings.php';
$settings = new Settings();
if (!$settings->init() && !preg_match('/^\\/_\\//', $_SERVER['REQUEST_URI'])) {
header('HTTP/1.1 500 Internal Server Error');
die('VHE');
}
/* initialise memcache */
require classes_dir . 'memcache.php';
$memcache = new Memcache();
$memcache->enabled = $config['memcache']['enabled'];
$memcache->server = $config['memcache']['server'];
$memcache->port = $config['memcache']['port'];
$memcache->prefix = $config['memcache']['prefix'] ? $config['memcache']['prefix'] : 'fearqdb';
$memcache->debug = $config['memcache']['debug'];
$memcache->init();
/* encoding */
if ($db->type == 'mysql') {
$db->query(sprintf('SET NAMES utf8 COLLATE %s', $settings->collate));
示例9: set
/**
* Save new settings
*
* @return void
* @author Thibaud Rohmer
*/
public static function set()
{
$var = array("name", "site_address", "like", "plusone", "fbappid", "max_comments", "noregister", "forcehttps", "nocomments", "nodownload", "loc", "l33t", "reverse_menu", "encode_video", "ffmpeg_path", "ffmpeg_option", "user_theme", "thumbs_size", "rss");
$f = fopen(Settings::$admin_settings_file, "w");
foreach ($var as $v) {
if (isset($_POST["{$v}"])) {
fwrite($f, "{$v} = \"" . $_POST["{$v}"] . "\"\n");
}
}
fclose($f);
Settings::init(true);
}
示例10: init_config
/**
* Load the config
*/
public static function init_config()
{
Settings::init(false, $GLOBALS['config_file']);
try {
CurrentUser::init();
} catch (Exception $e) {
// Yes I know, no account file found
}
}