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


PHP Context::convertEncodingStr方法代码示例

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


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

示例1: procRssAdminInsertConfig

 /**
  * @brief RSS 전체피드 설정
  **/
 function procRssAdminInsertConfig()
 {
     $oModuleModel =& getModel('module');
     $total_config = $oModuleModel->getModuleConfig('rss');
     $config_vars = Context::getRequestVars();
     $config_vars->feed_document_count = (int) $config_vars->feed_document_count;
     if (!$config_vars->use_total_feed) {
         $alt_message = 'msg_invalid_request';
     }
     if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) {
         $config_vars->open_rss = 'Y';
     }
     if ($config_vars->image || $config_vars->del_image) {
         $image_obj = $config_vars->image;
         $config_vars->image = $total_config->image;
         // 삭제 요청에 대한 변수를 구함
         if ($config_vars->del_image == 'Y' || $image_obj) {
             FileHandler::removeFile($config_vars->image);
             $config_vars->image = '';
             $total_config->image = '';
         }
         // 정상적으로 업로드된 파일이 아니면 무시
         if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) {
             // 이미지 파일이 아니어도 무시 (swf는 패스~)
             $image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
             if (!preg_match("/\\.(jpg|jpeg|gif|png)\$/i", $image_obj['name'])) {
                 $alt_message = 'msg_rss_invalid_image_format';
             } else {
                 // 경로를 정해서 업로드
                 $path = './files/attach/images/rss/';
                 // 디렉토리 생성
                 if (!FileHandler::makeDir($path)) {
                     $alt_message = 'msg_error_occured';
                 } else {
                     $filename = $path . $image_obj['name'];
                     // 파일 이동
                     if (!move_uploaded_file($image_obj['tmp_name'], $filename)) {
                         $alt_message = 'msg_error_occured';
                     } else {
                         $config_vars->image = $filename;
                     }
                 }
             }
         }
     }
     if (!$config_vars->image && $config_vars->del_image != 'Y') {
         $config_vars->image = $total_config->image;
     }
     $output = $this->setFeedConfig($config_vars);
     if (!$alt_message) {
         $alt_message = 'success_updated';
     }
     $alt_message = Context::getLang($alt_message);
     Context::set('msg', $alt_message);
     $this->setLayoutPath('./common/tpl');
     $this->setLayoutFile('default_layout.html');
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile("top_refresh.html");
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:62,代码来源:rss.admin.controller.php

示例2: ModuleHandler

 /**
  * prepares variables to use in moduleHandler
  * @param string $module name of module
  * @param string $act name of action
  * @param int $mid
  * @param int $document_srl
  * @param int $module_srl
  * @return void
  **/
 function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
 {
     // If XE has not installed yet, set module as install
     if (!Context::isInstalled()) {
         $this->module = 'install';
         $this->act = Context::get('act');
         return;
     }
     // Set variables from request arguments
     $this->module = $module ? $module : Context::get('module');
     $this->act = $act ? $act : Context::get('act');
     $this->mid = $mid ? $mid : Context::get('mid');
     $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
     $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
     $this->entry = Context::convertEncodingStr(Context::get('entry'));
     // Validate variables to prevent XSS
     $isInvalid = null;
     if ($this->module && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->module)) {
         $isInvalid = true;
     }
     if ($this->mid && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->mid)) {
         $isInvalid = true;
     }
     if ($this->act && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->act)) {
         $isInvalid = true;
     }
     if ($isInvalid) {
         htmlHeader();
         echo Context::getLang("msg_invalid_request");
         htmlFooter();
         Context::close();
         exit;
     }
     if (isset($this->act) && substr($this->act, 0, 4) == 'disp') {
         if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') {
             header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             return;
         }
     }
     // execute addon (before module initialization)
     $called_position = 'before_module_init';
     $oAddonController =& getController('addon');
     $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
     @(include $addon_file);
 }
开发者ID:relip,项目名称:xe-core,代码行数:54,代码来源:ModuleHandler.class.php

