本文整理汇总了PHP中WYSIJA::load_lang方法的典型用法代码示例。如果您正苦于以下问题:PHP WYSIJA::load_lang方法的具体用法?PHP WYSIJA::load_lang怎么用?PHP WYSIJA::load_lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WYSIJA
的用法示例。
在下文中一共展示了WYSIJA::load_lang方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_textdomain_mofile
/**
* function to rewrite the path of the file if the file doesn't exist
* @param type $mofile
* @param type $domain
* @return type
*/
public static function load_textdomain_mofile($mofile, $domain)
{
$extensionloaded = WYSIJA::load_lang('get_all');
if (isset($extensionloaded[$domain]) && !file_exists($mofile)) {
return WYSIJA_PLG_DIR . $domain . DS . 'languages' . DS . $extensionloaded[$domain] . '-' . get_locale() . '.mo';
}
return $mofile;
}
示例2: get
/**
* function to generate objects of different types, managing file requiring in order to be the most efficient
* @staticvar array $arrayOfObjects
* @param type $name
* @param type $type
* @return type
*/
public static function get($name, $type, $forceside = false, $extendedplugin = 'wysija-newsletters')
{
static $arrayOfObjects;
WYSIJA::load_lang($extendedplugin);
/*store all the objects made so that we can reuse them accross the application*/
if (isset($arrayOfObjects[$extendedplugin][$type . $name])) {
return $arrayOfObjects[$extendedplugin][$type . $name];
}
if ($forceside) {
$side = $forceside;
} else {
$side = WYSIJA_SIDE;
}
if ($extendedplugin == 'wysija-newsletters') {
$extendeconstant = strtoupper("wysija");
if (!defined($extendeconstant)) {
define($extendeconstant, $extendeconstant);
}
$extendedpluginname = 'wysija';
} else {
$extendeconstant = strtoupper($extendedplugin);
if (!defined($extendeconstant)) {
define($extendeconstant, $extendeconstant);
}
$extendedpluginname = $extendedplugin;
}
//security to protect against ./../ includes
$name = preg_replace('#[^a-z0-9_]#i', '', $name);
switch ($type) {
case 'controller':
$ctrdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'controllers' . DS;
/*require the parent class necessary*/
require_once WYSIJA_CORE . 'controller.php';
/*require the common controller file*/
if (defined('DOING_AJAX')) {
$classpath = $ctrdir . 'ajax' . DS . $name . '.php';
} else {
$classpath = $ctrdir . $side . DS . $name . '.php';
require_once WYSIJA_CTRL . $side . '.php';
/*require the side specific controller file*/
}
$classname = strtoupper($extendedpluginname) . '_control_' . $side . '_' . $name;
break;
case 'view':
$viewdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'views' . DS;
$classpath = $viewdir . $side . DS . $name . ".php";
$classname = strtoupper($extendedpluginname) . '_view_' . $side . '_' . $name;
require_once WYSIJA_CORE . 'view.php';
/*require the common view file*/
require_once WYSIJA_VIEWS . $side . '.php';
/*require the side specific view file*/
break;
case 'helper':
$helpdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'helpers' . DS;
$classpath = $helpdir . $name . '.php';
$classname = strtoupper($extendedpluginname) . '_help_' . $name;
break;
case 'model':
$modeldir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'models' . DS;
$classpath = $modeldir . $name . '.php';
$classname = strtoupper($extendedpluginname) . '_model_' . $name;
/*require the parent class necessary*/
require_once WYSIJA_CORE . 'model.php';
break;
default:
WYSIJA::setInfo('error', 'WYSIJA::get does not accept this type of file "' . $type . '" .');
return false;
}
if (!file_exists($classpath)) {
WYSIJA::setInfo('error', 'file has not been recognised ' . $classpath);
return;
}
require_once $classpath;
return $arrayOfObjects[$extendedplugin][$type . $name] = new $classname($extendedpluginname);
}