コード例 #1
0
 /**
  * Imports the specified file, encodes it as a base64 encoded string and stores it in $stringData
  * @param string The file path
  */
 function fromFile($fileName)
 {
     //input file name
     require_once DOM_XMLRPC_INCLUDE_PATH . 'php_file_utilities.php';
     $binaryData =& php_file_utilities::getDataFromFile($fileName, 'rb');
     $this->stringData = $this->encode($binaryData);
 }
コード例 #2
0
 /**
  * Unserializes a cached DOMIT! document
  * @param string The name of the xml file to be retrieved
  * @return Object The retrieved document
  */
 function &fromCache($xmlFileName)
 {
     require_once DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php';
     require_once DOMIT_INCLUDE_PATH . 'php_file_utilities.php';
     $name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE;
     $fileContents =& php_file_utilities::getDataFromFile($name, 'r');
     $newxmldoc =& unserialize($fileContents);
     return $newxmldoc;
 }
コード例 #3
0
ファイル: php_text_cache.php プロジェクト: klr2003/sourceread
 /**
  * Get text from an url or file
  * @param string The url or file path
  * @return string The text contained in the url or file, or an empty string
  */
 function fromFile($filename)
 {
     if (function_exists('file_get_contents')) {
         return @file_get_contents($filename);
     } else {
         require_once PHP_TEXT_CACHE_INCLUDE_PATH . 'php_file_utilities.php';
         $fileContents = php_file_utilities::getDataFromFile($filename, 'r');
         return $fileContents;
     }
     return '';
 }
コード例 #4
0
 /**
  * Retrieves text from a file
  * @param string The file path
  * @return string The text contained in the file
  */
 function getTextFromFile($filename)
 {
     if ($this->httpConnection != null) {
         $response =& $this->httpConnection->get($filename);
         $this->httpConnection->disconnect();
         return $response->getResponse();
     } else {
         if (function_exists('file_get_contents')) {
             //if (file_exists($filename)) {
             return file_get_contents($filename);
             //}
         } else {
             require_once DOMIT_INCLUDE_PATH . 'php_file_utilities.php';
             $fileContents =& php_file_utilities::getDataFromFile($filename, 'r');
             return $fileContents;
         }
     }
     return '';
 }
コード例 #5
0
 /**
  * Get text from an url or file
  * @param string The url or file path
  * @return string The text contained in the url or file, or an empty string
  */
 function getTextFromFile($filename)
 {
     $fileContents = '';
     if ($this->doUseHTTPClient) {
         $this->establishConnection($filename);
         $response =& $this->httpConnection->get($filename);
         if ($response != null) {
             $fileContents = $response->getResponse();
         }
     } else {
         if (function_exists('file_get_contents')) {
             $fileContents = @file_get_contents($filename);
         } else {
             require_once DOMIT_RSS_INCLUDE_PATH . 'php_file_utilities.php';
             $fileContents =& php_file_utilities::getDataFromFile($filename, 'r');
         }
         if ($fileContents == '') {
             $this->establishConnection($filename);
             $response =& $this->httpConnection->get($filename);
             if ($response != null) {
                 $fileContents = $response->getResponse();
             }
         }
     }
     return $fileContents;
 }