• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DataUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: renderFootnotes

 /**
  * Render the links into a list and return html.
  * @return string
  */
 private function renderFootnotes()
 {
     $text = '';
     if (!empty($this->links)) {
         $text .= '<div><strong>' . __('Links') . '</strong>';
         $text .= '<ol>';
         $this->links = array_unique($this->links);
         foreach ($this->links as $key => $link) {
             // check for an e-mail address
             if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$/i", $link)) {
                 $linkText = $link;
                 $link = 'mailto:' . $link;
             } else {
                 $linkText = $link;
             }
             $linkText = \DataUtil::formatForDisplay($linkText);
             $link = \DataUtil::formatForDisplay($link);
             // output link
             $text .= '<li><a class="print-normal" href="' . $link . '">' . $linkText . '</a></li>' . "\n";
         }
         $text .= '</ol>';
         $text .= '</div>';
     }
     return $text;
 }
开发者ID:Silwereth,项目名称:core,代码行数:29,代码来源:ZikulaPrinterTheme.php


示例2: calcularPercentilMargens

 public static function calcularPercentilMargens($imc, $sexo, $nascimento)
 {
     $curva = new Curva();
     // Margens dos percentis baseado no cálculo inicial.
     $margemIMCInferior = $imc - MARGEM_LIMITE_PERCENTIL;
     $margemIMCSuperior = $imc + MARGEM_LIMITE_PERCENTIL;
     // Valores crescentes e decrescentes do IMC.
     $imcDecrescente = $imc;
     $imcCrescente = $imc;
     $idadeMeses = DataUtil::calcularIdadeMeses($nascimento);
     $db = new DbHandler();
     // Verificação do percentil inferior.
     $percentilInferior = NULL;
     while (empty($percentilInferior) && $imcDecrescente >= $margemIMCInferior) {
         // Decrescer gradativamente os valores do IMC na escala.
         $imcDecrescente = $imcDecrescente - ESCALA_IMC_PERCENTIL;
         $percentilInferior = $db->selecionarPercentil($imcDecrescente, $sexo, $idadeMeses);
     }
     $curva->setPercentilInferior($percentilInferior);
     // Verificação do percentil superior.
     $percentilSuperior = NULL;
     while (empty($percentilSuperior) && $imcCrescente <= $margemIMCSuperior) {
         // Crescer gradativamente os valores do IMC na escala.
         $imcCrescente = $imcCrescente + ESCALA_IMC_PERCENTIL;
         $percentilSuperior = $db->selecionarPercentil($imcCrescente, $sexo, $idadeMeses);
     }
     $curva->setPercentilSuperior($percentilSuperior);
     return $curva;
 }
开发者ID:joseilsonjunior,项目名称:nutrif,代码行数:29,代码来源:PercentilController.php


示例3: smarty_function_manuallink

/**
 * Zikula_View function to create  manual link.
 *
 * This function creates a manual link from some parameters.
 *
 * Available parameters:
 *   - manual:    name of manual file, manual.html if not set
 *   - chapter:   an anchor in the manual file to jump to
 *   - newwindow: opens the manual in a new window using javascript
 *   - width:     width of the window if newwindow is set, default 600
 *   - height:    height of the window if newwindow is set, default 400
 *   - title:     name of the new window if newwindow is set, default is modulename
 *   - class:     class for use in the <a> tag
 *   - assign:    if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {manuallink newwindow=1 width=400 height=300 title=rtfm }
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string|void
 */
