本文整理汇总了PHP中MText::_方法的典型用法代码示例。如果您正苦于以下问题:PHP MText::_方法的具体用法?PHP MText::_怎么用?PHP MText::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MText
的用法示例。
在下文中一共展示了MText::_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
public static function _(){
$isSaved = MRequest::getCookie("profilesissaved",0, MREQUEST_INT);
if($isSaved){
MRequest::setCookie("profilesissaved", 0);
$css = _FM_IS_DEMO ? "rejectedAdvice" : "savedAdvice";
$text = _FM_IS_DEMO ? "notfordemo" : "datasaved";
echo '
<div id="mSavedAdvice" class="'.$css.'"><div>'.MText::_($text).'</div></div>
<script type="text/javascript">
dojo.addOnLoad(function(){
var node = dojo.byId("mSavedAdvice");
dojo.style(node,{opacity: 0});
_fx.fadeOpacity(node,300,0,1,function(){
setTimeout(function(){
var node = dojo.byId("mSavedAdvice");
dojo.style(node,{opacity: 1});
_fx.fadeOpacity(node,400,1,0,function(){
_removeNode(dojo.byId("mSavedAdvice"));
});
},2000);
});
});
</script>
';
}
}
示例2: getInstance
public static function getInstance($handler = null, $options = array())
{
static $now = null;
MCacheStorage::addIncludePath(MPATH_WP_CNT . '/miwi/framework/cache/storage');
if (!isset($handler)) {
$conf = MFactory::getConfig();
$handler = $conf->get('cache_handler');
if (empty($handler)) {
return MError::raiseWarning(500, MText::_('MLIB_CACHE_ERROR_CACHE_HANDLER_NOT_SET'));
}
}
if (is_null($now)) {
$now = time();
}
$options['now'] = $now;
$handler = strtolower(preg_replace('/[^A-Z0-9_\\.-]/i', '', $handler));
$class = 'MCacheStorage' . ucfirst($handler);
if (!class_exists($class)) {
mimport('joomla.filesystem.path');
if ($path = MPath::find(MCacheStorage::addIncludePath(), strtolower($handler) . '.php')) {
include_once $path;
} else {
return MError::raiseWarning(500, MText::sprintf('MLIB_CACHE_ERROR_CACHE_STORAGE_LOAD', $handler));
}
}
return new $class($options);
}
示例3: getOptions
protected function getOptions()
{
// Initialise variables
$folder = $this->element['folder'];
if (!empty($folder)) {
// Get list of plugins
$db = MFactory::getDbo();
$query = $db->getQuery(true);
$query->select('element AS value, name AS text');
$query->from('#__extensions');
$query->where('folder = ' . $db->q($folder));
$query->where('enabled = 1');
$query->order('ordering, name');
$db->setQuery($query);
$options = $db->loadObjectList();
$lang = MFactory::getLanguage();
foreach ($options as $i => $item) {
$source = MPATH_PLUGINS . '/' . $folder . '/' . $item->value;
$extension = 'plg_' . $folder . '_' . $item->value;
$lang->load($extension . '.sys', MPATH_ADMINISTRATOR, null, false, false) || $lang->load($extension . '.sys', $source, null, false, false) || $lang->load($extension . '.sys', MPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false);
$options[$i]->text = MText::_($item->text);
}
if ($db->getErrorMsg()) {
MError::raiseWarning(500, MText::_('MFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
return '';
}
} else {
MError::raiseWarning(500, MText::_('MFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例4: display
public function display($tpl = null)
{
$document = MFactory::getDocument();
$document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
// Toolbar
MToolBarHelper::title(MText::_('MiwoSQL') . ' - ' . MText::_('COM_MIWOSQL_RUN_QUERY'), 'miwosql');
if (MiwosqlHelper::is30()) {
MToolBarHelper::custom('run', 'play.png', 'play.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false);
MToolBarHelper::divider();
MToolBarHelper::custom('savequery', 'folder-close.png', 'folder-close.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false);
MToolBarHelper::divider();
MToolBarHelper::custom('csv', 'upload.png', 'upload.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false);
} else {
MToolBarHelper::custom('run', 'run.png', 'run.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false);
MToolBarHelper::divider();
MToolBarHelper::custom('savequery', 'savequery.png', 'savequery.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false);
MToolBarHelper::divider();
MToolBarHelper::custom('csv', 'csv.png', 'csv.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false);
}
// ACL
if (version_compare(MVERSION, '1.6.0', 'ge') && MFactory::getUser()->authorise('core.admin', 'com_miwosql')) {
MToolBarHelper::divider();
MToolBarHelper::preferences('com_miwosql', '550');
}
$this->data = $this->get('Data');
$this->tables = $this->get('Tables');
$this->prefix = $this->get('Prefix');
parent::display($tpl);
}
示例5: getInput
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="checkboxes ' . (string) $this->element['class'] . '"' : ' class="checkboxes"';
// Start the checkbox field output.
$html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
// Get the field options.
$options = $this->getOptions();
// Build the checkbox field output.
$html[] = '<ul>';
foreach ($options as $i => $option) {
// Initialize some option attributes.
$checked = in_array((string) $option->value, (array) $this->value) ? ' checked="checked"' : '';
$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
$html[] = '<li>';
$html[] = '<input type="checkbox" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
$html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . MText::_($option->text) . '</label>';
$html[] = '</li>';
}
$html[] = '</ul>';
// End the checkbox field output.
$html[] = '</fieldset>';
return implode($html);
}
示例6: __construct
public function __construct()
{
$isLoaded = MPluginHelper::importPlugin('authentication');
if (!$isLoaded) {
MError::raiseWarning('SOME_ERROR_CODE', MText::_('MLIB_USER_ERROR_AUTHENTICATION_LIBRARIES'));
}
}
示例7: getOptions
protected function getOptions()
{
MLog::add('MFormFieldEditors is deprecated. Use MFormFieldPlugins instead (with folder="editors").', MLog::WARNING, 'deprecated');
// Get the database object and a new query object.
$db = MFactory::getDBO();
$query = $db->getQuery(true);
// Build the query.
$query->select('element AS value, name AS text');
$query->from('#__extensions');
$query->where('folder = ' . $db->quote('editors'));
$query->where('enabled = 1');
$query->order('ordering, name');
// Set the query and load the options.
$db->setQuery($query);
$options = $db->loadObjectList();
$lang = MFactory::getLanguage();
foreach ($options as $i => $option) {
$lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
$options[$i]->text = MText::_($option->text);
}
// Check for a database error.
if ($db->getErrorNum()) {
MError::raiseWarning(500, $db->getErrorMsg());
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例8: runSqlFile
public static function runSqlFile($sql_file)
{
$db = MFactory::getDbo();
if (!file_exists($sql_file)) {
return;
}
$buffer = file_get_contents($sql_file);
if ($buffer === false) {
return;
}
$queries = $db->splitSql($buffer);
if (count($queries) == 0) {
return;
}
foreach ($queries as $query) {
$query = trim($query);
if ($query != '' && $query[0] != '#') {
$db->setQuery($query);
if (!$db->query()) {
MError::raiseWarning(1, 'MInstaller::install: ' . MText::_('SQL Error') . " " . $db->stderr(true));
return;
}
}
}
}
示例9: loadButtonType
public function loadButtonType($type, $new = false)
{
$signature = md5($type);
if (isset($this->_buttons[$signature]) && $new === false) {
return $this->_buttons[$signature];
}
if (!class_exists('MButton')) {
MError::raiseWarning('SOME_ERROR_CODE', MText::_('MLIB_HTML_BUTTON_BASE_CLASS'));
return false;
}
$buttonClass = 'MButton' . $type;
if (!class_exists($buttonClass)) {
if (isset($this->_buttonPath)) {
$dirs = $this->_buttonPath;
} else {
$dirs = array();
}
$file = MFilterInput::getInstance()->clean(str_replace('_', DIRECTORY_SEPARATOR, strtolower($type)) . '.php', 'path');
mimport('framework.filesystem.path');
if ($buttonFile = MPath::find($dirs, $file)) {
include_once $buttonFile;
} else {
MError::raiseWarning('SOME_ERROR_CODE', MText::sprintf('MLIB_HTML_BUTTON_NO_LOAD', $buttonClass, $buttonFile));
return false;
}
}
if (!class_exists($buttonClass)) {
//return MError::raiseError('SOME_ERROR_CODE', "Module file $buttonFile does not contain class $buttonClass.");
return false;
}
$this->_buttons[$signature] = new $buttonClass($this);
return $this->_buttons[$signature];
}
示例10: _getFilePosition
public function _getFilePosition()
{
// gzipped file... unpack it first
$position = 0;
$info = @unpack('CCM/CFLG/VTime/CXFL/COS', substr($this->_data, $position + 2));
if (!$info) {
$this->set('error.message', MText::_('MLIB_FILESYSTEM_GZIP_UNABLE_TO_DECOMPRESS'));
return false;
}
$position += 10;
if ($info['FLG'] & $this->_flags['FEXTRA']) {
$XLEN = unpack('vLength', substr($this->_data, $position + 0, 2));
$XLEN = $XLEN['Length'];
$position += $XLEN + 2;
}
if ($info['FLG'] & $this->_flags['FNAME']) {
$filenamePos = strpos($this->_data, "", $position);
$position = $filenamePos + 1;
}
if ($info['FLG'] & $this->_flags['FCOMMENT']) {
$commentPos = strpos($this->_data, "", $position);
$position = $commentPos + 1;
}
if ($info['FLG'] & $this->_flags['FHCRC']) {
$hcrc = unpack('vCRC', substr($this->_data, $position + 0, 2));
$hcrc = $hcrc['CRC'];
$position += 2;
}
return $position;
}
示例11: getOptions
protected function getOptions()
{
// Initialize variables.
// This gets the connectors available in the platform and supported by the server.
$available = MDatabase::getConnectors();
$supported = $this->element['supported'];
if (!empty($supported)) {
$supported = explode(',', $supported);
foreach ($supported as $support) {
if (in_array($support, $available)) {
$options[$support] = ucfirst($support);
}
}
} else {
foreach ($available as $support) {
$options[$support] = ucfirst($support);
}
}
// This will come into play if an application is installed that requires
// a database that is not available on the server.
if (empty($options)) {
$options[''] = MText::_('MNONE');
}
return $options;
}
示例12: getLabel
protected function getLabel()
{
$html = array();
$class = $this->element['class'] ? (string) $this->element['class'] : '';
$html[] = '<span class="spacer">';
$html[] = '<span class="before"></span>';
$html[] = '<span class="' . $class . '">';
if ((string) $this->element['hr'] == 'true') {
$html[] = '<hr class="' . $class . '" />';
} else {
$label = '';
// Get the label text from the XML element, defaulting to the element name.
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
$text = $this->translateLabel ? MText::_($text) : $text;
// Build the class for the label.
$class = !empty($this->description) ? 'hasTip' : '';
$class = $this->required == true ? $class . ' required' : $class;
// Add the opening label tag and main attributes attributes.
$label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"';
// If a description is specified, use it to build a tooltip.
if (!empty($this->description)) {
$label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? MText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
}
// Add the label text and closing tag.
$label .= '>' . $text . '</label>';
$html[] = $label;
}
$html[] = '</span>';
$html[] = '<span class="after"></span>';
$html[] = '</span>';
return implode('', $html);
}
示例13: getOptions
protected function getOptions()
{
// Initialize variables.
$options = array();
// Initialize some field attributes.
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
$query = (string) $this->element['query'];
// Get the database object.
$db = MFactory::getDBO();
// Set the query and get the result list.
$db->setQuery($query);
$items = $db->loadObjectlist();
// Check for an error.
if ($db->getErrorNum()) {
MError::raiseWarning(500, $db->getErrorMsg());
return $options;
}
// Build the field options.
if (!empty($items)) {
foreach ($items as $item) {
if ($translate == true) {
$options[] = MHtml::_('select.option', $item->{$key}, MText::_($item->{$value}));
} else {
$options[] = MHtml::_('select.option', $item->{$key}, $item->{$value});
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例14: _getCommand
protected function _getCommand($ref, $com, $override, $component)
{
// Get Help URL
mimport('framework.language.help');
$url = MHelp::createURL($ref, $com, $override, $component);
$url = htmlspecialchars($url, ENT_QUOTES);
$cmd = "Miwi.popupWindow('{$url}', '" . MText::_('MHELP', true) . "', 700, 500, 1)";
return $cmd;
}
示例15: cloak
public static function cloak($mail, $mailto = true, $text = '', $email = true)
{
// Convert text
$mail = self::_convertEncoding($mail);
// Split email by @ symbol
$mail = explode('@', $mail);
$mail_parts = explode('.', $mail[1]);
// Random number
$rand = rand(1, 100000);
$replacement = "<script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n var prefix = 'ma' + 'il' + 'to';";
$replacement .= "\n var path = 'hr' + 'ef' + '=';";
$replacement .= "\n var addy" . $rand . " = '" . @$mail[0] . "' + '@';";
$replacement .= "\n addy" . $rand . " = addy" . $rand . " + '" . implode("' + '.' + '", $mail_parts) . "';";
if ($mailto) {
// Special handling when mail text is different from mail address
if ($text) {
if ($email) {
// Convert text
$text = self::_convertEncoding($text);
// Split email by @ symbol
$text = explode('@', $text);
$text_parts = explode('.', $text[1]);
$replacement .= "\n var addy_text" . $rand . " = '" . @$text[0] . "' + '@' + '" . implode("' + '.' + '", @$text_parts) . "';";
} else {
$replacement .= "\n var addy_text" . $rand . " = '" . $text . "';";
}
$replacement .= "\n document.write('<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>');";
$replacement .= "\n document.write(addy_text" . $rand . ");";
$replacement .= "\n document.write('<\\/a>');";
} else {
$replacement .= "\n document.write('<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>');";
$replacement .= "\n document.write(addy" . $rand . ");";
$replacement .= "\n document.write('<\\/a>');";
}
} else {
$replacement .= "\n document.write(addy" . $rand . ");";
}
$replacement .= "\n //-->";
$replacement .= '\\n </script>';
// XHTML compliance no Javascript text handling
$replacement .= "<script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n document.write('<span style=\\'display: none;\\'>');";
$replacement .= "\n //-->";
$replacement .= "\n </script>";
$replacement .= MText::_('MLIB_HTML_CLOAKING');
$replacement .= "\n <script type='text/javascript'>";
$replacement .= "\n <!--";
$replacement .= "\n document.write('</');";
$replacement .= "\n document.write('span>');";
$replacement .= "\n //-->";
$replacement .= "\n </script>";
return $replacement;
}