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


PHP System::getBaseUrl方法代码示例

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


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

示例1: smarty_function_getImage

/**
 * Smarty function to return first image src from given HTML content.
 *
 * Examples
 *  {getImage htmlcontent=$item.body}
 *  {getImage htmlcontent=$item.body putbaseurl=true}
 *  {getImage htmlcontent=$item.body putbaseurl=true assign='imagesrc'}
 *
 * @return string
 */
function smarty_function_getImage($params, Zikula_View $view)
{
    $result = $params['htmlcontent'];
    if (isset($params['htmlcontent']) && $params['htmlcontent']) {
        if (strpos($params['htmlcontent'], '<img ') === false) {
            // image is not found in content
        } else {
            // get image src
            $posstart = strpos($params['htmlcontent'], ' src="', $posstart) + 6;
            $posend = strpos($params['htmlcontent'], '"', $posstart);
            $result = substr($params['htmlcontent'], $posstart, $posend - $posstart);
            if (isset($params['putbaseurl']) && $params['putbaseurl']) {
                // put base url, if not
                if (substr($result, 0, 7) != 'http://' || substr($result, 0, 8) != 'https://') {
                    $result = System::getBaseUrl() . ltrim($result, DIRECTORY_SEPARATOR);
                }
            }
        }
    }
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $result);
    } else {
        return $result;
    }
}
开发者ID:nmpetkov,项目名称:Ephemerides,代码行数:35,代码来源:function.getImage.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: 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

