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


PHP MText::sprintf方法代码示例

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


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

示例1: 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);
 }
开发者ID:vanie3,项目名称:appland,代码行数:27,代码来源:storage.php

示例2: id

 public static function id($rowNum, $recId, $checkedOut = false, $name = 'cid')
 {
     if ($checkedOut) {
         return '';
     } else {
         return '<input type="checkbox" id="cb' . $rowNum . '" name="' . $name . '[]" value="' . $recId . '" onclick="Miwi.isChecked(this.checked);" title="' . MText::sprintf('MGRID_CHECKBOX_ROW_N', $rowNum + 1) . '" />';
     }
 }
开发者ID:vanie3,项目名称:appland,代码行数:8,代码来源:grid.php

示例3: register

 public function register($event, $handler)
 {
     // Are we dealing with a class or function type handler?
     if (function_exists($handler)) {
         // Ok, function type event handler... let's attach it.
         $method = array('event' => $event, 'handler' => $handler);
         $this->attach($method);
     } elseif (class_exists($handler)) {
         // Ok, class type event handler... let's instantiate and attach it.
         $this->attach(new $handler($this));
     } else {
         return MError::raiseWarning('SOME_ERROR_CODE', MText::sprintf('MLIB_EVENT_ERROR_DISPATCHER', $handler));
     }
 }
开发者ID:vanie3,项目名称:appland,代码行数:14,代码来源:dispatcher.php

示例4: test

 public function test(&$element, $value, $group = null, &$input = null, &$form = null)
 {
     // Check for a valid regex.
     if (empty($this->regex)) {
         throw new MException(MText::sprintf('MLIB_FORM_INVALID_FORM_RULE', get_class($this)));
     }
     // Add unicode property support if available.
     if (MCOMPAT_UNICODE_PROPERTIES) {
         $this->modifiers = strpos($this->modifiers, 'u') !== false ? $this->modifiers : $this->modifiers . 'u';
     }
     // Test the value against the regular expression.
     if (preg_match(chr(1) . $this->regex . chr(1) . $this->modifiers, $value)) {
         return true;
     }
     return false;
 }
开发者ID:vanie3,项目名称:appland,代码行数:16,代码来源:rule.php

示例5: connect

 protected function connect()
 {
     // Build the configuration object to use for MDatabase.
     $options = array('driver' => $this->driver, 'host' => $this->host, 'user' => $this->user, 'password' => $this->password, 'database' => $this->database, 'prefix' => $this->prefix);
     try {
         $db = MDatabase::getInstance($options);
         if ($db instanceof Exception) {
             throw new LogException('Database Error: ' . (string) $db);
         }
         if ($db->getErrorNum() > 0) {
             throw new LogException(MText::sprintf('MLIB_UTIL_ERROR_CONNECT_DATABASE', $db->getErrorNum(), $db->getErrorMsg()));
         }
         // Assign the database connector to the class.
         $this->dbo = $db;
     } catch (RuntimeException $e) {
         throw new LogException($e->getMessage());
     }
 }
开发者ID:vanie3,项目名称:appland,代码行数:18,代码来源:database.php

示例6: test

 public function test(&$element, $value, $group = null, &$input = null, &$form = null)
 {
     // Initialize variables.
     $field = (string) $element['field'];
     // Check that a validation field is set.
     if (!$field) {
         return new MException(MText::sprintf('MLIB_FORM_INVALID_FORM_RULE', get_class($this)));
     }
     // Check that a valid MForm object is given for retrieving the validation field value.
     if (!$form instanceof MForm) {
         return new MException(MText::sprintf('MLIB_FORM_INVALID_FORM_OBJECT', get_class($this)));
     }
     // Test the two values against each other.
     if ($value == $input->get($field)) {
         return true;
     }
     return false;
 }
开发者ID:vanie3,项目名称:appland,代码行数:18,代码来源:equals.php

示例7: getInstance

 public static function getInstance($identifier = 0)
 {
     // Find the user id
     if (empty($identifier) and function_exists('wp_get_current_user')) {
         $user = wp_get_current_user();
         $id = $user->ID;
     } else {
         if (!is_numeric($identifier)) {
             if (!($id = MUserHelper::getUserId($identifier))) {
                 MError::raiseWarning('SOME_ERROR_CODE', MText::sprintf('MLIB_USER_ERROR_ID_NOT_EXISTS', $identifier));
                 $retval = false;
                 return $retval;
             }
         } else {
             $id = $identifier;
         }
     }
     if (empty(self::$instances[$id])) {
         $user = new MUser($id);
         self::$instances[$id] = $user;
     }
     return self::$instances[$id];
 }