function smarty_function_manuallink($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
    $userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $stdlang = System::getVar('language_i18n');
    $title = isset($params['title']) ? $params['title'] : 'Manual';
    $manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
    $chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
    $class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
    $width = isset($params['width']) ? $params['width'] : 600;
    $height = isset($params['height']) ? $params['height'] : 400;
    $modname = ModUtil::getName();
    $possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
    foreach ($possibleplaces as $possibleplace) {
        if (file_exists($possibleplace)) {
            $url = $possibleplace . $chapter;
            break;
        }
    }
    if (isset($params['newwindow'])) {
        $link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    } else {
        $link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    }
    if (isset($params['assign'])) {
        $ret = array('url' => $url, 'link' => $link);
        $view->assign($params['assign'], $ret);
        return;
    } else {
        return $link;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:function.manuallink.php


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


示例5: addParameters

 /**
  * called near end of loader() before template is fetched
  * @return array 
  */
 public static function addParameters()
 {
     // get plugins for tinymce
     $tinymce_listplugins = ModUtil::getVar('moduleplugin.scribite.tinymce', 'activeplugins');
     $tinymce_buttonmap = array('paste' => 'pastetext,pasteword,selectall', 'insertdatetime' => 'insertdate,inserttime', 'table' => 'tablecontrols,table,row_props,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,split_cells,merge_cells', 'directionality' => 'ltr,rtl', 'layer' => 'moveforward,movebackward,absolute,insertlayer', 'save' => 'save,cancel', 'style' => 'styleprops', 'xhtmlxtras' => 'cite,abbr,acronym,ins,del,attribs', 'searchreplace' => 'search,replace');
     if (is_array($tinymce_listplugins)) {
         // Buttons/controls: http://www.tinymce.com/wiki.php/Buttons/controls
         // We have some plugins with the button name same as plugin name
         // and a few plugins with custom button names, so we have to check the mapping array.
         $tinymce_buttons = array();
         foreach ($tinymce_listplugins as $tinymce_button) {
             if (array_key_exists($tinymce_button, $tinymce_buttonmap)) {
                 $tinymce_buttons = array_merge($tinymce_buttons, explode(",", $tinymce_buttonmap[$tinymce_button]));
             } else {
                 $tinymce_buttons[] = $tinymce_button;
             }
         }
         // TODO: I really would like to split this into multiple row, but I do not know how
         //    $tinymce_buttons_splitted = array_chunk($tinymce_buttons, 20);
         //    foreach ($tinymce_buttons_splitted as $key => $tinymce_buttonsrow) {
         //        $tinymce_buttonsrows[] = DataUtil::formatForDisplay(implode(',', $tinymce_buttonsrow));
         //    }
         $tinymce_buttons = DataUtil::formatForDisplay(implode(',', $tinymce_buttons));
         return array('buttons' => $tinymce_buttons);
     }
     return array('buttons' => '');
 }
开发者ID:pheski,项目名称:Scribite,代码行数:31,代码来源:Util.php


示例6: tagInclude

 /**
  * include a template file - in the current template (transparently)
  * @param string file | path to the template file - relative from view/
  */
 protected function tagInclude($attrs, $view)
 {
     $include = new View($attrs->file);
     $result = $include->render($view->data);
     $view->data = DataUtil::merge($view->data, $include->data);
     return $result;
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:11,代码来源:BasicTagLib.php


示例7: content_needleapi_content

/**
 * Content needle
 * @param $args['nid'] needle id
 * @return array()
 */
function content_needleapi_content($args)
{
    $dom = ZLanguage::getModuleDomain('Content');
    // Get arguments from argument array
    $nid = $args['nid'];
    unset($args);
    // cache the results
    static $cache;
    if (!isset($cache)) {
        $cache = array();
    }
    if (!empty($nid)) {
        if (!isset($cache[$nid])) {
            // not in cache array
            if (ModUtil::available('Content')) {
                $contentpage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $nid, 'includeContent' => false));
                if ($contentpage != false) {
                    $cache[$nid] = '<a href="' . DataUtil::formatForDisplay(ModUtil::url('Content', 'user', 'view', array('pid' => $nid))) . '" title="' . DataUtil::formatForDisplay($contentpage['title']) . '">' . DataUtil::formatForDisplay($contentpage['title']) . '</a>';
                } else {
                    $cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Unknown id', $dom)) . '</em>';
                }
            } else {
                $cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Content not available', $dom)) . '</em>';
            }
        }
        $result = $cache[$nid];
    } else {
        $result = '<em>' . DataUtil::formatForDisplay(__('No needle id', $dom)) . '</em>';
    }
    return $result;
}
开发者ID:robbrandt,项目名称:Content,代码行数:36,代码来源:content.php


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


示例9: smarty_function_mediashare_breadcrumb

function smarty_function_mediashare_breadcrumb($params, &$smarty)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    if (!isset($params['albumId'])) {
        $smarty->trigger_error(__f('Missing [%1$s] in \'%2$s\'', array('albumId', 'mediashare_breadcrumb'), $dom));
        return false;
    }
    $mode = isset($params['mode']) ? $params['mode'] : 'view';
    $breadcrumb = pnModAPIFunc('mediashare', 'user', 'getAlbumBreadcrumb', array('albumId' => (int) $params['albumId']));
    if ($breadcrumb === false) {
        $smarty->trigger_error(LogUtil::getErrorMessagesText());
        return false;
    }
    $urlType = $mode == 'edit' ? 'edit' : 'user';
    $url = pnModUrl('mediashare', $urlType, 'view', array('aid' => 0));
    $result = "<div class=\"mediashare-breadcrumb\">";
    $first = true;
    foreach ($breadcrumb as $album) {
        $url = DataUtil::formatForDisplay(pnModUrl('mediashare', $urlType, 'view', array('aid' => $album['id'])));
        $result .= ($first ? '' : ' &raquo; ') . "<a href=\"{$url}\">" . htmlspecialchars($album['title']) . "</a>";
        $first = false;
    }
    $result .= "</div>";
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $result);
    }
    return $result;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:28,代码来源:function.mediashare_breadcrumb.php


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


