本文整理汇总了PHP中jApp::config方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::config方法的具体用法?PHP jApp::config怎么用?PHP jApp::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create a jurl object with the given action data
* @param jUrlAction $url information about the action
* @return jUrl the url correspondant to the action
*/
public function create($urlact)
{
$m = $urlact->getParam('module');
$a = $urlact->getParam('action');
$scriptName = $this->getBasePath($urlact->requestType, $m, $a);
$script = $this->getScript($urlact->requestType, $m, $a);
if (isset(jApp::config()->basic_significant_urlengine_entrypoints[$script]) && jApp::config()->basic_significant_urlengine_entrypoints[$script]) {
if (!jApp::config()->urlengine['multiview']) {
$script .= '.php';
}
$scriptName .= $script;
}
$url = new jUrl($scriptName, $urlact->params, '');
// 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();
} else {
$pi = '/' . $m . '/';
if ($a != 'default:index') {
list($c, $a) = explode(':', $a);
$pi .= $c . '/';
if ($a != 'index') {
$pi .= $a;
}
}
$url->pathInfo = $pi;
$url->delParam('module');
$url->delParam('action');
}
return $url;
}
示例2: computeUrlFilePath
public static function computeUrlFilePath($config = null)
{
$basePath = jApp::config()->urlengine['basePath'];
if (!$config) {
$config =& jApp::config()->imagemodifier;
}
if ($config['src_url'] && $config['src_path']) {
$srcUri = $config['src_url'];
if ($srcUri[0] != '/' && strpos($srcUri, 'http:') !== 0) {
$srcUri = $basePath . $srcUri;
}
$srcPath = str_replace(array('www:', 'app:'), array(jApp::wwwPath(), jApp::appPath()), $config['src_path']);
} else {
$srcUri = jApp::coord()->request->getServerURI() . $basePath;
$srcPath = jApp::wwwPath();
}
if ($config['cache_path'] && $config['cache_url']) {
$cacheUri = $config['cache_url'];
if ($cacheUri[0] != '/' && strpos($cacheUri, 'http:') !== 0) {
$cacheUri = $basePath . $cacheUri;
}
$cachePath = str_replace(array('www:', 'app:'), array(jApp::wwwPath(), jApp::appPath()), $config['cache_path']);
} else {
$cachePath = jApp::wwwPath('cache/images/');
$cacheUri = jApp::coord()->request->getServerURI() . $basePath . 'cache/images/';
}
return array($srcPath, $srcUri, $cachePath, $cacheUri);
}
示例3: index
/**
* Displays a list of project for a given repository.
*
* @param string $repository. Name of the repository.
* @return Html page with a list of projects.
*/
function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
}
$rep = $this->getResponse('html');
// Get lizmap services
$services = lizmap::getServices();
// only maps
if ($services->onlyMaps) {
$repository = lizmap::getRepository($services->defaultRepository);
if ($repository && jAcl2::check('lizmap.repositories.view', $repository->getKey())) {
$project = lizmap::getProject($repository->getKey() . '~' . $services->defaultProject);
if ($project) {
// test redirection to an other controller
$items = jEvent::notify('mainviewGetMaps')->getResponse();
foreach ($items as $item) {
if ($item->parentId == $repository->getKey() && $item->id == $services->defaultProject) {
$rep = $this->getResponse('redirectUrl');
$rep->url = $item->url;
return $rep;
}
}
// redirection to default controller
$rep = $this->getResponse('redirect');
$rep->action = 'view~map:index';
return $rep;
}
}
}
// Get repository data
$repository = $this->param('repository');
$repositoryList = array();
if ($repository) {
if (!jAcl2::check('lizmap.repositories.view', $repository)) {
$rep = $this->getResponse('redirect');
$rep->action = 'view~default:index';
jMessage::add(jLocale::get('view~default.repository.access.denied'), 'error');
return $rep;
}
}
$title = jLocale::get("view~default.repository.list.title");
$rep->body->assign('repositoryLabel', $title);
$rep->body->assign('isConnected', jAuth::isConnected());
$rep->body->assign('user', jAuth::getUserSession());
if ($services->allowUserAccountRequests) {
$rep->body->assign('allowUserAccountRequests', True);
}
if ($repository) {
$lrep = lizmap::getRepository($repository);
$title .= ' - ' . $lrep->getData('label');
}
$rep->title = $title;
$rep->body->assignZone('MAIN', 'main_view', array('repository' => $repository));
$rep->addJSCode("\n \$(window).load(function() {\n \$('.liz-project-img').parent().mouseenter(function(){\n var self = \$(this);\n self.find('.liz-project-desc').slideDown();\n self.css('cursor','pointer');\n }).mouseleave(function(){\n var self = \$(this);\n self.find('.liz-project-desc').hide();\n }).click(function(){\n var self = \$(this);\n window.location = self.parent().find('a.liz-project-view').attr('href');\n return false;\n });\n });\n ");
// Js hack to normalize the height of the project thumbnails to avoid line breaks with long project titles
$bp = jApp::config()->urlengine['basePath'];
$rep->addJSLink($bp . 'js/view.js');
return $rep;
}
示例4: getMenus
/**
* get the menus to be added inside the ohers menu item
* @return $menus array of menus
*/
public function getMenus()
{
$menus = array();
if (file_exists(jApp::configPath() . '/havefnubb/hfnumenus.xml')) {
$doc = new DOMDocument();
$doc->load(realpath(jApp::configPath()) . '/havefnubb/hfnumenus.xml');
$xpath = new DOMXPath($doc);
$query = '/menus/menu';
$entries = $xpath->query($query);
$gJConfig = jApp::config();
foreach ($entries as $idx => $menu) {
$queryName = '//name[@lang="' . $gJConfig->locale . '"]';
$items = $xpath->query($queryName);
$name = $items->item($idx)->nodeValue;
$queryItemName = '//menu/itemName';
$items = $xpath->query($queryItemName);
$itemName = $items->item($idx)->nodeValue;
$queryUrl = '//menu/url';
$items = $xpath->query($queryUrl);
$url = $items->item($idx)->nodeValue;
$queryOrder = '//menu/order';
$items = $xpath->query($queryOrder);
$order = $items->item($idx)->nodeValue;
$menus[] = array('itemName' => $itemName, 'name' => $name, 'url' => $url, 'order' => $order);
}
}
return $menus;
}
示例5: _initParams
protected function _initParams()
{
$argv = $_SERVER['argv'];
$scriptName = array_shift($argv);
$mod = jApp::config()->startModule;
$act = jApp::config()->startAction;
if ($this->onlyDefaultAction) {
if ($_SERVER['argc'] > 1 && $argv[0] == 'help') {
$argv[0] = $mod . '~' . $act;
$mod = 'jelix';
$act = 'help:index';
}
} else {
if ($_SERVER['argc'] != 1) {
$argsel = array_shift($argv);
if ($argsel == 'help') {
$mod = 'jelix';
$act = 'help:index';
} else {
if (($pos = strpos($argsel, '~')) !== false) {
$mod = substr($argsel, 0, $pos);
$act = substr($argsel, $pos + 1);
} else {
$act = $argsel;
}
}
}
}
$this->params = $argv;
$this->params['module'] = $mod;
$this->params['action'] = $act;
}
示例6: __construct
function __construct()
{
parent::__construct();
global $gJConfig;
$config = jApp::config();
$baseDirectory = $config->urlengine['basePath'];
$this->addCSSLink($baseDirectory . "bootstrap/css/bootstrap.css");
$this->addCSSLink($baseDirectory . "bootstrap/css/bootstrap.min.css");
$this->addCSSLink($baseDirectory . "bootstrap/css/agency.css");
//var_dump($baseDirectory);
$this->addCSSLink($baseDirectory . "bootstrap/font-awesome/css/font-awesome.css");
$this->addCSSLink($baseDirectory . "bootstrap/js/jquery.js");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
//$this->addCSSLink($baseDirectory."");
$this->addJsLink($baseDirectory . "bootstrap/js/agency.js");
$this->addJsLink($baseDirectory . "bootstrap/js/bootstrap.js");
$this->addJsLink($baseDirectory . "bootstrap/js/bootstrap.min.js");
$this->addJsLink($baseDirectory . "bootstrap/js/cbpAnimatedHeader.js");
$this->addJsLink($baseDirectory . "bootstrap/js/classie.js");
$this->addJsLink($baseDirectory . "bootstrap/js/contact_me.js");
$this->addJsLink($baseDirectory . "bootstrap/js/jqBootstrapValidation.js");
$this->addJsLink($baseDirectory . "bootstrap/js/jquery.js");
//$this->addJsLink($baseDirectory."");
//$this->addCSSLink(jApp::config()->urlengine['jelixWWWPath'].'design/jelix.css');
//$this->addCSSLink($theme.'css/screen.css');
// Include your common CSS and JS files here
}
示例7: _loadLocales
/**
* Loads the resources for a given locale/charset.
* @param string $locale the locale
* @param string $charset the charset
*/
protected function _loadLocales($locale, $charset)
{
$this->_loadedCharset[] = $charset;
$source = $this->fic->getPath();
$cache = $this->fic->getCompiledFilePath();
// check if we have a compiled version of the ressources
if (is_readable($cache)) {
$okcompile = true;
if (jApp::config()->compilation['force']) {
$okcompile = false;
} else {
if (jApp::config()->compilation['checkCacheFiletime']) {
if (is_readable($source) && filemtime($source) > filemtime($cache)) {
$okcompile = false;
}
}
}
if ($okcompile) {
include $cache;
$this->_strings[$charset] = $_loaded;
return;
}
}
$this->_loadResources($source, $charset);
if (isset($this->_strings[$charset])) {
$content = '<?php $_loaded= ' . var_export($this->_strings[$charset], true) . ' ?>';
jFile::write($cache, $content);
}
}
示例8: jtpl_function_html_link_to_remote
/**
* function plugin : Ajax request
*
* it creates a javascript ajax function
* example :
* <pre>
* {link_to_remote
* 'Link', <!-- link label -->
* 'result', <!-- id dom for ajax result -->
* 'test~default:ajax', array('id'=>'34'), <!-- jurl request -->
* array(
* 'position'=>'html', <!-- html or append or prepend (default html) -->
* 'method'=>'GET', <!-- GET or POST (default POST) -->
* 'beforeSend'=>'alert("beforeSend")', <!-- JS script before send (default null) -->
* 'complete'=>'alert("complete")', <!-- JS script after send (default null)-->
* 'error'=>'alert("error")', <!-- JS if error (default null) -->
* )}
* <div id="result"></div>
* </pre>
*/
function jtpl_function_html_link_to_remote($tpl, $label, $element_id, $action_selector, $action_parameters, $option)
{
$resp = jApp::coord()->response;
static $id_link_to_remote = 0;
if ($resp && $resp->getFormatType() == 'html') {
// Add js link
$resp->addJSLink(jApp::config()->urlengine['jqueryPath'] . 'jquery.js');
}
$id_link_to_remote++;
$url = jUrl::get($action_selector, $action_parameters);
$position = array_key_exists("position", $option) ? $option['position'] : 'html';
$method = array_key_exists("method", $option) ? $option['method'] : 'GET';
$beforeSend = array_key_exists("beforeSend", $option) ? $option['beforeSend'] : '';
$complete = array_key_exists("complete", $option) ? $option['complete'] : '';
$error = array_key_exists("error", $option) ? $option['error'] : '';
// Link
echo '<a href="#" onclick="link_to_remote_' . $id_link_to_remote . '();">' . $label . "</a>\n";
// Script
echo '
<script type="text/javascript">//<![CDATA[
function link_to_remote_' . $id_link_to_remote . '() {
$.ajax({
type: \'' . $method . "',\n url: '" . $url . "',\n beforeSend: function(){" . $beforeSend . ";},\n complete: function(){" . $complete . ";},\n error: function(){" . $error . ';},
success: function(msg){
$(\'#' . $element_id . "')." . $position . "(msg);\n }\n });\n }; //]]>\n </script>";
}
示例9: read_rss
/**
* display the RSS of the forum
*/
public function read_rss()
{
$ftitle = jUrl::escape($this->param('ftitle'), true);
$id_forum = (int) $this->param('id_forum');
if (!jAcl2::check('hfnu.posts.list', 'forum' . $id_forum)) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
if ($id_forum == 0) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
$forum = jClasses::getService('havefnubb~hfnuforum')->getForum($id_forum);
if (jUrl::escape($forum->forum_name, true) != $ftitle) {
$rep = $this->getResponse('redirect');
$rep->action = jApp::config()->urlengine['notfoundAct'];
return $rep;
}
jApp::coord()->getPlugin('history')->change('label', htmlentities($forum->forum_name, ENT_COMPAT, 'UTF-8'));
$feed_reader = new jFeedReader();
$feed_reader->setCacheDir(jApp::varPath('feeds'));
$feed_reader->setTimeout(2);
$feed_reader->setUserAgent('HaveFnuBB - http://www.havefnubb.org/');
$feed = $feed_reader->parse($forum->forum_url);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('feed', $feed);
$tpl->assign('forum', $forum);
$rep->title = $forum->forum_name;
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~forum_rss.view'));
return $rep;
}
示例10: __construct
/**
* constructor
*/
function __construct()
{
if (jApp::config()->httpVersion != "") {
$this->httpVersion = jApp::config()->httpVersion;
$this->forcedHttpVersion = true;
}
}
示例11: _execute
protected function _execute(InputInterface $input, OutputInterface $output)
{
$group = $input->getArgument('group');
$labelkey = $input->getArgument('labelkey');
$label = $input->getArgument('label');
$cnx = \jDb::getConnection('jacl2_profile');
$sql = "SELECT id_aclsbjgrp FROM " . $cnx->prefixTable('jacl2_subject_group') . " WHERE id_aclsbjgrp=" . $cnx->quote($group);
$rs = $cnx->query($sql);
if ($rs->fetch()) {
throw new \Exception("This subject group already exists");
}
$sql = "INSERT into " . $cnx->prefixTable('jacl2_subject_group') . " (id_aclsbjgrp, label_key) VALUES (";
$sql .= $cnx->quote($group) . ',';
$sql .= $cnx->quote($labelkey);
$sql .= ')';
$cnx->exec($sql);
if ($this->verbose()) {
$ouput->writeln("Rights: group of subjects '" . $group . "' is created");
}
if ($label && preg_match("/^([a-zA-Z0-9_\\.]+)~([a-zA-Z0-9_]+)\\.([a-zA-Z0-9_\\.]+)\$/", $labelkey, $m)) {
$localestring = "\n" . $m[3] . '=' . $label;
$path = $this->getModulePath($m[1]);
$file = $path . 'locales/' . \jApp::config()->locale . '/' . $m[2] . '.' . \jApp::config()->charset . '.properties';
if (file_exists($file)) {
$localestring = file_get_contents($file) . $localestring;
}
file_put_contents($file, $localestring);
if ($output->isVerbose()) {
$output->writeln("locale string " . $m[3] . " is created into " . $file);
}
}
}
示例12: compileItem
public function compileItem($sourceFile, $module)
{
if (is_readable($sourceFile)) {
$xml = simplexml_load_file($sourceFile);
$config = jApp::config()->disabledListeners;
if (isset($xml->listener)) {
foreach ($xml->listener as $listener) {
$listenerName = (string) $listener['name'];
$selector = $module . '~' . $listenerName;
foreach ($listener->event as $eventListened) {
$name = (string) $eventListened['name'];
if (isset($config[$name])) {
if (is_array($config[$name])) {
if (in_array($selector, $config[$name])) {
continue;
}
} else {
if ($config[$name] == $selector) {
continue;
}
}
}
// key = event name , value = list of file listener
$this->eventList[$name][] = array($module, $listenerName);
}
}
}
}
return true;
}
示例13: extensionsConfig
function extensionsConfig()
{
$rep = $this->getResponse('js');
$config = array();
$dir = "modules/";
//
$iter = new DirectoryIterator($dir);
foreach ($iter as $file) {
if (!$file->isDot()) {
if ($file->isDir() && file_exists($dir . $file->getFilename() . '/urls.json')) {
$doc = jFile::read($dir . $file->getFilename() . '/urls.json');
$urls = json_decode($doc);
foreach ($urls->config as $row) {
$config['config'][] = $row;
}
foreach ($urls->modules as $row) {
$config['modules'][] = $row;
}
}
}
}
$tpl = new jTpl();
$tpl->assign('config', $config);
$tpl->assign('rootUrl', jApp::config()->urlengine['basePath']);
$content = $tpl->fetch('bos~init');
$rep->data = $content;
return $rep;
}
示例14: loadClass
public static function loadClass($class)
{
if (strpos($class, 'jelix\\') === 0) {
$f = LIB_PATH . 'jelix-legacy/' . str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 6)) . '.php';
} elseif (preg_match('/^j(Dao|Tpl|Event|Db|Controller|Forms|Auth|Installer|KV).*/i', $class, $m)) {
$f = self::$libPath[$m[1]] . $class . '.class.php';
} elseif (preg_match('/^cDao(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/', $class, $m)) {
// for DAO which are stored in sessions for example
if (!isset(jApp::config()->_modulesPathList[$m[1]])) {
//this may happen if we have several entry points, but the current one does not have this module accessible
return;
}
$s = new jSelectorDaoDb($m[1] . '~' . $m[2], '', $m[3]);
if (jApp::config()->compilation['checkCacheFiletime']) {
// if it is needed to check the filetime, then we use jIncluder
// because perhaps we will have to recompile the dao before the include
jIncluder::inc($s);
} else {
$f = $s->getCompiledFilePath();
// we should verify that the file is here and if not, we recompile
// (case where the temp has been cleaned, see bug #6062 on berlios.de)
if (!file_exists($f)) {
jIncluder::inc($s);
} else {
require $f;
}
}
return;
} else {
$f = JELIX_LIB_UTILS_PATH . $class . '.class.php';
}
if (file_exists($f)) {
require $f;
}
}
示例15: run
public function run()
{
$this->loadAppConfig();
$config = jApp::config();
$model_lang = $this->getParam('model_lang', $config->locale);
$lang = $this->getParam('lang');
foreach ($config->_modulesPathList as $module => $dir) {
$source_dir = $dir . 'locales/' . $model_lang . '/';
if (!file_exists($source_dir)) {
continue;
}
$target_dir = jApp::varPath('overloads/' . $module . '/locales/' . $lang . '/');
jFile::createDir($target_dir);
if ($dir_r = opendir($source_dir)) {
while (FALSE !== ($fich = readdir($dir_r))) {
if ($fich != "." && $fich != ".." && is_file($source_dir . $fich) && strpos($fich, '.' . $config->charset . '.properties') && !file_exists($target_dir . $fich)) {
copy($source_dir . $fich, $target_dir . $fich);
if ($this->verbose()) {
echo "Copy Locales file {$fich} from {$source_dir} to {$target_dir}.\n";
}
}
}
closedir($dir_r);
}
}
}