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


PHP io::utf8Encode方法代码示例

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


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

示例1: getHTMLAdmin

    /**
     * get HTML admin (used to enter object values in admin)
     *
     * @param integer $fieldID, the current field id (only for poly object compatibility)
     * @param CMS_language $language, the current admin language
     * @param string prefixname : the prefix to use for post names
     * @return string : the html admin
     * @access public
     */
    function getHTMLAdmin($fieldID, $language, $prefixName)
    {
        $return = parent::getHTMLAdmin($fieldID, $language, $prefixName);
        global $cms_user;
        $params = $this->getParamsValues();
        $prefixName = isset($inputParams['prefix']) ? $inputParams['prefix'] : '';
        $rootCategory = isset($inputParams['root']) && SensitiveIO::isPositiveInteger($inputParams['root']) ? $inputParams['root'] : false;
        //get module codename
        $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
        if ($params['multiCategories']) {
            // Get categories
            $a_all_categories = $this->getAllCategoriesAsArray($language, false, $moduleCodename, CLEARANCE_MODULE_EDIT, $rootCategory, true);
            $checkedValues = array();
            if (isset($this->_subfieldValues[0]) && is_object($this->_subfieldValues[0]) && !is_null($this->_subfieldValues[0]->getValue()) && $this->_subfieldValues[0]->getID()) {
                foreach (array_keys($this->_subfieldValues) as $subFieldID) {
                    if (is_object($this->_subfieldValues[$subFieldID])) {
                        $checkedValues[$this->_subfieldValues[$subFieldID]->getValue()] = $this->_subfieldValues[$subFieldID]->getValue();
                    }
                }
            } elseif (sensitiveIO::isPositiveInteger($params['defaultValue'])) {
                $checkedValues[$params['defaultValue']] = $params['defaultValue'];
            }
            $valueString = implode(',', $checkedValues);
            if (is_array($a_all_categories) && $a_all_categories) {
                $fathers = array(0 => false);
                foreach ($a_all_categories as $id => $category) {
                    $level = substr_count($category, '- ');
                    $father = false;
                    if ($level && isset($fathers[$level - 1])) {
                        $father = $fathers[$level - 1];
                    }
                    $cat = new stdClass();
                    $cat->id = $id;
                    $cat->checked = isset($checkedValues[$id]);
                    $cat->cls = isset($checkedValues[$id]) ? 'x-tree-checked' : '';
                    $cat->level = $level;
                    $cat->text = str_replace('- ', '', $category);
                    if (strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8') {
                        $cat->text = io::utf8Encode($cat->text);
                    }
                    $cat->leaf = true;
                    $fathers[$level] = $cat;
                    if ($father) {
                        $father->children[] = $cat;
                        $father->leaf = false;
                        $father->expanded = true;
                    } else {
                        $availableCategories[] = $cat;
                    }
                }
            } else {
                $availableCategories[] = array('id' => '', 'text' => $language->getMessage(self::MESSAGE_EMPTY_OBJECTS_SET), 'leaf' => true);
            }
            $fieldId = md5(mt_rand() . microtime());
            $field = array();
            $field['id'] = 'tree-' . $fieldId;
            $field['xtype'] = 'treepanel';
            $field['height'] = io::isPositiveInteger($params['selectHeight']) ? (int) $params['selectHeight'] : 150;
            $field['width'] = io::isPositiveInteger($params['selectWidth']) ? (int) $params['selectWidth'] : '100%';
            $field['autoScroll'] = true;
            $field['animate'] = true;
            $field['containerScroll'] = true;
            $field['rootVisible'] = false;
            $field['root'] = array('expanded' => true, 'children' => $availableCategories);
            $field['listeners'] = array('checkchange' => array('fn' => sensitiveIO::sanitizeJSString('function(node, checked){
						var tree = Ext.getCmp(\'tree-' . $fieldId . '\');
						var input = Ext.getCmp(\'cat-' . $fieldId . '\');
						if (tree && input) {
							input.setValue(tree.getChecked(\'id\').toString());
						}
						if(checked){
		                    node.getUI().addClass(\'x-tree-checked\');
		                }else{
		                    node.getUI().removeClass(\'x-tree-checked\');
		                }
					}', false, false)));
            $return['xtype'] = 'compositefield';
            $return['labelWidth'] = 120;
            $return['items'] = array($field, array('id' => 'cat-' . $fieldId, 'xtype' => 'hidden', 'name' => 'polymodFieldsValue[list' . $prefixName . $this->_field->getID() . '_0]', 'value' => $valueString));
        } else {
            if (isset($this->_subfieldValues[0]) && is_object($this->_subfieldValues[0]) && !is_null($this->_subfieldValues[0]->getValue()) && $this->_subfieldValues[0]->getID()) {
                $selectedValue = $this->_subfieldValues[0]->getValue() ? $this->_subfieldValues[0]->getValue() : '';
            } elseif (sensitiveIO::isPositiveInteger($params['defaultValue'])) {
                $selectedValue = $params['defaultValue'];
            } else {
                $selectedValue = '';
            }
            $return['xtype'] = 'atmCombo';
            $return['name'] = 'polymodFieldsValue[list' . $prefixName . $this->_field->getID() . '_0]';
            $return['hiddenName'] = $return['name'];
            $return['forceSelection'] = true;
//.........这里部分代码省略.........
开发者ID:davidmottet,项目名称:automne,代码行数:101,代码来源:object_categories.php

示例2: time

    } else {
        $content .= '<item>' . "\n" . '    <title>RSS Feed Error ..</title>' . "\n" . '    <guid isPermaLink="false">Error' . time() . '</guid>' . "\n" . '    <description><![CDATA[';
        switch ($error) {
            case 1:
                $content .= 'Error : RSS ID not found or not a valid integer ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
            case 2:
                $content .= 'Error : Invalid RSS ID found ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
            case 3:
                $content .= 'Error : RSS Content generation error or no valid content for this RSS feed ... Please contact the webmaster here : ' . APPLICATION_MAINTAINER_EMAIL;
                break;
        }
        $content .= ']]></description>' . "\n" . '    <link>' . CMS_websitesCatalog::getMainURL() . '</link>' . "\n" . '</item>';
    }
    $content .= '	</channel>' . "\n" . '</rss>';
    if ('utf-8' != strtolower(APPLICATION_DEFAULT_ENCODING)) {
        $content = io::utf8Encode($content);
    }
    //output content to record it into cache
    echo $content;
    $content = $cache->endSave();
}
unset($cache);
//send RSS content
if (!isset($_REQUEST['atm-previz'])) {
    header('Content-type: text/xml; charset=UTF-8');
    echo $content;
} else {
    echo '<pre>' . htmlspecialchars($content) . '</pre>';
}
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:rss.php


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