示例3: rss_request

 /**
  * @brief rss 주소로 부터 내용을 받아오는 함수
  *
  * tistory 의 경우 원본 주소가 location 헤더를 뿜는다.(내용은 없음) 이를 해결하기 위한 수정
  **/
 function rss_request($rss_url)
 {
     // request rss
     $rss_url = Context::convertEncodingStr($rss_url);
     $URL_parsed = parse_url($rss_url);
     if (strpos($URL_parsed["host"], 'naver.com')) {
         $rss_url = iconv('UTF-8', 'euc-kr', $rss_url);
     }
     $rss_url = str_replace(array('%2F', '%3F', '%3A', '%3D', '%3B', '%26'), array('/', '?', ':', '=', ';', '&'), urlencode($rss_url));
     $URL_parsed = parse_url($rss_url);
     $host = $URL_parsed["host"];
     $port = $URL_parsed["port"];
     if ($port == 0) {
         $port = 80;
     }
     $path = $URL_parsed["path"];
     if ($URL_parsed["query"] != '') {
         $path .= "?" . $URL_parsed["query"];
     }
     $oReqeust = new HTTP_Request($rss_url);
     $oReqeust->addHeader('Content-Type', 'application/xml');
     $oReqeust->addHeader('User-agent', 'RSS Reader Widget (XE ' . __ZBXE_VERSION__ . ' (http://www.xpressengine.com); PEAR HTTP_Request class (http://pear.php.net))');
     $oReqeust->setMethod('GET');
     $user = $URL_parsed["user"];
     $pass = $URL_parsed["pass"];
     if ($user) {
         $oReqeust->setBasicAuth($user, $pass);
     }
     $oResponse = $oReqeust->sendRequest();
     if (PEAR::isError($oResponse)) {
         return;
     }
     $header = $oReqeust->getResponseHeader();
     if ($header['location']) {
         return $this->rss_request(trim($header['location']));
     } else {
         return $oReqeust->getResponseBody();
     }
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:44,代码来源:rss_reader.class.php

示例4: _getRssItems

 function _getRssItems($args)
 {
     // 날짜 형태
     $DATE_FORMAT = $args->date_format ? $args->date_format : "Y-m-d H:i:s";
     $buff = $this->requestFeedContents($args->rss_url);
     $encoding = preg_match("/<\\?xml.*encoding=\"(.+)\".*\\?>/i", $buff, $matches);
     if ($encoding && !preg_match("/UTF-8/i", $matches[1])) {
         $buff = Context::convertEncodingStr($buff);
     }
     $buff = preg_replace("/<\\?xml.*\\?>/i", "", $buff);
     $oXmlParser = new XmlParser();
     $xml_doc = $oXmlParser->parse($buff);
     if ($xml_doc->rss) {
         $rss->title = $xml_doc->rss->channel->title->body;
         $rss->link = $xml_doc->rss->channel->link->body;
         $items = $xml_doc->rss->channel->item;
         if (!$items) {
             return;
         }
         if ($items && !is_array($items)) {
             $items = array($items);
         }
         $content_items = array();
         foreach ($items as $key => $value) {
             if ($key >= $args->list_count * $args->page_count) {
                 break;
             }
             unset($item);
             foreach ($value as $key2 => $value2) {
                 if (is_array($value2)) {
                     $value2 = array_shift($value2);
                 }
                 $item->{$key2} = $this->_getRssBody($value2);
             }
             $content_item = new contentItem($rss->title);
             $content_item->setContentsLink($rss->link);
             $content_item->setTitle($item->title);
             $content_item->setNickName(max($item->author, $item->{'dc:creator'}));
             //$content_item->setCategory($item->category);
             $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description);
             $content_item->setContent($item->description);
             $content_item->setLink($item->link);
             $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
             $content_item->setRegdate($date);
             $content_items[] = $content_item;
         }
     } elseif ($xml_doc->{'rdf:rdf'}) {
         // rss1.0 지원 (Xml이 대소문자를 구분해야 하는데 XE의 XML파서가 전부 소문자로 바꾸는 바람에 생긴 case) by misol
         $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
         $rss->link = $xml_doc->{'rdf:rdf'}->channel->link->body;
         $items = $xml_doc->{'rdf:rdf'}->item;
         if (!$items) {
             return;
         }
         if ($items && !is_array($items)) {
             $items = array($items);
         }
         $content_items = array();
         foreach ($items as $key => $value) {
             if ($key >= $args->list_count * $args->page_count) {
                 break;
             }
             unset($item);
             foreach ($value as $key2 => $value2) {
                 if (is_array($value2)) {
                     $value2 = array_shift($value2);
                 }
                 $item->{$key2} = $this->_getRssBody($value2);
             }
             $content_item = new contentItem($rss->title);
             $content_item->setContentsLink($rss->link);
             $content_item->setTitle($item->title);
             $content_item->setNickName(max($item->author, $item->{'dc:creator'}));
             //$content_item->setCategory($item->category);
             $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description);
             $content_item->setContent($item->description);
             $content_item->setLink($item->link);
             $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
             $content_item->setRegdate($date);
             $content_items[] = $content_item;
         }
     } elseif ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') {
         // Atom 1.0 spec 지원 by misol
         $rss->title = $xml_doc->feed->title->body;
         $links = $xml_doc->feed->link;
         if (is_array($links)) {
             foreach ($links as $value) {
                 if ($value->attrs->rel == 'alternate') {
                     $rss->link = $value->attrs->href;
                     break;
                 }
             }
         } elseif ($links->attrs->rel == 'alternate') {
             $rss->link = $links->attrs->href;
         }
         $items = $xml_doc->feed->entry;
         if (!$items) {
             return;
         }
         if ($items && !is_array($items)) {
//.........这里部分代码省略.........
开发者ID:hottaro,项目名称:xpressengine,代码行数:101,代码来源:content.class.php

示例5: getError

 /**
  * Returns object of error info
  * @return object object of error
  */
 function getError()
 {
     $this->errstr = Context::convertEncodingStr($this->errstr);
     return new Object($this->errno, $this->errstr);
 }
开发者ID:ned3y2k,项目名称:xe-core,代码行数:9,代码来源:DB.class.php

示例6: makeOptimizedFile

    /**
     * @brief css나 js파일을 묶어서 하나의 파일로 만들고 gzip 압축이나 헤더등을 통제하기 위해서 php파일을 별도로 만들어서 진행함
     **/
    function makeOptimizedFile($path, $filename, $targets, $type)
    {
        /**
         * 실제 css나 js의 내용을 합친 것을 구함
         **/
        // 대상 파일의 내용을 구해오고 css 파일일 경우 url()내의 경로를 변경
        foreach ($targets as $file) {
            $str = FileHandler::readFile($file['file']);
            $str = Context::convertEncodingStr($str);
            // css 일경우 background:url() 변경 / media 적용
            if ($type == 'css') {
                $str = $this->replaceCssPath($file['file'], $str);
                if ($file['media'] != 'all') {
                    $str = '@media ' . $file['media'] . ' {' . "\n" . $str . "\n" . '}';
                }
            }
            $content_buff .= $str . "\n";
        }
        if ($type == 'css') {
            $content_buff = '@charset "UTF-8";' . "\n" . $content_buff;
        }
        $content_filename = substr($filename, 0, -4);
        FileHandler::writeFile($path . '/' . $content_filename, $content_buff);
        /**
         * 캐시 타임을 제대로 이용하기 위한 헤더 파일 구함
         **/
        // 확장자별 content-type 체크
        if ($type == 'css') {
            $content_type = 'text/css';
        } elseif ($type == 'js') {
            $content_type = 'text/javascript';
        }
        // 캐시를 위한 처리
        $unique = crc32($content_filename);
        $size = filesize($path . '/' . $content_file);
        $mtime = filemtime($path . '/' . $content_file);
        // js, css 파일을 php를 통해서 출력하고 이 출력시에 헤더값을 조작하여 캐싱과 압축전송이 되도록 함 (IE6는 CSS파일일 경우 gzip압축하지 않음)
        $header_buff = '<?php
$content_filename = "' . $content_filename . '";
$mtime = ' . $mtime . ';
$cached = false;
$type = "' . $type . '";

if(isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
    $time = strtotime(preg_replace("/;.*$/", "", $_SERVER["HTTP_IF_MODIFIED_SINCE"])); 
    if($mtime == $time) {
        header("HTTP/1.1 304"); 
        $cached = true;
    } 
}

if( preg_match("/MSIE 6.0/i",$_SERVER["HTTP_USER_AGENT"]) || strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")===false || !function_exists("ob_gzhandler") ) {
    $size = filesize($content_filename);
} else {
    $f = fopen($content_filename,"r");
    $buff = fread($f, filesize($content_filename));
    fclose($f);
    $buff = ob_gzhandler($buff, 5);
    $size = strlen($buff);
    header("Content-Encoding: gzip");
}

header("Content-Type: ' . $content_type . '; charset=UTF-8");
header("Date: ' . substr(gmdate('r'), 0, -5) . 'GMT");
header("Expires: ' . substr(gmdate('r', strtotime('+1 MONTH')), 0, -5) . 'GMT");
header("Cache-Control: private, max-age=2592000"); 
header("Pragma: cache"); 
header("Last-Modified: ' . substr(gmdate('r', $mtime), 0, -5) . 'GMT");
header("ETag: \\"' . dechex($unique) . '-".dechex($size)."-' . dechex($mtime) . '\\""); 

if(!$cached) {
    if(empty($buff)) {
        $f = fopen($content_filename,"r");
        fpassthru($f);
    } else print $buff;
}
?>';
        FileHandler::writeFile($path . '/' . $filename, $header_buff);
    }
开发者ID:hottaro,项目名称:xpressengine,代码行数:82,代码来源:Optimizer.class.php

示例7: procRssAdminInsertConfig

 /**
  * All RSS feeds configurations
  *
  * @return void
  */
 function procRssAdminInsertConfig()
 {
     $oModuleModel = getModel('module');
     $total_config = $oModuleModel->getModuleConfig('rss');
     $config_vars = Context::getRequestVars();
     $config_vars->feed_document_count = (int) $config_vars->feed_document_count;
     if (!$config_vars->use_total_feed) {
         $alt_message = 'msg_invalid_request';
     }
     if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) {
         $config_vars->open_rss = 'Y';
     }
     if ($config_vars->image || $config_vars->del_image) {
         $image_obj = $config_vars->image;
         $config_vars->image = $total_config->image;
         // Get a variable for the delete request
         if ($config_vars->del_image == 'Y' || $image_obj) {
             FileHandler::removeFile($config_vars->image);
             $config_vars->image = '';
             $total_config->image = '';
         }
         // Ignore if the file is not the one which has been successfully uploaded
         if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) {
             // Ignore if the file is not an image (swf is accepted ~)
             $image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
             if (!preg_match("/\\.(jpg|jpeg|gif|png)\$/i", $image_obj['name'])) {
                 $alt_message = 'msg_rss_invalid_image_format';
             } else {
                 // Upload the file to a path
                 $path = './files/attach/images/rss/';
                 // Create a directory
                 if (!FileHandler::makeDir($path)) {
                     $alt_message = 'msg_error_occured';
                 } else {
                     $filename = $path . $image_obj['name'];
                     // Move the file
                     if (!move_uploaded_file($image_obj['tmp_name'], $filename)) {
                         $alt_message = 'msg_error_occured';
                     } else {
                         $config_vars->image = $filename;
                     }
                 }
             }
         }
     }
     if (!$config_vars->image && $config_vars->del_image != 'Y') {
         $config_vars->image = $total_config->image;
     }
     $output = $this->setFeedConfig($config_vars);
     if (!$alt_message) {
         $alt_message = 'success_updated';
     }
     $alt_message = Context::getLang($alt_message);
     $this->setMessage($alt_message, 'info');
     //$this->setLayoutPath('./common/tpl');
     //$this->setLayoutFile('default_layout.html');
     //$this->setTemplatePath($this->module_path.'tpl');
     //$this->setTemplateFile("top_refresh.html");
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispRssAdminIndex');
     $this->setRedirectUrl($returnUrl);
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:66,代码来源:rss.admin.controller.php

示例8: arrangeWidgetVars

 /**
  * @brief request parameters and variables sort through the information widget
  */
 function arrangeWidgetVars($widget, $request_vars, &$vars)
 {
     $oWidgetModel = getModel('widget');
     $widget_info = $oWidgetModel->getWidgetInfo($widget);
     if (!$vars) {
         $vars = new stdClass();
     }
     $widget = $vars->selected_widget;
     $vars->css_class = $request_vars->css_class;
     $vars->widgetstyle = $request_vars->widgetstyle;
     $vars->skin = trim($request_vars->skin);
     $vars->colorset = trim($request_vars->colorset);
     $vars->widget_sequence = (int) $request_vars->widget_sequence;
     $vars->widget_cache = (int) $request_vars->widget_cache;
     $vars->style = trim($request_vars->style);
     $vars->widget_padding_left = trim($request_vars->widget_padding_left);
     $vars->widget_padding_right = trim($request_vars->widget_padding_right);
     $vars->widget_padding_top = trim($request_vars->widget_padding_top);
     $vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
     $vars->document_srl = trim($request_vars->document_srl);
     if (count($widget_info->extra_var)) {
         foreach ($widget_info->extra_var as $key => $val) {
             $vars->{$key} = trim($request_vars->{$key});
         }
     }
     // If the widget style
     if ($request_vars->widgetstyle) {
         $widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle);
         if (count($widgetStyle_info->extra_var)) {
             foreach ($widgetStyle_info->extra_var as $key => $val) {
                 if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea') {
                     $vars->{$key} = trim($request_vars->{$key});
                 }
             }
         }
     }
     if ($vars->widget_sequence) {
         $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType());
         FileHandler::removeFile($cache_file);
     }
     if ($vars->widget_cache > 0) {
         $vars->widget_sequence = getNextSequence();
     }
     $attribute = array();
     foreach ($vars as $key => $val) {
         if (!$val) {
             unset($vars->{$key});
             continue;
         }
         if (strpos($val, '|@|') > 0) {
             $val = str_replace('|@|', ',', $val);
         }
         $vars->{$key} = Context::convertEncodingStr($val);
         $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
     }
     return $attribute;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:60,代码来源:widget.controller.php