开发者ID:vanie3,项目名称:appland,代码行数:23,代码来源:user.php

示例8: _

 public static function _($key)
 {
     list($key, $prefix, $file, $func) = self::extract($key);
     if (array_key_exists($key, self::$registry)) {
         $function = self::$registry[$key];
         $args = func_get_args();
         // Remove function name from arguments
         array_shift($args);
         return MHtml::call($function, $args);
     }
     $className = $prefix . ucfirst($file);
     if (!class_exists($className)) {
         mimport('framework.filesystem.path');
         self::addIncludePath(MPATH_MIWI . '/proxy/html/html');
         if ($path = MPath::find(MHtml::$includePaths, strtolower($file) . '.php')) {
             require_once $path;
             if (!class_exists($className)) {
                 MError::raiseError(500, MText::sprintf('MLIB_HTML_ERROR_NOTFOUNDINFILE', $className, $func));
                 return false;
             }
         } else {
             MError::raiseError(500, MText::sprintf('MLIB_HTML_ERROR_NOTSUPPORTED_NOFILE', $prefix, $file));
             return false;
         }
     }
     $toCall = array($className, $func);
     if (is_callable($toCall)) {
         MHtml::register($key, $toCall);
         $args = func_get_args();
         // Remove function name from arguments
         array_shift($args);
         return MHtml::call($toCall, $args);
     } else {
         MError::raiseError(500, MText::sprintf('MLIB_HTML_ERROR_NOTSUPPORTED', $className, $func));
         return false;
     }
 }
开发者ID:vanie3,项目名称:appland,代码行数:37,代码来源:html.php

示例9: shortcodeButton

    public function shortcodeButton($content)
    {
        $title = explode('miwo', $this->context);
        $content .= '<a href="#TB_inline?width=450&height=550&inlineId=' . $this->context . '-shortcode" class="button thickbox miwi-shortcode-btn" title="' . MText::sprintf('MLIB_X_ADD_SHORTCODE', 'Miwo' . ucfirst($title[1])) . '">
						<img src="' . MURL_WP_CNT . '/plugins/' . $this->context . '/admin/assets/images/icon-16-' . $this->context . '.png" alt="' . MText::sprintf('MLIB_X_ADD_SHORTCODE', 'Miwo' . ucfirst($title[1])) . '" />' . MText::_('MLIB_ADD_SHORTCODE') . '</a>';
        return $content;
    }
开发者ID:vanie3,项目名称:appland,代码行数:7,代码来源:wordpress.php

