本文整理汇总了PHP中Configuration::Query方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::Query方法的具体用法?PHP Configuration::Query怎么用?PHP Configuration::Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::Query方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MatchRule
public static function MatchRule($rule, $controller)
{
$subject = $_SERVER['REQUEST_URI'];
$rulematch = $rule->getAttribute('match');
/* Check if the app is running in a subdir */
$subdir = Configuration::Query('/configuration/domain/@subdir');
if ($subdir && $subdir->item(0)->nodeValue != '') {
$rulematch = '^\\/' . $subdir->item(0)->nodeValue . $rulematch;
// echo $rulematch;
// die;
} else {
$rulematch = '^' . $rulematch;
}
$pattern = '#' . $rulematch . '#';
$replace = $rule->getAttribute('args') != '' ? $rule->getAttribute('args') : false;
$method = $rule->getAttribute('apply');
if (preg_match($pattern, $subject, $matches)) {
if ($replace) {
$args = preg_replace($pattern, $replace, $subject);
$args = str_replace('?', '', $args);
$args = explode('&', $args);
$namedArgs = array();
foreach ($args as $argument) {
$thisArg = explode('=', $argument);
if (isset($thisArg[0]) && isset($thisArg[1])) {
$namedArgs[$thisArg[0]] = $thisArg[1];
}
}
call_user_func_array(array((string) $controller, (string) $method), $namedArgs);
} else {
call_user_func(array((string) $controller, (string) $method));
}
die;
}
}
示例2: GetFolderName
public function GetFolderName()
{
//$conf = Configuration::GetConfiguration();
$devices = Configuration::Query('/configuration/devices/device');
$generic = '';
foreach ($devices as $rule) {
$name = $rule->getAttribute('name');
if ($name != 'desktop') {
$match = (bool) preg_match("/" . $this->devices[$name] . "/i", $this->userAgent);
if ($match) {
return $rule->getAttribute('directory');
exit;
}
}
}
// return desktop
$desktop = Configuration::Query('/configuration/devices/device[@default="1"]');
return $desktop->item(0)->getAttribute('directory');
}
示例3: deferredPublication
/**
* Deferred Publication
*
* @return void
*/
public static function deferredPublication()
{
$modules = Configuration::Query('/configuration/modules/module');
foreach ($modules as $module) {
if (method_exists($module->getAttribute('controller'), 'PublishContent')) {
$moduleController = $module->getAttribute('controller');
// Pregunta si el modulo no hereda de Element para no hacer tantas consultas a la base
if (!is_subclass_of($moduleController, 'ElementController')) {
$moduleController::PublishContent();
}
}
}
die;
}
示例4: spl_autoload_extensions
* Register php files to autoload from classes directories
*/
spl_autoload_extensions('.php');
spl_autoload_register();
ini_set("memory_limit", "128M");
/**
* Set Error reporting
*/
error_reporting(E_STRICT | E_ALL);
ini_set('track_errors', 1);
/* Set application path */
PathManager::SetApplicationPath(dirname(dirname(__FILE__)));
/**
* Load Configuration
*/
Configuration::LoadConfiguration();
/**
* We will handle Errors
*/
set_error_handler(array('Error', 'ErrorHandler'));
set_exception_handler(array('Error', 'ExceptionHandler'));
/**
* default timezone should be in configuration
*/
date_default_timezone_set(Configuration::Query('/configuration/timezone')->item(0)->nodeValue);
/**
* Start Session
*/
session_set_cookie_params(0, '/', '', 0, 1);
ini_set('session.cookie_httponly', 1);
Session::Start();
示例5: SendEmail
private static function SendEmail($address, $html, $subject, $rtte = false)
{
$tcpNode = Configuration::Query('/configuration/smtp');
$server = $tcpNode->item(0)->nodeValue;
$mail = new PHPMailer(true);
try {
$mail->Host = $server;
// SMTP server
$mail->Port = 25;
// set the SMTP port for the GMAIL server
$mail->AddAddress($address);
$rtte = $rtte !== false ? $rtte . ' ' : '';
$rtte .= Configuration::GetSenderName();
$mail->SetFrom(Configuration::GetSender(), utf8_decode($rtte));
$mail->Subject = $subject;
$mail->MsgHTML(utf8_decode($html));
$mail->Send();
} catch (Exception $e) {
echo $e->getMessage();
// El mensaje no se pudo enviar
}
}
示例6: isAdmin
public static function isAdmin()
{
$conf = Configuration::Query('/configuration/adminpath');
$manager = $_SERVER['PHP_SELF'];
/* Ruta del archivo ejecutado */
$adminFolder = $conf->item(0)->nodeValue;
if (stristr($manager, $adminFolder)) {
return true;
} else {
return false;
}
}