示例11: smarty_function_nextpostlink

/**
 * Smarty function to display a link to the next post
 *
 * Example
 * <!--[nextpostlink sid=$info.sid layout='%link% <span class="news_metanav">&raquo;</span>']-->
 *
 * @author Mark West
 * @since 20/10/03
 * @see function.nextpostlink.php::smarty_function_nextpostlink()
 * @param array $params All attributes passed to this function from the template
 * @param object &$smarty Reference to the Smarty object
 * @param integer $sid article id
 * @param string $layout HTML string in which to insert link
 * @return string the results of the module function
 */
function smarty_function_nextpostlink($params, &$smarty)
{
    if (!isset($params['sid'])) {
        // get the info template var
        $info = $smarty->get_template_vars('info');
        $params['sid'] = $info['sid'];
    }

    if (!isset($params['layout'])) {
        $params['layout'] = '%link% <span class="news_metanav">&raquo;</span>';
    }

    $article = ModUtil::apiFunc('News', 'user', 'getall',
                            array('query' => array(array('sid', '>', $params[sid])),
                                  'orderdir' => 'ASC',
                                  'numitems' => 1));

    if (!$article) {
        return;
    }

    $articlelink = '<a href="'.DataUtil::formatForDisplay(ModUtil::url('News', 'user', 'display', array('sid' => $article[0]['sid']))).'">'.DataUtil::formatForDisplay($article[0]['title']).'</a>';
    $articlelink = str_replace('%link%', $articlelink, $params['layout']);

    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $articlelink);
    } else {
        return $articlelink;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:45,代码来源:function.nextpostlink.php


示例12: EZComments_migrateapi_pnFlashGames

/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.2
 */
function EZComments_migrateapi_pnFlashGames()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('pnFlashGames comments migration: Not Admin');
    }
    // Get datbase setup
    $tables = DBUtil::getTables();
    $Commentstable = $tables['pnFlashGames_comments'];
    $Commentscolumn = $tables['pnFlashGames_comments_column'];
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    $sql = "SELECT {$Commentscolumn['gid']},\n                   {$Commentscolumn['uname']},\n                   {$Commentscolumn['date']},\n                   {$Commentscolumn['comment']},\n                   {$Usercolumn['uid']}\n             FROM  {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['uname']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('pnFlashGames migration: DB Error: ' . $sql . ' -- ' . mysql_error());
    }
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('gid', 'uname', 'date', 'comment', 'uid'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'pnFlashGames', 'objectid' => DataUtil::formatForStore($item['gid']), 'url' => ModUtil::url('pnFlashGames', 'user', 'display', array('id' => $item['gid'])), 'comment' => $item['comment'], 'subject' => '', 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('pnFlashGames migration: Error creating comment');
        }
    }
    return LogUtil::registerStatus('pnFlashGames migration successful');
}
开发者ID:rmaiwald,项目名称:EZComments,代码行数:39,代码来源:pnFlashGames.php


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


示例14: mediashare_mediahandlerapi_getHandlerInfo

