本文整理汇总了PHP中XCube_Utils::formatString方法的典型用法代码示例。如果您正苦于以下问题:PHP XCube_Utils::formatString方法的具体用法?PHP XCube_Utils::formatString怎么用?PHP XCube_Utils::formatString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCube_Utils
的用法示例。
在下文中一共展示了XCube_Utils::formatString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update041
function update041()
{
$this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED);
//Add Table
$sqlfileInfo = $this->_mTargetXoopsModule->getInfo('sqlfile');
$dirname = $this->_mTargetXoopsModule->getVar('dirname');
$sqlfile = $sqlfileInfo[XOOPS_DB_TYPE];
$sqlfilepath = XOOPS_MODULE_PATH . '/' . $dirname . '/' . $sqlfile;
require_once XOOPS_MODULE_PATH . '/legacy/admin/class/Legacy_SQLScanner.class.php';
$scanner = new Legacy_SQLScanner();
$scanner->setDB_PREFIX(XOOPS_DB_PREFIX);
$scanner->setDirname($this->_mTargetXoopsModule->get('dirname'));
if (!$scanner->loadFile($sqlfilepath)) {
$this->mLog->addError(XCube_Utils::formatString(_AD_LEGACY_ERROR_SQL_FILE_NOT_FOUND, $sqlfile));
return false;
}
$scanner->parse();
$sqls = $scanner->getSQL();
$root = XCube_Root::getSingleton();
$db = $root->mController->getDB();
foreach ($sqls as $sql) {
if (strpos($sql, '_message_users') !== false) {
if (!$db->query($sql)) {
$this->mLog->addError($db->error());
return false;
}
}
}
$this->mLog->addReport(_AD_LEGACY_MESSAGE_DATABASE_SETUP_FINISHED);
//add table
$this->updatemain();
return true;
}
示例2: getNewMessage
public static function getNewMessage(&$arrays)
{
$root = XCube_Root::getSingleton();
if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
$uid = $root->mContext->mXoopsUser->get('uid');
$modHand = xoops_getmodulehandler('inbox', 'message');
$num = $modHand->getCountUnreadByFromUid($uid);
if ($num > 0) {
$root->mLanguageManager->loadModuleMessageCatalog('message');
$arrays[] = array('url' => XOOPS_MODULE_URL . '/message/index.php', 'title' => XCube_Utils::formatString(_MD_MESSAGE_NEWMESSAGE, $num));
}
}
}
示例3: executeViewIndex
function executeViewIndex(&$controller, &$xoopsUser, &$render)
{
//
// Because this action's template uses USER message catalog, load it.
//
$root =& $controller->mRoot;
$config_handler =& xoops_gethandler('config');
$moduleConfigUser =& $config_handler->getConfigsByDirname('user');
if ($moduleConfigUser['use_ssl'] == 1 && !empty($_POST[$moduleConfigUser['sslpost_name']])) {
session_id($_POST[$moduleConfigUser['sslpost_name']]);
}
$render->setTemplateName("legacy_misc_ssllogin.html");
$render->setAttribute("message", XCube_Utils::formatString(_MD_LEGACY_MESSAGE_LOGIN_SUCCESS, $xoopsUser->get('uname')));
}
示例4: preBlockFilter
function preBlockFilter()
{
if (LEGACY_INSTALLERCHECKER_ACTIVE == true && is_dir(XOOPS_ROOT_PATH . "/install")) {
$root =& XCube_Root::getSingleton();
$root->mLanguageManager->loadModuleMessageCatalog('legacy');
$xoopsConfig = $root->mContext->mXoopsConfig;
require_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
$xoopsTpl->assign(array('xoops_sitename' => htmlspecialchars($xoopsConfig['sitename']), 'xoops_themecss' => xoops_getcss(), 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'lang_message_confirm' => XCube_Utils::formatString(_MD_LEGACY_MESSAGE_INSTALL_COMPLETE_CONFIRM, XOOPS_ROOT_PATH . "/install"), 'lang_message_warning' => XCube_Utils::formatString(_MD_LEGACY_MESSAGE_INSTALL_COMPLETE_WARNING, XOOPS_ROOT_PATH . "/install")));
$xoopsTpl->compile_check = true;
// @todo filebase template with absolute file path
$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/legacy/templates/legacy_install_completed.html');
exit;
}
}
示例5: validateBmodule
function validateBmodule()
{
$bmodule = $this->get('bmodule');
if (!count($bmodule)) {
$this->addErrorMessage(_AD_LEGACY_ERROR_BMODULE);
} else {
$handler =& xoops_gethandler('module');
foreach ($this->get('bmodule') as $mid) {
$module =& $handler->get($mid);
if ($mid != -1 && $mid != 0 && !is_object($module)) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACY_ERROR_OBJECTEXIST, _AD_LEGACY_LANG_BMODULE));
}
}
}
}
示例6: validate
function validate()
{
parent::validate();
//
// If htmlbanner is clicked, htmlbanner is requreid.
//
if ($this->get('htmlbanner')) {
if (strlen($this->get('htmlcode')) == 0) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE));
}
} else {
if (strlen($this->get('imageurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL));
}
if (strlen($this->get('clickurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL));
}
}
}
示例7: validateRank
function validateRank()
{
$t_rank = $this->get('rank');
if ($t_rank > 0) {
$handler =& xoops_getmodulehandler('ranks', 'user');
$rank =& $handler->get($t_rank);
if (!is_object($rank)) {
$this->addErrorMessage(XCube_Utils::formatString(_MD_USER_ERROR_INJURY, _AD_USER_LANG_RANK));
} elseif ($rank->get('rank_special') != 1) {
$this->addErrorMessage(XCube_Utils::formatString(_MD_USER_ERROR_INJURY, _AD_USER_LANG_RANK));
}
}
}
示例8: getMailBody
private function getMailBody($body = 0)
{
$tpl = new Smarty();
$tpl->_canUpdateFromFile = true;
$tpl->compile_check = true;
$tpl->template_dir = _MY_MODULE_PATH . 'language/' . $this->root->mLanguageManager->mLanguageName . '/';
$tpl->cache_dir = XOOPS_CACHE_PATH;
$tpl->compile_dir = XOOPS_COMPILE_PATH;
$tpl->assign('sitename', $this->root->mContext->mXoopsConfig['sitename']);
$tpl->assign('uname', $this->root->mContext->mXoopsUser->get('uname'));
if ($body == 1) {
$tpl->assign('note', $this->mActionForm->get('note'));
} else {
$tpl->assign('note', XCube_Utils::formatString(_MD_MESSAGE_MAILBODY, XOOPS_URL . '/'));
}
$tpl->assign('siteurl', XOOPS_URL . '/');
return $tpl->fetch(_MY_MODULE_PATH . 'language/' . $this->root->mLanguageManager->mLanguageName . '/invitation.tpl');
}
示例9: validateSmile_url
function validateSmile_url()
{
if ($this->_mIsNew && $this->get('smile_url') == null) {
$this->addErrorMessage(XCube_Utils::formatString(_MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_SMILE_URL));
}
}
示例10: _saveAvatarImages
function _saveAvatarImages(&$avatarimages)
{
if (count($avatarimages) == 0) {
return true;
}
$avatarhandler =& xoops_getmodulehandler('avatar');
for ($i = 0; $i < count($avatarimages); $i++) {
$ext_pos = strrpos($avatarimages[$i]['name'], '.');
if ($ext_pos === false) {
continue;
}
$ext = strtolower(substr($avatarimages[$i]['name'], $ext_pos + 1));
if (empty($this->mAllowedExts[$ext])) {
continue;
}
$file_name = substr($avatarimages[$i]['name'], 0, $ext_pos);
$save_file_name = uniqid('savt') . '.' . $ext;
$filehandle = fopen(XOOPS_UPLOAD_PATH . '/' . $save_file_name, "w");
if (!$filehandle) {
$this->_addErrorMessage(XCube_Utils::formatString(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
continue;
}
if (!@fwrite($filehandle, $avatarimages[$i]['content'])) {
$this->_addErrorMessage(XCube_Utils::formatString(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
@fclose($filehandle);
continue;
}
@fclose($filehandle);
$avatar =& $avatarhandler->create();
$avatar->set('avatar_name', $file_name);
$avatar->set('avatar_file', $save_file_name);
$avatar->set('avatar_display', 1);
$avatar->set('avatar_weight', 0);
$avatar->set('avatar_type', 'S');
$avatar->set('avatar_mimetype', $this->mAllowedExts[$ext]);
if (!$avatarhandler->insert($avatar)) {
$this->_addErrorMessage(XCube_Utils::formatString(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
}
unset($avatar);
}
return true;
}
示例11: _processReport
function _processReport()
{
if (!$this->mLog->hasError()) {
$this->mLog->add(XCube_Utils::formatString(_AD_LEGACY_MESSAGE_INSTALLATION_MODULE_SUCCESSFUL, $this->_mXoopsModule->get('name')));
} else {
$this->mLog->addError(XCube_Utils::formatString(_AD_LEGACY_ERROR_INSTALLATION_MODULE_FAILURE, $this->_mXoopsModule->get('name')));
}
}
示例12: renderMessage
/**
* @public
* @brief Gets the error message rendered by XCube_Utils::formaString().
* @param $name string - Depend rule name
* @return string
*
* Gets the error message registered at addMessage(). If the message setting has some
* arguments, messages are rendered by XCube_Utils::formatString().
* \code
* $field->addMessage('required', "{0:ucFirst} is requred.", "name");
*
* // Gets "Name is required."
* $field->renderMessage('required');
* \endcode
* This feature is helpful for automatic ActionForm generators.
*/
function renderMessage($name)
{
if (!isset($this->mMessages[$name])) {
return null;
}
$message = $this->mMessages[$name]['message'];
if (isset($this->mMessages[$name]['args'])) {
// Use an unity method.
$message = XCube_Utils::formatString($message, $this->mMessages[$name]['args']);
}
return $message;
}
示例13: _adjustModules
function _adjustModules()
{
$handler =& xoops_gethandler('module');
$criteria =& new CriteriaCompo();
$criteria->add(new Criteria('isactive', 0));
$criteria->add(new Criteria('hasmain', 0));
$modules =& $handler->getObjects($criteria);
foreach ($modules as $module) {
$module->set('isactive', 1);
$handler->insert($module);
$log->add(XCube_Utils::formatString(_MI_XUPGRADE_MESSAGE_ADJUST_MODULE_ISACTIVE, $module->get('dirname')));
}
}
示例14: _fetchImageset
function _fetchImageset(&$tar, &$tplset, &$themeimages)
{
if (count($themeimages) == 0) {
return true;
}
$handler =& xoops_gethandler('imageset');
$imgset =& $handler->create();
$imgset->set('imgset_name', $tplset->get('tplset_name'));
$imgset->set('imgset_refid', 0);
if (!$handler->insert($imgset)) {
$this->_addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_COULD_NOT_SAVE_IMAGESET, $tplset->get('tplset_name')));
return false;
}
if (!$handler->linktplset($imgset->get('imgset_id'), $tplset->get('tplset_name'))) {
$this->_addErrorMessage(_AD_LEGACYRENDER_ERROR_COULD_NOT_SAVE_LINKTPLSET);
return false;
}
$handler =& xoops_gethandler('imagesetimg');
for ($i = 0; $i < count($themeimages); $i++) {
if (isset($themeimages[$i]['name']) && $themeimages[$i]['name'] != '') {
$image =& $handler->create();
$image->set('imgsetimg_file', $themeimages[$i]['name']);
$image->set('imgsetimg_imgset', $imgset->get('imgset_id'));
$image->set('imgsetimg_body', $themeimages[$i]['content'], true);
if (!$handler->insert($image)) {
$this->_addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_COULD_NOT_SAVE_IMAGE_FILE, $image->get('imgsetimg_file')));
}
unset($image);
}
}
return true;
}
示例15: uninstallPreferenceByOrder
function uninstallPreferenceByOrder($order, &$module, &$log)
{
$handler =& xoops_gethandler('config');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', $module->get('mid')));
$criteria->add(new Criteria('conf_catid', 0));
$criteria->add(new Criteria('conf_order', $order));
$configArr =& $handler->getConfigs($criteria);
foreach (array_keys($configArr) as $idx) {
if ($handler->deleteConfig($configArr[$idx])) {
$log->addReport(XCube_Utils::formatString("Delete preference '{0}'.", $configArr[$idx]->get('conf_name')));
} else {
$log->addError(XCube_Utils::formatString("Could not delete preference '{0}'.", $configArr[$idx]->get('conf_name')));
}
}
}