コード例 #1
0
ファイル: outputdata.php プロジェクト: netcon-source/apps
 /**
  * @brief Function for writing output
  *
  * Srray will be encoded to json format and written,
  * other type of arguments will be simple written to browser,
  *
  * @param any $output
  */
 public static function write($output)
 {
     // write simple output
     if (gettype($output) != 'array') {
         self::writeOutput($output);
     } else {
         if (OutputData::getOutputFormat() == self::NewLineFormat) {
             self::writeNewLineFormat($output);
         } else {
             self::writeLengthFormat($output);
         }
     }
 }
コード例 #2
0
ファイル: outputdata.php プロジェクト: mach-o/mozilla_sync
 /**
  * @brief Function for writing output.
  *
  * Arrays will be encoded to JSON or other formats depending on the
  * Content-Type header sent by the client.
  *
  * @param any $output The output sent back to the client.
  * @param number $modifiedTime Modified time which will be sent back to the
  * client as a HTTP header. By default the current time is sent.
  */
 public static function write($output, $modifiedTime = null)
 {
     // If no modified time is set get a timestamp now, then send the header
     Utils::sendMozillaTimestampHeader($modifiedTime);
     // Write simple output
     if (gettype($output) != 'array') {
         self::writeOutput($output);
     } else {
         switch (OutputData::getOutputFormat()) {
             case self::NewlinesFormat:
                 self::writeNewlinesFormat($output);
                 break;
             case self::LengthFormat:
                 self::writeLengthFormat($output);
                 break;
             case self::JsonFormat:
                 self::writeJsonFormat($output);
                 break;
         }
     }
 }