Permalink
Browse files

updated messaging system; iframe upload

git-svn-id: svn://mislav.caboo.se/public/uploader@232 b38871a6-e216-0410-912a-b3827fb9e1fb
  • Loading branch information...
mislav committed Jul 24, 2007
1 parent 65dde2b commit 77972d5089359c82ccaa51cb71477e36461f512d
Showing with 1,078 additions and 12 deletions.
  1. +91 −0 Zend/Json.php
  2. +454 −0 Zend/Json/Decoder.php
  3. +413 −0 Zend/Json/Encoder.php
  4. +36 −0 Zend/Json/Exception.php
  5. +1 −0 Zend/Json/TODO.txt
  6. +39 −0 application.js
  7. +15 −2 image.php
  8. +2 −4 index.php
  9. +4 −1 style.css
  10. +23 −5 upload.php
View
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Json
+ * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+
+/**
+ * Class for encoding to and decoding from JSON.
+ *
+ * @category Zend
+ * @package Zend_Json
+ * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class Zend_Json
+{
+ /**
+ * How objects should be encoded -- arrays or as StdClass. TYPE_ARRAY is 1
+ * so that it is a boolean true value, allowing it to be used with
+ * ext/json's functions.
+ */
+ const TYPE_ARRAY = 1;
+ const TYPE_OBJECT = 0;
+
+ /**
+ * @var bool
+ */
+ public static $useBuiltinEncoderDecoder = false;
+
+ /**
+ * Decodes the given $encodedValue string which is
+ * encoded in the JSON format
+ *
+ * Uses ext/json's json_decode if available.
+ *
+ * @param string $encodedValue Encoded in JSON format
+ * @param int $objectDecodeType Optional; flag indicating how to decode
+ * objects. See {@link ZJsonDecoder::decode()} for details.
+ * @return mixed
+ */
+ public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY)
+ {
+ if (function_exists('json_decode') && self::$useBuiltinEncoderDecoder !== true) {
+ return json_decode($encodedValue, $objectDecodeType);
+ }
+
+ require_once 'Zend/Json/Decoder.php';
+ return Zend_Json_Decoder::decode($encodedValue, $objectDecodeType);
+ }
+
+
+ /**
+ * Encode the mixed $valueToEncode into the JSON format
+ *
+ * Encodes using ext/json's json_encode() if available.
+ *
+ * NOTE: Object should not contain cycles; the JSON format
+ * does not allow object reference.
+ *
+ * NOTE: Only public variables will be encoded
+ *
+ * @param mixed $valueToEncode
+ * @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
+ * @return string JSON encoded object
+ */
+ public static function encode($valueToEncode, $cycleCheck = false)
+ {
+ if (function_exists('json_encode') && self::$useBuiltinEncoderDecoder !== true) {
+ return json_encode($valueToEncode);
+ }
+
+ require_once 'Zend/Json/Encoder.php';
+ return Zend_Json_Encoder::encode($valueToEncode, $cycleCheck);
+ }
+}
+
Oops, something went wrong.

0 comments on commit 77972d5

Please sign in to comment.