├── lib ├── jquery-qunit │ ├── .gitignore │ ├── addons │ │ ├── themes │ │ │ ├── README.md │ │ │ ├── nv.html │ │ │ ├── gabe.html │ │ │ ├── nv.css │ │ │ └── gabe.css │ │ ├── composite │ │ │ ├── qunit-composite.css │ │ │ ├── README.md │ │ │ ├── composite-demo-test.html │ │ │ ├── index.html │ │ │ └── qunit-composite.js │ │ ├── canvas │ │ │ ├── qunit-canvas.js │ │ │ ├── README.md │ │ │ ├── canvas.html │ │ │ └── canvas-test.js │ │ ├── step │ │ │ ├── step-test.js │ │ │ ├── step.html │ │ │ ├── README.md │ │ │ └── qunit-step.js │ │ ├── phantomjs │ │ │ ├── README.md │ │ │ └── runner.js │ │ ├── close-enough │ │ │ ├── close-enough.html │ │ │ ├── README.md │ │ │ ├── close-enough-test.js │ │ │ └── qunit-close-enough.js │ │ └── junitlogger │ │ │ ├── index.html │ │ │ └── junitlogger.js │ ├── test │ │ ├── swarminject.js │ │ ├── logs.html │ │ ├── index.html │ │ ├── node-test.js │ │ ├── narwhal-test.js │ │ ├── headless.html │ │ ├── logs.js │ │ └── test.js │ ├── package.json │ ├── grunt.js │ ├── README.md │ └── qunit │ │ └── qunit.css └── mimic_2.2 │ ├── doc │ └── User Guide.pdf │ ├── test │ ├── suite.html │ ├── qunit │ │ └── qunit.css │ └── mimic-test.js │ ├── deploy │ └── mimic.js │ └── source │ └── mimic.js ├── tests ├── wordpress-test.html └── wordpress-test-1.js ├── README.zh_CN.md ├── README.md ├── incubation ├── blogger.js ├── pingback.js ├── utils.js ├── options.js ├── movabletype.js ├── metaweblog.js └── wordpress1.js ├── wordpress.obfuscate.js ├── wordpress.min.js └── wordpress.js /lib/jquery-qunit/.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | *~ 3 | *.diff 4 | *.patch 5 | .DS_Store 6 | .settings 7 | node_modules 8 | -------------------------------------------------------------------------------- /lib/mimic_2.2/doc/User Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developerworks/wordpress-xmlrpc-javascript-api/HEAD/lib/mimic_2.2/doc/User Guide.pdf -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/themes/README.md: -------------------------------------------------------------------------------- 1 | Themes 2 | ====== 3 | 4 | These custom themes fully replace the default qunit.css file and should work 5 | with the default markup. To see them in action, open the html file for each. 6 | They'll run the QUnit testsuite itself. -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/composite/qunit-composite.css: -------------------------------------------------------------------------------- 1 | iframe.qunit-subsuite{ 2 | position: fixed; 3 | bottom: 0; 4 | left: 0; 5 | 6 | margin: 0; 7 | padding: 0; 8 | border-width: 1px 0 0; 9 | height: 45%; 10 | width: 100%; 11 | 12 | background: #fff; 13 | } -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/canvas/qunit-canvas.js: -------------------------------------------------------------------------------- 1 | QUnit.extend( QUnit, { 2 | pixelEqual: function(canvas, x, y, r, g, b, a, message) { 3 | var actual = Array.prototype.slice.apply(canvas.getContext('2d').getImageData(x, y, 1, 1).data), expected = [r, g, b, a]; 4 | QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /lib/jquery-qunit/test/swarminject.js: -------------------------------------------------------------------------------- 1 | // load testswarm agent 2 | (function() { 3 | var url = window.location.search; 4 | url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); 5 | if ( !url || url.indexOf("http") !== 0 ) { 6 | return; 7 | } 8 | document.write(""); 9 | })(); 10 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/step/step-test.js: -------------------------------------------------------------------------------- 1 | module('Step Addon'); 2 | test("step", 3, function () { 3 | QUnit.step(1, "step starts at 1"); 4 | setTimeout(function () { 5 | start(); 6 | QUnit.step(3); 7 | }, 100); 8 | QUnit.step(2, "before the setTimeout callback is run"); 9 | stop(); 10 | }); 11 | test("step counter", 1, function () { 12 | QUnit.step(1, "each test has its own step counter"); 13 | }); -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/phantomjs/README.md: -------------------------------------------------------------------------------- 1 | PhantomJS Runner 2 | ================ 3 | 4 | A runner for PhantomJS, providing console output for tests. 5 | 6 | Usage: 7 | 8 | phantomjs runner.js url 9 | 10 | Example: 11 | 12 | phantomjs runner.js http://localhost/qunit/test 13 | 14 | If you're using Grunt, you should take a look at its [qunit task](https://github.com/cowboy/grunt/blob/master/docs/task_qunit.md). -------------------------------------------------------------------------------- /lib/jquery-qunit/test/logs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QUnit Test Suite 5 | 6 | 7 | 8 | 9 | 10 |
11 |
test markup
12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/mimic_2.2/test/suite.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mimic Tests 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/jquery-qunit/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit Test Suite 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
test markup
15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/step/step.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit Test Suite - Step Addon 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/themes/nv.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QUnit Test Suite - NV Theme 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
test markup
13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/themes/gabe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QUnit Test Suite - Gabe Theme 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
test markup
13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/close-enough/close-enough.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit Test Suite - Close Enough Addon 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/step/README.md: -------------------------------------------------------------------------------- 1 | QUnit.step() - A QUnit Addon For Testing execution in order 2 | ============================================================ 3 | 4 | This addon for QUnit adds a step method that allows you to assert 5 | the proper sequence in which the code should execute. 6 | 7 | Example: 8 | 9 | test("example test", function () { 10 | function x() { 11 | QUnit.step(2, "function y should be called first"); 12 | } 13 | function y() { 14 | QUnit.step(1); 15 | } 16 | y(); 17 | x(); 18 | }); -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/canvas/README.md: -------------------------------------------------------------------------------- 1 | Canvas - A QUnit Addon For Testing Canvas Rendering 2 | ================================ 3 | 4 | This addon for QUnit adds a pixelEqual method that allows you to assert 5 | individual pixel values in a given canvas. 6 | 7 | Usage: 8 | 9 | pixelEqual(canvas, x, y, r, g, b, a, message) 10 | 11 | Where: 12 | 13 | * canvas: Reference to a canvas element 14 | * x, y: Coordinates of the pixel to test 15 | * r, g, b, a: The color and opacity value of the pixel that you except 16 | * message: Optional message, same as for other assertions 17 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/composite/README.md: -------------------------------------------------------------------------------- 1 | Composite - A QUnit Addon For Running Multiple Test Files 2 | ================================ 3 | 4 | Composite is a QUnit addon that, when handed an array of files, will 5 | open each of those files inside of an iframe, run the tests and 6 | display the results as a single suite of QUnit tests. 7 | 8 | The Rerun link next to each suite allows you to quickly rerun that suite, 9 | outside the composite runner. 10 | 11 | If you want to see what assertion failed in a long list of assertions, 12 | just use the regular "Hide passed tests" checkbox. -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/canvas/canvas.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit Test Suite - Canvas Addon 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/wordpress-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WordPress XmlRpc Javascript Api Unit Tests 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /lib/jquery-qunit/test/node-test.js: -------------------------------------------------------------------------------- 1 | // run with 2 | // node test/node-test.js 3 | var QUnit = require("../qunit/qunit"); 4 | QUnit.log(function(details) { 5 | if (!details.result) { 6 | var output = "FAILED: " + (details.message ? details.message + ", " : ""); 7 | if (details.actual) { 8 | output += "expected: " + details.expected + ", actual: " + details.actual; 9 | } 10 | if (details.source) { 11 | output += ", " + details.source; 12 | } 13 | console.log(output); 14 | } 15 | }); 16 | QUnit.test("yo", function() { 17 | QUnit.equal(true, false); 18 | QUnit.equal(true, false, "gotta fail"); 19 | x.y.z; 20 | }); -------------------------------------------------------------------------------- /lib/jquery-qunit/test/narwhal-test.js: -------------------------------------------------------------------------------- 1 | // run with 2 | // node test/node-test.js 3 | var QUnit = require("../qunit/qunit"); 4 | QUnit.log(function(details) { 5 | if (!details.result) { 6 | var output = "FAILED: " + (details.message ? details.message + ", " : ""); 7 | if (details.actual) { 8 | output += "expected: " + details.expected + ", actual: " + details.actual; 9 | } 10 | if (details.source) { 11 | output += ", " + details.source; 12 | } 13 | print(output); 14 | } else { 15 | print("ok!"); 16 | } 17 | }); 18 | QUnit.test("yo", function() { 19 | QUnit.equal(true, false); 20 | QUnit.equal(true, false, "gotta fail"); 21 | x.y.z; 22 | }); -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/close-enough/README.md: -------------------------------------------------------------------------------- 1 | Close-Enough - A QUnit Addon For Number Approximations 2 | ================================ 3 | 4 | This addon for QUnit adds close and notClose assertion methods, to test that 5 | numbers are close enough (or different enough) from an expected number, with 6 | a specified accuracy. 7 | 8 | Usage: 9 | 10 | close(actual, expected, maxDifference, message) 11 | notClose(actual, expected, minDifference, message) 12 | 13 | Where: 14 | 15 | * maxDifference: the maximum inclusive difference allowed between the actual and expected numbers 16 | * minDifference: the minimum exclusive difference allowed between the actual and expected numbers 17 | * actual, expected, message: The usual 18 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/composite/composite-demo-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit SubsuiteRunner Test Suite 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 | WordPress XmlRpc Javascript Api 2 | ===================== 3 | 4 | WordPress XmlRpc Javascript Api 是一个基于[mimic](http://mimic-xmlrpc.sourceforge.net/) xmlrpc 库的Wordpress XmlRpc 客户端库. 5 | 它实现了所有在 [XML-RPC_WordPress_API](http://codex.wordpress.org/XML-RPC_WordPress_API) 所描述的所有接口. 6 | 7 | 实例: 8 | ====== 9 | var connection = { 10 | url : "your xmlprc url such as http://www.exmaple.com/xmlrpc.php", 11 | username : "you login name", 12 | password : "you password" 13 | }; 14 | var wp = new WordPress(connection.url, connection.username, connection.password); 15 | var blogId = 1; 16 | var postId = 1; 17 | var object = wp.getPost(blogId, postId); 18 | // 运行 console.log(object); 输出此对象的属性 19 | 20 | 其他API接口的详细信息,亲,请你参考tests/wordpress-test.js这个单元测试脚本 -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/step/qunit-step.js: -------------------------------------------------------------------------------- 1 | QUnit.extend( QUnit, { 2 | 3 | /** 4 | * Check the sequence/order 5 | * 6 | * @example step(1); setTimeout(function () { step(3); }, 100); step(2); 7 | * @param Number expected The excepted step within the test() 8 | * @param String message (optional) 9 | */ 10 | step: function (expected, message) { 11 | this.config.current.step++; // increment internal step counter. 12 | if (typeof message === "undefined") { 13 | message = "step " + expected; 14 | } 15 | var actual = this.config.current.step; 16 | QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); 17 | } 18 | }); 19 | 20 | /** 21 | * Reset the step counter for every test() 22 | */ 23 | QUnit.testStart(function () { 24 | this.config.current.step = 0; 25 | }); 26 | -------------------------------------------------------------------------------- /lib/jquery-qunit/test/headless.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QUnit Test Suite 5 | 6 | 7 | 8 | 9 | 20 | 21 | 22 |
test markup
23 | 24 | 25 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/close-enough/close-enough-test.js: -------------------------------------------------------------------------------- 1 | test("Close Numbers", function () { 2 | var halfPi = Math.PI / 2, 3 | sqrt2 = Math.sqrt(2); 4 | 5 | QUnit.close(7, 7, 0); 6 | QUnit.close(7, 7.1, 0.1); 7 | QUnit.close(7, 7.1, 0.2); 8 | 9 | QUnit.close(3.141, Math.PI, 0.001); 10 | QUnit.close(3.1, Math.PI, 0.1); 11 | 12 | QUnit.close(halfPi, 1.57, 0.001); 13 | 14 | QUnit.close(sqrt2, 1.4142, 0.0001); 15 | 16 | QUnit.close(Infinity, Infinity, 1); 17 | }); 18 | 19 | test("Distant Numbers", function () { 20 | var halfPi = Math.PI / 2, 21 | sqrt2 = Math.sqrt(2); 22 | 23 | QUnit.notClose(6, 7, 0); 24 | QUnit.notClose(7, 7.2, 0.1); 25 | QUnit.notClose(7, 7.2, 0.19999999999); 26 | 27 | QUnit.notClose(3.141, Math.PI, 0.0001); 28 | QUnit.notClose(3.1, Math.PI, 0.001); 29 | 30 | QUnit.notClose(halfPi, 1.57, 0.0001); 31 | 32 | QUnit.notClose(sqrt2, 1.4142, 0.00001); 33 | 34 | QUnit.notClose(Infinity, -Infinity, 5); 35 | }); -------------------------------------------------------------------------------- /lib/jquery-qunit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qunitjs", 3 | "title": "QUnit", 4 | "description": "An easy-to-use JavaScript Unit Testing framework.", 5 | "version": "1.9.0pre", 6 | "author": "The jQuery Project", 7 | "contributors": [ 8 | "John Resig (http://ejohn.org/)", 9 | "Jörn Zaefferer (http://bassistance.de/)" 10 | ], 11 | "homepage": "http://docs.jquery.com/QUnit", 12 | "repository": { 13 | "type": "git", 14 | "url": "git://github.com/jquery/qunit.git" 15 | }, 16 | "bugs": { 17 | "url": "https://github.com/jquery/qunit/issues" 18 | }, 19 | "license": { 20 | "name": "MIT", 21 | "url": "http://www.opensource.org/licenses/mit-license.php" 22 | }, 23 | "keywords": [ 24 | "testing", 25 | "unit", 26 | "jquery" 27 | ], 28 | "main": "qunit/qunit.js", 29 | "devDependencies": { 30 | "grunt": "0.3.x", 31 | "testswarm": "0.2.2" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WordPress XmlRpc Javascript Api 2 | ===================== 3 | 4 | Node: This lib was not developed 5 | Please use https://github.com/armand1m/wordpress-api 6 | 7 | WordPress XmlRpc Javascript Api is a wordpress api javascript client based on [mimic](http://mimic-xmlrpc.sourceforge.net/) xmlrpc client. 8 | It implement all interfaces descripted at [XML-RPC_WordPress_API](http://codex.wordpress.org/XML-RPC_WordPress_API). 9 | 10 | Examples: 11 | ====== 12 | var connection = { 13 | url : "your xmlprc url such as http://www.exmaple.com/xmlrpc.php", 14 | username : "you login name", 15 | password : "you password" 16 | }; 17 | var wp = new WordPress(connection.url, connection.username, connection.password); 18 | var blogId = 1; 19 | var postId = 1; 20 | var object = wp.getPost(blogId, postId); 21 | // run console.log(object); to output the attributes of the object 22 | 23 | About others api usage details, you can see tests/wordpress-test.js 24 | -------------------------------------------------------------------------------- /incubation/blogger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress supports the Blogger XML-RPC API methods, augmented with additional WordPress-specific functionality (denoted by †) . 3 | * This support was added in WordPress 1.5.0.The original Blogger API spec lived at http://plant.blogger.com/api, but is no longer available. 4 | * 5 | * http://codex.wordpress.org/XML-RPC_Blogger_API 6 | */ 7 | 8 | /** 9 | * 10 | * 11 | * @param string 12 | * url The wordpress xmlrpc endpoint 13 | * @param string 14 | * username Login username 15 | * @param string 16 | * password Login password 17 | */ 18 | function Blogger(url, username, password) { 19 | this.url = url; 20 | this.username = username; 21 | this.password = password; 22 | this.request = new XmlRpcRequest(this.url); 23 | }; 24 | 25 | Blogger.prototype.getUsersBlogs = function() { 26 | this.request.methodName = "blogger.getUsersBlogs"; 27 | 28 | this.request.addParam(""); 29 | this.request.addParam(this.username); 30 | this.request.addParam(this.password); 31 | 32 | var resp = this.request.send(); 33 | this.request.clearParams(); 34 | return resp.parseXML(); 35 | }; 36 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/composite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Composite 6 | 7 | 8 |

Composite

9 |

A QUnit Addon For Running Multiple Test Files

10 |

Composite is a QUnit addon that, when handed an array of 11 | files, will open each of those files inside of an iframe, run 12 | the tests and display the results as a single suite of QUnit 13 | tests.

14 |

Using Composite

15 |

To use Composite, setup a standard QUnit html page as you 16 | would with other QUnit tests. Remember to include composite.js 17 | and composite.css. Then, inside of either an external js file, 18 | or a script block call the only new method that Composite 19 | exposes, QUnit.testSuites().

QUnit.testSuites() is 20 | passed an array of test files to run as follows:

21 |
22 | QUnit.testSuites([
23 |     "test-file-1.html",
24 |     "test-file-2.html",
25 |     "test-file-3.html"
26 | ]);
27 | 		
28 |

Tests

29 |

30 | Composite Demo: A suite which demoes how Composite is bootstrapped and run. 31 |

32 | 33 | 34 | -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/junitlogger/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | QUnit Test Suite - JUnit report 6 | 7 | 8 | 9 | 40 | 41 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /incubation/pingback.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Pingback constructor 3 | * 4 | * @param string 5 | * url 6 | * @param string 7 | * username 8 | * @param string 9 | * password 10 | * @returns {Pingback} 11 | */ 12 | 13 | function Pingback(url, username, password) { 14 | 15 | this.url = url; 16 | this.username = username; 17 | this.password = password; 18 | 19 | this.request = XmlRpcRequest(this.url); 20 | }; 21 | 22 | /** 23 | * @param string 24 | * sourceUri 25 | * @param string 26 | * targetUri 27 | * 28 | * @returns string 29 | */ 30 | Pingback.prototype.ping = function(sourceUri, targetUri) { 31 | 32 | this.request.methodName = "blogger.getUsersBlogs"; 33 | 34 | this.request.addParam(sourceUri); 35 | this.request.addParam(targetUri); 36 | 37 | var resp = this.request.send(); 38 | this.request.clearParams(); 39 | return resp.parseXML(); 40 | }; 41 | 42 | /** 43 | * 44 | * @param string 45 | * url 46 | * @returns array URLs that pingbacked url 47 | */ 48 | Pingback.prototype.getPingbacks = function(url) { 49 | this.request.methodName = "pingback.extensions.getPingbacks"; 50 | 51 | this.request.addParam(url); 52 | 53 | var resp = this.request.send(); 54 | this.request.clearParams(); 55 | return resp.parseXML(); 56 | }; -------------------------------------------------------------------------------- /lib/jquery-qunit/addons/close-enough/qunit-close-enough.js: -------------------------------------------------------------------------------- 1 | QUnit.extend( QUnit, { 2 | /** 3 | * Checks that the first two arguments are equal, or are numbers close enough to be considered equal 4 | * based on a specified maximum allowable difference. 5 | * 6 | * @example close(3.141, Math.PI, 0.001); 7 | * 8 | * @param Number actual 9 | * @param Number expected 10 | * @param Number maxDifference (the maximum inclusive difference allowed between the actual and expected numbers) 11 | * @param String message (optional) 12 | */ 13 | close: function(actual, expected, maxDifference, message) { 14 | var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference; 15 | QUnit.push(passes, actual, expected, message); 16 | }, 17 | 18 | /** 19 | * Checks that the first two arguments are numbers with differences greater than the specified 20 | * minimum difference. 21 | * 22 | * @example notClose(3.1, Math.PI, 0.001); 23 | * 24 | * @param Number actual 25 | * @param Number expected 26 | * @param Number minDifference (the minimum exclusive difference allowed between the actual and expected numbers) 27 | * @param String message (optional) 28 | */ 29 | notClose: function(actual, expected, minDifference, message) { 30 | QUnit.push(Math.abs(actual - expected) > minDifference, actual, expected, message); 31 | } 32 | }); -------------------------------------------------------------------------------- /tests/wordpress-test-1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The software is licensed under The MIT License (MIT) 3 | * http://www.opensource.org/licenses/mit-license.php 4 | * 5 | * Copyright (c) 2012 Hezhiqiang 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 8 | * associated documentation files (the"Software"), to deal in the Software without restriction, 9 | * including without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | /** 26 | * This file is used to test a few of tests for reduce testing time, because the 27 | * testing will connect to xmlprc server 28 | */ 29 | 30 | module("Wordpress API"); 31 | var connection = { 32 | url : "your xmlprc url such as http://www.exmaple.com/xmlrpc", 33 | username : "you login name", 34 | password : "you password" 35 | }; 36 | var wp = new WordPress(connection.url, connection.username, connection.password); 37 | -------------------------------------------------------------------------------- /incubation/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The software is licensed under The MIT License (MIT) 3 | * http://www.opensource.org/licenses/mit-license.php 4 | * 5 | * Copyright (c) 2012 Hezhiqiang 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the"Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | */ 26 | var WordPressUtils = {}; 27 | /** 28 | * Testing the options if it is readonly 29 | * 30 | * @static 31 | * 32 | * @returns boolean 33 | */ 34 | WordPressUtils.isOptionReadOnly = function(options, name) { 35 | if (options[name].readonly == true) { 36 | return true; 37 | } 38 | return false; 39 | }; 40 | 41 | /** 42 | * Check the response if is a error 43 | * 44 | * @param object 45 | * The response object 46 | * @returns boolean 47 | */ 48 | WordPressUtils.isFault = function(object) { 49 | if (object.faultCode) { 50 | return true; 51 | } 52 | return false; 53 | } -------------------------------------------------------------------------------- /incubation/options.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The software is licensed under The MIT License (MIT) 3 | * http://www.opensource.org/licenses/mit-license.php 4 | * 5 | * Copyright (c) 2012 Hezhiqiang 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 8 | * associated documentation files (the"Software"), to deal in the Software without restriction, 9 | * including without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | */ 24 | 25 | /** 26 | * Before use the Options class, you must link wordpress.js in head tag of html page with this: 27 | * 28 | *