示例9: _getRssItems

 function _getRssItems($args)
 {
     // Date Format
     $DATE_FORMAT = $args->date_format ? $args->date_format : "Y-m-d H:i:s";
     $buff = $this->requestFeedContents($args->rss_url);
     $encoding = preg_match("/<\\?xml.*encoding=\"(.+)\".*\\?>/i", $buff, $matches);
     if ($encoding && stripos($matches[1], "UTF-8") === FALSE) {
         $buff = Context::convertEncodingStr($buff);
     }
     $buff = preg_replace("/<\\?xml.*\\?>/i", "", $buff);
     $oXmlParser = new XmlParser();
     $xml_doc = $oXmlParser->parse($buff);
     if ($xml_doc->rss) {
         $rss->title = $xml_doc->rss->channel->title->body;
         $rss->link = $xml_doc->rss->channel->link->body;
         $items = $xml_doc->rss->channel->item;
         if (!$items) {
             return;
         }
         if ($items && !is_array($items)) {
             $items = array($items);
         }
         $content_items = array();
         foreach ($items as $key => $value) {
             if ($key >= $args->list_count * $args->page_count) {
                 break;
             }
             unset($item);
             foreach ($value as $key2 => $value2) {
                 if (is_array($value2)) {
                     $value2 = array_shift($value2);
                 }
                 $item->{$key2} = $this->_getRssBody($value2);
             }
             $content_item = new contentItem($rss->title);
             $content_item->setContentsLink($rss->link);
             $content_item->setTitle($item->title);
             $content_item->setNickName(max($item->author, $item->{'dc:creator'}));
             //$content_item->setCategory($item->category);
             $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description);
             $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
             $content_item->setThumbnail($this->_getRssThumbnail($item->description));
             $content_item->setLink($item->link);
             $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
             $content_item->setRegdate($date);
             $content_items[] = $content_item;
         }
     } else {
         if ($xml_doc->{'rdf:rdf'}) {
             // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol
             $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
             $rss->link = $xml_doc->{'rdf:rdf'}->channel->link->body;
             $items = $xml_doc->{'rdf:rdf'}->item;
             if (!$items) {
                 return;
             }
             if ($items && !is_array($items)) {
                 $items = array($items);
             }
             $content_items = array();
             foreach ($items as $key => $value) {
                 if ($key >= $args->list_count * $args->page_count) {
                     break;
                 }
                 unset($item);
                 foreach ($value as $key2 => $value2) {
                     if (is_array($value2)) {
                         $value2 = array_shift($value2);
                     }
                     $item->{$key2} = $this->_getRssBody($value2);
                 }
                 $content_item = new contentItem($rss->title);
                 $content_item->setContentsLink($rss->link);
                 $content_item->setTitle($item->title);
                 $content_item->setNickName(max($item->author, $item->{'dc:creator'}));
                 //$content_item->setCategory($item->category);
                 $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description);
                 $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
                 $content_item->setThumbnail($this->_getRssThumbnail($item->description));
                 $content_item->setLink($item->link);
                 $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
                 $content_item->setRegdate($date);
                 $content_items[] = $content_item;
             }
         } else {
             if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') {
                 // Atom 1.0 spec supported by misol
                 $rss->title = $xml_doc->feed->title->body;
                 $links = $xml_doc->feed->link;
                 if (is_array($links)) {
                     foreach ($links as $value) {
                         if ($value->attrs->rel == 'alternate') {
                             $rss->link = $value->attrs->href;
                             break;
                         }
                     }
                 } else {
                     if ($links->attrs->rel == 'alternate') {
                         $rss->link = $links->attrs->href;
                     }
//.........这里部分代码省略.........
开发者ID:umjinsun12,项目名称:dngshin,代码行数:101,代码来源:content.class.php

示例10: ModuleHandler

 /**
  * prepares variables to use in moduleHandler
  * @param string $module name of module
  * @param string $act name of action
  * @param int $mid
  * @param int $document_srl
  * @param int $module_srl
  * @return void
  * */
 function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
 {
     // If XE has not installed yet, set module as install
     if (!Context::isInstalled()) {
         $this->module = 'install';
         $this->act = Context::get('act');
         return;
     }
     $oContext = Context::getInstance();
     if ($oContext->isSuccessInit == FALSE) {
         $logged_info = Context::get('logged_info');
         if ($logged_info->is_admin != "Y") {
             $this->error = 'msg_invalid_request';
             return;
         }
     }
     // Set variables from request arguments
     $this->module = $module ? $module : Context::get('module');
     $this->act = $act ? $act : Context::get('act');
     $this->mid = $mid ? $mid : Context::get('mid');
     $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
     $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
     if ($entry = Context::get('entry')) {
         $this->entry = Context::convertEncodingStr($entry);
     }
     // Validate variables to prevent XSS
     $isInvalid = NULL;
     if ($this->module && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->module)) {
         $isInvalid = TRUE;
     }
     if ($this->mid && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->mid)) {
         $isInvalid = TRUE;
     }
     if ($this->act && !preg_match("/^([a-z0-9\\_\\-]+)\$/i", $this->act)) {
         $isInvalid = TRUE;
     }
     if ($isInvalid) {
         htmlHeader();
         echo Context::getLang("msg_invalid_request");
         htmlFooter();
         Context::close();
         exit;
     }
     if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) {
         if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') {
             if (Context::get('_https_port') != null) {
                 header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
             } else {
                 header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             }
             return;
         }
     }
     // call a trigger before moduleHandler init
     ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
     // execute addon (before module initialization)
     $called_position = 'before_module_init';
     $oAddonController = getController('addon');
     $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
     if (file_exists($addon_file)) {
         include $addon_file;
     }
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:72,代码来源:ModuleHandler.class.php

