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


PHP __f函数代码示例

本文整理汇总了PHP中__f函数的典型用法代码示例。如果您正苦于以下问题:PHP __f函数的具体用法?PHP __f怎么用?PHP __f使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mediashare_source_browserapi_addMediaItem

function mediashare_source_browserapi_addMediaItem($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($args['albumId'])) {
        return LogUtil::registerError(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'source_browserapi.addMediaItem'), $dom));
    }
    $uploadFilename = $args['uploadFilename'];
    // FIXME Required because the globals??
    //pnModAPILoad('mediashare', 'edit');
    // For OPEN_BASEDIR reasons we move the uploaded file as fast as possible to an accessible place
    // MUST remember to remove it afterwards!!!
    // Create and check tmpfilename
    $tmpDir = pnModGetVar('mediashare', 'tmpDirName');
    if (($tmpFilename = tempnam($tmpDir, 'Upload_')) === false) {
        return LogUtil::registerError(__f("Unable to create a temporary file in '%s'", $tmpDir, $dom) . ' - ' . __('(uploading image)', $dom));
    }
    if (is_uploaded_file($uploadFilename)) {
        if (move_uploaded_file($uploadFilename, $tmpFilename) === false) {
            unlink($tmpFilename);
            return LogUtil::registerError(__f('Unable to move uploaded file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(uploading image)', $dom));
        }
    } else {
        if (!copy($uploadFilename, $tmpFilename)) {
            unlink($tmpFilename);
            return LogUtil::registerError(__f('Unable to copy the file from \'%1$s\' to \'%2$s\'', array($uploadFilename, $tmpFilename), $dom) . ' - ' . __('(adding image)', $dom));
        }
    }
    $args['mediaFilename'] = $tmpFilename;
    $result = pnModAPIFunc('mediashare', 'edit', 'addMediaItem', $args);
    unlink($tmpFilename);
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:32,代码来源:pnsource_browserapi.php

示例2: smarty_block_gettext

/**
 * Zikula_View function to use the _dgettext() function
 *
 * This function takes a identifier and returns the corresponding language constant.
 *
 * Available parameters:
 *   - text:     (required) string to translate
 *   - tagN:     (optional) replace for sprintf() e.g. %s or %1$s
 *   - domain:   (optional) textdomain to be used (not required, the system will fill this out automatically
 *   - comment:  (optional) comment to the translator (this is not processed by this code)
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Examples
 * {gettext}Hello world{/gettext}
 * {gettext tag1=$name}Hello %s{/gettext}
 * {gettext  tag1=$city tag2=$country comment="%1 is a name %2 is the place"}Hello %1$s, welcome to %2$s{/gettext}
 *
 * String replacement follows the rules at http://php.net/sprintf but please note Smarty seems to pass
 * all variables as strings so %s and %n$s are mostly used.
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The block content.
 * @param Zikula_View $view    Reference to the Zikula_View object.
 *
 * @return string Translation if it was available.
 */
function smarty_block_gettext($params, $content, Zikula_View $view)
{
    if ($content) {
        if (isset($params['domain'])) {
            $domain = strtolower($params['domain']) == 'zikula' ? null : $params['domain'];
        } else {
            $domain = $view->getDomain();
            // default domain
        }
        // build array for tags (for %s, %1$s etc) if applicable
        ksort($params);
        $tags = array();
        foreach ($params as $key => $value) {
            if (preg_match('#^tag([0-9]{1,2})$#', $key)) {
                $tags[] = $value;
            }
        }
        $tags = count($tags) == 0 ? null : $tags;
        // perform gettext
        $output = isset($tags) ? __f($content, $tags, $domain) : __($content, $domain);
        if (isset($params['assign'])) {
            $render->assign($params['assign'], $output);
        } else {
            return $output;
        }
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:53,代码来源:block.gettext.php

示例3: smarty_function_html_select_languages

/**
 * Zikula_View function to display a drop down list of languages
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - name:     Name for the control
 *   - id:       ID for the control
 *   - selected: Selected value
 *   - installed: if set only show languages existing in languages folder
 *   - all:      show dummy entry '_ALL' on top of the list with empty value
 *
 * Example
 *   {html_select_languages name=language selected=en}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @deprecated smarty_function_html_select_locales()
 * @return string The value of the last status message posted, or void if no status message exists.
 */
function smarty_function_html_select_languages($params, Zikula_View $view)
{
    if (!isset($params['name']) || empty($params['name'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('html_select_languages', 'name')));
        return false;
    }
    require_once $view->_get_plugin_filepath('function', 'html_options');
    $params['output'] = array();
    $params['values'] = array();
    if (isset($params['all']) && $params['all']) {
        $params['values'][] = '';
        $params['output'][] = DataUtil::formatForDisplay(__('All'));
        unset($params['all']);
    }
    if (isset($params['installed']) && $params['installed']) {
        $languagelist = ZLanguage::getInstalledLanguageNames();
        unset($params['installed']);
    } else {
        $languagelist = ZLanguage::languageMap();
    }
    $params['output'] = array_merge($params['output'], DataUtil::formatForDisplay(array_values($languagelist)));
    $params['values'] = array_merge($params['values'], DataUtil::formatForDisplay(array_keys($languagelist)));
    $assign = isset($params['assign']) ? $params['assign'] : null;
    unset($params['assign']);
    $html_result = smarty_function_html_options($params, $view);
    if (!empty($assign)) {
        $view->assign($assign, $html_result);
    } else {
        return $html_result;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:51,代码来源:function.html_select_languages.php

示例4: smarty_function_previewimage

/**
 * Zikula_View function to display a preview image from a theme
 *
 * Available parameters:
 *  - name       name of the theme to display the preview image for
 *  - name       if set, the id assigned to the image
 *  - size         if set, the size of the image to use from small, medium, large (optional: default 'medium')
 *  - assign     if set, the title will be assigned to this variable
 *
 * Example
 * {previewimage name=andreas08 size=large}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.title.php::smarty_function_previewimage()
 *
 * @return string The markup to display the theme image.
 */
function smarty_function_previewimage($params, Zikula_View $view)
{
    if (!isset($params['name'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('previewimage', 'name')));
        return false;
    }
    if (!isset($params['size']) || !in_array($params['size'], array('large', 'medium', 'small'))) {
        $params['size'] = 'medium';
    }
    $idstring = '';
    if (isset($params['id'])) {
        $idstring = " id=\"{$params['id']}\"";
    }
    $themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($params['name']));
    $theme = ThemeUtil::getTheme($themeinfo['name']);
    $themePath = null === $theme ? "themes/{$themeinfo['directory']}/images" : $theme->getRelativePath() . '/Resources/public/images';
    if (file_exists("{$themePath}/preview_{$params['size']}.png")) {
        $filesrc = "{$themePath}/preview_{$params['size']}.png";
    } else {
        $filesrc = "system/ThemeModule/Resources/public/images/preview_{$params['size']}.png";
    }
    $markup = "<img{$idstring} src=\"{$filesrc}\" alt=\"\" />";
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $markup);
    } else {
        return $markup;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:47,代码来源:function.previewimage.php

示例5: validateAll

 /**
  * Performs all validation rules.
  *
  * @return mixed either array with error information or true on success
  */
 public function validateAll()
 {
     $errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
     $dom = ZLanguage::getModuleDomain('MUBoard');
     if (!$this->isValidInteger('userid')) {
         $errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('userid'), $dom);
         return $errorInfo;
     }
     if (!$this->isNumberNotEmpty('userid')) {
         $errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('userid'), $dom);
         return $errorInfo;
     }
     if (!$this->isNumberNotLongerThan('userid', 11)) {
         $errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('userid', 11), $dom);
         return $errorInfo;
     }
     if (!$this->isValidInteger('numberPostings')) {
         $errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('numberPostings'), $dom);
         return $errorInfo;
     }
     /* if (!$this->isNumberNotEmpty('numberPostings')) {
            $errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('numberPostings'), $dom);
            return $errorInfo;
        }*/
     if (!$this->isNumberNotLongerThan('numberPostings', 11)) {
         $errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('numberPostings', 11), $dom);
         return $errorInfo;
     }
     if (!$this->isValidDateTime('lastVisit')) {
         $errorInfo['message'] = __f('Error! Field value must be a valid datetime (%s).', array('lastVisit'), $dom);
         return $errorInfo;
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:39,代码来源:User.php

示例6: validateAll

 /**
  * Performs all validation rules.
  *
  * @return mixed either array with error information or true on success
  */
 public function validateAll()
 {
     $errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
     $dom = ZLanguage::getModuleDomain('MUBoard');
     if (!$this->isStringNotLongerThan('title', 255)) {
         $errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('title', 255), $dom);
         return $errorInfo;
     }
     if (!$this->isStringNotEmpty('title')) {
         $errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('title'), $dom);
         return $errorInfo;
     }
     if (!$this->isStringNotLongerThan('description', 2000)) {
         $errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('description', 2000), $dom);
         return $errorInfo;
     }
     if (!$this->isStringNotEmpty('description')) {
         $errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('description'), $dom);
         return $errorInfo;
     }
     if (!$this->isValidInteger('pos')) {
         $errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('pos'), $dom);
         return $errorInfo;
     }
     /* if (!$this->isNumberNotEmpty('pos')) {
            $errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('pos'), $dom);
            return $errorInfo;
        }*/
     if (!$this->isNumberNotLongerThan('pos', 3)) {
         $errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('pos', 3), $dom);
         return $errorInfo;
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:39,代码来源:Category.php