示例10: getInput

 protected function getInput()
 {
     MHtml::_('behavior.tooltip');
     // Initialise some field attributes.
     $section = $this->element['section'] ? (string) $this->element['section'] : '';
     $component = $this->element['component'] ? (string) $this->element['component'] : '';
     $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
     // Get the actions for the asset.
     $actions = MAccess::getActions($component, $section);
     // Iterate over the children and add to the actions.
     foreach ($this->element->children() as $el) {
         if ($el->getName() == 'action') {
             $actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'], 'description' => (string) $el['description']);
         }
     }
     // Get the explicit rules for this asset.
     if ($section == 'component') {
         // Need to find the asset id by the name of the component.
         $db = MFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select($db->quoteName('id'));
         $query->from($db->quoteName('#__assets'));
         $query->where($db->quoteName('name') . ' = ' . $db->quote($component));
         $db->setQuery($query);
         $assetId = (int) $db->loadResult();
         if ($error = $db->getErrorMsg()) {
             MError::raiseNotice(500, $error);
         }
     } else {
         // Find the asset id of the content.
         // Note that for global configuration, com_config injects asset_id = 1 into the form.
         $assetId = $this->form->getValue($assetField);
     }
     // Use the compact form for the content rules (deprecated).
     //if (!empty($component) && $section != 'component') {
     //	return MHtml::_('rules.assetFormWidget', $actions, $assetId, $assetId ? null : $component, $this->name, $this->id);
     //}
     // Full width format.
     // Get the rules for just this asset (non-recursive).
     $assetRules = MAccess::getAssetRules($assetId);
     // Get the available user groups.
     $groups = $this->getUserGroups();
     // Build the form control.
     $curLevel = 0;
     // Prepare output
     $html = array();
     $html[] = '<div id="permissions-sliders" class="pane-sliders">';
     $html[] = '<p class="rule-desc">' . MText::_('MLIB_RULES_SETTINGS_DESC') . '</p>';
     $html[] = '<ul id="rules">';
     // Start a row for each user group.
     foreach ($groups as $group) {
         $difLevel = $group->level - $curLevel;
         if ($difLevel > 0) {
             $html[] = '<li><ul>';
         } elseif ($difLevel < 0) {
             $html[] = str_repeat('</ul></li>', -$difLevel);
         }
         $html[] = '<li>';
         $html[] = '<div class="panel">';
         $html[] = '<h3 class="pane-toggler title"><a href="javascript:void(0);"><span>';
         $html[] = str_repeat('<span class="level">|&ndash;</span> ', $curLevel = $group->level) . $group->text;
         $html[] = '</span></a></h3>';
         $html[] = '<div class="pane-slider content pane-hide">';
         $html[] = '<div class="mypanel">';
         $html[] = '<table class="group-rules">';
         $html[] = '<thead>';
         $html[] = '<tr>';
         $html[] = '<th class="actions" id="actions-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_ACTION') . '</span>';
         $html[] = '</th>';
         $html[] = '<th class="settings" id="settings-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_SELECT_SETTING') . '</span>';
         $html[] = '</th>';
         // The calculated setting is not shown for the root group of global configuration.
         $canCalculateSettings = $group->parent_id || !empty($component);
         if ($canCalculateSettings) {
             $html[] = '<th id="aclactionth' . $group->value . '">';
             $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_CALCULATED_SETTING') . '</span>';
             $html[] = '</th>';
         }
         $html[] = '</tr>';
         $html[] = '</thead>';
         $html[] = '<tbody>';
         foreach ($actions as $action) {
             $html[] = '<tr>';
             $html[] = '<td headers="actions-th' . $group->value . '">';
             $html[] = '<label class="hasTip" for="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(MText::_($action->title) . '::' . MText::_($action->description), ENT_COMPAT, 'UTF-8') . '">';
             $html[] = MText::_($action->title);
             $html[] = '</label>';
             $html[] = '</td>';
             $html[] = '<td headers="settings-th' . $group->value . '">';
             $html[] = '<select name="' . $this->name . '[' . $action->name . '][' . $group->value . ']" id="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . MText::sprintf('MLIB_RULES_SELECT_ALLOW_DENY_GROUP', MText::_($action->title), trim($group->text)) . '">';
             $inheritedRule = MAccess::checkGroup($group->value, $action->name, $assetId);
             // Get the actual setting for the action for this group.
             $assetRule = $assetRules->allow($action->name, $group->value);
             // Build the dropdowns for the permissions sliders
             // The parent group has "Not Set", all children can rightly "Inherit" from that.
             $html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>' . MText::_(empty($group->parent_id) && empty($component) ? 'MLIB_RULES_NOT_SET' : 'MLIB_RULES_INHERITED') . '</option>';
             $html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_ALLOWED') . '</option>';
             $html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_DENIED') . '</option>';
//.........这里部分代码省略.........
开发者ID:vanie3,项目名称:appland,代码行数:101,代码来源:rules.php

示例11: _mode

 protected function _mode($mode)
 {
     if ($mode == FTP_BINARY) {
         if (!$this->_putCmd("TYPE I", 200)) {
             MError::raiseWarning('35', MText::sprintf('MLIB_CLIENT_ERROR_MFTP_MODE_BINARY', $this->_response));
             return false;
         }
     } else {
         if (!$this->_putCmd("TYPE A", 200)) {
             MError::raiseWarning('35', MText::sprintf('MLIB_CLIENT_ERROR_MFTP_MODE_ASCII', $this->_response));
             return false;
         }
     }
     return true;
 }
开发者ID:vanie3,项目名称:appland,代码行数:15,代码来源:ftp.php

示例12: getInput

 protected function getInput()
 {
     // Get the client id.
     $clientId = $this->element['client_id'];
     if (is_null($clientId) && $this->form instanceof MForm) {
         $clientId = $this->form->getValue('client_id');
     }
     $clientId = (int) $clientId;
     $client = MApplicationHelper::getClientInfo($clientId);
     // Get the module.
     $module = (string) $this->element['module'];
     if (empty($module) && $this->form instanceof MForm) {
         $module = $this->form->getValue('module');
     }
     $module = preg_replace('#\\W#', '', $module);
     // Get the template.
     $template = (string) $this->element['template'];
     $template = preg_replace('#\\W#', '', $template);
     // Get the style.
     if ($this->form instanceof MForm) {
         $template_style_id = $this->form->getValue('template_style_id');
     }
     $template_style_id = preg_replace('#\\W#', '', $template_style_id);
     // If an extension and view are present build the options.
     if ($module && $client) {
         // Load language file
         $lang = MFactory::getLanguage();
         $lang->load($module . '.sys', $client->path, null, false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, null, false, false) || $lang->load($module . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, $lang->getDefault(), false, false);
         // Get the database object and a new query object.
         $db = MFactory::getDBO();
         $query = $db->getQuery(true);
         // Build the query.
         $query->select('element, name');
         $query->from('#__extensions as e');
         $query->where('e.client_id = ' . (int) $clientId);
         $query->where('e.type = ' . $db->quote('template'));
         $query->where('e.enabled = 1');
         if ($template) {
             $query->where('e.element = ' . $db->quote($template));
         }
         if ($template_style_id) {
             $query->join('LEFT', '#__template_styles as s on s.template=e.element');
             $query->where('s.id=' . (int) $template_style_id);
         }
         // Set the query and load the templates.
         $db->setQuery($query);
         $templates = $db->loadObjectList('element');
         // Check for a database error.
         if ($db->getErrorNum()) {
             MError::raiseWarning(500, $db->getErrorMsg());
         }
         // Build the search paths for module layouts.
         $module_path = MPath::clean($client->path . '/modules/' . $module . '/tmpl');
         // Prepare array of component layouts
         $module_layouts = array();
         // Prepare the grouped list
         $groups = array();
         // Add the layout options from the module path.
         if (is_dir($module_path) && ($module_layouts = MFolder::files($module_path, '^[^_]*\\.php$'))) {
             // Create the group for the module
             $groups['_'] = array();
             $groups['_']['id'] = $this->id . '__';
             $groups['_']['text'] = MText::sprintf('MOPTION_FROM_MODULE');
             $groups['_']['items'] = array();
             foreach ($module_layouts as $file) {
                 // Add an option to the module group
                 $value = MFile::stripExt($file);
                 $text = $lang->hasKey($key = strtoupper($module . '_LAYOUT_' . $value)) ? MText::_($key) : $value;
                 $groups['_']['items'][] = MHtml::_('select.option', '_:' . $value, $text);
             }
         }
         // Loop on all templates
         if ($templates) {
             foreach ($templates as $template) {
                 // Load language file
                 $lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false);
                 $template_path = MPath::clean($client->path . '/templates/' . $template->element . '/html/' . $module);
                 // Add the layout options from the template path.
                 if (is_dir($template_path) && ($files = MFolder::files($template_path, '^[^_]*\\.php$'))) {
                     foreach ($files as $i => $file) {
                         // Remove layout that already exist in component ones
                         if (in_array($file, $module_layouts)) {
                             unset($files[$i]);
                         }
                     }
                     if (count($files)) {
                         // Create the group for the template
                         $groups[$template->element] = array();
                         $groups[$template->element]['id'] = $this->id . '_' . $template->element;
                         $groups[$template->element]['text'] = MText::sprintf('MOPTION_FROM_TEMPLATE', $template->name);
                         $groups[$template->element]['items'] = array();
                         foreach ($files as $file) {
                             // Add an option to the template group
                             $value = MFile::stripExt($file);
                             $text = $lang->hasKey($key = strtoupper('TPL_' . $template->element . '_' . $module . '_LAYOUT_' . $value)) ? MText::_($key) : $value;
                             $groups[$template->element]['items'][] = MHtml::_('select.option', $template->element . ':' . $value, $text);
                         }
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:vanie3,项目名称:appland,代码行数:101,代码来源:modulelayout.php

示例13: assetFormWidget

 public static function assetFormWidget($actions, $assetId = null, $parent = null, $control = 'mform[rules]', $idPrefix = 'mform_rules')
 {
     $images = self::_getImagesArray();
     // Get the user groups.
     $groups = self::_getUserGroups();
     // Get the incoming inherited rules as well as the asset specific rules.
     $inheriting = MAccess::getAssetRules($parent ? $parent : self::_getParentAssetId($assetId), true);
     $inherited = MAccess::getAssetRules($assetId, true);
     $rules = MAccess::getAssetRules($assetId);
     $html = array();
     $html[] = '<div class="acl-options">';
     $html[] = MHtml::_('tabs.start', 'acl-rules-' . $assetId, array('useCookie' => 1));
     $html[] = MHtml::_('tabs.panel', MText::_('MLIB_HTML_ACCESS_SUMMARY'), 'summary');
     $html[] = '			<p>' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC') . '</p>';
     $html[] = '			<table class="aclsummary-table" summary="' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC') . '">';
     $html[] = '			<caption>' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC_CAPTION') . '</caption>';
     $html[] = '			<tr>';
     $html[] = '				<th class="col1 hidelabeltxt">' . MText::_('MLIB_RULES_GROUPS') . '</th>';
     foreach ($actions as $i => $action) {
         $html[] = '				<th class="col' . ($i + 2) . '">' . MText::_($action->title) . '</th>';
     }
     $html[] = '			</tr>';
     foreach ($groups as $i => $group) {
         $html[] = '			<tr class="row' . $i % 2 . '">';
         $html[] = '				<td class="col1">' . $group->text . '</td>';
         foreach ($actions as $j => $action) {
             $html[] = '				<td class="col' . ($j + 2) . '">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
         }
         $html[] = '			</tr>';
     }
     $html[] = ' 		</table>';
     foreach ($actions as $action) {
         $actionTitle = MText::_($action->title);
         $actionDesc = MText::_($action->description);
         $html[] = MHtml::_('tabs.panel', $actionTitle, $action->name);
         $html[] = '			<p>' . $actionDesc . '</p>';
         $html[] = '			<table class="aclmodify-table" summary="' . strip_tags($actionDesc) . '">';
         $html[] = '			<caption>' . MText::_('MLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_ACL') . ' ' . $actionTitle . ' ' . MText::_('MLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_TABLE') . '</caption>';
         $html[] = '			<tr>';
         $html[] = '				<th class="col1 hidelabeltxt">' . MText::_('MLIB_RULES_GROUP') . '</th>';
         $html[] = '				<th class="col2">' . MText::_('MLIB_RULES_INHERIT') . '</th>';
         $html[] = '				<th class="col3 hidelabeltxt">' . MText::_('MMODIFY') . '</th>';
         $html[] = '				<th class="col4">' . MText::_('MCURRENT') . '</th>';
         $html[] = '			</tr>';
         foreach ($groups as $i => $group) {
             $selected = $rules->allow($action->name, $group->value);
             $html[] = '			<tr class="row' . $i % 2 . '">';
             $html[] = '				<td class="col1">' . $group->text . '</td>';
             $html[] = '				<td class="col2">' . ($inheriting->allow($action->name, $group->identities) ? $images['allow-i'] : $images['deny-i']) . '</td>';
             $html[] = '				<td class="col3">';
             $html[] = '					<select id="' . $idPrefix . '_' . $action->name . '_' . $group->value . '" class="inputbox" size="1" name="' . $control . '[' . $action->name . '][' . $group->value . ']" title="' . MText::sprintf('MLIB_RULES_SELECT_ALLOW_DENY_GROUP', $actionTitle, $group->text) . '">';
             $html[] = '						<option value=""' . ($selected === null ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_INHERIT') . '</option>';
             $html[] = '						<option value="1"' . ($selected === true ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_ALLOWED') . '</option>';
             $html[] = '						<option value="0"' . ($selected === false ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_DENIED') . '</option>';
             $html[] = '					</select>';
             $html[] = '				</td>';
             $html[] = '				<td class="col4">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
             $html[] = '			</tr>';
         }
         $html[] = '			</table>';
     }
     $html[] = MHtml::_('tabs.end');
     // Build the footer with legend and special purpose buttons.
     $html[] = '	<div class="clr"></div>';
     $html[] = '	<ul class="acllegend fltlft">';
     $html[] = '		<li class="acl-allowed">' . MText::_('MLIB_RULES_ALLOWED') . '</li>';
     $html[] = '		<li class="acl-denied">' . MText::_('MLIB_RULES_DENIED') . '</li>';
     $html[] = '	</ul>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
开发者ID:vanie3,项目名称:appland,代码行数:71,代码来源:rules.php

示例14: publish

 public function publish($pks = null, $state = 1, $userId = 0)
 {
     // Initialise variables.
     $k = $this->_tbl_key;
     // Sanitize input.
     MArrayHelper::toInteger($pks);
     $userId = (int) $userId;
     $state = (int) $state;
     // If there are no primary keys set check to see if the instance key is set.
     if (empty($pks)) {
         if ($this->{$k}) {
             $pks = array($this->{$k});
         } else {
             $e = new MException(MText::_('MLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
             $this->setError($e);
             return false;
         }
     }
     // Update the publishing state for rows with the given primary keys.
     $query = $this->_db->getQuery(true);
     $query->update($this->_tbl);
     $query->set('published = ' . (int) $state);
     // Determine if there is checkin support for the table.
     if (property_exists($this, 'checked_out') || property_exists($this, 'checked_out_time')) {
         $query->where('(checked_out = 0 OR checked_out = ' . (int) $userId . ')');
         $checkin = true;
     } else {
         $checkin = false;
     }
     // Build the WHERE clause for the primary keys.
     $query->where($k . ' = ' . implode(' OR ' . $k . ' = ', $pks));
     $this->_db->setQuery($query);
     // Check for a database error.
     if (!$this->_db->execute()) {
         $e = new MException(MText::sprintf('MLIB_DATABASE_ERROR_PUBLISH_FAILED', get_class($this), $this->_db->getErrorMsg()));
         $this->setError($e);
         return false;
     }
     // If checkin is supported and all rows were adjusted, check them in.
     if ($checkin && count($pks) == $this->_db->getAffectedRows()) {
         // Checkin the rows.
         foreach ($pks as $pk) {
             $this->checkin($pk);
         }
     }
     // If the MTable instance value is in the list of primary keys that were set, set the instance.
     if (in_array($this->{$k}, $pks)) {
         $this->published = $state;
     }
     $this->setError('');
     return true;
 }
开发者ID:vanie3,项目名称:appland,代码行数:52,代码来源:table.php

示例15: _folders

 protected function _folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\\..*'))
 {
     $arr = array();
     $path = $this->_cleanPath($path);
     if (!is_dir($path)) {
         MError::raiseWarning(21, 'MCacheStorageFile::_folders' . MText::sprintf('MLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path));
         return false;
     }
     if (!($handle = @opendir($path))) {
         return $arr;
     }
     if (count($excludefilter)) {
         $excludefilter_string = '/(' . implode('|', $excludefilter) . ')/';
     } else {
         $excludefilter_string = '';
     }
     while (($file = readdir($handle)) !== false) {
         if ($file != '.' && $file != '..' && !in_array($file, $exclude) && (empty($excludefilter_string) || !preg_match($excludefilter_string, $file))) {
             $dir = $path . '/' . $file;
             $isDir = is_dir($dir);
             if ($isDir) {
                 if (preg_match("/{$filter}/", $file)) {
                     if ($fullpath) {
                         $arr[] = $dir;
                     } else {
                         $arr[] = $file;
                     }
                 }
                 if ($recurse) {
                     if (is_integer($recurse)) {
                         $arr2 = $this->_folders($dir, $filter, $recurse - 1, $fullpath, $exclude, $excludefilter);
                     } else {
                         $arr2 = $this->_folders($dir, $filter, $recurse, $fullpath, $exclude, $excludefilter);
                     }
                     $arr = array_merge($arr, $arr2);
                 }
             }
         }
     }
     closedir($handle);
     return $arr;
 }
开发者ID:vanie3,项目名称:appland,代码行数:42,代码来源:file.php


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