本文整理汇总了PHP中jApp::getCurrentModule方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::getCurrentModule方法的具体用法?PHP jApp::getCurrentModule怎么用?PHP jApp::getCurrentModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::getCurrentModule方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $sel the selector
* @param boolean $enableRequestPart true if the selector can contain the request part
* @param boolean $toRetrieveUrl true if the goal to have this selector is to generate an url
*/
function __construct($sel, $enableRequestPart = false, $toRetrieveUrl = false)
{
$coord = jApp::coord();
$this->forUrl = $toRetrieveUrl;
// jSelectorAct is called by the url engine parser, before
// jcoordinator set its properties, so we set a value to avoid a
// parameter error on jelix_scan_action_sel. the value doesn't matter
// since the parser call jSelectorAct only for 404 page
if ($coord->actionName === null) {
$coord->actionName = 'default:index';
}
if ($this->_scan_act_sel($sel, $coord->actionName)) {
if ($this->module == '#') {
$this->module = $coord->moduleName;
} elseif ($this->module == '') {
$this->module = jApp::getCurrentModule();
}
if ($this->request == '' || !$enableRequestPart) {
$this->request = $coord->request->type;
}
$this->_createPath();
} else {
throw new jExceptionSelector('jelix~errors.selector.invalid.syntax', array($sel, $this->type));
}
}
示例2: __construct
function __construct($sel, $locale = null, $charset = null)
{
if ($locale === null) {
$locale = jApp::config()->locale;
}
if ($charset === null) {
$charset = jApp::config()->charset;
}
if (strpos($locale, '_') === false) {
$locale = jLocale::langToLocale($locale);
}
$this->locale = $locale;
$this->charset = $charset;
$this->_suffix = '.' . $charset . '.properties';
$this->_compilerPath = JELIX_LIB_CORE_PATH . 'jLocalesCompiler.class.php';
if (jelix_scan_locale_sel($sel, $this)) {
if ($this->module == '') {
$this->module = jApp::getCurrentModule();
}
$this->_createPath();
$this->_createCachePath();
} else {
throw new jExceptionSelector('jelix~errors.selector.invalid.syntax', array($sel, $this->type));
}
}
示例3: __construct
function __construct($sel)
{
if (jelix_scan_class_sel($sel, $this)) {
if ($this->module == '') {
$this->module = jApp::getCurrentModule();
}
$this->_createPath();
$this->_createCachePath();
} else {
throw new jExceptionSelector('jelix~errors.selector.invalid.syntax', array($sel, $this->type));
}
}
示例4: render
function render()
{
$file = explode('~', $this->tplname);
if (sizeof($file) < 2) {
$filePath = 'modules/' . jApp::getCurrentModule() . '/' . $this->templateDir . '/' . $this->tplname . $this->ext;
} else {
$filePath = 'modules/' . $file[0] . '/' . $this->templateDir . '/' . $file[1] . $this->ext;
}
if (file_exists($filePath)) {
require_once $filePath;
} else {
header("HTTP/{$this->httpVersion} 500 Internal jelix error");
header('Content-type: text/plain');
echo jApp::coord()->getGenericErrorMessage();
}
}
示例5: 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
* @author Laurent Jouanneau
* @copyright 2005 CopixTeam, 2005-2006 Laurent Jouanneau
* very few lines of code are copyrighted by CopixTeam, written by Laurent Jouanneau
* and released under GNU Lesser General Public Licence,
* in an experimental version of Copix Framework v2.3dev20050901,
* http://www.copix.org.
*/
public function create($urlact)
{
if ($this->dataCreateUrl == null) {
$sel = new jSelectorUrlCfgSig(jApp::config()->urlengine['significantFile']);
jIncluder::inc($sel);
$this->dataCreateUrl =& $GLOBALS['SIGNIFICANT_CREATEURL'];
}
$url = new jUrl('', $urlact->params, '');
$module = $url->getParam('module', jApp::getCurrentModule());
$action = $url->getParam('action');
// let's try to retrieve informations corresponding
// to the given action. this informations will allow us to build
// the url
$id = $module . '~' . $action . '@' . $urlact->requestType;
$urlinfo = null;
if (isset($this->dataCreateUrl[$id])) {
$urlinfo = $this->dataCreateUrl[$id];
$url->delParam('module');
$url->delParam('action');
} else {
$id = $module . '~*@' . $urlact->requestType;
if (isset($this->dataCreateUrl[$id])) {
$urlinfo = $this->dataCreateUrl[$id];
if ($urlinfo[0] != 3 || $urlinfo[3] === true) {
$url->delParam('module');
}
} else {
$id = '@' . $urlact->requestType;
if (isset($this->dataCreateUrl[$id])) {
$urlinfo = $this->dataCreateUrl[$id];
} else {
throw new Exception("Significant url engine doesn't find corresponding url to this action :" . $module . '~' . $action . '@' . $urlact->requestType);
}
}
}
/*
urlinfo =
or array(0,'entrypoint', https true/false, 'handler selector', 'basepathinfo')
or array(1,'entrypoint', https true/false,
array('year','month',), // list of dynamic values included in the url
array(true, false..), // list of integers which indicates for each
// dynamic value: 0: urlencode, 1:urlencode except '/', 2:escape
"/news/%1/%2/", // the url
true/false, // false : this is a secondary action
array('bla'=>'whatIWant' ) // list of static values
)
or array(2,'entrypoint', https true/false), // for the patterns "@request"
or array(3,'entrypoint', https true/false), // for the patterns "module~@request"
or array(4, array(1,...), array(1,...)...)
*/
if ($urlinfo[0] == 4) {
// an action is mapped to several urls
// so it isn't finished. Let's find building information
// into the array
$l = count($urlinfo);
$urlinfofound = null;
for ($i = 1; $i < $l; $i++) {
$ok = true;
// verify that given static parameters of the action correspond
// to those defined for this url
foreach ($urlinfo[$i][7] as $n => $v) {
// specialStatic are static values for which the url engine
// can compare not only with a given url parameter value, but
// also with a value stored some where (typically, a configuration value)
$specialStatic = !empty($v) && $v[0] == '$';
$paramStatic = $url->getParam($n, null);
if ($specialStatic) {
// special statique value
$typePS = $v[1];
$v = substr($v, 2);
if ($typePS == 'l') {
if ($paramStatic === null) {
$paramStatic = jLocale::getCurrentLang();
} else {
if (preg_match('/^(\\w{2,3})_\\w{2,3}$/', $paramStatic, $m)) {
// 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);
}
}
}
//.........这里部分代码省略.........
示例6: _getCacheFiles
/**
* create the cache filename
* @return string the filename
*/
private function _getCacheFiles($forCurrentResponse = true)
{
$module = jApp::getCurrentModule();
$ar = $this->_params;
ksort($ar);
$id = md5(serialize($ar));
$cacheFiles = array('content' => jApp::tempPath('zonecache/' . $module . '/' . strtolower(get_class($this)) . '/' . $id . '.php'));
if ($forCurrentResponse) {
//make distinct a cache files for metas according to response type as meta handling is often different for different responses
$respType = jApp::coord()->response->getType();
$cacheFiles['meta'] = jApp::tempPath('zonecache/' . $module . '/' . strtolower(get_class($this)) . '/meta~' . $respType . '~' . $id . '.php');
} else {
foreach (jApp::config()->responses as $respType) {
//list all response types
if (substr($respType, -5) != '.path') {
$cacheFiles['meta.' . $respType] = jApp::tempPath('zonecache/' . $module . '/' . strtolower(get_class($this)) . '/meta~' . $respType . '~' . $id . '.php');
}
}
}
return $cacheFiles;
}