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


PHP DataUtil::formatForOS方法代码示例

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


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

示例1: 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

示例2: transform

 /**
  * transform text to images
  * 
  * @param string $args['text']
  */
 function transform($args)
 {
     $text = $args['text'];
     // check the user agent - if it is a bot, return immediately
     $robotslist = array("ia_archiver", "googlebot", "mediapartners-google", "yahoo!", "msnbot", "jeeves", "lycos");
     $useragent = System::serverGetVar('HTTP_USER_AGENT');
     for ($cnt = 0; $cnt < count($robotslist); $cnt++) {
         if (strpos(strtolower($useragent), $robotslist[$cnt]) !== false) {
             return $text;
         }
     }
     $smilies = $this->getVar('smilie_array');
     $remove_inactive = $this->getVar('remove_inactive');
     if (is_array($smilies) && count($smilies) > 0) {
         // sort smilies, see http://code.zikula.org/BBSmile/ticket/1
         uasort($smilies, array($this, 'cmp_smiliesort'));
         $imagepath = System::getBaseUrl() . DataUtil::formatForOS($this->getVar('smiliepath'));
         $imagepath_auto = System::getBaseUrl() . DataUtil::formatForOS($this->getVar('smiliepath_auto'));
         $auto_active = $this->getVar('activate_auto');
         // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
         // This is important!
         $text = ' ' . $text;
         foreach ($smilies as $smilie) {
             // check if smilie is active
             if ($smilie['active'] == 1) {
                 // check if alt is a define
                 $smilie['alt'] = defined($smilie['alt']) ? constant($smilie['alt']) : $smilie['alt'];
                 if ($smilie['type'] == 0) {
                     $text = str_replace($smilie['short'], ' <img src="' . $imagepath . '/' . $smilie['imgsrc'] . '" alt="' . $smilie['alt'] . '" /> ', $text);
                 } else {
                     if ($auto_active == 1) {
                         $text = str_replace($smilie['short'], ' <img src="' . $imagepath_auto . '/' . $smilie['imgsrc'] . '" alt="' . $smilie['alt'] . '" /> ', $text);
                     }
                 }
                 if (!empty($smilie['alias'])) {
                     $aliases = explode(",", trim($smilie['alias']));
                     if (is_array($aliases) && count($aliases) > 0) {
                         foreach ($aliases as $alias) {
                             if ($smilie['type'] == 0) {
                                 $text = str_replace($alias, ' <img src="' . $imagepath . '/' . $smilie['imgsrc'] . '" alt="' . $smilie['alt'] . '" /> ', $text);
                             } else {
                                 if ($auto_active == 1) {
                                     $text = str_replace($alias, ' <img src="' . $imagepath_auto . '/' . $smilie['imgsrc'] . '" alt="' . $smilie['alt'] . '" /> ', $text);
                                 }
                             }
                         }
                     }
                 }
             } else {
                 // End of if smilie is active
                 $text = str_replace($smilie['short'], '', $text);
             }
         }
         // foreach
         // Remove our padding from the string..
         $text = substr($text, 1);
     }
     // End of if smilies is array and not empty
     return $text;
 }
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:65,代码来源:User.php

示例3: processTemplate

 /**
  * Utility method for managing view templates.
  *
  * @param Zikula_View $view       Reference to view object.
  * @param string      $type       Current type (admin, user, ...).
  * @param string      $objectType Name of treated entity type.
  * @param string      $func       Current function (main, view, ...).
  * @param array       $args       Additional arguments.
  *
  * @return mixed Output.
  */
 public static function processTemplate($view, $type, $objectType, $func, $args = array())
 {
     // create the base template name
     $template = DataUtil::formatForOS($type . '/' . $objectType . '/' . $func);
     // check for template extension
     $templateExtension = self::determineExtension($view, $type, $objectType, $func, $args);
     // check whether a special template is used
     $tpl = isset($args['tpl']) && !empty($args['tpl']) ? $args['tpl'] : FormUtil::getPassedValue('tpl', '', 'GETPOST', FILTER_SANITIZE_STRING);
     if (!empty($tpl) && $view->template_exists($template . '_' . DataUtil::formatForOS($tpl) . '.' . $templateExtension)) {
         $template .= '_' . DataUtil::formatForOS($tpl);
     }
     $template .= '.' . $templateExtension;
     // look whether we need output with or without the theme
     $raw = (bool) (isset($args['raw']) && !empty($args['raw'])) ? $args['raw'] : FormUtil::getPassedValue('raw', false, 'GETPOST', FILTER_VALIDATE_BOOLEAN);
     if (!$raw && in_array($templateExtension, array('csv', 'rss', 'atom', 'xml', 'pdf', 'vcard', 'ical', 'json'))) {
         $raw = true;
     }
     if ($raw == true) {
         // standalone output
         if ($templateExtension == 'pdf') {
             return self::processPdf($view, $template);
         } else {
             $view->display($template);
         }
         System::shutDown();
     }
     // normal output
     return $view->fetch($template);
 }