function mediashare_mediahandlerapi_getHandlerInfo($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $mimeType = strtolower($args['mimeType']);
    $filename = strtolower($args['filename']);
    if (!empty($filename)) {
        $dotPos = strpos($filename, '.');
        if ($dotPos === false) {
            $fileType = '';
        } else {
            $fileType = substr($filename, $dotPos + 1);
        }
    } else {
        $fileType = '';
    }
    $pntable = pnDBGetTables();
    $handlersTable = $pntable['mediashare_mediahandlers'];
    $handlersColumn = $pntable['mediashare_mediahandlers_column'];
    $sql = "SELECT DISTINCT {$handlersColumn['handler']},\r\n                            {$handlersColumn['foundMimeType']},\r\n                            {$handlersColumn['foundFileType']}\r\n                       FROM {$handlersTable}\r\n                      WHERE {$handlersColumn['mimeType']} = '" . DataUtil::formatForStore($mimeType) . "'\r\n                         OR {$handlersColumn['fileType']} = '" . DataUtil::formatForStore($fileType) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND {$handlersColumn['active']} =\t1 ";
    $result = DBUtil::executeSQL($sql);
    $errormsg = __f('Unable to locate media handler for \'%1$s\' (%2$s)', array($filename, $mimeType), $dom);
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.getHandlerInfo', $errormsg), $dom));
    }
    if (!$result) {
        return LogUtil::registerError($errormsg);
    }
    $colArray = array('handlerName', 'mimeType', 'fileType');
    $handler = DBUtil::marshallObjects($result, $colArray);
    return $handler[0];
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:31,代码来源:pnmediahandlerapi.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


示例16: changeModuleCategory

 /**
  * Change the category a module belongs to by ajax.
  *
  * @return AjaxUtil::output Output to the calling ajax request is returned.
  *                          response is a string moduleid on sucess.
  */
 public function changeModuleCategory()
 {
     $this->checkAjaxToken();
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Admin::', '::', ACCESS_ADMIN));
     $moduleID = $this->request->getPost()->get('modid');
     $newParentCat = $this->request->getPost()->get('cat');
     //get info on the module
     $module = ModUtil::getInfo($moduleID);
     if (!$module) {
         //deal with couldnt get module info
         throw new Zikula_Exception_Fatal($this->__('Error! Could not get module name for id %s.'));
     }
     //get the module name
     $displayname = DataUtil::formatForDisplay($module['displayname']);
     $module = $module['name'];
     $oldcid = ModUtil::apiFunc('Admin', 'admin', 'getmodcategory', array('mid' => $moduleID));
     //move the module
     $result = ModUtil::apiFunc('Admin', 'admin', 'addmodtocategory', array('category' => $newParentCat, 'module' => $module));
     if (!$result) {
         throw new Zikula_Exception_Fatal($this->__('Error! Could not add module to module category.'));
     }
     $output = array();
     $output['response'] = $moduleID;
     $output['newParentCat'] = $newParentCat;
     $output['oldcid'] = $oldcid;
     $output['modulename'] = $displayname;
     $output['url'] = ModUtil::url($module, 'admin', 'main');
     return new Zikula_Response_Ajax($output);
 }
开发者ID:,项目名称:,代码行数:35,代码来源:


示例17: smarty_function_footnotes

/**
 * Smarty function to display footnotes caculated by earlier modifier
 *
 * Example
 *   {footnotes}
 *
 * @param       array       $params      All attributes passed to this function from the template
 * @param       object      $smarty     Reference to the Smarty object
 */
function smarty_function_footnotes($params, $smarty)
{
    // globalise the links array
    global $link_arr;
    $text = '';
    if (is_array($link_arr) && !empty($link_arr)) {
        $text .= '<ol>';
        $link_arr = array_unique($link_arr);
        foreach ($link_arr as $key => $link) {
            // check for an e-mail address
            if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$/i", $link)) {
                $linktext = $link;
                $link = 'mailto:' . $link;
                // append base URL for local links (not web links)
            } elseif (!preg_match("/^http:\\/\\//i", $link)) {
                $link = System::getBaseUrl() . $link;
                $linktext = $link;
            } else {
                $linktext = $link;
            }
            $linktext = DataUtil::formatForDisplay($linktext);
            $link = DataUtil::formatForDisplay($link);
            // output link
            $text .= '<li><a class="print-normal" href="' . $link . '">' . $linktext . '</a></li>' . "\n";
        }
        $text .= '</ol>';
    }
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $text);
    } else {
        return $text;
    }
}
开发者ID:rmaiwald,项目名称:core,代码行数:42,代码来源:function.footnotes.php


