本文整理汇总了PHP中jApp::urlBasePath方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::urlBasePath方法的具体用法?PHP jApp::urlBasePath怎么用?PHP jApp::urlBasePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::urlBasePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputMetaContent
public function outputMetaContent($resp)
{
$bp = jApp::urlBasePath();
$confDate =& jApp::config()->datepickers;
$datepicker_default_config = jApp::config()->forms['datepicker'];
$config = isset($ctrl->datepickerConfig) ? $ctrl->datepickerConfig : $datepicker_default_config;
$resp->addJSLink($bp . $confDate[$config]);
}
示例2: loadConfig
/**
* Load the configuration of authentification, stored in the auth plugin config
* @return array
* @since 1.2.10
*/
public static function loadConfig($newconfig = null)
{
if (self::$config === null || $newconfig) {
if (!$newconfig) {
$plugin = jApp::coord()->getPlugin('auth');
if ($plugin === null) {
throw new jException('jelix~auth.error.plugin.missing');
}
$config =& $plugin->config;
} else {
$config = $newconfig;
}
if (!isset($config['session_name']) || $config['session_name'] == '') {
$config['session_name'] = 'JELIX_USER';
}
if (!isset($config['persistant_cookie_path']) || $config['persistant_cookie_path'] == '') {
if (jApp::config()) {
$config['persistant_cookie_path'] = jApp::urlBasePath();
} else {
$config['persistant_cookie_path'] = '/';
}
}
if (!isset($config['persistant_encryption_key'])) {
if (isset(jApp::config()->coordplugin_auth) && isset(jApp::config()->coordplugin_auth['persistant_encryption_key'])) {
$config['persistant_encryption_key'] = trim(jApp::config()->coordplugin_auth['persistant_encryption_key']);
} else {
$config['persistant_encryption_key'] = '';
}
}
if (!isset($config['persistant_cookie_name'])) {
$config['persistant_cookie_name'] = 'jauthSession';
}
// Read hash method configuration. If not empty, cryptPassword will use
// the new API of PHP 5.5 (password_verify and so on...)
$password_hash_method = isset($config['password_hash_method']) ? $config['password_hash_method'] : 0;
if ($password_hash_method === '' || !is_numeric($password_hash_method)) {
$password_hash_method = 0;
} else {
$password_hash_method = intval($password_hash_method);
}
$password_hash_options = isset($config['password_hash_options']) ? $config['password_hash_options'] : '';
if ($password_hash_options != '') {
$list = '{"' . str_replace(array('=', ';'), array('":"', '","'), $config['password_hash_options']) . '"}';
$password_hash_options = @json_decode($list, true);
if (!$password_hash_options) {
$password_hash_options = array();
}
} else {
$password_hash_options = array();
}
$config['password_hash_method'] = $password_hash_method;
$config['password_hash_options'] = $password_hash_options;
$config[$config['driver']]['password_hash_method'] = $password_hash_method;
$config[$config['driver']]['password_hash_options'] = $password_hash_options;
self::$config = $config;
}
return self::$config;
}
示例3: loadConfig
/**
* Load the configuration of authentification, stored in the auth plugin config
* @return array
* @since 1.2.10
*/
public static function loadConfig($newconfig = null)
{
if (self::$config === null || $newconfig) {
if (!$newconfig) {
$plugin = jApp::coord()->getPlugin('auth');
if ($plugin === null) {
throw new jException('jelix~auth.error.plugin.missing');
}
$config =& $plugin->config;
} else {
$config = $newconfig;
}
if (!isset($config['session_name']) || $config['session_name'] == '') {
$config['session_name'] = 'JELIX_USER';
}
if (!isset($config['persistant_cookie_path']) || $config['persistant_cookie_path'] == '') {
if (jApp::config()) {
$config['persistant_cookie_path'] = jApp::urlBasePath();
} else {
$config['persistant_cookie_path'] = '/';
}
}
// Read hash method configuration. If not empty, cryptPassword will use
// the new API of PHP 5.5 (password_verify and so on...)
$password_hash_method = isset($config['password_hash_method']) ? $config['password_hash_method'] : 0;
if ($password_hash_method === '' || !is_numeric($password_hash_method)) {
$password_hash_method = 0;
} else {
$password_hash_method = intval($password_hash_method);
}
if ($password_hash_method > 0) {
require_once __DIR__ . '/password.php';
if (!can_use_password_API()) {
$password_hash_method = 0;
}
} else {
require_once __DIR__ . '/hash_equals.php';
}
$password_hash_options = isset($config['password_hash_options']) ? $config['password_hash_options'] : '';
if ($password_hash_options != '') {
$list = '{"' . str_replace(array('=', ';'), array('":"', '","'), $config['password_hash_options']) . '"}';
$json = new jJson(SERVICES_JSON_LOOSE_TYPE);
$password_hash_options = @$json->decode($list);
if (!$password_hash_options) {
$password_hash_options = array();
}
} else {
$password_hash_options = array();
}
$config['password_hash_method'] = $password_hash_method;
$config['password_hash_options'] = $password_hash_options;
$config[$config['driver']]['password_hash_method'] = $password_hash_method;
$config[$config['driver']]['password_hash_options'] = $password_hash_options;
self::$config = $config;
}
return self::$config;
}
示例4: __construct
public function __construct()
{
$config = jApp::config();
$basePath = jApp::urlBasePath();
$this->_vars['j_basepath'] = $basePath;
$this->_vars['j_jelixwww'] = $config->urlengine['jelixWWWPath'];
$this->_vars['j_jquerypath'] = $config->urlengine['jqueryPath'];
$this->_vars['j_themepath'] = $basePath . 'themes/' . $config->theme . '/';
$this->_vars['j_locale'] = $config->locale;
parent::__construct();
}
示例5: outputHeader
public function outputHeader($builder)
{
$conf = jApp::config()->urlengine;
// no scope into an anonymous js function, because jFormsJQ.tForm is used by other generated source code
echo '<script type="text/javascript">
//<![CDATA[
jFormsJQ.selectFillUrl=\'' . jUrl::get('jelix~jforms:getListData') . '\';
jFormsJQ.config = {locale:' . $builder->escJsStr(jApp::config()->locale) . ',basePath:' . $builder->escJsStr(jApp::urlBasePath()) . ',jqueryPath:' . $builder->escJsStr($conf['jqueryPath']) . ',jelixWWWPath:' . $builder->escJsStr($conf['jelixWWWPath']) . '};
jFormsJQ.tForm = new jFormsJQForm(\'' . $builder->getName() . '\',\'' . $builder->getForm()->getSelector() . '\',\'' . $builder->getForm()->getContainer()->formId . '\');
jFormsJQ.tForm.setErrorDecorator(new ' . $builder->getOption('errorDecorator') . '());
jFormsJQ.declareForm(jFormsJQ.tForm);
//]]>
</script>';
}
示例6: outputMetaContent
public function outputMetaContent($resp)
{
$bp = jApp::urlBasePath();
$confWikiEditor =& jApp::config()->wikieditors;
if (isset($confWikiEditor[$this->ctrl->config . '.engine.file'])) {
$resp->addJSLink($bp . $confWikiEditor[$this->ctrl->config . '.engine.file']);
}
if (isset($confWikiEditor[$this->ctrl->config . '.config.path'])) {
$p = $bp . $confWikiEditor[$this->ctrl->config . '.config.path'];
$resp->addJSLink($p . jApp::config()->locale . '.js');
$resp->addCSSLink($p . 'style.css');
}
if (isset($confWikiEditor[$this->ctrl->config . '.skin'])) {
$resp->addCSSLink($bp . $confWikiEditor[$this->ctrl->config . '.skin']);
}
}
示例7: start
/**
* start a session
*/
public static function start()
{
$params =& jApp::config()->sessions;
// do not start the session if the request is made from the command line or if sessions are disabled in configuration
if (jApp::coord()->request instanceof jCmdLineRequest || !$params['start']) {
return false;
}
//make sure that the session cookie is only for the current application
if (!$params['shared_session']) {
session_set_cookie_params(0, jApp::urlBasePath());
}
if ($params['storage'] != '') {
/* on debian/ubuntu (maybe others), garbage collector launch probability is set to 0
and replaced by a simple cron job which is not enough for jSession (different path, db storage, ...),
so we set it to 1 as PHP's default value */
if (!ini_get('session.gc_probability')) {
ini_set('session.gc_probability', '1');
}
switch ($params['storage']) {
case 'dao':
session_set_save_handler(array(__CLASS__, 'daoOpen'), array(__CLASS__, 'daoClose'), array(__CLASS__, 'daoRead'), array(__CLASS__, 'daoWrite'), array(__CLASS__, 'daoDestroy'), array(__CLASS__, 'daoGarbageCollector'));
self::$_params = $params;
break;
case 'files':
session_save_path($params['files_path']);
break;
}
}
if ($params['name'] != '') {
#ifnot ENABLE_OPTIMIZED_SOURCE
if (!preg_match('#^[a-zA-Z0-9]+$#', $params['name'])) {
// regexp check because session name can only be alpha numeric according to the php documentation
throw new jException('jelix~errors.jsession.name.invalid');
}
#endif
session_name($params['name']);
}
if (isset($params['_class_to_load'])) {
foreach ($params['_class_to_load'] as $file) {
require_once $file;
}
}
session_start();
return true;
}
示例8: jtpl_meta_xml_xml
/**
* meta plugin : modify an xml response object
*
* @see jResponseXml
* @param jTpl $tpl template engine
* @param string $method indicates what you want to specify (possible values : xsl,css,csstheme)
* @param mixed $param parameter (a css style sheet url for "css" for example)
*/
function jtpl_meta_xml_xml($tpl, $method, $param)
{
$resp = jApp::coord()->response;
if ($resp->getFormatType() != 'xml') {
return;
}
switch ($method) {
case 'xsl':
$resp->addXSLStyleSheet($param);
break;
case 'css':
$resp->addCSSLink($param);
break;
case 'csstheme':
$resp->addCSSLink(jApp::urlBasePath() . 'themes/' . jApp::config()->theme . '/' . $param);
break;
}
}
示例9: outputMetaContent
public function outputMetaContent($resp)
{
$bp = jApp::urlBasePath();
$confHtmlEditor =& jApp::config()->htmleditors;
if (isset($confHtmlEditor[$this->ctrl->config . '.engine.file'])) {
if (is_array($confHtmlEditor[$this->ctrl->config . '.engine.file'])) {
foreach ($confHtmlEditor[$this->ctrl->config . '.engine.file'] as $url) {
$resp->addJSLink($bp . $url);
}
} else {
$resp->addJSLink($bp . $confHtmlEditor[$this->ctrl->config . '.engine.file']);
}
}
if (isset($confHtmlEditor[$this->ctrl->config . '.config'])) {
$resp->addJSLink($bp . $confHtmlEditor[$this->ctrl->config . '.config']);
}
$skin = $this->ctrl->config . '.skin.' . $this->ctrl->skin;
if (isset($confHtmlEditor[$skin]) && $confHtmlEditor[$skin] != '') {
$resp->addCSSLink($bp . $confHtmlEditor[$skin]);
}
}
示例10: outputMetaContent
public function outputMetaContent($t)
{
$resp = jApp::coord()->response;
if ($resp === null || $resp->getType() != 'html') {
return;
}
$config = jApp::config();
$www = $config->urlengine['jelixWWWPath'];
$bp = jApp::urlBasePath();
$resp->addJSLink($www . 'js/jforms_light.js');
$resp->addCSSLink($www . 'design/jform.css');
$heConf =& $config->htmleditors;
foreach ($t->_vars as $k => $v) {
if ($v instanceof jFormsBase && count($edlist = $v->getHtmlEditors())) {
foreach ($edlist as $ed) {
if (isset($heConf[$ed->config . '.engine.file'])) {
$file = $heConf[$ed->config . '.engine.file'];
if (is_array($file)) {
foreach ($file as $url) {
$resp->addJSLink($bp . $url);
}
} else {
$resp->addJSLink($bp . $file);
}
}
if (isset($heConf[$ed->config . '.config'])) {
$resp->addJSLink($bp . $heConf[$ed->config . '.config']);
}
$skin = $ed->config . '.skin.' . $ed->skin;
if (isset($heConf[$skin]) && $heConf[$skin] != '') {
$resp->addCSSLink($bp . $heConf[$skin]);
}
}
}
}
}
示例11: create
//.........这里部分代码省略.........
// if the value is a locale instead of lang, translate it
$paramStatic = $m[1];
}
}
} elseif ($typePS == 'L') {
if ($paramStatic === null) {
$paramStatic = jApp::config()->locale;
} else {
if (preg_match('/^\\w{2,3}$/', $paramStatic, $m)) {
// if the value is a lang instead of locale, translate it
$paramStatic = jLocale::langToLocale($paramStatic);
}
}
}
}
if ($paramStatic != $v) {
$ok = false;
break;
}
}
if ($ok) {
// static parameters correspond: we found our informations
$urlinfofound = $urlinfo[$i];
break;
}
}
if ($urlinfofound !== null) {
$urlinfo = $urlinfofound;
} else {
$urlinfo = $urlinfo[1];
}
}
// at this step, we have informations to build the url
$url->scriptName = jApp::urlBasePath() . $urlinfo[1];
if ($urlinfo[2]) {
$url->scriptName = jApp::coord()->request->getServerURI(true) . $url->scriptName;
}
if ($urlinfo[1] && !jApp::config()->urlengine['multiview']) {
$url->scriptName .= '.php';
}
// for some request types, parameters aren't in the url
// so we remove them
// it's a bit dirty to do that hardcoded here, but it would be a pain
// to load the request class to check whether we can remove or not
if (in_array($urlact->requestType, array('xmlrpc', 'jsonrpc', 'soap'))) {
$url->clearParam();
return $url;
}
if ($urlinfo[0] == 0) {
$s = new jSelectorUrlHandler($urlinfo[3]);
$c = $s->resource . 'UrlsHandler';
$handler = new $c();
$handler->create($urlact, $url);
if ($urlinfo[4] != '') {
$url->pathInfo = $urlinfo[4] . $url->pathInfo;
}
} elseif ($urlinfo[0] == 1) {
$pi = $urlinfo[5];
foreach ($urlinfo[3] as $k => $param) {
$typeParam = $urlinfo[4][$k];
$value = $url->getParam($param, '');
if ($typeParam & 2) {
$value = jUrl::escape($value, true);
} else {
if ($typeParam & 1) {
$value = str_replace('%2F', '/', urlencode($value));
示例12: generateMinifyUrl
protected function generateMinifyUrl($urlsList)
{
$url = jApp::urlBasePath() . jApp::config()->jResponseHtml['minifyEntryPoint'] . '?f=';
$url .= implode(',', $urlsList);
return $url;
}
示例13: handleError
static function handleError($type, $code, $message, $file, $line, $trace)
{
$errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace);
// for non fatal error appeared during init, let's just store it for loggers later
if ($type != 'error') {
self::$initErrorMessages[] = $errorLog;
return;
} else {
if (jServer::isCLI()) {
// fatal error appeared during init, in a CLI context
while (ob_get_level() && @ob_end_clean()) {
}
// log into file and output message in the console
echo 'Error during initialization: \\n';
foreach (self::$initErrorMessages as $err) {
@error_log($err->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
echo '* ' . $err->getMessage() . ' (' . $err->getFile() . ' ' . $err->getLine() . ")\n";
}
@error_log($errorLog->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
echo '* ' . $message . ' (' . $file . ' ' . $line . ")\n";
} else {
// fatal error appeared during init, let's display an HTML page
// since we don't know the request, we cannot return a response
// corresponding to the expected protocol
while (ob_get_level() && @ob_end_clean()) {
}
// log into file
foreach (self::$initErrorMessages as $err) {
@error_log($err->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
}
@error_log($errorLog->getFormatedMessage() . "\n", 3, jApp::logPath('errors.log'));
$msg = $errorLog->getMessage();
if (strpos($msg, '--') !== false) {
list($msg, $bin) = explode('--', $msg, 2);
// remove confidential data
}
// if accept text/html
if (isset($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'text/html')) {
if (file_exists(jApp::appPath('responses/error.en_US.php'))) {
$file = jApp::appPath('responses/error.en_US.php');
} else {
$file = JELIX_LIB_CORE_PATH . 'response/error.en_US.php';
}
$HEADTOP = '';
$HEADBOTTOM = '';
$BODYTOP = '';
$BODYBOTTOM = htmlspecialchars($msg);
$BASEPATH = jApp::urlBasePath();
if ($BASEPATH == '') {
$BASEPATH = '/';
}
header("HTTP/1.1 500 Internal jelix error");
header('Content-type: text/html');
include $file;
} else {
// output text response
header("HTTP/1.1 500 Internal jelix error");
header('Content-type: text/plain');
echo 'Error during initialization. ' . $msg;
}
}
}
exit(1);
}
示例14: generateMinifyUrl
protected function generateMinifyUrl($urlsList)
{
$entrypoint = 'minify.php';
if (isset(jApp::config()->jResponseHtml['minifyEntryPoint']) && jApp::config()->jResponseHtml['minifyEntryPoint']) {
$entrypoint = jApp::config()->jResponseHtml['minifyEntryPoint'];
}
$url = jApp::urlBasePath() . $entrypoint . '?f=';
$url .= implode(',', $urlsList);
return $url;
}
示例15: _compile
/**
* Generate the WSDL content
*/
private function _compile()
{
$url = jUrl::get($this->module . '~' . $this->controller . ':index@soap', array(), jUrl::JURL);
$url->clearParam();
$url->setParam('service', $this->module . '~' . $this->controller);
$serverUri = jUrl::getRootUrlRessourceValue('soap');
if ($serverUri === null) {
$serverUri = jUrl::getRootUrlRessourceValue('soap-' . $this->module);
}
if ($serverUri === null) {
$serverUri = jUrl::getRootUrlRessourceValue('soap-' . $this->module . '-' . $this->controller);
}
if ($serverUri === null) {
$serverUri = jApp::coord()->request->getServerURI();
}
$serviceURL = $serverUri . $url->toString();
$serviceNameSpace = $serverUri . jApp::urlBasePath();
$wsdl = new WSDLStruct($serviceNameSpace, $serviceURL, SOAP_RPC, SOAP_ENCODED);
$wsdl->setService(new IPReflectionClass($this->controllerClassName));
try {
$gendoc = $wsdl->generateDocument();
} catch (WSDLException $exception) {
throw new JException('jsoap~errors.wsdl.generation', $exception->msg);
}
return $gendoc;
}