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


PHP XoopsLocale::getCharset方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @return XoopsMailerLocal
  */
 public function __construct()
 {
     parent::__construct();
     // It is supposed no need to change the charset
     $this->charSet = strtolower(XoopsLocale::getCharset());
     // You MUST specify the language code value so that the file exists: XOOPS_ROOT_PAT/class/mail/phpmailer/language/lang-["your-language-code"].php
     $this->multimailer->SetLanguage("en");
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:13,代码来源:_xoopsmailerlocal.php

示例2: execute

 function execute()
 {
     $xoops = Xoops::getInstance();
     // use HTMLPurifier inside Protector
     //require_once $xoops->path('lib/HTMLPurifier/HTMLPurifier.auto.php');
     $config = HTMLPurifier_Config::createDefault();
     $config->set('Cache', 'SerializerPath', \XoopsBaseConfig::get('lib-path'));
     $config->set('Core', 'Encoding', XoopsLocale::getCharset());
     //$config->set('HTML', 'Doctype', 'HTML 4.01 Transitional');
     $this->purifier = new HTMLPurifier($config);
     $this->method = 'purify';
     $_POST = $this->purify_recursive($_POST);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:13,代码来源:postcommon_post_htmlpurify4everyone.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     // SMARTY_PLUGINS_DIR is initialized into parent
     $xoops = Xoops::getInstance();
     $xoops->preload()->triggerEvent('core.template.construct.start', array($this));
     $this->left_delimiter = '<{';
     $this->right_delimiter = '}>';
     $this->setTemplateDir(\XoopsBaseConfig::get('themes-path'));
     $this->setCacheDir(\XoopsBaseConfig::get('smarty-cache'));
     $this->setCompileDir(\XoopsBaseConfig::get('smarty-compile'));
     $this->compile_check = $xoops->getConfig('theme_fromfile') == 1;
     $this->setPluginsDir(\XoopsBaseConfig::get('smarty-xoops-plugins'));
     $this->addPluginsDir(SMARTY_PLUGINS_DIR);
     $this->setCompileId();
     $this->assign(array('xoops_url' => \XoopsBaseConfig::get('url'), 'xoops_rootpath' => \XoopsBaseConfig::get('root-path'), 'xoops_langcode' => XoopsLocale::getLangCode(), 'xoops_charset' => XoopsLocale::getCharset(), 'xoops_version' => \Xoops::VERSION, 'xoops_upload_url' => \XoopsBaseConfig::get('uploads-url')));
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:17,代码来源:template.php

示例4: test__construct

 public function test__construct()
 {
     $xoops = \Xoops::getInstance();
     $this->assertSame('{', $this->object->left_delimiter);
     $this->assertSame('}', $this->object->right_delimiter);
     $this->assertTrue(in_array(\XoopsBaseConfig::get('themes-path') . DIRECTORY_SEPARATOR, $this->object->getTemplateDir()));
     $this->assertSame(\XoopsBaseConfig::get('var-path') . '/caches/smarty_cache' . DIRECTORY_SEPARATOR, $this->object->getCacheDir());
     $this->assertSame(\XoopsBaseConfig::get('var-path') . '/caches/smarty_compile' . DIRECTORY_SEPARATOR, $this->object->getCompileDir());
     $this->assertSame($xoops->getConfig('theme_fromfile') == 1, $this->object->compile_check);
     $this->assertSame(array(\XoopsBaseConfig::get('lib-path') . '/smarty/xoops_plugins' . DIRECTORY_SEPARATOR, SMARTY_DIR . 'plugins' . DS), $this->object->plugins_dir);
     $this->assertSame(\XoopsBaseConfig::get('url'), $this->object->getTemplateVars('xoops_url'));
     $this->assertSame(\XoopsBaseConfig::get('root-path'), $this->object->getTemplateVars('xoops_rootpath'));
     $this->assertSame(\XoopsLocale::getLangCode(), $this->object->getTemplateVars('xoops_langcode'));
     $this->assertSame(\XoopsLocale::getCharset(), $this->object->getTemplateVars('xoops_charset'));
     $this->assertSame(\Xoops::VERSION, $this->object->getTemplateVars('xoops_version'));
     $this->assertSame(\XoopsBaseConfig::get('uploads-url'), $this->object->getTemplateVars('xoops_upload_url'));
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:17,代码来源:XoopsTplTest.php

示例5: buildRssFeedCache

function buildRssFeedCache($rssurl)
{
    $snoopy = new Snoopy();
    $cnt = 0;
    foreach ($rssurl as $url) {
        if ($snoopy->fetch($url)) {
            $rssdata = $snoopy->results;
            $rss2parser = new XoopsXmlRss2Parser($rssdata);
            if (false != $rss2parser->parse()) {
                $_items = $rss2parser->getItems();
                $count = count($_items);
                for ($i = 0; $i < $count; $i++) {
                    $_items[$i]['title'] = XoopsLocale::convert_encoding($_items[$i]['title'], XoopsLocale::getCharset(), 'UTF-8');
                    $_items[$i]['description'] = XoopsLocale::convert_encoding($_items[$i]['description'], XoopsLocale::getCharset(), 'UTF-8');
                    $items[(string) strtotime($_items[$i]['pubdate']) . "-" . (string) ++$cnt] = $_items[$i];
                }
            } else {
                echo $rss2parser->getErrors();
            }
        }
    }
    krsort($items);
    return $items;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:24,代码来源:admin.php

示例6: mb_http_output

if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : -1;
if ($categoryid != -1) {
    /* @var $categoryObj PublisherCategory */
    $categoryObj = $publisher->getCategoryHandler()->get($categoryid);
}
header('Content-Type:text/xml; charset=' . XoopsLocale::getCharset());
$tpl = new XoopsTpl();
$tpl->caching = 2;
$tpl->cache_lifetime = 0;
$myts = MyTextSanitizer::getInstance();
if (!$tpl->isCached('module:publisher/publisher_rss.tpl')) {
    $channel_category = $publisher->getModule()->getVar('name');
    $tpl->assign('channel_charset', XoopsLocale::getCharset());
    $tpl->assign('channel_title', htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES));
    $tpl->assign('channel_link', PUBLISHER_URL);
    $tpl->assign('channel_desc', htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES));
    $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoops->getConfig('adminmail'));
    $tpl->assign('channel_editor', $xoops->getConfig('adminmail'));
    if ($categoryid != -1) {
        $channel_category .= " > " . $categoryObj->getVar('name');
    }
    $tpl->assign('channel_category', htmlspecialchars($channel_category));
    $tpl->assign('channel_generator', $publisher->getModule()->getVar('name'));
    $tpl->assign('channel_language', XoopsLocale::getLangCode());
    $tpl->assign('image_url', \XoopsBaseConfig::get('url') . '/images/logo.gif');
    $dimention = getimagesize(\XoopsBaseConfig::get('root-path') . '/images/logo.gif');
    if (empty($dimention[0])) {
开发者ID:mambax7,项目名称:publisher-26,代码行数:31,代码来源:backend.php

示例7: simpleHeader

 /**
  * Render Simple Header
  *
  * @param bool $closehead true to close the HTML head element
  *
  * @return void
  */
 public function simpleHeader($closehead = true)
 {
     $this->events()->triggerEvent('core.header.start');
     $this->theme();
     $xoopsConfigMetaFooter = $this->getConfigs();
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . XoopsLocale::getCharset());
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header('Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0');
         header("Pragma: no-cache");
     }
     echo "<!DOCTYPE html>\n";
     $xoops_url = \XoopsBaseConfig::get('url');
     echo '<html lang="' . XoopsLocale::getLangCode() . '">
           <head>
           <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
           <meta name="robots" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_robots']) . '" />
           <meta name="keywords" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_keywords']) . '" />
           <meta name="description" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_description']) . '" />
           <meta name="rating" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_rating']) . '" />
           <meta name="author" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_author']) . '" />
           <meta name="generator" content="XOOPS" />
           <title>' . htmlspecialchars($this->getConfig('sitename')) . '</title>
           <script type="text/javascript" src="' . $xoops_url . '/include/xoops.js"></script>
           <script type="text/javascript" src="' . $xoops_url . '/media/jquery/jquery.js"></script>
           <script type="text/javascript" src="' . $xoops_url . '/media/bootstrap/js/bootstrap.min.js"></script>';
     $themecss = $this->getCss($this->getConfig('theme_set'));
     echo '<link rel="stylesheet" type="text/css" media="all" href="' . $xoops_url . '/xoops.css" />';
     $locale = $this->getConfig('locale');
     if (XoopsLoad::fileExists($this->path('locale/' . $locale . '/style.css'))) {
         echo '<link rel="stylesheet" type="text/css" media="all" href="' . $xoops_url . '/locale/' . $locale . '/style.css" />';
     }
     if ($themecss) {
         echo '<link rel="stylesheet" type="text/css" media="all" href="' . $themecss . '" />';
         echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $this->url('themes/' . $this->getConfig('theme_set') . '/media/bootstrap/css/xoops.bootstrap.css') . '" />';
     }
     if ($closehead) {
         echo '</head><body>';
     }
 }
开发者ID:elitet,项目名称:XoopsCore,代码行数:48,代码来源:Xoops.php

示例8: getLanguage

 /**
  * get language
  *
  * @return    string
  */
 function getLanguage()
 {
     if ($this->language) {
         return $this->language;
     }
     if (defined("_XOOPS_EDITOR_TINYMCE_LANGUAGE")) {
         $this->language = strtolower(constant("_XOOPS_EDITOR_TINYMCE_LANGUAGE"));
     } else {
         $this->language = str_replace('_', '-', strtolower(XoopsLocale::getLangCode()));
         if (strtolower(XoopsLocale::getCharset()) == "utf-8") {
             $this->language .= "_utf8";
         }
     }
     return $this->language;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:20,代码来源:formtinymce.php

示例9: isset

$path = '/path/to/xoops/directory';
include $path . '/mainfile.php';
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/user.php';
$op = isset($_POST['op']) && $_POST['op'] == 'dologin' ? 'dologin' : 'login';
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$password = isset($_POST['userpass']) ? trim($_POST['userpass']) : '';
if ($username == '' || $password == '') {
    $op = 'login';
}
echo '
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
    <meta http-equiv="content-language" content="' . XoopsLocale::getLangCode() . '" />
    <title>' . $xoopsConfig['sitename'] . '</title>
    <link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/xoops.css" />
';
$style = xoops_getcss($xoopsConfig['theme_set']);
if ($style == '') {
    $style = xoops_getcss($xoopsConfig['theme_set']);
}
if ($style != '') {
    echo '<link rel="stylesheet" type="text/css" media="all" href="' . $style . '" />';
}
echo '
  </head>
  <body>
';
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:login.php

示例10: geshi

 /**
  * @param string $source
  * @param string $language
  * @return bool
  */
 public function geshi($source, $language)
 {
     if (!@XoopsLoad::load("geshi", "framework")) {
         return false;
     }
     // Create the new XoopsGeshi object, passing relevant stuff
     // XoopsGeshi should be extending geSHi in Frameworks/geshi/xoopsgeshi.php
     $geshi = new XoopsGeshi($source, $language);
     // Enclose the code in a <div>
     $geshi->set_header_type(GESHI_HEADER_NONE);
     // Sets the proper encoding charset other than "ISO-8859-1"
     $geshi->set_encoding(XoopsLocale::getCharset());
     $geshi->set_link_target("_blank");
     // Parse the code
     $code = $geshi->parse_code();
     return $code;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:22,代码来源:syntaxhighlight.php

示例11: init

 /**
  * init - called by parent::_construct
  *
  * @return void
  */
 protected function init()
 {
     $this->setTemplate('module:xmf/xmf_feed.tpl');
     //$this->disableLogger();
     global $xoopsConfig;
     $this->_title = $xoopsConfig['sitename'];
     $this->_url = \XoopsBaseConfig::get('url');
     $this->_description = $xoopsConfig['slogan'];
     $this->_language = \XoopsLocale::getLangCode();
     $this->_charset = \XoopsLocale::getCharset();
     $this->_pubdate = \XoopsLocale::formatTimestamp(time(), 'short');
     $this->_lastbuild = \XoopsLocale::formatTimestamp(time(), 'D, d M Y H:i:s');
     $this->_webmaster = $xoopsConfig['adminmail'];
     $this->_editor = $xoopsConfig['adminmail'];
     $this->_generator = \Xoops::VERSION;
     $this->_copyright = 'Copyright ' . \XoopsLocale::formatTimestamp(time(), 'Y') . ' ' . $xoopsConfig['sitename'];
     $this->_image_title = $this->_title;
     $this->_image_url = \XoopsBaseConfig::get('url') . '/images/logo.gif';
     $this->_image_link = $this->_url;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:25,代码来源:Feed.php

示例12: htmlSpecialChars

 /**
  * Convert special characters to HTML entities
  *
  * @param string $text string being converted
  * @param int $quote_style
  * @param string $charset character set used in conversion
  * @param bool $double_encode
  * @return string
  */
 public function htmlSpecialChars($text, $quote_style = ENT_QUOTES, $charset = null, $double_encode = true)
 {
     if (version_compare(phpversion(), '5.2.3', '>=')) {
         $text = htmlspecialchars($text, $quote_style, $charset ? $charset : (class_exists('xoopslocale', false) ? XoopsLocale::getCharset() : 'UTF-8'), $double_encode);
     } else {
         $text = htmlspecialchars($text, $quote_style);
     }
     return preg_replace(array('/&amp;/i', '/&nbsp;/i'), array('&', '&amp;nbsp;'), $text);
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:18,代码来源:module.textsanitizer.php

示例13: dump

    /**
     * Dump output
     * 
     * @param string $mode unused
     * 
     * @return string output
     */
    public function dump($mode = '')
    {
        $ret = '';
        // -------------------------------------------------------------
        $xoops = Xoops::getInstance();
        /* @var $this LoggerLegacy */
        $ret = '';
        if ($mode == 'popup') {
            $dump = $this->dump('');
            $content = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <meta http-equiv="content-language" content="' . XoopsLocale::getLangCode() . '" />
    <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
    <title>' . $xoops->getConfig('sitename') . ' - ' . _MD_LOGGER_DEBUG . ' </title>
    <meta name="generator" content="XOOPS" />
    <link rel="stylesheet" type="text/css" media="all" href="' . $xoops->getCss($xoops->getConfig('theme_set')) . '" />
</head>
<body>' . $dump . '
    <div style="text-align:center;">
        <input class="formButton" value="' . XoopsLocale::A_CLOSE . '" type="button" onclick="javascript:window.close();" />
    </div>
';
            $ret .= '
<script type="text/javascript">
    debug_window = openWithSelfMain("about:blank", "popup", 680, 450, true);
    debug_window.document.clear();
';
            $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
            foreach ($lines as $line) {
                $ret .= "\n" . 'debug_window.document.writeln("' . str_replace(array('"', '</'), array('\\"', '<\\/'), $line) . '");';
            }
            $ret .= '
    debug_window.focus();
    debug_window.document.close();
</script>
';
        }
        $this->addExtra(_MD_LOGGER_INCLUDED_FILES, sprintf(_MD_LOGGER_FILES, count(get_included_files())));
        /*
        $included_files = get_included_files();
        foreach ($included_files as $filename) {
            $this->addExtra('files',$filename);
        }
        
        if (function_exists('memory_get_peak_usage')) {
            $this->addExtra('Peak memory',memory_get_peak_usage());
        }
        */
        $memory = 0;
        if (function_exists('memory_get_usage')) {
            $memory = memory_get_usage() . ' bytes';
        } else {
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                $out = array();
                exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $out);
                if (isset($out[5])) {
                    $memory = sprintf(_MD_LOGGER_MEM_ESTIMATED, substr($out[5], strpos($out[5], ':') + 1));
                }
            }
        }
        if ($memory) {
            $this->addExtra(_MD_LOGGER_MEM_USAGE, $memory);
        }
        if (empty($mode)) {
            $views = array('errors', 'deprecated', 'queries', 'blocks', 'extra');
            $ret .= "\n<div id=\"xo-logger-output\">\n<div id='xo-logger-tabs'>\n";
            $ret .= "<a href='javascript:xoSetLoggerView(\"none\")'>" . _MD_LOGGER_NONE . "</a>\n";
            $ret .= "<a href='javascript:xoSetLoggerView(\"\")'>" . _MD_LOGGER_ALL . "</a>\n";
            foreach ($views as $view) {
                $count = count($this->{$view});
                $ret .= "<a href='javascript:xoSetLoggerView(\"{$view}\")'>" . constant('_MD_LOGGER_' . strtoupper($view)) . " ({$count})</a>\n";
            }
            $count = count($this->logstart);
            $ret .= "<a href='javascript:xoSetLoggerView(\"timers\")'>" . _MD_LOGGER_TIMERS . "({$count})</a>\n";
            $ret .= "</div>\n";
        }
        if (empty($mode) || $mode == 'errors') {
            $class = 'even';
            $ret .= '<table id="xo-logger-errors" class="outer"><thead><tr><th>' . _MD_LOGGER_ERRORS . '</th></tr></thead><tbody>';
            foreach ($this->errors as $error) {
                $ret .= "\n<tr><td class='{$class}'>";
                $ret .= $error;
                $ret .= "<br />\n</td></tr>";
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= "\n</tbody></table>\n";
        }
        if (empty($mode) || $mode == 'deprecated') {
            $class = 'even';
            $ret .= '<table id="xo-logger-deprecated" class="outer"><thead><tr><th>' . _MD_LOGGER_DEPRECATED . '</th></tr></thead><tbody>';
            foreach ($this->deprecated as $message) {
                $ret .= "\n<tr><td class='{$class}'>";
//.........这里部分代码省略.........
开发者ID:redmexico,项目名称:XoopsCore,代码行数:101,代码来源:legacylogger.php

示例14: convert_encoding

 /**
  * @param mixed  $text
  * @param string $to
  * @param string $from
  *
  * @return string
  */
 public static function convert_encoding($text, $to = 'utf-8', $from = '')
 {
     $xoops = Xoops::getInstance();
     $xlanguage = $xoops->registry()->get('XLANGUAGE', array());
     $charset = false;
     if (isset($xlanguage['charset_base'])) {
         $charset = $xlanguage['charset_base'];
     }
     if (empty($text)) {
         return $text;
     }
     if (empty($from)) {
         $from = $charset ? $charset : XoopsLocale::getCharset();
     }
     if (empty($to) || !strcasecmp($to, $from)) {
         return $text;
     }
     if (self::isMultiByte() && function_exists('mb_convert_encoding')) {
         $converted_text = @mb_convert_encoding($text, $to, $from);
     } elseif (function_exists('iconv')) {
         $converted_text = @iconv($from, $to . "//TRANSLIT", $text);
     } elseif ('utf-8' == $to) {
         $converted_text = utf8_encode($text);
     }
     $text = empty($converted_text) ? $text : $converted_text;
     return $text;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:34,代码来源:Abstract.php

示例15: convertCharset

 /**
  * @param string $item
  *
  * @return string
  */
 public static function convertCharset($item)
 {
     if (XoopsLocale::getCharset() == 'UTF-8') {
         return $item;
     }
     if (XoopsLocale::getCharset() != 'windows-1256') {
         return utf8_encode($item);
     }
     if ($unserialize = unserialize($item)) {
         foreach ($unserialize as $key => $value) {
             $unserialize[$key] = @iconv('windows-1256', 'UTF-8', $value);
         }
         $serialize = serialize($unserialize);
         return $serialize;
     } else {
         return @iconv('windows-1256', 'UTF-8', $item);
     }
 }
开发者ID:mambax7,项目名称:publisher-26,代码行数:23,代码来源:utils.php


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