diff --git a/ceo-config.php b/ceo-config.php index 5daa844..9ef9bf8 100644 --- a/ceo-config.php +++ b/ceo-config.php @@ -1,13 +1,35 @@

- + + + + + + + + + + + + + + + + + + + + + +
error
base_url
base_path
theme_url
theme_path
style_url
style_path
plugin_url
plugin_path
comic_url
comic_path
thumbnail_medium_url
thumbnail_medium_path
thumbnail_small_url
thumbnail_small_path
comic_folder
comic_folder_medium
comic_folder_small
medium_comic_width
small_comic_width
add_dashboard_frumph_feed_widget (1 true, 0 false)
\ No newline at end of file diff --git a/ceo-core.php b/ceo-core.php index f6f30ef..235968d 100644 --- a/ceo-core.php +++ b/ceo-core.php @@ -32,10 +32,9 @@ function ceo_add_menu_pages() { case 'comiceasel-chapter-manager': add_action('admin_print_scripts-' . $chapter_manager_hook, 'ceo_load_scripts_chapter_manager'); break; - case 'comiceasel-upload': - add_action('admin_print_scripts-' . $upload_hook, 'ceo_load_scripts_upload'); - add_action('admin_print_styles-' . $upload_hook, 'ceo_load_styles_upload'); - add_action( 'admin_head-settings_page_' . $upload_hook, 'ceo_add_help_upload' ); + case 'comiceasel-image-manager': + add_action('admin_print_scripts-' . $image_manager_hook, 'ceo_load_scripts_image_manager'); + add_action('admin_print_styles-' . $image_manager_hook, 'ceo_load_styles_image_manager'); break; } } @@ -47,18 +46,15 @@ function ceo_load_scripts_chapter_manager() { wp_enqueue_script('jquery-ui-sortable'); } -function ceo_load_scripts_upload() { +function ceo_load_scripts_image_manager() { wp_enqueue_script('comiceasel-fileuploader-script', ceo_pluginfo('plugin_url') .'/js/fileuploader.js'); } -function ceo_load_styles_upload() { +function ceo_load_styles_image_manager() { wp_enqueue_style('comiceasel-fileuploader-style', ceo_pluginfo('plugin_url') .'/css/fileuploader.css'); } -function ceo_add_help_upload() { - global $current_screen; - add_contextual_help( $current_screen, __( 'Help\'s on the way! Don\'t panic!' ) ); -} + // This is done this way to *not* load pages unless they are called, self sufficient code, but since attached to the ceo-core it can use the library in core. @@ -94,7 +90,19 @@ function ceo_add_dashboard_widgets() { wp_add_dashboard_widget('ceo_dashboard_widget', 'Frumph.NET News', 'ceo_dashboard_feed_widget'); } +// ajax stuff +// if both logged in and not logged in users can send this AJAX request, +// add both of these actions, otherwise add only the appropriate one +// add_action( 'wp_ajax_nopriv_ceo_comic_upload', 'myajax_submit' ); +add_action( 'wp_ajax_ceo_uploader', 'ceo_comic_upload' ); +function ceo_comic_upload() { + require_once('functions/uploader.php'); + $result = ceo_handleUpload(); + // to pass data through iframe you will need to encode all html tags + echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); + exit; +} ?> diff --git a/ceo-image-manager.php b/ceo-image-manager.php index 6affd4f..8fbe95e 100644 --- a/ceo-image-manager.php +++ b/ceo-image-manager.php @@ -1,3 +1,24 @@

-
\ No newline at end of file + +
+ +
+ + diff --git a/ceo-upload.php b/ceo-upload.php index 7ea4e93..bfef54e 100644 --- a/ceo-upload.php +++ b/ceo-upload.php @@ -33,9 +33,10 @@ function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-demo1'), - action: '/functions/uploader.php', + action: userSettings.ajaxurl, params: { - userid: userSettings.uid + userid: userSettings.uid, + action: 'ceo_uploader' }, onSubmit: function(id, fileName){ uploader.setParams({ diff --git a/functions/admin-meta.php b/functions/admin-meta.php index 75a35c4..923e18a 100644 --- a/functions/admin-meta.php +++ b/functions/admin-meta.php @@ -7,9 +7,8 @@ function ceo_add_new_comic_columns($comic_columns) { $new_columns['title'] = _x('Comic Title Name', 'column name'); - $new_columns['chapters'] = __('Chapters','easel'); + $new_columns['chapter'] = __('Chapter','easel'); $new_columns['characters'] = __('Characters','easel'); - $new_columns['locations'] = __('Locations','easel'); $new_columns['tags'] = __('Tags', 'easel'); $new_columns['date'] = _x('Date', 'column name'); @@ -23,9 +22,9 @@ add_action('manage_posts_custom_column', 'ceo_manage_comic_columns', 10, 2); function ceo_manage_comic_columns($column_name, $id) { global $wpdb; switch ($column_name) { - case 'chapters': + case 'chapter': $allterms = get_the_terms( $id, 'chapters'); - if (!empty($allterms) && !isset($allterms->errors)) { + if (!empty($allterms)) { foreach ($allterms as $term) { $term_list_chapters[] = ''.$term->name.''; } @@ -34,21 +33,12 @@ function ceo_manage_comic_columns($column_name, $id) { break; case 'characters': $allterms = get_the_terms( $id, 'characters'); - if (!empty($allterms) && !isset($allterms->errors)) { + if (!empty($allterms)) { foreach ($allterms as $term) { $term_list_characters[] = ''.$term->name.''; } echo join(', ', $term_list_characters ); } - break; - case 'locations': - $allterms = get_the_terms( $id, 'locations'); - if (!empty($allterms) && !isset($allterms->errors)) { - foreach ($allterms as $term) { - $term_list_locations[] = ''.$term->name.''; - } - echo join(', ', $term_list_locations ); - } break; case 'comicimages': $comicthumb = ''; diff --git a/functions/displaycomic.php b/functions/displaycomic.php index 2869d19..2a7e1c1 100644 --- a/functions/displaycomic.php +++ b/functions/displaycomic.php @@ -34,13 +34,13 @@ if (!function_exists('ceo_display_comic_navigation')) { global $post, $wp_query; if (!ceo_pluginfo('disable_default_comic_nav')) { $first_comic = ceo_get_first_comic_permalink(); - $first_text = __('‹‹ First','comiceasel'); + $first_text = __('‹‹ First','comicpress'); $last_comic = ceo_get_last_comic_permalink(); - $last_text = __('Last ››','comiceasel'); + $last_text = __('Last ››','comicpress'); $next_comic = ceo_get_next_comic_permalink(); - $next_text = __('Next ›','comiceasel'); + $next_text = __('Next ›','comicpress'); $prev_comic = ceo_get_previous_comic_permalink(); - $prev_text = __('‹ Prev','comiceasel'); + $prev_text = __('‹ Prev','comicpress'); ?> '; - $output = get_the_term_list( $post->ID, 'characters', $before, $sep, $after ); - return $output; -} - -function ceo_display_locations() { - global $post; - $before = '
Location: '; - $sep = ', '; - $after = '
'; - $output = get_the_term_list( $post->ID, 'locations', $before, $sep, $after ); - return $output; -} - -function ceo_display_comic_info() { - $output = ceo_display_characters(); - $output .= ceo_display_locations(); - echo $output; -} - -add_action('easel-post-info', 'ceo_display_comic_info'); - ?> diff --git a/functions/navigation.php b/functions/navigation.php index 050ce4b..72911b0 100644 --- a/functions/navigation.php +++ b/functions/navigation.php @@ -145,7 +145,7 @@ function ceo_get_adjacent_comic($in_same_chapter = false, $previous = true, $exc $order = $previous ? 'DESC' : 'ASC'; $join = apply_filters( "get_{$adjacent}_comic_join", $join, $in_same_chapter, $excluded_chapters ); - $where = apply_filters( "get_{$adjacent}_comic_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_chapter, $excluded_chapters ); + $where = apply_filters( "get_{$adjacent}_comic_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories ); $sort = apply_filters( "get_{$adjacent}_comic_sort", "ORDER BY p.post_date $order LIMIT 1" ); $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort"; diff --git a/functions/uploader.php b/functions/uploader.php index 82efd2c..1bdd4cb 100644 --- a/functions/uploader.php +++ b/functions/uploader.php @@ -1,9 +1,6 @@ Createthumb(ceo_pluginfo('comic_path') .'/'. $filename . '.' . $ext,'file'); } - //generate post for comic - //need to add more data for the post from the uploader form here. - $post = array( - 'post_content' => $_REQUEST['content'], //The full text of the post. - 'post_title' => $_REQUEST['title'], //The title of your post. - 'post_type' => 'comic', - 'post_author' => $_REQUEST['userid'], - 'post_status' => 'publish', - 'post_date' => $_REQUEST['date'] .' '. $_REQUEST['time'], - 'tags_input' => $_REQUEST['tags'] - ); - - $newpost = wp_insert_post( $post ); - $chapter = get_term_by('id', $_REQUEST['chapter'], 'chapters'); - wp_set_object_terms( $newpost, $chapter->slug , 'chapters', false); - add_post_meta($newpost, 'comic', $filename . '.' . $ext); return array(success=>true); } - - -$result = ceo_handleUpload(); - -// to pass data through iframe you will need to encode all html tags -echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); - diff --git a/js/fileuploader.js b/js/fileuploader.js index a16f429..1f3e897 100644 --- a/js/fileuploader.js +++ b/js/fileuploader.js @@ -4,7 +4,7 @@ * Multiple file upload component with progress-bar, drag-and-drop. * © 2010 Andrew Valums andrew(at)valums.com * - * Licensed under GNU GPL 2 or later, see license.txt. + * Licensed under GNU GPL. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . @@ -100,7 +100,7 @@ qq.FileUploader = function(o){ var self = this; this._button = new qq.UploadButton({ element: this._getElement('button'), - multiple: qq.UploadHandlerXhr.isSupported(), + //multiple: qq.UploadHandlerXhr.isSupported(), onChange: function(input){ self._onInputChange(input); } @@ -172,56 +172,86 @@ qq.FileUploader.prototype = { return false; }, _setupDragDrop: function(){ + function isValidDrag(e){ + var dt = e.dataTransfer, + // do not check dt.types.contains in webkit, because it crashes safari 4 + isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1; + + // dt.effectAllowed is none in Safari 5 + // dt.types.contains check is for firefox + return dt && dt.effectAllowed != 'none' && + (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files'))); + } + var self = this, dropArea = this._getElement('drop'); - - var dz = new qq.FileDropZone({ - element: dropArea, - onEnter: function(e){ - qq.addClass(dropArea, self._classes.dropActive); - e.stopPropagation(); - }, - onLeave: function(e){ - e.stopPropagation(); - }, - onLeaveNotDescendants: function(e){ - qq.removeClass(dropArea, self._classes.dropActive); - }, - onDrop: function(e){ - dropArea.style.display = 'none'; - qq.removeClass(dropArea, self._classes.dropActive); - self._uploadFileList(e.dataTransfer.files); - } - }); - + dropArea.style.display = 'none'; + + var hideTimeout; + qq.attach(document, 'dragenter', function(e){ + e.preventDefault(); + }); - qq.attach(document, 'dragenter', function(e){ - if (!dz._isValidFileDrag(e)) return; - - dropArea.style.display = 'block'; + qq.attach(document, 'dragover', function(e){ + if (isValidDrag(e)){ + + if (hideTimeout){ + clearTimeout(hideTimeout); + } + + if (dropArea == e.target || qq.contains(dropArea,e.target)){ + var effect = e.dataTransfer.effectAllowed; + if (effect == 'move' || effect == 'linkMove'){ + e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed) + } else { + e.dataTransfer.dropEffect = 'copy'; // for Chrome + } + qq.addClass(dropArea, self._classes.dropActive); + e.stopPropagation(); + } else { + dropArea.style.display = 'block'; + e.dataTransfer.dropEffect = 'none'; + } + + e.preventDefault(); + } }); - qq.attach(document, 'dragleave', function(e){ - if (!dz._isValidFileDrag(e)) return; - - var relatedTarget = document.elementFromPoint(e.clientX, e.clientY); - - // only fire when leaving document out - if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){ - dropArea.style.display = 'none'; - } - }); + qq.attach(document, 'dragleave', function(e){ + if (isValidDrag(e)){ + + if (dropArea == e.target || qq.contains(dropArea,e.target)){ + qq.removeClass(dropArea, self._classes.dropActive); + e.stopPropagation(); + } else { + + if (hideTimeout){ + clearTimeout(hideTimeout); + } + + hideTimeout = setTimeout(function(){ + dropArea.style.display = 'none'; + }, 77); + } + } + }); + + qq.attach(dropArea, 'drop', function(e){ + dropArea.style.display = 'none'; + self._uploadFileList(e.dataTransfer.files); + e.preventDefault(); + }); }, _createUploadHandler: function(){ var self = this, handlerClass; - if(qq.UploadHandlerXhr.isSupported()){ - handlerClass = 'UploadHandlerXhr'; - } else { + //if(qq.UploadHandlerXhr.isSupported()){ + // handlerClass = 'UploadHandlerXhr'; + //} else { handlerClass = 'UploadHandlerForm'; - } + //} var handler = new qq[handlerClass]({ action: this._options.action, @@ -255,17 +285,17 @@ qq.FileUploader.prototype = { }, _onInputChange: function(input){ - if (this._handler instanceof qq.UploadHandlerXhr){ - - this._uploadFileList(input.files); - - } else { + //if (this._handler instanceof qq.UploadHandlerXhr){ + // + // this._uploadFileList(input.files); + // + //} else { if (this._validateFile(input)){ this._uploadFile(input); } - } + //} this._button.reset(); }, @@ -288,7 +318,8 @@ qq.FileUploader.prototype = { _uploadFile: function(fileContainer){ var id = this._handler.add(fileContainer); var name = this._handler.getName(id); - this._options.onSubmit(id, name); + if (false == this._options.onSubmit(id, name)) + return false; this._addToList(id, name); this._handler.upload(id, this._options.params); }, @@ -391,91 +422,6 @@ qq.FileUploader.prototype = { } }; -qq.FileDropZone = function(o){ - this._options = { - element: null, - onEnter: function(e){}, - onLeave: function(e){}, - // is not fired when leaving element by hovering descendants - onLeaveNotDescendants: function(e){}, - onDrop: function(e){} - }; - qq.extend(this._options, o); - - this._element = this._options.element; - - this._disableDropOutside(); - this._attachEvents(); -}; - -qq.FileDropZone.prototype = { - _disableDropOutside: function(e){ - // run only once for all instances - if (!qq.FileDropZone.dropOutsideDisabled ){ - - qq.attach(document, 'dragover', function(e){ - e.dataTransfer.dropEffect = 'none'; - e.preventDefault(); - }); - - qq.FileDropZone.dropOutsideDisabled = true; - } - }, - _attachEvents: function(){ - var self = this; - - qq.attach(self._element, 'dragover', function(e){ - if (!self._isValidFileDrag(e)) return; - - var effect = e.dataTransfer.effectAllowed; - if (effect == 'move' || effect == 'linkMove'){ - e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed) - } else { - e.dataTransfer.dropEffect = 'copy'; // for Chrome - } - - e.stopPropagation(); - e.preventDefault(); - }); - - qq.attach(self._element, 'dragenter', function(e){ - if (!self._isValidFileDrag(e)) return; - - self._options.onEnter(e); - }); - - qq.attach(self._element, 'dragleave', function(e){ - if (!self._isValidFileDrag(e)) return; - - self._options.onLeave(e); - - var relatedTarget = document.elementFromPoint(e.clientX, e.clientY); - // do not fire when moving a mouse over a descendant - if (qq.contains(this, relatedTarget)) return; - - self._options.onLeaveNotDescendants(e); - }); - - qq.attach(self._element, 'drop', function(e){ - if (!self._isValidFileDrag(e)) return; - - e.preventDefault(); - self._options.onDrop(e); - }); - }, - _isValidFileDrag: function(e){ - var dt = e.dataTransfer, - // do not check dt.types.contains in webkit, because it crashes safari 4 - isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1; - - // dt.effectAllowed is none in Safari 5 - // dt.types.contains check is for firefox - return dt && dt.effectAllowed != 'none' && - (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files'))); - - } -}; - qq.UploadButton = function(o){ this._options = { element: null, @@ -535,11 +481,8 @@ qq.UploadButton.prototype = { // the right side of the input right: 0, top: 0, - fontFamily: 'Arial', - // when button is big it becomes visible in IE8 on SOME PCs - // probably related to http://social.msdn.microsoft.com/forums/en-US/iewebdevelopment/thread/29d0b0e7-4326-4b3e-823c-51420d4cf253 - // three persons reported this, the max values that worked for them were 243, 236, 236 - fontSize: '222px', + zIndex: 1, + fontSize: '460px', margin: 0, padding: 0, cursor: 'pointer', @@ -732,7 +675,10 @@ qq.UploadHandlerForm.prototype = { // Because in this case file won't be attached to request var form = qq.toElement('
'); - var queryString = '?' + qq.obj2url(params); + var queryString = '?'; + for (var key in params){ + queryString += '&' + key + '=' + encodeURIComponent(params[key]); + } form.setAttribute('action', this._options.action + queryString); form.setAttribute('target', iframe.name); @@ -746,119 +692,115 @@ qq.UploadHandlerForm.prototype = { /** * Class for uploading files using xhr */ -qq.UploadHandlerXhr = function(o){ - this._options = { - // url of the server-side upload script, +//qq.UploadHandlerXhr = function(o){ +// this._options = { +// // url of the server-side upload script, // should be on the same domain - action: '/upload', - onProgress: function(id, fileName, loaded, total){}, - onComplete: function(id, fileName, response){} - }; - qq.extend(this._options, o); + // action: '/upload', +// onProgress: function(id, fileName, loaded, total){}, +// onComplete: function(id, fileName, response){} +// }; +// qq.extend(this._options, o); - this._files = []; - this._xhrs = []; -}; +// this._files = []; +// this._xhrs = []; +//}; // static method -qq.UploadHandlerXhr.isSupported = function(){ - var input = document.createElement('input'); - input.type = 'file'; - - return ( - 'multiple' in input && - typeof File != "undefined" && - typeof (new XMLHttpRequest()).upload != "undefined" ); -}; +//qq.UploadHandlerXhr.isSupported = function(){ +// return typeof File != "undefined" && +// typeof (new XMLHttpRequest()).upload != "undefined"; +//}; -qq.UploadHandlerXhr.prototype = { +//qq.UploadHandlerXhr.prototype = { /** * Adds file to the queue * Returns id to use with upload, cancel **/ - add: function(file){ - return this._files.push(file) - 1; - }, +// add: function(file){ +// return this._files.push(file) - 1; +// }, /** * Sends the file identified by id and additional query params to the server * @param {Object} params name-value string pairs */ - upload: function(id, params){ - var file = this._files[id], - name = this.getName(id), - size = this.getSize(id); - - if (!file){ - throw new Error('file with passed id was not added, or already uploaded or cancelled'); - } - - var xhr = this._xhrs[id] = new XMLHttpRequest(); - var self = this; - - xhr.upload.onprogress = function(e){ - if (e.lengthComputable){ - self._options.onProgress(id, name, e.loaded, e.total); - } - }; +// upload: function(id, params){ +// var file = this._files[id], +// name = this.getName(id), +// size = this.getSize(id); +// +// if (!file){ +// throw new Error('file with passed id was not added, or already uploaded or cancelled'); +// } +// +// var xhr = this._xhrs[id] = new XMLHttpRequest(); +// var self = this; +// +// xhr.upload.onprogress = function(e){ +// if (e.lengthComputable){ +// self._options.onProgress(id, name, e.loaded, e.total); +// } +// }; - xhr.onreadystatechange = function(){ +// xhr.onreadystatechange = function(){ // the request was aborted/cancelled - if (!self._files[id]){ - return; - } - - if (xhr.readyState == 4){ +// if (!self._files[id]){ +// return; +// } + +// if (xhr.readyState == 4){ - self._options.onProgress(id, name, size, size); +// self._options.onProgress(id, name, size, size); - if (xhr.status == 200){ - var response; - - try { - response = eval("(" + xhr.responseText + ")"); - } catch(err){ - response = {}; - } - - self._options.onComplete(id, name, response); - - } else { - self._options.onComplete(id, name, {}); - } - - self._files[id] = null; - self._xhrs[id] = null; - } - }; +// if (xhr.status == 200){ +// var response; +// +// try { +// response = eval("(" + xhr.responseText + ")"); +// } catch(err){ +// response = {}; +// } +// +// self._options.onComplete(id, name, response); +// +// } else { +// self._options.onComplete(id, name, {}); +// } +// +// self._files[id] = null; +// self._xhrs[id] = null; +// } +// }; // build query string - var queryString = '?qqfile=' + encodeURIComponent(name) + '&' + qq.obj2url(params); - - xhr.open("POST", this._options.action + queryString, true); - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); - xhr.send(file); - - }, - cancel: function(id){ - this._files[id] = null; - - if (this._xhrs[id]){ - this._xhrs[id].abort(); - this._xhrs[id] = null; - } - }, - getName: function(id){ +// var queryString = '?qqfile=' + encodeURIComponent(name); +// for (var key in params){ +// queryString += '&' + key + '=' + encodeURIComponent(params[key]); + // } +// +// xhr.open("GET", this._options.action + queryString, true); +// xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); +// xhr.send(file); +// }, +// cancel: function(id){ +// this._files[id] = null; +// +// if (this._xhrs[id]){ +// this._xhrs[id].abort(); +// this._xhrs[id] = null; +// } +// }, +// getName: function(id){ // fix missing name in Safari 4 - var file = this._files[id]; - return file.fileName != null ? file.fileName : file.name; - }, - getSize: function(id){ +// var file = this._files[id]; +// return file.fileName != null ? file.fileName : file.name; +// }, +// getSize: function(id){ // fix missing size in Safari 4 - var file = this._files[id]; - return file.fileSize != null ? file.fileSize : file.size; - } -}; + // var file = this._files[id]; + // return file.fileSize != null ? file.fileSize : file.size; + // } +//}; // // Helper functions @@ -926,10 +868,7 @@ qq.remove = function(element){ element.parentNode.removeChild(element); }; -qq.contains = function(parent, descendant){ - // compareposition returns false in this case - if (parent == descendant) return true; - +qq.contains = function(parent, descendant){ if (parent.contains){ return parent.contains(descendant); } else { @@ -1017,50 +956,3 @@ qq.getByClass = function(element, className){ } return result; }; - -/** - * obj2url() takes a json-object as argument and generates - * a querystring. pretty much like jQuery.param() - * - * @param Object JSON-Object - * @param String current querystring-part - * @return String encoded querystring - */ -qq.obj2url = function(obj, temp){ - var uristrings = [], - add = function(nextObj, i){ - - var nextTemp = temp - ? (/\[\]$/.test(temp)) // prevent double-encoding - ? temp - : temp+'['+i+']' - : i; - - uristrings.push(typeof nextObj === 'object' - ? qq.obj2url(nextObj, nextTemp) - : (Object.prototype.toString.call(nextObj) === '[object Function]') - ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj()) - : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)); - }; - - if (Object.prototype.toString.call(obj) === '[object Array]'){ - // we wont use a for-in-loop on an array (performance) - for (var i = 0, len = obj.length; i < len; ++i){ - add(obj[i], i); - } - - } else if ((obj !== undefined) && - (obj !== null) && - (typeof obj === "object")){ - - // for anything else but a scalar, we will use for-in-loop - for (var i in obj){ - add(obj[i], i); - } - } else { - uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj)); - } - - return uristrings.join('&').replace(/%20/g, '+'); -}; -