示例4: getPluginData

 function getPluginData($filtAfterDate = null)
 {
     if (!$this->pluginAvailable()) {
         return array();
     }
     if (!SecurityUtil::checkPermission('ZphpBB2::', '::', ACCESS_READ, $this->userNewsletter)) {
         return array();
     }
     //ModUtil::load('ZphpBB2');
     $table_prefix = ModUtil::getVar('ZphpBB2', 'table_prefix', 'phpbb_');
     $TOPICS_TABLE = $table_prefix . "topics";
     $POSTS_TABLE = $table_prefix . "posts";
     $POSTS_TEXT_TABLE = $table_prefix . "posts_text";
     $FORUMS_TABLE = $table_prefix . "forums";
     $connection = Doctrine_Manager::getInstance()->getCurrentConnection();
     $sql = "SELECT forum_id, forum_name FROM {$FORUMS_TABLE} WHERE auth_view <= 0 AND auth_read <= 0";
     $stmt = $connection->prepare($sql);
     try {
         $stmt->execute();
     } catch (Exception $e) {
         return LogUtil::registerError(__('Error in plugin') . ' ZphpBB2: ' . $e->getMessage());
     }
     $userforums = $stmt->fetchAll(Doctrine_Core::FETCH_ASSOC);
     $allowedforums = array();
     foreach (array_keys($userforums) as $k) {
         if (SecurityUtil::checkPermission('ZphpBB2::', ":" . $userforums[$k]['forum_id'] . ":", ACCESS_READ, $this->userNewsletter)) {
             $allowedforums[] = $userforums[$k]['forum_id'];
         }
     }
     if (count($allowedforums) == 0) {
         // user is not allowed to read any forum at all
         return array();
     }
     $sql = "SELECT {$TOPICS_TABLE}.topic_title, {$TOPICS_TABLE}.topic_replies, {$TOPICS_TABLE}.topic_views, {$TOPICS_TABLE}.topic_id, \n                     {$POSTS_TABLE}.post_id, {$POSTS_TABLE}.poster_id, {$POSTS_TABLE}.post_time, \n                     {$POSTS_TEXT_TABLE}.post_subject, {$POSTS_TEXT_TABLE}.post_text, \n                     {$FORUMS_TABLE}.forum_name \n                     FROM {$TOPICS_TABLE} \n                     INNER JOIN {$POSTS_TABLE} ON {$POSTS_TABLE}.topic_id = {$TOPICS_TABLE}.topic_id \n                     INNER JOIN {$POSTS_TEXT_TABLE} ON {$POSTS_TEXT_TABLE}.post_id = {$POSTS_TABLE}.post_id \n                     INNER JOIN {$FORUMS_TABLE} ON {$FORUMS_TABLE}.forum_id = {$TOPICS_TABLE}.forum_id";
     $sql .= " WHERE {$TOPICS_TABLE}.forum_id IN (" . implode(',', $allowedforums) . ")";
     if ($filtAfterDate) {
         $sql .= " AND FROM_UNIXTIME(post_time)>='" . $filtAfterDate . "'";
     }
     $sql .= " ORDER BY post_time DESC LIMIT " . $this->nItems;
     $stmt = $connection->prepare($sql);
     try {
         $stmt->execute();
     } catch (Exception $e) {
         return LogUtil::registerError(__('Error in plugin') . ' ZphpBB2: ' . $e->getMessage());
     }
     $items = $stmt->fetchAll(Doctrine_Core::FETCH_BOTH);
     foreach (array_keys($items) as $k) {
         $items[$k]['topicurl'] = ModUtil::url('ZphpBB2', 'user', 'viewtopic', array('t' => $items[$k]['topic_id']));
         $items[$k]['posturl'] = ModUtil::url('ZphpBB2', 'user', 'viewtopic', array('p' => $items[$k]['post_id'] . '#' . $items[$k]['post_id']));
         $items[$k]['postdate'] = DateUtil::getDatetime($items[$k]['post_time']);
         $items[$k]['username'] = UserUtil::getVar('uname', $items[$k]['poster_id']);
         $items[$k]['nl_title'] = $items[$k]['topic_title'];
         $items[$k]['nl_url_title'] = System::getBaseUrl() . $items[$k]['posturl'];
         $items[$k]['nl_content'] = $items[$k]['forum_name'] . ', ' . $items[$k]['username'] . "<br />\n" . $items[$k]['post_text'];
         $items[$k]['nl_url_readmore'] = $items[$k]['nl_url_title'];
     }
     return $items;
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:58,代码来源:ZphpBB2.php

示例5: smarty_function_useravatar

/**
 * Zikula_View function to display the avatar of a user
 *
 * Available parameters:
 *   - uid            User uid
 *   - width, height  Width and heigt of the image (optional)
 *   - assign         The results are assigned to the corresponding variable instead of printed out (optional).
 * Gravatar parameters
 *   - size           Size of the gravtar (optional)
 *   - rating         Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience.
 *                    [g|pg|r|x] see: http://en.gravatar.com/site/implement/images/ (optional)
 *
 * Examples:
 * {useravatar uid="2"}
 * {useravatar uid="2" width=80 height=80}
 * {useravatar uid="2" size=80 rating=g}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string A formatted string containing the avatar image.
 */
function smarty_function_useravatar($params, Zikula_View $view)
{
    if (!isset($params['uid'])) {
        $view->trigger_error("Error! Missing 'uid' attribute for useravatar.");
        return false;
    }
    $email = UserUtil::getVar('email', $params['uid']);
    $avatar = UserUtil::getVar('avatar', $params['uid']);
    $uname = UserUtil::getVar('uname', $params['uid']);
    $avatarpath = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_AVATAR_IMAGE_PATH, UsersConstant::DEFAULT_AVATAR_IMAGE_PATH);
    $allowgravatars = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_GRAVATARS_ENABLED, UsersConstant::DEFAULT_GRAVATARS_ENABLED);
    $gravatarimage = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_GRAVATAR_IMAGE, UsersConstant::DEFAULT_GRAVATAR_IMAGE);
    if (isset($avatar) && !empty($avatar) && $avatar != $gravatarimage && $avatar != 'blank.gif') {
        $avatarURL = System::getBaseUrl() . $avatarpath . '/' . $avatar;
    } elseif ($avatar == $gravatarimage && $allowgravatars == 1) {
        if (!isset($params['rating'])) {
            $params['rating'] = false;
        }
        if (!isset($params['size'])) {
            if (isset($params['width'])) {
                $params['size'] = $params['width'];
            }
            $params['size'] = 80;
        }
        $params['width'] = $params['size'];
        $params['height'] = $params['size'];
        $avatarURL = 'http://www.gravatar.com/avatar.php?gravatar_id=' . md5($email);
        if (isset($params['rating']) && !empty($params['rating'])) {
            $avatarURL .= "&rating=" . $params['rating'];
        }
        if (isset($params['size']) && !empty($params['size'])) {
            $avatarURL .= "&size=" . $params['size'];
        }
        $avatarURL .= "&default=" . urlencode(System::getBaseUrl() . $avatarpath . '/' . $gravatarimage);
    } else {
        // e.g. blank.gif or empty avatars
        return false;
    }
    $classString = '';
    if (isset($params['class'])) {
        $classString = "class=\"{$params['class']}\" ";
    }
    $html = '<img ' . $classString . ' src="' . DataUtil::formatForDisplay($avatarURL) . '" title="' . DataUtil::formatForDisplay($uname) . '" alt="' . DataUtil::formatForDisplay($uname);
    if (isset($params['width'])) {
        $html .= ' width="' . $params['width'] . '"';
    }
    if (isset($params['height'])) {
        $html .= ' height="' . $params['height'] . '"';
    }
    $html .= '" />';
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $avatarURL);
    } else {
        return $html;
    }
}
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:78,代码来源:function.useravatar.php

示例6: smarty_function_getbaseurl

/**
 * Zikula_View function to obtain base URL for this site
 *
 * This function obtains the base URL for the site. The base url is defined as the
 * full URL for the site minus any file information  i.e. everything before the
 * 'index.php' from your start page.
 * Unlike the API function System::getBaseUrl, the results of this function are already
 * sanitized to display, so it should not be passed to the safetext modifier.
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Example
 *   {getbaseurl}
 *
 * @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 base URL of the site.
 */
function smarty_function_getbaseurl($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('getbaseurl', '$baseurl')), E_USER_DEPRECATED);
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $result = htmlspecialchars(System::getBaseUrl());
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:function.getbaseurl.php

示例7: smarty_function_id

/**
 * Smarty function to generate a valid atom ID for the feed
 *
 * Example
 *
 *   <id>{id}</id>
 *
 * @return       string the atom ID
 */
function smarty_function_id($params, &$smarty)
{
    $baseurl = System::getBaseUrl();
    $parts = parse_url($baseurl);
    $starttimestamp = strtotime(System::getVar('startdate'));
    $startdate = strftime('%Y-%m-%d', $starttimestamp);
    $sitename = System::getVar('sitename');
    $sitename = preg_replace('/[^a-zA-Z0-9-\\s]/', '', $sitename);
    $sitename = DataUtil::formatForURL($sitename);
    return "tag:{$parts['host']},{$startdate}:{$sitename}";
}
开发者ID:rmaiwald,项目名称:core,代码行数:20,代码来源:function.id.php

示例8: smarty_modifier_reviewsObjectState

/**
 * The reviewsObjectState modifier displays the name of a given object's workflow state.
 * Examples:
 *    {$item.workflowState|reviewsObjectState}       {* with visual feedback *}
 *    {$item.workflowState|reviewsObjectState:false} {* no ui feedback *}
 *
 * @param string  $state      Name of given workflow state.
 * @param boolean $uiFeedback Whether the output should include some visual feedback about the state.
 *
 * @return string Enriched and translated workflow state ready for display.
 */
function smarty_modifier_reviewsObjectState($state = 'initial', $uiFeedback = true)
{
    $serviceManager = ServiceUtil::getManager();
    $workflowHelper = new Reviews_Util_Workflow($serviceManager);
    $stateInfo = $workflowHelper->getStateInfo($state);
    $result = $stateInfo['text'];
    if ($uiFeedback === true) {
        $result = '<img src="' . System::getBaseUrl() . 'images/icons/extrasmall/' . $stateInfo['ui'] . 'led.png" width="16" height="16" alt="' . $result . '" />&nbsp;&nbsp;' . $result;
    }
    return $result;
}
开发者ID:rmaiwald,项目名称:Reviews,代码行数:22,代码来源:modifier.reviewsObjectState.php

示例9: smarty_outputfilter_shorturls

