本文整理汇总了PHP中WFText::sprintf方法的典型用法代码示例。如果您正苦于以下问题:PHP WFText::sprintf方法的具体用法?PHP WFText::sprintf怎么用?PHP WFText::sprintf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WFText
的用法示例。
在下文中一共展示了WFText::sprintf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
public function getForm($group = null)
{
jimport('joomla.form.form');
if (class_exists('JForm')) {
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_jce');
$form = JForm::getInstance('com_jce.component', 'config', array('control' => 'params'), false, '/config');
if ($group) {
return $form->getFieldset($group);
}
return $form;
} else {
$component = WFExtensionHelper::getComponent();
// get params definitions
$params = json_decode($component->params);
$rules = isset($params->access) ? $params->access : null;
// Build the form control.
$curLevel = 0;
$actions = $this->getActions();
$groups = $this->getUserGroups();
$tabs = array('<ul class="nav nav-tabs">');
$content = array('<div class="tabs-content">');
foreach ($groups as $group) {
$difLevel = $group->level - $curLevel;
$html = array();
$item = new StdClass();
$id = $curLevel;
$tabs[] = '<li><a href="#permission-' . $id . '">' . str_repeat('<span> › </span> ', $curLevel = $group->level) . $group->text . '</a></li>';
$content[] = '<div id="permission-' . $id . '" class="tab-pane">';
$content[] = '<table border="0" cellspacing="1" class="table table-striped">';
$content[] = '<thead>';
$content[] = '<tr>';
$content[] = '<th><span>' . WFText::_('WF_RULES_ACTION') . '</span></th>';
$content[] = '<th><span>' . WFText::_('WF_RULES_SELECT_SETTING') . '</span></th>';
$content[] = '</tr>';
$content[] = '</thead>';
$content[] = '<tbody>';
foreach ($actions as $action) {
$content[] = '<tr>';
$content[] = '<td><label class="tooltip" for="' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(WFText::_($action->title) . '::' . WFText::_($action->description), ENT_COMPAT, 'UTF-8') . '">' . WFText::_($action->title) . '</label></td>';
$content[] = '<td>';
$content[] = '<select name="params[rules][' . $action->name . '][' . $group->value . ']" id="' . $action->name . '_' . $group->value . '" title="' . WFText::sprintf('WF_RULES_SELECT_ALLOW_DENY_GROUP', WFText::_($action->title), trim($group->text)) . '">';
$assetRule = $this->checkRule($rules, $action->name, $group->value);
$content[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_ALLOWED') . '</option>';
$content[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_DENIED') . '</option>';
$content[] = '</select>  ';
$content[] = '</td>';
$content[] = '</tr>';
}
$content[] = '</tbody>';
$content[] = '</table>';
$content[] = '</div>';
}
$tabs[] = '</ul>';
$content[] = '</div>';
return implode('', array_merge($tabs, $content));
}
return null;
}
示例2: checkVersion
function checkVersion()
{
$file = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml';
if (!is_file($file)) {
$file = JPATH_PLUGINS . DS . 'system' . 'jcemediabox' . DS . 'jcemediabox.xml';
}
$required = $this->get('_requires');
if ($xml = JApplicationHelper::parseXMLInstallFile($file)) {
if (version_compare($xml['version'], (int) $required, '<')) {
echo '<p class="required">' . WFText::sprintf('WF_POPUPS_JCEMEDIABOX_VERSION_ERROR', $required) . '</p>';
}
}
}
示例3: remove
public function remove($id, $type)
{
$app = JFactory::getApplication();
// Use Joomla! Installer class for related extensions
if ($type == 'related') {
jimport('joomla.installer.installer');
$installer = JInstaller::getInstance();
$result = $installer->uninstall('plugin', $id);
} else {
$installer = WFInstaller::getInstance();
$installer->setAdapter($type);
$result = $installer->uninstall($type, $id);
}
if (!$result) {
$app->enqueueMessage(WFText::sprintf('WF_INSTALLER_UNINSTALL_ERROR'), 'error');
} else {
$app->enqueueMessage(WFText::sprintf('WF_INSTALLER_UNINSTALL_SUCCESS'));
}
$this->_result[] = array('name' => $installer->get('name'), 'type' => $type, 'version' => $installer->get('version'), 'result' => $result);
$this->setState('name', WFText::_($installer->get('name')));
$this->setState('result', $result);
$this->setState('install.result', $this->_result);
return $result;
}
示例4: renameItem
/**
* Rename a file.
* @param string $src The relative path of the source file
* @param string $dest The name of the new file
* @return string $error
*/
public function renameItem()
{
// check for feature access
if (!$this->checkFeature('rename', 'folder') && !$this->checkFeature('rename', 'file')) {
JError::raiseError(403, 'Access to this resource is restricted');
}
$args = func_get_args();
$source = array_shift($args);
$destination = array_shift($args);
$source = rawurldecode($source);
$destination = rawurldecode($destination);
WFUtility::checkPath($source);
WFUtility::checkPath($destination);
// check for extension in destination name
if (WFUtility::validateFileName($destination) === false) {
JError::raiseError(403, 'INVALID FILE NAME');
}
$filesystem = $this->getFileSystem();
if ($filesystem->is_file($source)) {
if ($this->checkFeature('rename', 'file') === false) {
JError::raiseError(403, 'Access to this resource is restricted');
}
} elseif ($filesystem->is_dir($source)) {
if ($this->checkFeature('rename', 'folder') === false) {
JError::raiseError(403, 'Access to this resource is restricted');
}
}
$result = $filesystem->rename($source, WFUtility::makeSafe($destination, $this->get('websafe_mode'), $this->get('websafe_spaces'), $this->get('websafe_textcase')), $args);
if ($result instanceof WFFileSystemResult) {
if (!$result->state) {
$this->setResult(WFText::sprintf('WF_MANAGER_RENAME_' . strtoupper($result->type) . '_ERROR', basename($source)), 'error');
if ($result->message) {
$this->setResult($result->message, 'error');
}
} else {
$this->setResult($this->fireEvent('on' . ucfirst($result->type) . 'Rename', array($destination)));
$this->setResult($destination, $result->type);
}
}
return $this->getResult();
}
示例5: renameItem
/**
* Rename a file.
* @param string $src The relative path of the source file
* @param string $dest The name of the new file
* @return string $error
*/
public function renameItem()
{
// check for feature access
if (!$this->checkFeature('rename', 'folder') && !$this->checkFeature('rename', 'file')) {
JError::raiseError(403, 'RESTRICTED ACCESS');
}
$args = func_get_args();
$source = array_shift($args);
$destination = array_shift($args);
$source = rawurldecode($source);
$destination = rawurldecode($destination);
WFUtility::checkPath($source);
WFUtility::checkPath($destination);
// check for extension in destination name
if (preg_match('#\\.(php|php(3|4|5)|phtml|pl|py|jsp|asp|htm|html|shtml|sh|cgi)\\b#i', $destination)) {
JError::raiseError(403, 'INVALID FILE NAME');
}
$filesystem = $this->getFileSystem();
$result = $filesystem->rename($source, WFUtility::makeSafe($destination, $this->get('websafe_mode')), $args);
if ($result instanceof WFFileSystemResult) {
if (!$result->state) {
$this->setResult(WFText::sprintf('WF_MANAGER_RENAME_' . strtoupper($result->type) . '_ERROR', basename($source)), 'error');
if ($result->message) {
$this->setResult($result->message, 'error');
}
} else {
$this->setResult($this->fireEvent('on' . ucfirst($result->type) . 'Rename', array($destination)));
$this->setResult($destination, $result->type);
}
}
return $this->getResult();
}