示例18: display

 /**
  * Display block
  */
 public function display($blockinfo)
 {
     if (!SecurityUtil::checkPermission('Zgoodies:marqueeblock:', "{$blockinfo['bid']}::", ACCESS_OVERVIEW)) {
         return;
     }
     if (!ModUtil::available('Zgoodies')) {
         return;
     }
     $vars = BlockUtil::varsFromContent($blockinfo['content']);
     $lang = ZLanguage::getLanguageCode();
     // block title
     if (isset($vars['block_title'][$lang]) && !empty($vars['block_title'][$lang])) {
         $blockinfo['title'] = $vars['block_title'][$lang];
     }
     // marquee content
     if (isset($vars['marquee_content'][$lang]) && !empty($vars['marquee_content'][$lang])) {
         $vars['marquee_content_lang'] = $vars['marquee_content'][$lang];
     }
     if (!isset($vars['marquee_content'])) {
         $vars['marquee_content_lang'] = '';
     }
     $this->view->assign('vars', $vars);
     $this->view->assign('bid', $blockinfo['bid']);
     $blockinfo['content'] = $this->view->fetch('blocks/' . $vars['block_template']);
     if (isset($vars['block_wrap']) && !$vars['block_wrap']) {
         if (empty($blockinfo['title'])) {
             return $blockinfo['content'];
         } else {
             return '<h4>' . DataUtil::formatForDisplayHTML($blockinfo['title']) . '</h4>' . "\n" . $blockinfo['content'];
         }
     }
     return BlockUtil::themeBlock($blockinfo);
 }
开发者ID:nmpetkov,项目名称:Zgoodies,代码行数:36,代码来源:Marquee.php


示例19: toggleblock

    /**
     * Toggleblock.
     *
     * This function toggles active/inactive.
     *
     * @param bid int  id of block to toggle.
     *
     * @return mixed true or Ajax error
     */
    public function toggleblock()
    {
        $this->checkAjaxToken();
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Blocks::', '::', ACCESS_ADMIN));

        $bid = $this->request->request->get('bid', -1);

        if ($bid == -1) {
            throw new Zikula_Exception_Fatal($this->__('No block ID passed.'));
        }

        // read the block information
        $blockinfo = BlockUtil::getBlockInfo($bid);
        if ($blockinfo == false) {
            throw new Zikula_Exception_Fatal($this->__f('Error! Could not retrieve block information for block ID %s.', DataUtil::formatForDisplay($bid)));
        }

        if ($blockinfo['active'] == 1) {
            ModUtil::apiFunc('Blocks', 'admin', 'deactivate', array('bid' => $bid));
        } else {
            ModUtil::apiFunc('Blocks', 'admin', 'activate', array('bid' => $bid));
        }

        return new Zikula_Response_Ajax(array('bid' => $bid));
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:34,代码来源:Ajax.php


示例20: getPanelContent

 /**
  * Returns the the HTML code of the content panel.
  *
  * @return string HTML
  */
 public function getPanelContent()
 {
     $rows = array();
     foreach ($this->_log as $log) {
         $hasFileAndLine = isset($log['errfile']) && $log['errfile'] && isset($log['errline']) && $log['errline'];
         $rows[] = '<tr class="DebugToolbarType' . $log['type'] . '">
                        <td class="DebugToolbarLogsType">' . $this->getImageForErrorType($log['type']) . ' ' . $this->errorTypeToString($log['type']) . '</td>
                        <td class="DebugToolbarLogsMessage">' . DataUtil::formatForDisplay($log['errstr']) . '</td>
                        <td class="DebugToolbarLogsFile">' . ($hasFileAndLine ? $log['errfile'] . ':' . $log['errline'] : '-') . '</td>
                    </tr>';
     }
     if (empty($rows)) {
         $rows[] = '<tr>
                        <td colspan="3">' . __('No items found.') . '</td>
                    </tr>';
     }
     return '<table class="DebugToolbarTable">
                 <tr>
                     <th class="DebugToolbarLogsType">' . __('Type') . '</th>
                     <th class="DebugToolbarLogsMessage">' . __('Message') . '</th>
                     <th class="DebugToolbarLogsFile">' . __('File: Line') . '</th>
                 </tr>
                 ' . implode(' ', $rows) . '
             </table>';
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:30,代码来源:Log.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DataValidator类代码示例发布时间:2022-05-23
下一篇:
PHP DataType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap