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


PHP Phpfox_Error::skip方法代码示例

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


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

示例1: getUrl

 public function getUrl()
 {
     Phpfox_Error::skip(true);
     $mReturn = $this->_oTwitter->getAuthorizationUrl();
     Phpfox_Error::skip(false);
     return $mReturn;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:7,代码来源:twitter.class.php

示例2: validXhtml

 /**
  * Uses the class DOMDocument to clean HTML and make it valid XHTML.
  *
  * @link http://php.net/manual/en/class.domdocument.php 
  * @param string $sStr String we need to parse.
  * @return string Parsed string withn clean valid XHTML code.
  */
 public function validXhtml($sStr)
 {
     if (class_exists('DOMDocument')) {
         static $oDoc = null;
         if ($oDoc === null) {
             $oDoc = new DOMDocument('1.0');
         }
         Phpfox_Error::skip(true);
         $oDoc->loadHTML($sStr);
         $sStr = $oDoc->saveHTML();
         $sStr = preg_replace('/^<!DOCTYPE.+?>/i', '', $sStr);
         $sStr = trim($sStr);
         if (substr($sStr, 0, 12) == '<html><body>') {
             $sStr = substr_replace($sStr, '', 0, 12);
         }
         if (substr($sStr, -14) == '</body></html>') {
             $sStr = substr_replace($sStr, '', -14);
         }
         Phpfox_Error::skip(false);
     }
     return $sStr;
 }
开发者ID:lev1976g,项目名称:core,代码行数:29,代码来源:format.class.php

示例3: update

	public function update($aVals)
	{		
		if (isset($aVals['order']))
		{
			foreach ($aVals['order'] as $sVar => $iOrder)
			{
				$this->database()->update($this->_sTable, array('ordering' => (int) $iOrder), "var_name = '" . $this->database()->escape($sVar) . "'");
			}		
		}
				
		if (isset($aVals['value']['admin_debug_mode']) && file_exists(PHPFOX_DIR . 'file' . PHPFOX_DS . 'cache' . PHPFOX_DS . 'debug.php'))
		{
			Phpfox::getLib('file')->unlink(PHPFOX_DIR . 'file' . PHPFOX_DS . 'cache' . PHPFOX_DS . 'debug.php');
		}
		
		if (isset($aVals['value']['ftp_enabled']) && $aVals['value']['ftp_enabled'])
		{			
			define('PHPFOX_FTP_LOGIN_PASS', true);
	
			if (Phpfox::getLib('ftp')->connect($aVals['value']['ftp_host'], $aVals['value']['ftp_username'], $aVals['value']['ftp_password']))
			{
				if (!Phpfox::getLib('ftp')->test($aVals['value']['ftp_dir_path']))
				{
					return false;
				}
			}
			
			if (!Phpfox_Error::isPassed())
			{
				return false;
			}			
		}
		
		if (isset($aVals['value']['enable_api_support']) && $aVals['value']['enable_api_support'])
		{
			if (!Phpfox::getService('api')->test())
			{
				return false;
			}
		}
		
		if (isset($aVals['value']['enable_janrain_login']) && $aVals['value']['enable_janrain_login'] == 1 &&
			( (isset($aVals['value']['janrain_api_key']) && empty($aVals['value']['janrain_api_key'])) ||
				(isset($aVals['value']['janrain_application_domain']) && empty($aVals['value']['janrain_application_domain']))
			)
			)
		{			
			return Phpfox_Error::set('To enable Janrain you must set the API Key and the Application domain');
		}
		
		if (isset($aVals['value']['method']) && $aVals['value']['method']['value'] == 'smtp')
		{			
			Phpfox_Error::skip(true);
			
			$bSent = Phpfox::getLib('mail', 'smtp')->test($aVals['value'])
				->to($aVals['value']['email_from_email'])
				->subject('Test SMTP E-mail')
				->message('SMTP is working!')
				->send();				
				
			if ($bSent === false)
			{
				$sEmailHeader = ob_get_contents();
				
				ob_clean();
				
				if (!empty($sEmailHeader))
				{
					Phpfox_Error::set('<b>SMTP Error Message</b>: ' . $sEmailHeader);
				}
				
				return false;
			}
			
			Phpfox_Error::skip(false);
		}			

		if (!empty($_FILES['watermark']['name']))
		{
			$aImage = Phpfox::getLib('file')->load('watermark', array('jpg', 'gif', 'png'));
			if ($aImage === false)
			{
				return false;
			}
			
			$hDir = opendir(Phpfox::getParam('core.dir_watermark'));
			while ($sFile = readdir($hDir))
			{
				if (!preg_match('/(.*)\.(jpg|jpeg|gif|png)/i', $sFile))
				{
					continue;
				}
				
				Phpfox::getLib('file')->unlink(Phpfox::getParam('core.dir_watermark') . $sFile);
			}
			closedir($hDir);
			
			if (!Phpfox::getLib('file')->upload('watermark', Phpfox::getParam('core.dir_watermark'), 'watermark', false, 0644, false))
			{
				return false;	
//.........这里部分代码省略.........
开发者ID:hoanghd,项目名称:tools,代码行数:101,代码来源:process.class.php

示例4: upload

 public function upload($aVals, $iAlbumId = 0)
 {
     if (!isset($_FILES['mp3'])) {
         return Phpfox_Error::set(Phpfox::getPhrase('music.select_an_mp3'));
     }
     $aSong = Phpfox::getLib('file')->load('mp3', 'mp3', Phpfox::getUserParam('music.music_max_file_size'));
     if (function_exists('finfo_open')) {
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         if (!in_array(finfo_file($finfo, $_FILES['mp3']['tmp_name']), Phpfox::getService('music')->getMimeTypes())) {
             return Phpfox_Error::set(Phpfox::getPhrase('core.uploaded_file_is_not_valid'));
         }
         finfo_close($finfo);
     }
     if ($aSong === false) {
         return false;
     }
     if (empty($aVals['title'])) {
         $aVals['title'] = $aSong['name'];
     }
     if (!isset($aVals['privacy'])) {
         $aVals['privacy'] = 0;
     }
     if (!isset($aVals['privacy_comment'])) {
         $aVals['privacy_comment'] = 0;
     }
     if ($iAlbumId < 1 && isset($aVals['album_id'])) {
         $iAlbumId = (int) $aVals['album_id'];
     }
     if ($iAlbumId > 0) {
         $aAlbum = $this->database()->select('*')->from(Phpfox::getT('music_album'))->where('album_id = ' . (int) $iAlbumId)->execute('getSlaveRow');
         $aVals['privacy'] = $aAlbum['privacy'];
         $aVals['privacy_comment'] = $aAlbum['privacy_comment'];
         if (!empty($aAlbum['module_id'])) {
             $aVals['callback_module'] = $aAlbum['module_id'];
         }
         if (!empty($aAlbum['item_id'])) {
             $aVals['callback_item_id'] = $aAlbum['item_id'];
         }
     }
     if (!empty($aVals['new_album_title'])) {
         $iAlbumId = $this->database()->insert(Phpfox::getT('music_album'), array('user_id' => Phpfox::getUserId(), 'name' => $this->preParse()->clean($aVals['new_album_title']), 'privacy' => isset($aVals['privacy']) ? $aVals['privacy'] : '0', 'privacy_comment' => isset($aVals['privacy_comment']) ? $aVals['privacy_comment'] : '0', 'time_stamp' => PHPFOX_TIME, 'module_id' => isset($aVals['callback_module']) ? $aVals['callback_module'] : null, 'item_id' => isset($aVals['callback_item_id']) ? (int) $aVals['callback_item_id'] : '0'));
         $aAlbum = $this->database()->select('*')->from(Phpfox::getT('music_album'))->where('album_id = ' . (int) $iAlbumId)->execute('getSlaveRow');
         $this->database()->insert(Phpfox::getT('music_album_text'), array('album_id' => $iAlbumId));
         if ($aVals['privacy'] == '4') {
             // Phpfox::getService('privacy.process')->add('music_album', $iAlbumId, (isset($aVals['privacy_list']) ? $aVals['privacy_list'] : array()));
         }
     }
     Phpfox::getService('ban')->checkAutomaticBan($aVals['title']);
     $aInsert = array('view_id' => Phpfox::getUserParam('music.music_song_approval') ? '1' : '0', 'privacy' => isset($aVals['privacy']) ? $aVals['privacy'] : '0', 'privacy_comment' => isset($aVals['privacy_comment']) ? $aVals['privacy_comment'] : '0', 'album_id' => $iAlbumId, 'genre_id' => isset($aVals['genre_id']) ? (int) $aVals['genre_id'] : '0', 'user_id' => Phpfox::getUserId(), 'title' => Phpfox::getLib('parse.input')->clean($aVals['title'], 255), 'description' => isset($aVals['status_info']) ? Phpfox::getLib('parse.input')->clean($aVals['status_info'], 255) : null, 'explicit' => isset($aVals['explicit']) && $aVals['explicit'] ? 1 : 0, 'time_stamp' => PHPFOX_TIME, 'module_id' => isset($aVals['callback_module']) ? $aVals['callback_module'] : null, 'item_id' => isset($aVals['callback_item_id']) ? (int) $aVals['callback_item_id'] : '0');
     $iId = $this->database()->insert($this->_sTable, $aInsert);
     if (!$iId) {
         return false;
     }
     $sFileName = Phpfox::getLib('file')->upload('mp3', Phpfox::getParam('music.dir'), $iId);
     $sDuration = null;
     if (file_exists(PHPFOX_DIR_LIB . 'getid3' . PHPFOX_DS . 'getid3' . PHPFOX_DS . 'getid3.php')) {
         // Temp. disable error reporting
         Phpfox_Error::skip(true);
         require_once PHPFOX_DIR_LIB . 'getid3' . PHPFOX_DS . 'getid3' . PHPFOX_DS . 'getid3.php';
         $oGetId3 = new getID3();
         $aMetaData = $oGetId3->analyze(Phpfox::getParam('music.dir') . sprintf($sFileName, ''));
         if (isset($aMetaData['playtime_string'])) {
             $sDuration = $aMetaData['playtime_string'];
         }
     }
     $aInsert['song_id'] = $iId;
     $aInsert['duration'] = $sDuration;
     $aInsert['song_path'] = $sFileName;
     $aInsert['full_name'] = $sFileName;
     $aInsert['is_featured'] = 0;
     $aInsert['user_name'] = Phpfox::getUserBy('user_name');
     // Return back error reporting
     Phpfox_Error::skip(false);
     $this->database()->update($this->_sTable, array('song_path' => $sFileName, 'server_id' => Phpfox::getLib('request')->getServer('PHPFOX_SERVER_ID'), 'duration' => $sDuration), 'song_id = ' . (int) $iId);
     // Update user space usage
     if (!Phpfox::getUserParam('music.music_song_approval')) {
         Phpfox::getService('user.space')->update(Phpfox::getUserId(), 'music', filesize(Phpfox::getParam('music.dir') . sprintf($sFileName, '')));
     }
     if ($aVals['privacy'] == '4') {
         Phpfox::getService('privacy.process')->add('music_song', $iId, isset($aVals['privacy_list']) ? $aVals['privacy_list'] : array());
     }
     $aCallback = null;
     if (!empty($aVals['callback_module']) && Phpfox::hasCallback($aVals['callback_module'], 'uploadSong')) {
         $aCallback = Phpfox::callback($aVals['callback_module'] . '.uploadSong', $aVals['callback_item_id']);
     }
     if ($iAlbumId > 0) {
         if (!Phpfox::getUserParam('music.music_song_approval')) {
             $this->database()->updateCounter('music_album', 'total_track', 'album_id', $iAlbumId);
             Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->callback($aCallback)->add('music_album', $iId, $aAlbum['privacy'], isset($aAlbum['privacy_comment']) ? (int) $aAlbum['privacy_comment'] : 0, isset($aVals['callback_item_id']) ? (int) $aVals['callback_item_id'] : '0') : null;
         }
     } else {
         if (!Phpfox::getUserParam('music.music_song_approval')) {
             Phpfox::isModule('feed') ? Phpfox::getService('feed.process')->callback($aCallback)->add('music_song', $iId, $aVals['privacy'], isset($aVals['privacy_comment']) ? (int) $aVals['privacy_comment'] : 0, isset($aVals['callback_item_id']) ? (int) $aVals['callback_item_id'] : '0') : null;
         }
     }
     if (!Phpfox::getUserParam('music.music_song_approval')) {
         Phpfox::getService('user.activity')->update(Phpfox::getUserId(), 'music_song');
     }
     // plugin call
     if ($sPlugin = Phpfox_Plugin::get('music.service_process_upload__end')) {
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:kr-indian,代码行数:101,代码来源:process.class.php

示例5: _check

 private function _check($sDestination)
 {
     if (!file_exists($sDestination)) {
         $this->_debug(Phpfox::getPhrase('video.unable_to_convert_video'));
         if (!empty($this->_sLastLineCode)) {
             Phpfox_Error::set($this->_sLastLineCode);
         }
         return Phpfox_Error::set(Phpfox::getPhrase('video.unable_to_convert_video'));
     }
     // Temp. disable error reporting
     Phpfox_Error::skip(true);
     require_once PHPFOX_DIR_LIB . 'getid3' . PHPFOX_DS . 'getid3' . PHPFOX_DS . 'getid3.php';
     $oGetId3 = new getID3();
     $aMetaData = $oGetId3->analyze($sDestination);
     // Return back error reporting
     Phpfox_Error::skip(false);
     if (isset($aMetaData['error']) && count($aMetaData['error'])) {
         if (!empty($this->_sLastLineCode)) {
             Phpfox_Error::set($this->_sLastLineCode);
         }
         return Phpfox_Error::set(implode('<br />', array_map('ucfirst', $aMetaData['error'])));
     }
     return true;
 }
开发者ID:noikiy,项目名称:phpfox-v3-dist,代码行数:24,代码来源:convert.class.php

示例6: isWritable

 /**
  * Checks if path is writable
  *
  * @param string $sPath Path to file or directory
  * @param bool $bForce If set to TRUE we will disable error reporting and force a check on the file/folder
  * @return boolean If file/folder is writable we return TRUE otherwise we return FALSE
  */
 public function isWritable($sPath, $bForce = false)
 {
     clearstatcache();
     if ($bForce === false) {
         if (!is_writable($sPath)) {
             if (!stristr(PHP_OS, "win")) {
                 return false;
             }
         }
     }
     if ($bForce === true) {
         Phpfox_Error::skip(true);
     }
     /**
      * Checking if writable on windows OS
      */
     if (stristr(PHP_OS, "win") || $bForce === true) {
         /**
          * need to check whether we can really create files in this directory or not
          */
         if (is_dir($sPath)) {
             /**
              * Trying to create a new file
              */
             $fp = @fopen($sPath . PHPFOX_DS . 'win-test.txt', 'w');
             if (!$fp) {
                 if ($bForce === true) {
                     Phpfox_Error::skip(false);
                 }
                 return false;
             }
             if (!@fwrite($fp, 'test')) {
                 if ($bForce === true) {
                     Phpfox_Error::skip(false);
                 }
                 return false;
             }
             fclose($fp);
             /**
              * clean up after ourselves
              */
             if (file_exists($sPath . 'win-test.txt')) {
                 unlink($sPath . 'win-test.txt');
             }
         } else {
             if (!file_exists($sPath)) {
                 if ($bForce === true) {
                     Phpfox_Error::skip(false);
                 }
                 return false;
             }
             $sContent = @file_get_contents($sPath);
             if (!($fp = @fopen($sPath, 'w'))) {
                 if ($bForce === true) {
                     Phpfox_Error::skip(false);
                 }
                 return false;
             }
             if (!@fwrite($fp, $sContent)) {
                 if ($bForce === true) {
                     Phpfox_Error::skip(false);
                 }
                 return false;
             }
             fclose($fp);
         }
     }
     if ($bForce === true) {
         Phpfox_Error::skip(false);
     }
     return true;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:79,代码来源:file.class.php

示例7: getLink

 public function getLink($sUrl)
 {
     if (substr($sUrl, 0, 7) != 'http://' && substr($sUrl, 0, 8) != 'https://') {
         $sUrl = 'http://' . $sUrl;
     }
     $aParts = parse_url($sUrl);
     if (!isset($aParts['host'])) {
         return Phpfox_Error::set(Phpfox::getPhrase('link.not_a_valid_link'));
     }
     $aReturn = array();
     $oVideo = json_decode(Phpfox::getLib('request')->send('http://api.embed.ly/1/oembed?format=json&maxwidth=400&url=' . urlencode($sUrl), array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
     // http://www.phpfox.com/tracker/view/15305/
     if (!isset($oVideo->thumbnail_url)) {
         if (preg_match('/facebook/i', $sUrl)) {
             $aRegexes = array('/https?:\\/\\/www\\.facebook\\.com\\/v\\/([0-9]+)/i', '/https?:\\/\\/www\\.facebook\\.com\\/.*\\?v=([0-9]+)/i', '/https?:\\/\\/www\\.facebook\\.com\\/video\\/embed\\?video_id=([0-9]+)/i');
             foreach ($aRegexes as $sRegex) {
                 if (preg_match($sRegex, $sUrl, $aMatches)) {
                     $iId = $aMatches[1];
                 }
             }
             $oThumbnail = json_decode(Phpfox::getLib('request')->send('https://graph.facebook.com/' . $iId . '/picture?redirect=false', array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
             $oVideo->thumbnail_url = $oThumbnail->data->url;
             $oVideo->type = 'video';
             $oVideo->html = '<iframe src="https://www.facebook.com/video/embed?video_id=' . $iId . '" width="400" height="300" frameborder="0"></iframe>';
         }
     }
     // END
     // http://embed.ly/docs/embed/api/endpoints/1/oembed => object->photo does not exist as response
     if (isset($oVideo->provider_url) || isset($oVideo->photo)) {
         $aReturn = array('link' => $sUrl, 'title' => isset($oVideo->title) ? strip_tags($oVideo->title) : '', 'description' => isset($oVideo->description) ? strip_tags($oVideo->description) : '', 'default_image' => $oVideo->type == 'photo' ? $oVideo->url : (isset($oVideo->thumbnail_url) ? $oVideo->thumbnail_url : ''), 'embed_code' => $oVideo->type == 'video' ? $oVideo->html : '');
         return $aReturn;
     }
     $aParseBuild = array();
     $sContent = Phpfox::getLib('request')->send($sUrl, array(), 'GET', $_SERVER['HTTP_USER_AGENT']);
     preg_match_all('/<(meta|link)(.*?)>/i', $sContent, $aRegMatches);
     if (isset($aRegMatches[2])) {
         foreach ($aRegMatches as $iKey => $aMatch) {
             if ($iKey !== 2) {
                 continue;
             }
             foreach ($aMatch as $sLine) {
                 $sLine = rtrim($sLine, '/');
                 $sLine = trim($sLine);
                 preg_match('/(property|name|rel)=("|\')(.*?)("|\')/ise', $sLine, $aType);
                 if (count($aType) && isset($aType[3])) {
                     $sType = $aType[3];
                     preg_match('/(content|type)=("|\')(.*?)("|\')/i', $sLine, $aValue);
                     if (count($aValue) && isset($aValue[3])) {
                         if ($sType == 'alternate') {
                             $sType = $aValue[3];
                             preg_match('/href=("|\')(.*?)("|\')/i', $sLine, $aHref);
                             if (isset($aHref[2])) {
                                 $aValue[3] = $aHref[2];
                             }
                         }
                         $aParseBuild[$sType] = $aValue[3];
                     }
                 }
             }
         }
         if (isset($aParseBuild['og:title'])) {
             $aReturn['link'] = $sUrl;
             $aReturn['title'] = $aParseBuild['og:title'];
             $aReturn['description'] = isset($aParseBuild['og:description']) ? $aParseBuild['og:description'] : '';
             $aReturn['default_image'] = isset($aParseBuild['og:image']) ? $aParseBuild['og:image'] : '';
             if (isset($aParseBuild['application/json+oembed'])) {
                 $oJson = json_decode(Phpfox::getLib('request')->send($aParseBuild['application/json+oembed'], array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
                 if (isset($oJson->html)) {
                     $aReturn['embed_code'] = $oJson->html;
                 }
             }
             return $aReturn;
         }
     }
     $sContent = Phpfox::getLib('request')->send($sUrl, array(), 'GET', $_SERVER['HTTP_USER_AGENT'], null, true);
     if (function_exists('mb_convert_encoding')) {
         $sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', "UTF-8");
     }
     $aReturn['link'] = $sUrl;
     Phpfox_Error::skip(true);
     $oDoc = new DOMDocument();
     $oDoc->loadHTML($sContent);
     Phpfox_Error::skip(false);
     if (($oTitle = $oDoc->getElementsByTagName('title')->item(0)) && !empty($oTitle->nodeValue)) {
         $aReturn['title'] = strip_tags($oTitle->nodeValue);
     }
     if (empty($aReturn['title'])) {
         if (preg_match('/^(.*?)\\.(jpg|png|jpeg|gif)$/i', $sUrl, $aImageMatches)) {
             return array('link' => $sUrl, 'title' => '', 'description' => '', 'default_image' => $sUrl, 'embed_code' => '');
         }
         return Phpfox_Error::set(Phpfox::getPhrase('link.not_a_valid_link_unable_to_find_a_title'));
     }
     $oXpath = new DOMXPath($oDoc);
     $oMeta = $oXpath->query("//meta[@name='description']")->item(0);
     if (method_exists($oMeta, 'getAttribute')) {
         $sMeta = $oMeta->getAttribute('content');
         if (!empty($sMeta)) {
             $aReturn['description'] = strip_tags($sMeta);
         }
     }
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:kr-indian,代码行数:101,代码来源:link.class.php

示例8: getPath

	/**
	 * Try to find the full path of where we are currently located based on the relative position
	 * we are allowed to access on the FTP server.
	 *
	 * @return mixed FALSE if we cannot find where we are, STRING if we can; which is the full path to where we are
	 */
	public function getPath()
	{
		Phpfox_Error::skip(true);
		if (ftp_chdir($this->_oFtp, PHPFOX_DIR))
		{
			return '';
		}
		Phpfox_Error::skip(false);
		
		$sCurrentDirectory = ftp_pwd($this->_oFtp);
		
		$aCache = array();
		$aParts = explode(PHPFOX_DS, PHPFOX_DIR);
		foreach ($aParts as $sPart)
		{
			if (empty($sPart))
			{
				continue;
			}
			
			$aCache[$sPart] = true;
		}		
		
		$sBase = '';
		$aList = ftp_nlist($this->_oFtp, '.');
		foreach ($aList as $sList)
		{
			if ($sList == '.' || $sList == '..')
			{
				continue;
			}

            $sList = trim($sList, '.');
            $sList = trim($sList, '/');
            $sList = trim($sList, '\/');
			
			if (isset($aCache[$sList]))
			{
				$sBase = $sList;
				break;
			}
		}		
		
		if (!empty($sBase))
		{
			$aBaseParts = explode($sBase, PHPFOX_DIR);			
			
			return PHPFOX_DS . $sBase . $aBaseParts[1];
		}
		
		return false;
	}
开发者ID:hoanghd,项目名称:tools,代码行数:58,代码来源:ftp.class.php

示例9: parse

 /**
  * Text we need to parse, usually text added via a <textarea>.
  *
  * @param string $sTxt is the string we need to parse
  * @return string Parsed string
  */
 public function parse($sTxt)
 {
     if (empty($sTxt)) {
         return $sTxt;
     }
     if ($sPlugin = Phpfox_Plugin::get('phpfox_parse_output_parse__start')) {
         eval($sPlugin);
     }
     $sTxt = ' ' . $sTxt;
     if (!Phpfox::getParam('core.allow_html')) {
         $oFilterBbcode = Phpfox::getLib('parse.bbcode');
         if (Phpfox::isModule('emoticon')) {
             $sTxt = Phpfox::getService('emoticon')->parse($sTxt);
         }
         $sTxt = $oFilterBbcode->preParse($sTxt);
         $sAllowedTags = '<p><b><i><u><br><br />';
         $sTxt = strip_tags($sTxt, $sAllowedTags);
         // Add breaks without messing up HTML
         $sTxt = str_replace("\n", "[br]", $sTxt);
         $sTxt = preg_replace('/<(.*?)>/ise', "'<'. stripslashes(str_replace('[br]', '', '\\1')) .'>'", $sTxt);
         $sTxt = str_replace("[br]", "<br />", $sTxt);
         // Parse BBCode
         $sTxt = $oFilterBbcode->parse($sTxt);
     }
     $sTxt = Phpfox::getService('ban.word')->clean($sTxt);
     /*
     if (Phpfox::getParam('core.xhtml_valid'))
     {
     	$sTxt = Phpfox::getLib('parse.format')->validXhtml($sTxt);
     }
     */
     $sTxt = $this->parseUrls($sTxt);
     $sTxt = preg_replace_callback('/<object(.*?)>(.*?)<\\/object>/is', array($this, '_embedWmode'), $sTxt);
     // $sTxt = preg_replace_callback('/<iframe(.*?)>(.*?)<\/iframe>/is', array($this, '_embedWmode'), $sTxt);
     if (Phpfox::getParam('core.enable_html_purifier') && file_exists(PHPFOX_DIR_LIB . 'htmlpurifier/HTMLPurifier.auto.php')) {
         static $purifier = null;
         Phpfox_Error::skip(true);
         if ($purifier === null) {
             require_once PHPFOX_DIR_LIB . 'htmlpurifier/HTMLPurifier.auto.php';
             $config = HTMLPurifier_Config::createDefault();
             if (file_exists(PHPFOX_DIR_SETTING . 'htmlpurifier.sett.php')) {
                 require_once PHPFOX_DIR_SETTING . 'htmlpurifier.sett.php';
             } else {
                 require_once PHPFOX_DIR_SETTING . 'htmlpurifier.sett.php.new';
             }
             $config->set('Attr.AllowedRel', array('nofollow'));
             $config->set('Attr.AllowedFrameTargets', array('_blank'));
             $purifier = new HTMLPurifier($config);
         }
         $sTxt = $purifier->purify($sTxt);
         Phpfox_Error::skip(false);
     }
     $sTxt = preg_replace_callback('/\\[PHPFOX_PHRASE\\](.*?)\\[\\/PHPFOX_PHRASE\\]/i', array($this, '_getPhrase'), $sTxt);
     if (Phpfox::getParam('core.resize_images')) {
         $sTxt = preg_replace_callback('/<img(.*?)>/i', array($this, '_fixImageWidth'), $sTxt);
     }
     if (Phpfox::getParam('tag.enable_hashtag_support')) {
         $sTxt = $this->replaceHashTags($sTxt);
     }
     return $sTxt;
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:67,代码来源:output.class.php

示例10: put

 /**
  * Uploads the file to Rackspace server.
  *
  * @param string $sFile Full path to where the file is located.
  * @param string $sName Optional name of the file once it is uploaded. By default we just use the original file name.
  * @return bool We only return a bool false if we were not able to upload the item.
  */
 public function put($sFile, $sName = null)
 {
     $this->connect();
     Phpfox_Error::skip(true);
     if (empty($sName)) {
         $sName = str_replace("\\", '/', str_replace(PHPFOX_DIR, '', $sFile));
     }
     $object = $this->_oContainer->create_object($sName);
     try {
         $object->load_from_filename($sFile);
     } catch (Exception $hException) {
         Phpfox_Error::trigger($hException->getMessage());
     }
     $this->_bIsUploaded = true;
     if (Phpfox::getParam('core.keep_files_in_server') == false) {
         $oSess = Phpfox::getLib('session');
         $aFiles = $oSess->get('deleteFiles');
         if (is_array($aFiles)) {
             $aFiles[] = $sFile;
         } else {
             $aFiles = array($sFile);
         }
         $oSess->set('deleteFiles', $aFiles);
     }
     Phpfox_Error::skip(false);
     return true;
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:34,代码来源:rackspace.class.php

示例11: getLink

	public function getLink($sUrl)
	{
		if (substr($sUrl, 0, 7) != 'http://')
		{
			$sUrl = 'http://' . $sUrl;
		}
			
		$aParts = parse_url($sUrl);	
		
		if (!isset($aParts['host']))
		{
			return Phpfox_Error::set('Not a valid link.');
		}
		
		$aReturn = array();
		
		$sCacheId = $this->cache()->set('api_embed_ly');
		$aSites = array();		
		if (!($aSites = $this->cache()->get($sCacheId)))
		{
			$aSites[] = '#http://.*myspace.com/video/.*#i';
			$oOutput = json_decode(Phpfox::getLib('request')->send('http://api.embed.ly/1/services/php', array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
			if (!is_array($oOutput))
			{
				return Phpfox_Error::set('Unable to build api.embed.ly array of sites.');
			}
			foreach ($oOutput as $aOutput)
			{
				foreach ($aOutput->regex as $sRegex)
				{
					$aSites[] = $sRegex;
				}
			}

			$this->cache()->save($sCacheId, $aSites);
		}
		
		foreach ($aSites as $sSiteRegex)
		{		
			if (preg_match($sSiteRegex, $sUrl))
			{
				$oVideo = json_decode(Phpfox::getLib('request')->send('http://api.embed.ly/1/oembed?format=json&maxwidth=400&url=' . urlencode($sUrl), array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
	
				if (isset($oVideo->provider_url))
				{
					$aReturn = array(
						'link' => $sUrl,
						'title' => strip_tags($oVideo->title),
						'description' => strip_tags($oVideo->description),
						'default_image' => $oVideo->thumbnail_url,
						'embed_code' => ($oVideo->type == 'video' ? $oVideo->html : '')
					);
					
					return $aReturn;
				}
			}
		}
		
		$sContent = Phpfox::getLib('request')->send($sUrl, array(), 'GET', $_SERVER['HTTP_USER_AGENT']);
		if( function_exists('mb_convert_encoding') )
      	{
      		$sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', "UTF-8");
      	}		
      	      	
      	$aReturn['link'] = $sUrl;
		
		Phpfox_Error::skip(true);
		$oDoc = new DOMDocument();
		$oDoc->loadHTML($sContent);
		Phpfox_Error::skip(false);
		
		if (($oTitle = $oDoc->getElementsByTagName('title')->item(0)) && !empty($oTitle->nodeValue))
		{
			$aReturn['title'] = strip_tags($oTitle->nodeValue);
		}
		
		if (empty($aReturn['title']))
		{
			return Phpfox_Error::set('Not a valid link. Unable to find a title.');
		}
		
		$oXpath = new DOMXPath($oDoc);	
		$oMeta = $oXpath->query("//meta[@name='description']")->item(0);
		if (method_exists($oMeta, 'getAttribute'))
		{
			$sMeta = $oMeta->getAttribute('content');
			if (!empty($sMeta))
			{
				$aReturn['description'] = strip_tags($sMeta);
			}
		}
		
		$aImages = array();		
		$oMeta = $oXpath->query("//meta[@property='og:image']")->item(0);
		if (method_exists($oMeta, 'getAttribute'))
		{			
			$aReturn['default_image'] = strip_tags($oMeta->getAttribute('content'));
			$aImages[] = strip_tags($oMeta->getAttribute('content'));
		}		
		
//.........这里部分代码省略.........
开发者ID:hoanghd,项目名称:tools,代码行数:101,代码来源:link.class.php

示例12: gc

 /**
  * Garbage collecting.
  *
  * @param int $iMaxLifetime Define how long a session can exist on the server.
  * @return bool Always TRUE.
  */
 public function gc($iMaxLifetime)
 {
     Phpfox_Error::skip(true);
     foreach (glob($this->_sSavePath . $this->_sPrefix . '*') as $sFilename) {
         if (filemtime($sFilename) + $iMaxLifetime < time()) {
             @unlink($sFilename);
         }
     }
     Phpfox_Error::skip(false);
     return true;
 }
开发者ID:lev1976g,项目名称:core,代码行数:17,代码来源:file.class.php

示例13: getLink

 /**
  * get link
  * @param $sUrl
  * @return array|bool
  */
 public function getLink($sUrl)
 {
     if (substr($sUrl, 0, 7) != 'http://' && substr($sUrl, 0, 8) != 'https://') {
         $sUrl = 'http://' . $sUrl;
     }
     $aParts = parse_url($sUrl);
     if (!isset($aParts['host'])) {
         return false;
     }
     $aReturn = array();
     $oVideo = json_decode(Phpfox::getLib('request')->send('http://api.embed.ly/1/oembed?format=json&maxwidth=400&url=' . urlencode($sUrl), array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
     if (isset($oVideo->provider_url) && isset($oVideo->photo)) {
         $aReturn = array('link' => $sUrl, 'title' => isset($oVideo->title) ? strip_tags($oVideo->title) : '', 'description' => isset($oVideo->description) ? strip_tags($oVideo->description) : '', 'default_image' => $oVideo->type == 'photo' ? $oVideo->url : (isset($oVideo->thumbnail_url) ? $oVideo->thumbnail_url : ''), 'embed_code' => $oVideo->type == 'video' ? $oVideo->html : '');
         return $aReturn;
     }
     $aParseBuild = array();
     $sContent = Phpfox::getLib('request')->send($sUrl, array(), 'GET', $_SERVER['HTTP_USER_AGENT']);
     preg_match_all('/<(meta|link)(.*?)>/i', $sContent, $aRegMatches);
     if (isset($aRegMatches[2])) {
         foreach ($aRegMatches as $iKey => $aMatch) {
             if ($iKey !== 2) {
                 continue;
             }
             foreach ($aMatch as $sLine) {
                 $sLine = rtrim($sLine, '/');
                 $sLine = trim($sLine);
                 preg_match('/(property|name|rel)=("|\')(.*?)("|\')/ise', $sLine, $aType);
                 if (count($aType) && isset($aType[3])) {
                     $sType = $aType[3];
                     preg_match('/(content|type)=("|\')(.*?)("|\')/i', $sLine, $aValue);
                     if (count($aValue) && isset($aValue[3])) {
                         if ($sType == 'alternate') {
                             $sType = $aValue[3];
                             preg_match('/href=("|\')(.*?)("|\')/i', $sLine, $aHref);
                             if (isset($aHref[2])) {
                                 $aValue[3] = $aHref[2];
                             }
                         }
                         $aParseBuild[$sType] = $aValue[3];
                     }
                 }
             }
         }
         if (isset($aParseBuild['og:title'])) {
             $aReturn['link'] = $sUrl;
             $aReturn['title'] = $aParseBuild['og:title'];
             $aReturn['description'] = isset($aParseBuild['og:description']) ? $aParseBuild['og:description'] : '';
             $aReturn['default_image'] = isset($aParseBuild['og:image']) ? $aParseBuild['og:image'] : '';
             if (isset($aParseBuild['application/json+oembed'])) {
                 $oJson = json_decode(Phpfox::getLib('request')->send($aParseBuild['application/json+oembed'], array(), 'GET', $_SERVER['HTTP_USER_AGENT']));
                 if (isset($oJson->html)) {
                     $aReturn['embed_code'] = $oJson->html;
                 }
             }
             return $aReturn;
         }
     }
     $sContent = Phpfox::getLib('request')->send($sUrl, array(), 'GET', $_SERVER['HTTP_USER_AGENT'], null, true);
     if (function_exists('mb_convert_encoding')) {
         $sContent = mb_convert_encoding($sContent, 'HTML-ENTITIES', "UTF-8");
     }
     $aReturn['link'] = $sUrl;
     Phpfox_Error::skip(true);
     $oDoc = new DOMDocument();
     $oDoc->loadHTML($sContent);
     Phpfox_Error::skip(false);
     if (($oTitle = $oDoc->getElementsByTagName('title')->item(0)) && !empty($oTitle->nodeValue)) {
         $aReturn['title'] = strip_tags($oTitle->nodeValue);
     }
     if (empty($aReturn['title'])) {
         if (preg_match('/^(.*?)\\.(jpg|png|jpeg|gif)$/i', $sUrl, $aImageMatches)) {
             return array('link' => $sUrl, 'title' => '', 'description' => '', 'default_image' => $sUrl, 'embed_code' => '');
         }
         return false;
     }
     $oXpath = new DOMXPath($oDoc);
     $oMeta = $oXpath->query("//meta[@name='description']")->item(0);
     if (method_exists($oMeta, 'getAttribute')) {
         $sMeta = $oMeta->getAttribute('content');
         if (!empty($sMeta)) {
             $aReturn['description'] = strip_tags($sMeta);
         }
     }
     $aImages = array();
     $oMeta = $oXpath->query("//meta[@property='og:image']")->item(0);
     if (method_exists($oMeta, 'getAttribute')) {
         $aReturn['default_image'] = strip_tags($oMeta->getAttribute('content'));
         $aImages[] = strip_tags($oMeta->getAttribute('content'));
     }
     $oMeta = $oXpath->query("//link[@rel='image_src']")->item(0);
     if (method_exists($oMeta, 'getAttribute')) {
         if (empty($aReturn['default_image'])) {
             $aReturn['default_image'] = strip_tags($oMeta->getAttribute('href'));
         }
         $aImages[] = strip_tags($oMeta->getAttribute('href'));
//.........这里部分代码省略.........
开发者ID:PhpFoxPro,项目名称:Better-Mobile-Module,代码行数:101,代码来源:link.class.php


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