开发者ID:rmaiwald,项目名称:MUBoard,代码行数:40,代码来源:View.php

示例4: main

    /**
     * display theme changing user interface
     */
    public function main()
    {
        // check if theme switching is allowed
        if (!System::getVar('theme_change')) {
            LogUtil::registerError($this->__('Notice: Theme switching is currently disabled.'));
            $this->redirect(ModUtil::url('Users', 'user', 'main'));
        }

        if (!SecurityUtil::checkPermission('Theme::', '::', ACCESS_COMMENT)) {
            return LogUtil::registerPermissionError();
        }

        // get our input
        $startnum = FormUtil::getPassedValue('startnum', isset($args['startnum']) ? $args['startnum'] : 1, 'GET');

        // we need this value multiple times, so we keep it
        $itemsperpage = $this->getVar('itemsperpage');

        // get some use information about our environment
        $currenttheme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));

        // get all themes in our environment
        $allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER);

        $previewthemes = array();
        $currentthemepic = null;
        foreach ($allthemes as $key => $themeinfo) {
            $themename = $themeinfo['name'];
            if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_medium.png')) {
                $themeinfo['previewImage'] = $themepic;
                $themeinfo['largeImage'] = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_large.png';
            } else {
                $themeinfo['previewImage'] = 'system/Theme/images/preview_medium.png';
                $themeinfo['largeImage'] = 'system/Theme/images/preview_large.png';
            }
            if ($themename == $currenttheme['name']) {
                $currentthemepic = $themepic;
                unset($allthemes[$key]);
            } else {
                $previewthemes[$themename] = $themeinfo;
            }
        }

        $previewthemes = array_slice($previewthemes, $startnum-1, $itemsperpage);

        $this->view->setCaching(Zikula_View::CACHE_DISABLED);

        $this->view->assign('currentthemepic', $currentthemepic)
                   ->assign('currenttheme', $currenttheme)
                   ->assign('themes', $previewthemes)
                   ->assign('defaulttheme', ThemeUtil::getInfo(ThemeUtil::getIDFromName(System::getVar('Default_Theme'))));

        // assign the values for the pager plugin
        $this->view->assign('pager', array('numitems' => sizeof($allthemes),
                                           'itemsperpage' => $itemsperpage));

        // Return the output that has been generated by this function
        return $this->view->fetch('theme_user_main.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:62,代码来源:User.php

示例5: updateFile

 function updateFile($orgFileReference, $newFilename)
 {
     $dom = ZLanguage::getModuleDomain('mediashare');
     $orgFilename = $this->storageDir . '/' . DataUtil::formatForOS($orgFileReference);
     if (!copy($newFilename, $orgFilename)) {
         return LogUtil::registerError(__f('Unable to copy the file from \'%1$s\' to \'%2$s\'', array($newFilename, $orgFileReference), $dom));
     }
     return true;
 }
开发者ID:ro0f,项目名称:Mediashare,代码行数:9,代码来源:pnvfs_fsdirectapi.php

示例6: deleteavatar

 /**
  * delete an avatar
  *
  */
 public function deleteavatar($args)
 {
     if (!SecurityUtil::checkPermission('Avatar::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $osdir = DataUtil::formatForOS(ModUtil::getVar('Users', 'avatarpath'));
     $avatarfile = $osdir . '/' . DataUtil::formatForOS($args['avatar']);
     if (unlink($avatarfile) == false) {
         return LogUtil::registerError($this->__f('Error! Unable to delete avatar \'%s\'.', $avatarfile));
     }
     LogUtil::registerStatus($this->__f('Done! The Avatar \'%s\' has been deleted.', $avatarfile));
     return true;
 }
开发者ID:robbrandt,项目名称:Avatar,代码行数:17,代码来源:Admin.php

示例7: update

 /**
  * Step 1 - Check if the needed files exists and if they are writeable
  * @author Albert Pérez Monfort (aperezm@xtec.cat)
  * @return if they exist and are writeable user can jump to step 2
  */
 public function update()
 {
     $filesRealPath = FormUtil::getPassedValue('filesRealPath', isset($args['filesRealPath']) ? $args['filesRealPath'] : null, 'POST');
     $usersFolder = FormUtil::getPassedValue('usersFolder', isset($args['usersFolder']) ? $args['usersFolder'] : null, 'POST');
     if (!SecurityUtil::checkPermission('Files::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $multisites = false;
     if (isset($GLOBALS['PNConfig']['Multisites']['multi']) && $GLOBALS['PNConfig']['Multisites']['multi'] == 1) {
         // create the needed folders for the site
         $siteDNS = isset($_GET['siteDNS']) ? DataUtil::formatForOS($_GET['siteDNS']) : null;
         $filesRealPath = $GLOBALS['PNConfig']['Multisites']['filesRealPath'] . '/' . $siteDNS . $GLOBALS['PNConfig']['Multisites']['siteFilesFolder'];
         if (!FileUtil::mkdirs($filesRealPath . '/' . $usersFolder, 0777, true)) {
             LogUtil::registerError($this->__('Directory creation error') . ': ' . $usersFolder);
             return false;
         }
         $multisites = true;
     }
     // check if the needed files are located in the correct places and they are writeable
     $file1 = false;
     $file2 = false;
     $fileWriteable1 = false;
     $fileWriteable2 = false;
     $path = $filesRealPath;
     if (file_exists($path)) {
         $file1 = true;
     }
     if (is_writeable($path)) {
         $fileWriteable1 = true;
     }
     $path = $filesRealPath . '/' . $usersFolder;
     if (file_exists($path)) {
         $file2 = true;
     }
     if (is_writeable($path)) {
         $fileWriteable2 = true;
     }
     if ($fileWriteable1 && $fileWriteable2) {
         ModUtil::setVar('Files', 'folderPath', $filesRealPath);
         ModUtil::setVar('Files', 'usersFolder', $usersFolder);
     }
     $this->view->assign('filesRealPath', $filesRealPath);
     $this->view->assign('usersFolder', $usersFolder);
     $this->view->assign('file1', $file1);
     $this->view->assign('file2', $file2);
     $this->view->assign('multisites', $multisites);
     $this->view->assign('fileWriteable1', $fileWriteable1);
     $this->view->assign('fileWriteable2', $fileWriteable2);
     $this->view->assign('step', 'check');
     return $this->view->fetch('Files_init.htm');
 }
开发者ID:hardtoneselector,项目名称:Files,代码行数:56,代码来源:Interactiveinstaller.php

示例8: smarty_function_adminonlinemanual

/**
 * Smarty function to displaya modules online manual
 *
 * Admin
 * {adminonlinemanual}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $smarty     Reference to the Smarty object
 * @param        int         xhtml        if set, the link to the navtabs.css will be xhtml compliant
 * @return       string      the results of the module function
 */
function smarty_function_adminonlinemanual($params, $smarty)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('adminonlinemanual')), E_USER_DEPRECATED);
    $lang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $modinfo = ModUtil::getInfoFromName(ModUtil::getName());
    $modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
    $file = DataUtil::formatForOS("{$modpath}/{$modinfo['directory']}/lang/{$lang}/manual.html");
    $man_link = '';
    if (is_readable($file)) {
        PageUtil::addVar('javascript', 'zikula.ui');
        $man_link = '<div style="margin-top: 20px; text-align:center">[ <a id="online_manual" href="' . $file . '">' . __('Online manual') . '</a> ]</div>' . "\n";
        $man_link .= '<script type="text/javascript">var online_manual = new Zikula.UI.Window($(\'online_manual\'),{resizable: true})</script>' . "\n";
    }
    return $man_link;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:function.adminonlinemanual.php

示例9: loadModels

 /**
  * Aggressively load models.
  *
  * This helper is required because we are using PEAR naming standards with
  * our own autoloading.  Doctrine's model loading doesn't take this into
  * account in non agressive modes.
  *
  * In general, this method is NOT required.
  *
  * @param string $modname Module name to load models for.
  *
  * @return void
  */
 public static function loadModels($modname)
 {
     $modname = isset($modname) ? strtolower((string) $modname) : '';
     $modinfo = ModUtil::getInfoFromName($modname);
     $osdir = DataUtil::formatForOS($modinfo['directory']);
     $base = $modinfo['type'] == ModUtil::TYPE_MODULE ? 'modules' : 'system';
     $dm = Doctrine_Manager::getInstance();
     $save = $dm->getAttribute(Doctrine_Core::ATTR_MODEL_LOADING);
     $dm->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE);
     $path = "{$base}/{$osdir}/lib/{$osdir}/Model";
     // prevent exception when model folder does not exist
     if (file_exists($path)) {
         Doctrine_Core::loadModels(realpath($path));
     }
     $dm->setAttribute(Doctrine::ATTR_MODEL_LOADING, $save);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:29,代码来源:DoctrineUtil.php

示例10: display

    /**
     * display block
     *
     * @param  array  $blockinfo a blockinfo structure
     * @return output the rendered bock
     */
    public function display($blockinfo)
    {
        if (!SecurityUtil::checkPermission('fincludeblock::', "$blockinfo[title]::", ACCESS_READ)) {
            return;
        }

        // Get current content
        $vars = BlockUtil::varsFromContent($blockinfo['content']);

        // Defaults
        if (empty($vars['filo'])) {
            $vars['filo'] = 'relative/path/to/file.txt';
        }
        if (empty($vars['typo'])) {
            $vars['typo'] = 0;
        }

        if (!file_exists($vars['filo'])) {
            if (SecurityUtil::checkPermission('fincludeblock::', "$blockinfo[title]::", ACCESS_EDIT)) {
                $blockinfo['content'] = $this->__f("Error! The file '%s' was not found.", $vars['filo']);

                return BlockUtil::themeBlock($blockinfo);
            } else {
                return;
            }
        }

        $blockinfo['content'] = '';
        switch ($vars['typo']) {
            case 0:
                $blockinfo['content'] = /*nl2br(*/file_get_contents($vars['filo'])/*)*/;    // #155 (Blocktype finclude creates not needed line breaks)
                break;
            case 1:
                $blockinfo['content'] = DataUtil::formatForDisplay(file_get_contents($vars['filo']));
                break;
            case 2:
                ob_start();
                include DataUtil::formatForOS($vars['filo']);
                $blockinfo['content'] = ob_get_clean();
                break;
            default:
                return;
        }

        return BlockUtil::themeBlock($blockinfo);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:52,代码来源:Finclude.php

示例11: getViewTemplate

 /**
  * Determines the view template for a certain method with given parameters.
  *
  * @param Zikula_View $view    Reference to view object.
  * @param string      $type    Current controller (name of currently treated entity).
  * @param string      $func    Current function (main, view, ...).
  * @param array       $args    Additional arguments.
  *
  * @return string name of template file.
  */
 public function getViewTemplate(Zikula_View $view, $type, $func, $args = array())
 {
     // create the base template name
     $template = DataUtil::formatForOS($type . '/' . $func);
     // check for template extension
     $templateExtension = $this->determineExtension($view, $type, $func, $args);
     // check whether a special template is used
     $tpl = isset($args['tpl']) && !empty($args['tpl']) ? $args['tpl'] : FormUtil::getPassedValue('tpl', '', 'GETPOST', FILTER_SANITIZE_STRING);
     $templateExtension = '.' . $templateExtension;
     if ($templateExtension != '.tpl') {
         $templateExtension .= '.tpl';
     }
     if (!empty($tpl) && $view->template_exists($template . '_' . DataUtil::formatForOS($tpl) . $templateExtension)) {
         $template .= '_' . DataUtil::formatForOS($tpl);
     }
     $template .= $templateExtension;
     return $template;
 }
开发者ID:robbrandt,项目名称:MUVideo,代码行数:28,代码来源:View.php

示例12: load_smilies

 /**
  * get all smilies
  */
 public function load_smilies()
 {
     // default smilies
     $icons = BBSmile_Util::getDefaultSmilies();
     if ($this->getVar('activate_auto') == 1) {
         $smiliepath_auto = DataUtil::formatForOS($this->getVar('smiliepath_auto'));
         $handle = opendir($smiliepath_auto);
         if ($handle != false) {
             while ($file = readdir($handle)) {
                 if ($file != '.' && $file != '..' && $file != 'index.tpl' && $file != 'CVS') {
                     if (preg_match("/(.*?)(.gif|.jpg|.jpeg|.png)\$/i", $file, $matches) != 0) {
                         $icons[$matches[1]] = array('type' => 1, 'imgsrc' => $matches[0], 'alt' => $matches[1], 'alias' => '', 'short' => ":" . $matches[1] . ":", 'active' => '1');
                     }
                 }
             }
         }
     }
     return $icons;
 }
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:22,代码来源:Admin.php

示例13: bbsmiles

 /**
  * bbsmiles
  * returns a html snippet with buttons for inserting bbsmiles into a text
  *
  * @param    $args['textfieldid']  id of the textfield for inserting smilies
  */
 public function bbsmiles($args)
 {
     if (!isset($args['textfieldid']) || empty($args['textfieldid'])) {
         return LogUtil::registerArgsError();
     }
     // if we have more than one textarea we need to distinguish them, so we simply use
     // a counter stored in a session var until we find a better solution
     $counter = SessionUtil::getVar('bbsmile_counter', 0);
     $counter++;
     SessionUtil::setVar('bbsmile_counter', $counter);
     $this->view->assign('counter', $counter);
     $this->view->assign('textfieldid', $args['textfieldid']);
     PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('BBSmile'));
     $templatefile = DataUtil::formatForOS(ModUtil::getName()) . '.tpl';
     if ($this->view->template_exists($templatefile)) {
         return $this->view->fetch($templatefile);
     }
     $this->view->add_core_data();
     return $this->view->fetch('bbsmile_user_bbsmiles.tpl');
 }
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:26,代码来源:User.php

示例14: handleCommand

 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('BBSmile', 'admin', 'main');
         return $view->redirect($url);
     }
     // Security check
     if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError(ModUtil::url('BBSmile', 'admin', 'main'));
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $ok = true;
     $data = $view->getValues();
     $ossmiliepath = DataUtil::formatForOS($data['smiliepath']);
     if (!file_exists($ossmiliepath) || !is_readable($ossmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     $osautosmiliepath = DataUtil::formatForOS($data['smiliepath_auto']);
     if (!file_exists($osautosmiliepath) || !is_readable($osautosmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath_auto');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     if ($ok == false) {
         return false;
     }
     $this->setVar('smiliepath', $data['smiliepath']);
     $this->setVar('smiliepath_auto', $data['smiliepath_auto']);
     $this->setVar('activate_auto', $data['activate_auto']);
     $this->setVar('remove_inactive', $data['remove_inactive']);
     LogUtil::registerStatus($this->__('BBSmile configuration updated'));
     return true;
 }
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:38,代码来源:ModifyConfig.php

示例15: comment

 /**
  * Display a comment form
  *
  * This function displays a comment form, if you do not want users to
  * comment on the same page as the item is.
  *
  * @param $comment the comment (taken from HTTP put)
  * @param $mod the name of the module the comment is for (taken from HTTP put)
  * @param $objectid ID of the item the comment is for (taken from HTTP put)
  * @param $redirect URL to return to (taken from HTTP put)
  * @param $subject The subject of the comment (if any) (taken from HTTP put)
  * @param $replyto The ID of the comment for which this an anser to (taken from HTTP put)
  * @param $template The name of the template file to use (with extension)
  * @todo Check out it this function can be merged with _view!
  * @since 0.2
  */
 public function comment($args)
 {
     $mod = isset($args['mod']) ? $args['mod'] : FormUtil::getPassedValue('mod', null, 'POST');
     $objectid = isset($args['objectid']) ? $args['objectid'] : FormUtil::getPassedValue('objectid', null, 'POST');
     $areaid = isset($args['areaid']) ? $args['areaid'] : FormUtil::getPassedValue('areaid', null, 'POST');
     $redirect = isset($args['redirect']) ? $args['redirect'] : FormUtil::getPassedValue('redirect', null, 'POST');
     $useurl = isset($args['useurl']) ? $args['useurl'] : FormUtil::getPassedValue('useurl', null, 'POST');
     $comment = isset($args['comment']) ? $args['comment'] : FormUtil::getPassedValue('comment', null, 'POST');
     $subject = isset($args['subject']) ? $args['subject'] : FormUtil::getPassedValue('subject', null, 'POST');
     $replyto = isset($args['replyto']) ? $args['replyto'] : FormUtil::getPassedValue('replyto', null, 'POST');
     $order = isset($args['order']) ? $args['order'] : FormUtil::getPassedValue('order', null, 'POST');
     $owneruid = isset($args['owneruid']) ? $args['owneruid'] : FormUtil::getPassedValue('owneruid', null, 'POST');
     $template = isset($args['template']) ? $args['template'] : FormUtil::getPassedValue('template', null, 'POST');
     $stylesheet = isset($args['ezccss']) ? $args['ezccss'] : FormUtil::getPassedValue('ezccss', null, 'POST');
     if ($order == 1) {
         $sortorder = 'DESC';
     } else {
         $sortorder = 'ASC';
     }
     $status = 0;
     // check if commenting is setup for the input module
     if (!ModUtil::available($mod) || !ModUtil::isHooked('EZComments', $mod)) {
         return LogUtil::registerPermissionError();
     }
     // check if we're using the pager
     $enablepager = $this->getVar('enablepager');
     if ($enablepager) {
         $numitems = $this->getVar('commentsperpage');
         $startnum = FormUtil::getPassedValue('comments_startnum');
         if (!isset($startnum) && !is_numeric($startnum)) {
             $startnum = -1;
         }
     } else {
         $startnum = -1;
         $numitems = -1;
     }
     $items = ModUtil::apiFunc('EZComments', 'user', 'getall', compact('mod', 'objectid', 'sortorder', 'status', 'numitems', 'startnum'));
     if ($items === false) {
         return LogUtil::registerError($this->__('Internal Error.'), null, 'index.php');
     }
     $items = ModUtil::apiFunc('EZComments', 'user', 'prepareCommentsForDisplay', $items);
     if ($enablepager) {
         $commentcount = ModUtil::apiFunc('EZComments', 'user', 'countitems', compact('mod', 'objectid'));
     } else {
         $commentcount = count($items);
     }
     // don't use caching (for now...)
     $this->view->setCaching(false);
     $this->view->assign('comments', $items)->assign('commentcount', $commentcount)->assign('order', $sortorder)->assign('redirect', $redirect)->assign('allowadd', SecurityUtil::checkPermission('EZComments::', "{$mod}:{$objectid}: ", ACCESS_COMMENT))->assign('mod', DataUtil::formatForDisplay($mod))->assign('objectid', DataUtil::formatForDisplay($objectid))->assign('subject', DataUtil::formatForDisplay($subject))->assign('replyto', DataUtil::formatForDisplay($replyto))->assign('owneruid', $owneruid)->assign('useurl', $useurl)->assign(ModUtil::getVar('EZComments'))->assign('ezc_pager', array('numitems' => $commentcount, 'itemsperpage' => $numitems));
     // find out which template to use
     $templateset = isset($args['template']) ? $args['template'] : $template;
     $defaultcss = $this->getVar('css', 'style.css');
     if (!$this->view->template_exists(DataUtil::formatForOS($templateset) . '/ezcomments_user_comment.tpl')) {
         $templateset = $this->getVar('template', 'Standard');
     }
     $this->view->assign('template', $templateset);
     // include stylesheet if there is a style sheet
     $css = $stylesheet ? "{$stylesheet}.css" : $defaultcss;
     if ($css = ModUtil::apiFunc('EZComments', 'user', 'getStylesheet', array('path' => "{$templateset}/{$css}"))) {
         PageUtil::addVar('stylesheet', $css);
     }
     // FIXME comment template missing
     return $this->view->fetch(DataUtil::formatForOS($templateset) . '/ezcomments_user_view.tpl');
 }
开发者ID:rmaiwald,项目名称:EZComments,代码行数:80,代码来源:User.php


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