示例7: smarty_function_modgetvar

/**
 * Zikula_View function to get module variable
 *
 * This function obtains a module-specific variable from the Zikula system.
 *
 * Note that the results should be handled by the safetext or the safehtml
 * modifier before being displayed.
 *
 *
 * Available parameters:
 *   - module:   The well-known name of a module from which to obtain the variable
 *   - name:     The name of the module variable to obtain
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - html:     If true then result will be treated as html content
 *   - default:  The default value to return if the config variable is not set
 *
 * Example
 *   {modgetvar module='Example' name='foobar' assign='foobarOfExample'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The module variable.
 */
function smarty_function_modgetvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $module = isset($params['module']) ? $params['module'] : null;
    $html = isset($params['html']) ? (bool) $params['html'] : false;
    $name = isset($params['name']) ? $params['name'] : null;
    if (!$module) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'module')));
        return false;
    }
    if (!$name && !$assign) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'name')));
        return false;
    }
    if (!$name) {
        $result = ModUtil::getVar($module);
    } else {
        $result = ModUtil::getVar($module, $name, $default);
    }
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if ($html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:54,代码来源:function.modgetvar.php

示例8: smarty_function_modapifunc

/**
 * Zikula_View function to to execute a module API function
 *
 * This function calls a calls a specific module API function. It returns whatever the return
 * value of the resultant function is if it succeeds.
 * Note that in contrast to the API function ModUtil::apiFunc you need not to load the
 * module API with ModUtil::loadApi.
 *
 *
 * Available parameters:
 *   - modname:  The well-known name of a module to execute a function from (required)
 *   - type:     The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
 *   - func:     The name of the module function to execute (default is 'main')
 *   - assign:   The name of a variable to which the results are assigned
 *   - all remaining parameters are passed to the module API function
 *
 * Examples
 *   {modapifunc modname='News' type='user' func='get' sid='3'}
 *
 *   {modapifunc modname='foobar' type='user' func='getfoo' id='1' assign='myfoo'}
 *   {$myfoo.title}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.modfunc.php::smarty_function_modfunc()
 *
 * @return string The results of the module API function.
 */
function smarty_function_modapifunc($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $func = isset($params['func']) && $params['func'] ? $params['func'] : 'main';
    $modname = isset($params['modname']) ? $params['modname'] : null;
    $type = isset($params['type']) && $params['type'] ? $params['type'] : 'user';
    // avoid passing these to ModUtil::apiFunc
    unset($params['modname']);
    unset($params['type']);
    unset($params['func']);
    unset($params['assign']);
    if (!$modname) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modapifunc', 'modname')));
        return false;
    }
    if (isset($params['modnamefunc'])) {
        $params['modname'] = $params['modnamefunc'];
        unset($params['modnamefunc']);
    }
    $result = ModUtil::apiFunc($modname, $type, $func, $params);
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:function.modapifunc.php

示例9: smarty_function_html_select_modulestylesheets

/**
 * Zikula_View function to display a drop down list of module stylesheets.
 *
 * Available parameters:
 *   - modname   The module name to show the styles for
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - id:       ID for the control
 *   - name:     Name for the control
 *   - exclude   Comma seperated list of files to exclude (optional)
 *   - selected: Selected value
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The value of the last status message posted, or void if no status message exists.
 */
function smarty_function_html_select_modulestylesheets($params, Zikula_View $view)
{
    if (!isset($params['modname'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('html_select_modulestylesheets', 'modname')));
        return false;
    }
    if (isset($params['exclude'])) {
        $exclude = explode(',', trim($params['exclude']));
        unset($params['exclude']);
    } else {
        $exclude = array();
    }
    $params['values'] = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodstyles', array('modname' => $params['modname'], 'exclude' => $exclude));
    unset($params['modname']);
    $params['output'] = $params['values'];
    $assign = isset($params['assign']) ? $params['assign'] : null;
    unset($params['assign']);
    require_once $view->_get_plugin_filepath('function', 'html_options');
    $output = smarty_function_html_options($params, $view);
    if (!empty($assign)) {
        $view->assign($assign, $output);
    } else {
        return $output;
    }
}
开发者ID:rmaiwald,项目名称:core,代码行数:41,代码来源:function.html_select_modulestylesheets.php

示例10: smarty_function_notifydisplayhooks

/**
 * Zikula_View function notify display hooks.
 *
 * This function notify display hooks.
 *
 * Available parameters:
 * - 'eventname' The name of the hook event [required].
 * - 'id'        The ID if the subject.
 * - 'urlobject' Zikula_ModUrl instance or null.
 * - 'assign'    If set, the results array is assigned to the named variable instead display [optional].
 * - all remaining parameters are passed to the hook via the args param in the event.
 *
 * Example:
 *  {notifydisplayhooks eventname='news.ui_hooks.item.display_view' id=$id urlobject=$urlObject}
 *  {notifydisplayhooks eventname='news.ui_hooks.item.display_view' id=$id urlobject=$urlObject assign='displayhooks'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    smarty_function_notifydisplayhooks()
 *
 * @return string|void if the results are assigned to variable in assigned.
 */
function smarty_function_notifydisplayhooks($params, Zikula_View $view)
{
    if (!isset($params['eventname'])) {
        return trigger_error(__f('Error! "%1$s" must be set in %2$s', array('eventname', 'notifydisplayhooks')));
    }
    $eventname = $params['eventname'];
    $id = isset($params['id']) ? $params['id'] : null;
    $urlObject = isset($params['urlobject']) ? $params['urlobject'] : null;
    if ($urlObject && !$urlObject instanceof \Zikula\Core\UrlInterface) {
        return trigger_error(__f('Error! "%1$s" must be an instance of %2$s', array('urlobject', '\\Zikula\\Core\\UrlInterface')));
    }
    $assign = isset($params['assign']) ? $params['assign'] : false;
    // create event and notify
    $hook = new Zikula_DisplayHook($eventname, $id, $urlObject);
    // @todo Zikula_DisplayHook maintains BC. IN 1.5.0 change to \Zikula\Core\Hook\DisplayHook($id, $urlObject);
    $view->getContainer()->get('hook_dispatcher')->dispatch($eventname, $hook);
    $responses = $hook->getResponses();
    // assign results, this plugin does not return any display
    if ($assign) {
        $view->assign($assign, $responses);
        return null;
    }
    $output = '';
    foreach ($responses as $result) {
        $output .= "<div class=\"z-displayhook\">{$result}</div>\n";
    }
    return $output;
}
开发者ID:Silwereth,项目名称:core,代码行数:51,代码来源:function.notifydisplayhooks.php

示例11: execute

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When the target directory does not exist or symlink cannot be used
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (version_compare(ZIKULACORE_CURRENT_INSTALLED_VERSION, UpgraderController::ZIKULACORE_MINIMUM_UPGRADE_VERSION, '<')) {
         $output->writeln(__f('The current installed version of Zikula is reporting (%1$s). You must upgrade to version (%2$s) before you can use this upgrade.', array(ZIKULACORE_CURRENT_INSTALLED_VERSION, UpgraderController::ZIKULACORE_MINIMUM_UPGRADE_VERSION)));
         return false;
     }
     $output->writeln(array("<info>---------------------------</info>", "| Zikula Upgrader Script |", "<info>---------------------------</info>"));
     $output->writeln("*** UPGRADING TO ZIKULA CORE v" . \Zikula_Core::VERSION_NUM . " ***");
     $env = $this->getContainer()->get('kernel')->getEnvironment();
     $output->writeln('Upgrading Zikula in <info>' . $env . '</info> environment.');
     $this->bootstrap(false);
     $output->writeln('Initializing upgrade...');
     $initStage = new InitStage($this->getContainer());
     $initStage->isNecessary();
     // runs init and upgradeUsersModule methods and intentionally returns false
     $output->writeln('Initialization complete');
     $warnings = $this->getContainer()->get('core_installer.controller.util')->initPhp();
     if (!empty($warnings)) {
         $this->printWarnings($output, $warnings);
         return;
     }
     $checks = $this->getContainer()->get('core_installer.controller.util')->requirementsMet($this->getContainer());
     if (true !== $checks) {
         $this->printRequirementsWarnings($output, $checks);
         return;
     }
     // get the settings from user input
     $formType = new LocaleType();
     $settings = $this->getHelper('form')->interactUsingForm($formType, $input, $output);
     $formType = new LoginType();
     $data = $this->getHelper('form')->interactUsingForm($formType, $input, $output);
     foreach ($data as $k => $v) {
         $data[$k] = base64_encode($v);
         // encode so values are 'safe' for json
     }
     $settings = array_merge($settings, $data);
     $formType = new RequestContextType();
     $data = $this->getHelper('form')->interactUsingForm($formType, $input, $output);
     foreach ($data as $k => $v) {
         $newKey = str_replace(':', '.', $k);
         $data[$newKey] = $v;
         unset($data[$k]);
     }
     $settings = array_merge($settings, $data);
     // write the parameters to custom_parameters.yml
     $yamlManager = new YamlDumper($this->getContainer()->get('kernel')->getRootDir() . '/config', 'custom_parameters.yml');
     $params = array_merge($yamlManager->getParameters(), $settings);
     $yamlManager->setParameters($params);
     // upgrade!
     $ajaxInstallerStage = new AjaxUpgraderStage();
     $stages = $ajaxInstallerStage->getTemplateParams();
     foreach ($stages['stages'] as $key => $stage) {
         $output->writeln($stage[AjaxInstallerStage::PRE]);
         $output->writeln("<fg=blue;options=bold>" . $stage[AjaxInstallerStage::DURING] . "</fg=blue;options=bold>");
         $status = $this->getContainer()->get('core_installer.controller.ajaxupgrade')->commandLineAction($stage[AjaxInstallerStage::NAME]);
         $message = $status ? "<info>" . $stage[AjaxInstallerStage::SUCCESS] . "</info>" : "<error>" . $stage[AjaxInstallerStage::FAIL] . "</error>";
         $output->writeln($message);
     }
     $output->writeln("UPGRADE COMPLETE!");
 }