示例11: getRequestUrl

 /**
  * Return request URL
  * @return string request URL
  */
 function getRequestUrl()
 {
     static $url = null;
     if (is_null($url)) {
         $url = Context::getRequestUri();
         if (count($_GET)) {
             foreach ($_GET as $key => $val) {
                 $vars[] = $key . '=' . ($val ? urlencode(Context::convertEncodingStr($val)) : '');
             }
             $url .= '?' . join('&', $vars);
         }
     }
     return $url;
 }
开发者ID:relip,项目名称:xe-core,代码行数:18,代码来源:Context.class.php

示例12: procPlanetInsertSMS

 /**
  * @brief SMS를 받는다
  *
  **/
 function procPlanetInsertSMS()
 {
     $phone_number = Context::get('phone_number');
     $message = Context::get('message');
     $message = Context::convertEncodingStr($message);
     //@골뱅이를 빼자
     if (substr($message, 0, 1) == '@') {
         $message = substr($message, 1);
     }
     $args->phone_number = $phone_number;
     $oPlanetModel =& getModel('planet');
     $output = $oPlanetModel->getSMSUser($args);
     // SMS 사용자가 있으면 해당 planet에 등록
     if ($output->data) {
         $args->content = $message;
         $args->module_srl = $output->data->module_srl;
         $args->member_srl = $output->data->member_srl;
         $oMemberModel =& getModel('member');
         $output = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
         $args->user_id = $output->user_id;
         $args->user_name = $output->user_name;
         $args->nick_name = $output->nick_name;
         $args->email_address = $output->email_address;
         $args->homepage = $output->homepage;
         $module_info = $oPlanetModel->getPlanetConfig();
         $args->tags = join(',', $module_info->smstag);
         $manual_inserted = true;
         $output = $this->insertContent($args, $manual_inserted);
     } else {
         // SMS 사용자가 아니라면 planet_sms_resv에 쌓는다
         $output = $this->insertSMSRecv($phone_number, $message);
     }
     if ($output->toBool()) {
         header("X-SMSMORESPONSE:0");
     } else {
         header("X-SMSMORESPONSE:1");
     }
     // response를 XMLRPC로 변환
     Context::setResponseMethod('XMLRPC');
     return $output;
 }
