当前位置: 首页>>代码示例>>PHP>>正文


PHP MText::alt方法代码示例

本文整理汇总了PHP中MText::alt方法的典型用法代码示例。如果您正苦于以下问题:PHP MText::alt方法的具体用法?PHP MText::alt怎么用?PHP MText::alt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MText的用法示例。


在下文中一共展示了MText::alt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 protected function getInput()
 {
     // Initialize variables.
     $html = array();
     // Initialize some field attributes.
     $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';
     // Start the radio field output.
     $html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
     // Get the field options.
     $options = $this->getOptions();
     // Build the radio field output.
     foreach ($options as $i => $option) {
         // Initialize some option attributes.
         $checked = (string) $option->value == (string) $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[] = '<input type="radio" 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::alt($option->text, preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)) . '</label>';
     }
     // End the radio field output.
     $html[] = '</fieldset>';
     return implode($html);
 }
开发者ID:vanie3,项目名称:appland,代码行数:25,代码来源:radio.php

示例2: getOptions

 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $stripExt = (string) $this->element['stripext'];
     $hideNone = (string) $this->element['hide_none'];
     $hideDefault = (string) $this->element['hide_default'];
     // Get the path in which to search for file options.
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $path = MPATH_ROOT . '/' . $path;
     }
     // Prepend some default options based on field attributes.
     if (!$hideNone) {
         $options[] = MHtml::_('select.option', '-1', MText::alt('MOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     if (!$hideDefault) {
         $options[] = MHtml::_('select.option', '', MText::alt('MOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     // Get a list of files in the search path with the given filter.
     $files = MFolder::files($path, $filter);
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             // If the extension is to be stripped, do it.
             if ($stripExt) {
                 $file = MFile::stripExt($file);
             }
             $options[] = MHtml::_('select.option', $file, $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:vanie3,项目名称:appland,代码行数:44,代码来源:filelist.php

示例3: getOptions

 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = MHtml::_('select.option', (string) $option['value'], MText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }
开发者ID:vanie3,项目名称:appland,代码行数:21,代码来源:list.php

示例4: existing

 public static function existing($all = false, $translate = false)
 {
     if (empty(self::$items)) {
         $languages = array();
         $langs = get_available_languages();
         if (!in_array(get_locale(), $langs)) {
             $langs[] = get_locale();
         }
         $i = 0;
         foreach ($langs as $lang) {
             $languages[$i] = new stdClass();
             $languages[$i]->value = $lang;
             $languages[$i]->text = $lang;
             $i++;
         }
         self::$items = $languages;
         if ($all) {
             array_unshift(self::$items, new MObject(array('value' => '*', 'text' => $translate ? MText::alt('MALL', 'language') : 'MALL_LANGUAGE')));
         }
     }
     return self::$items;
 }
开发者ID:vanie3,项目名称:appland,代码行数:22,代码来源:contentlanguage.php


注:本文中的MText::alt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。