开发者ID:rojblake,项目名称:core,代码行数:65,代码来源:UpgradeCommand.php

示例12: validate

 function validate(Zikula_Form_View $view)
 {
     parent::validate($view);
     if (!$this->isValid) {
         return;
     }
     if ($this->text != '') {
         if (!is_dir($this->text) || !is_readable($this->text)) {
             $this->setError(__f('The path %s does not exist or is not readable by the webserver.', $this->text));
         } elseif ($this->writable == true && !is_writable($this->text)) {
             $this->setError(__f('The webserver cannot write to %s.', $this->text));
         } else {
             if ($this->removeSlash == true) {
                 do {
                     $hasSlash = false;
                     if (StringUtil::right($this->text, 1) == '/') {
                         $hasSlash = true;
                         $this->text = StringUtil::left($this->text, strlen($this->text) - 1);
                     }
                 } while ($hasSlash == true);
             }
         }
     } else {
         $this->setError(__('Error! Missing path.'));
     }
 }
开发者ID:robbrandt,项目名称:Avatar,代码行数:26,代码来源:PathInput.php

示例13: delete

 function delete()
 {
     // security check
     if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
     $url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
     $class = 'AddressBook_DBObject_' . ucfirst($ot);
     if (!class_exists($class)) {
         return z_exit(__f('Error! Unable to load class [%s]', $ot));
     }
     $object = new $class();
     $data = $object->get($id);
     if (!$data) {
         LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
         return System::redirect($url);
     }
     $object->delete();
     if ($ot == "customfield") {
         $sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
         try {
             DBUtil::executeSQL($sql, -1, -1, true, true);
         } catch (Exception $e) {
         }
     }
     LogUtil::registerStatus($this->__('Done! Item deleted.'));
     return System::redirect($url);
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:30,代码来源:Admin.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param string $message
  * @param int $code
  */
 public function __construct($message = '', $code = 0)
 {
     if (empty($message)) {
         $message = __f("The requested extension [%s%] is currently unavailable.", __NAMESPACE__);
     }
     parent::__construct($message, $code);
 }
开发者ID:rmaiwald,项目名称:core,代码行数:13,代码来源:ExtensionNotAvailableException.php

示例15: loadFile

 /**
  * Load a file from the specified location in the file tree
  *
  * @param fileName    The name of the file to load
  * @param path        The path prefix to use (optional) (default=null)
  * @param exitOnError whether or not exit upon error (optional) (default=true)
  * @param returnVar   The variable to return from the sourced file (optional) (default=null)
  *
  * @return string The file which was loaded
  */
 public static function loadFile($fileName, $path = null, $exitOnError = true, $returnVar = null)
 {
     if (!$fileName) {
         return z_exit(__f("Error! Invalid file specification '%s'.", $fileName));
     }
     $file = null;
     if ($path) {
         $file = "{$path}/{$fileName}";
     } else {
         $file = $fileName;
     }
     $file = DataUtil::formatForOS($file);
     if (is_file($file) && is_readable($file)) {
         if (include_once $file) {
             if ($returnVar) {
                 return ${$returnVar};
             } else {
                 return $file;
             }
         }
     }
     if ($exitOnError) {
         return z_exit(__f("Error! Could not load the file '%s'.", $fileName));
     }
     return false;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:36,代码来源:Loader.php


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