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


PHP Context::convertEncoding方法代码示例

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


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

示例1: getHtmlPage

 /**
  * @brief 외부 http로 요청되는 파일일 경우 파일을 받아와서 저장 후 return
  **/
 function getHtmlPage($path, $caching_interval, $cache_file)
 {
     // 캐시 검사
     if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > time()) {
         $content = FileHandler::readFile($cache_file);
     } else {
         FileHandler::getRemoteFile($path, $cache_file);
         $content = FileHandler::readFile($cache_file);
     }
     // opage controller 생성
     $oOpageController =& getController('opage');
     // 외부 서버의 페이지 일 경우 이미지, css, javascript등의 url을 변경
     $content = $oOpageController->replaceSrc($content, $path);
     // 해당 문서를 utf-8로 변경
     $buff->content = $content;
     $buff = Context::convertEncoding($buff);
     $content = $buff->content;
     // title 추출
     $title = $oOpageController->getTitle($content);
     if ($title) {
         Context::setBrowserTitle($title);
     }
     // header script 추출
     $head_script = $oOpageController->getHeadScript($content);
     if ($head_script) {
         Context::addHtmlHeader($head_script);
     }
     // body 내용 추출
     $body_script = $oOpageController->getBodyScript($content);
     if (!$body_script) {
         $body_script = $content;
     }
     return $content;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:37,代码来源:opage.view.php

示例2: getInstallFTPList

 function getInstallFTPList()
 {
     $ftp_info = Context::getRequestVars();
     if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
         return new Object(-1, 'msg_ftp_invalid_auth_info');
     }
     $this->pwd = $ftp_info->ftp_root_path;
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = "127.0.0.1";
     }
     if ($ftp_info->sftp == 'Y') {
         return $this->getSFTPList();
     }
     if (function_exists(ftp_connect)) {
         $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
         if (!$connection) {
             return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
         }
         $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
         if (!$login_result) {
             ftp_close($connection);
             return new Object(-1, 'msg_ftp_invalid_auth_info');
         }
         if ($ftp_info->ftp_pasv != "N") {
             ftp_pasv($connection, true);
         }
         $_list = ftp_rawlist($connection, $this->pwd);
         ftp_close($connection);
     } else {
         require_once _XE_PATH_ . 'libs/ftp.class.php';
         $oFtp = new ftp();
         if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
             if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
                 $_list = $oFtp->ftp_rawlist($this->pwd);
                 $oFtp->ftp_quit();
             } else {
                 $oFtp->ftp_quit();
                 return new Object(-1, 'msg_ftp_invalid_auth_info');
             }
         }
     }
     $list = array();
     if ($_list) {
         foreach ($_list as $k => $v) {
             $src = null;
             $src->data = $v;
             $res = Context::convertEncoding($src);
             $v = $res->data;
             if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) {
                 $list[] = substr(strrchr($v, ' '), 1) . '/';
             }
         }
     }
     $this->add('list', $list);
 }
开发者ID:relip,项目名称:xe-core,代码行数:55,代码来源:install.model.php

示例3: getAdminFTPList

 /**
  * Add file list to Object after ftp connect
  * @return void|Object
  */
 function getAdminFTPList()
 {
     Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
     @set_time_limit(5);
     $ftp_info = Context::getRequestVars();
     if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
         return new Object(-1, 'msg_ftp_invalid_auth_info');
     }
     $this->pwd = $ftp_info->ftp_root_path;
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = "127.0.0.1";
     }
     if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) {
         $ftp_info->ftp_port = "21";
     }
     if ($ftp_info->sftp == 'Y') {
         if (!function_exists('ssh2_sftp')) {
             return new Object(-1, 'disable_sftp_support');
         }
         return $this->getSFTPList();
     }
     $oFtp = new ftp();
     if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
         if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
             $_list = $oFtp->ftp_rawlist($this->pwd);
             $oFtp->ftp_quit();
         } else {
             return new Object(-1, 'msg_ftp_invalid_auth_info');
         }
     }
     $list = array();
     if ($_list) {
         foreach ($_list as $k => $v) {
             $src = new stdClass();
             $src->data = $v;
             $res = Context::convertEncoding($src);
             $v = $res->data;
             if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) {
                 $list[] = substr(strrchr($v, ' '), 1) . '/';
             }
         }
     } else {
         return new Object(-1, 'msg_ftp_no_directory');
     }
     $this->add('list', $list);
 }
开发者ID:conory,项目名称:rhymix,代码行数:50,代码来源:admin.admin.model.php

示例4: getHtmlPage

 /**
  * @brief Save the file and return if a file is requested by http
  */
 function getHtmlPage($path, $caching_interval, $cache_file)
 {
     // Verify cache
     if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME']) {
         $content = FileHandler::readFile($cache_file);
     } else {
         FileHandler::getRemoteFile($path, $cache_file);
         $content = FileHandler::readFile($cache_file);
     }
     // Create opage controller
     $oPageController = getController('page');
     // change url of image, css, javascript and so on if the page is from external server
     $content = $oPageController->replaceSrc($content, $path);
     // Change the document to utf-8 format
     $buff = new stdClass();
     $buff->content = $content;
     $buff = Context::convertEncoding($buff);
     $content = $buff->content;
     // Extract a title
     $title = $oPageController->getTitle($content);
     if ($title) {
         Context::setBrowserTitle($title);
     }
     // Extract header script
     $head_script = $oPageController->getHeadScript($content);
     if ($head_script) {
         Context::addHtmlHeader($head_script);
     }
     // Extract content from the body
     $body_script = $oPageController->getBodyScript($content);
     if (!$body_script) {
         $body_script = $content;
     }
     return $content;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:38,代码来源:page.view.php