开发者ID:eondcom,项目名称:xe-package-planet,代码行数:45,代码来源:planet.controller.php

示例13: procLivexeGet

 /**
  * @brief rss_url 의 정보를 구해서 return
  * title, homepage, rss_url
  **/
 function procLivexeGet()
 {
     $rss_url = Context::get('rss_url');
     if (!$rss_url) {
         return new Object(-1, 'msg_invalid_request');
     }
     if (strpos($rss_url, '://') === false) {
         $rss_url = 'http://' . $rss_url;
     }
     $body = Context::convertEncodingStr(FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml', array('User-Agent' => 'liveXE ( ' . Context::getRequestUri() . ' )')));
     $body = $this->_checkAndCorrectEncodingInPI($body);
     $oXml = new XmlParser();
     $doc = $oXml->parse($body);
     if ($doc->rss->attrs->version == '2.0') {
         $this->add('title', $doc->rss->channel->title->body);
         $this->add('homepage', $doc->rss->channel->link->body);
         $this->add('rss_url', $rss_url);
     } elseif (preg_match('/atom/i', $doc->feed->attrs->xmlns)) {
         $this->add('title', $doc->feed->title->body);
         if (is_array($doc->feed->link)) {
             $this->add('homepage', $doc->feed->link[0]->attrs->href);
         } else {
             $this->add('homepage', $doc->feed->link->attrs->href);
         }
         $this->add('rss_url', $rss_url);
     } else {
         return new Object(-1, 'msg_not_supported_rss');
     }
 }
开发者ID:haegyung,项目名称:xe-module-live,代码行数:33,代码来源:livexe.controller.php


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