/**
 * Zikula_View short urls outputfilter plugin.
 *
 * File:      outputfilter.shorturls.php
 * Type:      outputfilter
 * Name:      shorturls
 *
 * @param string      $source Output source.
 * @param Zikula_View $view   Reference to Zikula_View instance.
 *
 * @return string
 */
function smarty_outputfilter_shorturls($source, $view)
{
    // If you control the server, it is preferable for better performance to put rewrite rules
    // from the htaccess file into main configuration file, httpd.conf.
    $baseurl = System::getBaseUrl();
    $prefix = '[(<[^>]*?)[\'"](?:' . $baseurl . '|' . $baseurl . ')?(?:[./]{0,2})';
    // Match local URLs in HTML tags, removes / and ./
    $in = array('[<([^>]+)\\s(src|href|background|action)\\s*=\\s*((["\'])?)(?!http)(?!skype)(?!xmpp)(?!icq)(?!mailto)(?!javascript:)(?![/"\'\\s#]+)]Ui');
    $out = array('<$1 $2=$3' . $baseurl);
    // perform the replacement
    $source = preg_replace($in, $out, $source);
    // return the modified source
    return $source;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:26,代码来源:outputfilter.shorturls.php

示例10: getJSConfig

 /**
  * Generate a configuration for javascript and return script tag to embed in HTML HEAD.
  *
  * @return string HTML code with script tag
  */
 public static function getJSConfig()
 {
     $return = '';
     $config = array('entrypoint' => System::getVar('entrypoint', 'index.php'), 'baseURL' => System::getBaseUrl(), 'baseURI' => System::getBaseUri() . '/', 'ajaxtimeout' => (int) System::getVar('ajaxtimeout', 5000), 'lang' => ZLanguage::getLanguageCode(), 'sessionName' => session_name());
     $config = DataUtil::formatForDisplay($config);
     $return .= "<script type=\"text/javascript\">/* <![CDATA[ */ \n";
     if (System::isLegacyMode()) {
         $return .= 'document.location.entrypoint="' . $config['entrypoint'] . '";';
         $return .= 'document.location.ajaxtimeout=' . $config['ajaxtimeout'] . ";\n";
     }
     $return .= "if (typeof(Zikula) == 'undefined') {var Zikula = {};}\n";
     $return .= "Zikula.Config = " . json_encode($config) . "\n";
     $return .= ' /* ]]> */</script>' . "\n";
     return $return;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:20,代码来源:JCSSUtil.php

示例11: smarty_function_cotypeEditor

/**
 * CoType
 *
 * @copyright (C) 2007, Jorn Wildt
 * @link http://www.elfisk.dk
 * @version $Id$
 * @license See license.txt
 */
function smarty_function_cotypeEditor($params, &$render)
{
    $inputId = $params['inputId'];
    $documentId = (int) $params['documentId'];
    static $firstTime = true;
    if ($firstTime) {
        PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
        $moduleStylesheet = '../../../../' . ThemeUtil::getModuleStylesheet('cotype', 'editor.css');
        $url = System::getBaseUrl();
        $head = "<script type=\"text/javascript\">\nCoTypeStylesheet = '{$moduleStylesheet}';\nCoTypeDocumentId = {$documentId};\n</script>";
        PageUtil::AddVar('header', $head);
    }
    $firstTime = false;
    $html = "";
    return $html;
}
开发者ID:rmaiwald,项目名称:Scribite,代码行数:24,代码来源:function.cotypeEditor.php

示例12: smarty_function_debugenvironment

/**
 * Zikula_View function to get all session variables.
 *
 * This function gets all session vars from the Zikula system assigns the names and
 * values to two array. This is being used in pndebug to show them.
 *
 * Example
 *   {debugenvironment}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return void
 */
function smarty_function_debugenvironment($params, Zikula_View $view)
{
    $view->assign('_ZSession_keys', array_keys($_SESSION));
    $view->assign('_ZSession_vals', array_values($_SESSION));
    $view->assign('_smartyversion', $view->_version);
    $_theme = ModUtil::getInfoFromName('ZikulaThemeModule');
    $view->assign('_themeversion', $_theme['version']);
    $view->assign('_force_compile', ModUtil::getVar('ZikulaThemeModule', 'force_compile') ? __('On') : __('Off'));
    $view->assign('_compile_check', ModUtil::getVar('ZikulaThemeModule', 'compile_check') ? __('On') : __('Off'));
    $view->assign('_baseurl', System::getBaseUrl());
    $view->assign('_baseuri', System::getBaseUri());
    $plugininfo = isset($view->_plugins['function']['zdebug']) ? $view->_plugins['function']['zdebug'] : $view->_plugins['function']['zpopup'];
    $view->assign('_template', $plugininfo[1]);
    $view->assign('_path', $view->get_template_path($plugininfo[1]));
    $view->assign('_line', $plugininfo[2]);
}
开发者ID:rmaiwald,项目名称:core,代码行数:30,代码来源:function.debugenvironment.php

示例13: display

    /**
     * Show the month calendar into a bloc
     * @autor:	Albert Pérez Monfort
     * @autor:	Toni Ginard Lladó
     * param:	The month and the year to show
     * return:	The calendar content
     */
    public function display($blockinfo) {

        // Security check
        if (!SecurityUtil::checkPermission("IWusers:welcomeblock:", $blockinfo['title'] . "::", ACCESS_READ)) {
            return;
        }
        $baseURL = System::getBaseUrl();
        $baseURL .= 'index.php';
        if ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] != $baseURL) {
            return;
        }
        // Check if the module is available
        if (!ModUtil::available('IWusers')) {
            return;
        }
        $user = (UserUtil::isLoggedIn()) ? UserUtil::getVar('uid') : '-1';
        // Only for loggedin users
        if ($user == '-1') {
            return;
        }
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $userName = ModUtil::func('IWmain', 'user', 'getUserInfo', array('sv' => $sv,
                    'uid' => $user,
                    'info' => 'n'));
        $values = explode('---', $blockinfo['url']);
        $hello = (!empty($values[0])) ? $values[0] : $this->__('Hi');
        $welcome = (!empty($values[0])) ? $values[1] : $this->__('welcome to the intranet');
        $date = (isset($values[2])) ? $values[2] : '';

        $s = $this->view->assign('userName', $userName)
                        ->assign('hello', $hello)
                        ->assign('welcome', $welcome)
                        ->assign('date', $date)
                        ->assign('dateText', date('d/m/Y', time()))
                        ->assign('timeText', date('H.i', time()))
                        ->fetch('IWusers_block_welcome.htm');
        // Populate block info and pass to theme
        $blockinfo['content'] = $s;
        return BlockUtil::themesideblock($blockinfo);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:47,代码来源:Welcome.php

示例14: getJSConfig

 /**
  * Generate a configuration for javascript and return script tag to embed in HTML HEAD.
  *
  * @return string HTML code with script tag
  */
 public static function getJSConfig()
 {
     $return = '';
     $config = array('entrypoint' => System::getVar('entrypoint', 'index.php'), 'baseURL' => System::getBaseUrl(), 'baseURI' => System::getBaseUri() . '/', 'ajaxtimeout' => (int) System::getVar('ajaxtimeout', 5000), 'lang' => ZLanguage::getLanguageCode(), 'sessionName' => session_name(), 'uid' => (int) UserUtil::getVar('uid'));
     $polyfill_features = PageUtil::getVar('polyfill_features');
     // merge in features added via twig
     $featuresFromTwig = ServiceUtil::get('zikula_core.common.theme.pagevars')->get('polyfill_features', []);
     $polyfill_features = array_unique(array_merge($polyfill_features, $featuresFromTwig));
     if (!empty($polyfill_features)) {
         $config['polyfillFeatures'] = implode(' ', $polyfill_features);
     }
     $config = DataUtil::formatForDisplay($config);
     $return .= "<script type=\"text/javascript\">/* <![CDATA[ */ \n";
     if (System::isLegacyMode()) {
         $return .= 'document.location.entrypoint="' . $config['entrypoint'] . '";';
         $return .= 'document.location.pnbaseURL="' . $config['baseURL'] . '"; ';
         $return .= 'document.location.ajaxtimeout=' . $config['ajaxtimeout'] . ";\n";
     }
     $return .= "if (typeof(Zikula) == 'undefined') {var Zikula = {};}\n";
     $return .= "Zikula.Config = " . json_encode($config) . "\n";
     $return .= ' /* ]]> */</script>' . "\n";
     return $return;
 }
开发者ID:Silwereth,项目名称:core,代码行数:28,代码来源:JCSSUtil.php

示例15: _upg_upgrademodules

/**
 * Generate the upgrade module page.
 *
 * This function upgrade available module to an upgrade
 *
 * @param string $username Username of the admin user.
 * @param string $password Password of the admin user.
 *
 * @return void
 */
function _upg_upgrademodules($username, $password)
{
    _upg_header();
    $modvars = DBUtil::selectObjectArray('module_vars');
    foreach ($modvars as $modvar) {
        if ($modvar['value'] == '0' || $modvar['value'] == '1') {
            $modvar['value'] = serialize($modvar['value']);
            DBUtil::updateObject($modvar, 'module_vars');
        }
    }
    // force load the modules admin API
    ModUtil::loadApi('Extensions', 'admin', true);
    echo '<h2>' . __('Starting upgrade') . '</h2>' . "\n";
    echo '<ul id="upgradelist" class="check">' . "\n";
    // reset for User module
    //$GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x'] = false;
    $results = ModUtil::apiFunc('Extensions', 'admin', 'upgradeall');
    if ($results) {
        foreach ($results as $modname => $result) {
            if ($result) {
                echo '<li class="passed">' . DataUtil::formatForDisplay($modname) . ' ' . __('upgraded') . '</li>' . "\n";
            } else {
                echo '<li class="failed">' . DataUtil::formatForDisplay($modname) . ' ' . __('not upgraded') . '</li>' . "\n";
            }
        }
    }
    echo '</ul>' . "\n";
    if (!$results) {
        echo '<ul class="check"><li class="passed">' . __('No modules required upgrading') . '</li></ul>';
    }
    // wipe out the deprecated modules from Modules list.
    $modTable = 'modules';
    $sql = "DELETE FROM {$modTable} WHERE name = 'Header_Footer' OR name = 'AuthPN' OR name = 'pnForm' OR name = 'Workflow' OR name = 'pnRender' OR name = 'Admin_Messages'";
    DBUtil::executeSQL($sql);
    // store localized displayname and description for Extensions module
    $extensionsDisplayname = __('Extensions');
    $extensionsDescription = __('Manage your modules and plugins.');
    $sql = "UPDATE modules SET name = 'Extensions', displayname = '{$extensionsDisplayname}', description = '{$extensionsDescription}' WHERE modules.name = 'Extensions'";
    DBUtil::executeSQL($sql);
    // regenerate the themes list
    ModUtil::apiFunc('Theme', 'admin', 'regenerate');
    // store the recent version in a config var for later usage. This enables us to determine the version we are upgrading from
    System::setVar('Version_Num', Zikula_Core::VERSION_NUM);
    System::setVar('language_i18n', ZLanguage::getLanguageCode());
    // Relogin the admin user to give a proper admin link
    SessionUtil::requireSession();
    echo '<p class="z-statusmsg">' . __('Finished upgrade') . " - \n";
    $authenticationInfo = array('login_id' => $username, 'pass' => $password);
    $authenticationMethod = array('modname' => 'Users', 'method' => 'uname');
    if (!UserUtil::loginUsing($authenticationMethod, $authenticationInfo)) {
        $url = sprintf('<a href="%s">%s</a>', DataUtil::formatForDisplay(System::getBaseUrl()), DataUtil::formatForDisplay(System::getVar('sitename')));
        echo __f('Go to the startpage for %s', $url);
    } else {
        upgrade_clear_caches();
        $url = sprintf('<a href="%s">%s</a>', ModUtil::url('Admin', 'admin', 'adminpanel'), DataUtil::formatForDisplay(System::getVar('sitename')));
        echo __f('Go to the admin panel for %s', $url);
    }
    echo "</p>\n";
    _upg_footer();
}
开发者ID:Git-Host,项目名称:AMPPS,代码行数:70,代码来源:orig_upgrade.php


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