示例5: convertEncodingStr

 /**
  * Convert strings into UTF-8
  *
  * @param string $str String to convert
  * @return string converted string
  */
 function convertEncodingStr($str)
 {
     $obj->str = $str;
     $obj = Context::convertEncoding($obj);
     return $obj->str;
 }
开发者ID:relip,项目名称:xe-core,代码行数:12,代码来源:Context.class.php

示例6: insertTrackback

 function insertTrackback($obj, $manual_inserted = false)
 {
     // 엮인글 정리
     $obj = Context::convertEncoding($obj);
     if (!$obj->blog_name) {
         $obj->blog_name = $obj->title;
     }
     $obj->excerpt = strip_tags($obj->excerpt);
     // trigger 호출 (before)
     $output = ModuleHandler::triggerCall('trackback.insertTrackback', 'before', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     // GET으로 넘어온 document_srl을 참조, 없으면 오류~
     $document_srl = $obj->document_srl;
     if (!$manual_inserted) {
         // document model 객체 생성후 원본글을 가져옴
         $oDocumentModel =& getModel('document');
         $oDocument = $oDocumentModel->getDocument($document_srl);
         // 원본글이 없거나 트랙백 허용을 하지 않으면 오류 표시
         if (!$oDocument->isExists()) {
             return $this->stop('fail');
         }
         if (!$oDocument->allowTrackback()) {
             return new Object(-1, 'fail');
         }
         $obj->module_srl = $oDocument->get('module_srl');
     }
     // 엮인글을 입력
     $obj->trackback_srl = getNextSequence();
     $obj->list_order = $obj->trackback_srl * -1;
     $output = executeQuery('trackback.insertTrackback', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     // 입력에 이상이 없으면 해당 글의 엮인글 수를 올림
     if (!$manual_inserted) {
         // trackback model 객체 생성
         $oTrackbackModel =& getModel('trackback');
         // 해당 글의 전체 엮인글 수를 구해옴
         $trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
         // document controller 객체 생성
         $oDocumentController =& getController('document');
         // 해당글의 엮인글 수를 업데이트
         $output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
         // 결과 return
         if (!$output->toBool()) {
             return $output;
         }
     }
     // 원본글에 알림(notify_message)가 설정되어 있으면 메세지 보냄
     if (!$manual_inserted) {
         $oDocument->notify(Context::getLang('trackback'), $obj->excerpt);
     }
     // trigger 호출 (after)
     $output = ModuleHandler::triggerCall('trackback.insertTrackback', 'after', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     return new Object();
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:61,代码来源:trackback.controller.php

示例7: insertTrackback

 /**
  * Trackback inserted
  * @param object $obj
  * @param bool $manual_inserted
  * @return Object
  */
 function insertTrackback($obj, $manual_inserted = false)
 {
     // List trackback
     $obj = Context::convertEncoding($obj);
     if (!$obj->blog_name) {
         $obj->blog_name = $obj->title;
     }
     $obj->excerpt = strip_tags($obj->excerpt);
     // Call a trigger (before)
     $output = ModuleHandler::triggerCall('trackback.insertTrackback', 'before', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     // Document_srl see passed in GET, if an error ~
     $document_srl = $obj->document_srl;
     if (!$manual_inserted) {
         // Imported document model object, it permits you to wonbongeul
         $oDocumentModel =& getModel('document');
         $oDocument = $oDocumentModel->getDocument($document_srl);
         // If you do not allow two or trackback wonbongeul error display
         if (!$oDocument->isExists()) {
             return $this->stop('fail');
         }
         if (!$oDocument->allowTrackback()) {
             return new Object(-1, 'fail');
         }
         $obj->module_srl = $oDocument->get('module_srl');
     }
     // Enter Trackbacks
     $obj->trackback_srl = getNextSequence();
     $obj->list_order = $obj->trackback_srl * -1;
     $output = executeQuery('trackback.insertTrackback', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     // If there is more to enter the article number yeokingeul Rounds
     if (!$manual_inserted) {
         // trackback model object creation
         $oTrackbackModel =& getModel('trackback');
         // All the article number yeokingeul guhaeom
         $trackback_count = $oTrackbackModel->getTrackbackCount($document_srl);
         // document controller object creation
         $oDocumentController =& getController('document');
         // Update the number of posts that yeokingeul
         $output = $oDocumentController->updateTrackbackCount($document_srl, $trackback_count);
         // Return result
         if (!$output->toBool()) {
             return $output;
         }
     }
     // Notify wonbongeul (notify_message) if there is a Send a message
     if (!$manual_inserted) {
         $oDocument->notify(Context::getLang('trackback'), $obj->excerpt);
     }
     // Call a trigger (after)
     $output = ModuleHandler::triggerCall('trackback.insertTrackback', 'after', $obj);
     if (!$output->toBool()) {
         return $output;
     }
     return new Object();
 }
开发者ID:relip,项目名称:xe-core,代码行数:67,代码来源:trackback.controller.php


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