Changeset 629956
- Timestamp:
- 11/26/2012 04:50:24 AM (13 years ago)
- Location:
- tinywebdb-api/trunk
- Files:
-
- 1 added
- 3 edited
-
menus.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (added)
-
tinywebdb-api.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tinywebdb-api/trunk/menus.php
r628574 r629956 12 12 if ($_POST['issubmitted'] == 'yes') { 13 13 $post_urltrigger = $_POST['urltrigger']; 14 $post_apikey = $_POST['apikey']; 14 15 $post_tagtype = $_POST['tagtype']; 15 16 update_option("wp_tinywebdb_api_url_trigger", $post_urltrigger); 17 update_option("wp_tinywebdb_api_key", $post_apikey); 16 18 update_option("wp_tinywebdb_api_tag_type", $post_tagtype); 17 19 } 18 20 $setting_url_trigger = get_option("wp_tinywebdb_api_url_trigger") or $setting_url_trigger = 'api'; 19 21 $setting_tagtype = get_option("wp_tinywebdb_api_tag_type") or $setting_tagtype = 'id'; 22 $setting_apikey = get_option("wp_tinywebdb_api_key"); 20 23 21 24 echo '<form method="post" action="http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '">'; … … 43 46 <tr class="active"> 44 47 <th class="check-column" scope="row"> 45 <input type="checkbox" name="controllers[]" value="core" />46 48 </th> 47 49 <td class="plugin-title"> 48 50 <strong>Core</strong> 49 <div class="row-actions-visible"> 50 <a href="options-general.php?page=json-api&action=deactivate&controller=core&_wpnonce=0e3d72a68d" title="Deactivate this controller" class="edit">â~</a> </td> 51 </td> 51 52 <td class="desc"> 52 53 <p>Basic introspection methods</p> 53 54 <p><code><a href="<?php echo get_option('home') . "/" . $setting_url_trigger ?>/info/">info</a></code></p> 54 55 </td> 55 56 </tr> 57 <tr class="active"> 58 <th class="check-column" scope="row"> 59 </th> 60 <td class="plugin-title"> 61 <strong>Get Value</strong> 62 </td> 63 <td class="desc"> 64 <p>Get dara from your post by Post ID or Slug </p> 65 <p><code><a href="<?php echo get_option('home') . "/" . $setting_url_trigger ?>/getvalue/">getvalue</a></code></p> 66 </td> 67 </tr> 68 </tr> 69 <tr class="inactive"> 70 <th class="check-column" scope="row"> 71 </th> 72 <td class="plugin-title"> 73 <strong>Store A Value</strong> 74 </td> 75 <td class="desc"> 76 <p>Store data on a your post by Post ID or Slug </p> 77 <p><code><a href="<?php echo get_option('home') . "/" . $setting_url_trigger ?>/storeavalue/">storeavalue</a></code></p> 78 </td> 56 79 </tbody> 80 </table> 81 <div class="clear"></div> 82 </div> 57 83 58 84 <h3>Address</h3> 59 85 60 <tr valign="top"> 61 <th scope="row">URL Trigger</th> 62 <td><input name="urltrigger" type="text" id="urltrigger" value="<?php echo $setting_url_trigger; ?>" size="50" /><br/>Change the <em>api</em> part of your TinyWebDB APIs to something else. Enter without slashes.</td> 86 <table class="form-table"> 87 <tr valign="top"> 88 <th scope="row">API base</th> 89 <td><input name="urltrigger" type="text" id="urltrigger" value="<?php echo $setting_url_trigger; ?>" size="50" /><br/>Specify a base URL for TinyWebDB API. For example, using api as your API base URL would enable the following <?php echo get_option('home'); ?>/api/. You can change the <em>api</em> part of your TinyWebDB APIs to something else. Enter without slashes.</td> 90 </tr> 91 92 <tr valign="top"> 93 <th scope="row">API Key</th> 94 <td><input name="apikey" type="text" id="apikey" value="<?php echo $setting_apikey; ?>" size="50" /><br/>Set api key to protect your TinyWebDB API. Client mast set same api key to Store A Value to your site</td> 63 95 </tr> 64 96 -
tinywebdb-api/trunk/readme.txt
r624048 r629956 7 7 Requires at least: 3.4 8 8 Tested up to: 3.4.2 9 Stable tag: 0. 1.39 Stable tag: 0.2.0 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 36 36 1. FTP the entire tinywebdb-api directory to your Wordpress blog's plugins folder (/wp-content/plugins/). 37 37 2. Activate the plugin on the "Plugins" tab of the administration panel. 38 3. Refer to the usage section of this guide. 38 3. Check test URL on admin menu to make sure API work properly. 39 4. Refer to Plugin URI to get sample Android test app which make by App Inventor, to create your own app. 39 40 40 41 for how to use AppInventor to inventor your Android app with this plugin , visit Plugin URI for detail please. … … 74 75 75 76 = 0.2.0 = 77 Release which implemented Get Value Action with API Key. 78 Add test URL on admin menu. 76 79 77 80 = 1.0.0 = -
tinywebdb-api/trunk/tinywebdb-api.php
r626835 r629956 9 9 Author: Hong Chen 10 10 Author URI: http://digilib.net/ 11 Version: 0. 1.311 Version: 0.2.0 12 12 */ 13 13 14 14 15 15 define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php"); 16 define("TINYWEBDB_VER", "0. 1.3");16 define("TINYWEBDB_VER", "0.2.0"); 17 17 18 18 … … 131 131 exit; // this stops WordPress entirely 132 132 break; 133 //case "storeavalue": // this action will enable from v 0.2.x133 case "storeavalue": // this action will enable from v 0.2.x 134 134 // JSON_API , Post Parameters : tag,value 135 135 $tagName = get_query_var('tag'); 136 $tagValue = get_query_var('value'); 137 error_log("Wp TinyWebDB API : storeavalue: " . __FILE__ . "/" . __LINE__ . " $tagName -- $tagValue"); 138 // Create post object 139 $args = array( 140 'post_title' => wp_strip_all_tags( $tagName ), 141 'post_content' => $tagValue, 142 'post_status' => 'publish', 143 ); 144 145 // Insert the post into the database 146 $postid = wp_insert_post( $args ); 147 if ($postid == 0) { 148 $postid = wp_tinywebdb_api_get_postid($tagName); 136 $tagValue = get_query_var('value'); // $_REQUEST['value']; // 137 $apiKey = get_query_var('apikey'); 138 error_log("Wp TinyWebDB API : storeavalue: " . __FILE__ . "/" . __LINE__ . " ($apiKey) $tagName -- $tagValue"); 139 $setting_apikey = get_option("wp_tinywebdb_api_key"); 140 if ($apiKey == $setting_apikey){ 141 142 // Create post object 149 143 $args = array( 150 'ID' => wp_strip_all_tags( $postid ), 151 'post_content' => $tagValue, 144 'post_title' => wp_strip_all_tags( $tagName ), 145 'post_content' => $tagValue, 146 'post_status' => 'publish', 152 147 ); 153 $postid = wp_update_post( $args ); 148 149 // Insert the post into the database 150 $postid = wp_insert_post( $args ); 151 if ($postid == 0) { 152 $postid = wp_tinywebdb_api_get_postid($tagName); 153 $args = array( 154 'ID' => wp_strip_all_tags( $postid ), 155 'post_content' => $tagValue, 156 ); 157 $postid = wp_update_post( $args ); 158 } 159 $tagName = wp_tinywebdb_api_get_tagName($postid); 160 161 header('Cache-Control: no-cache, must-revalidate'); 162 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 163 header('Content-type: application/json'); 164 echo json_encode(array("STORED", $tagName, $tagValue)); 165 } else { 166 echo "check api key."; 154 167 } 155 $tagName = wp_tinywebdb_api_get_tagName($postid);156 157 header('Cache-Control: no-cache, must-revalidate');158 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');159 header('Content-type: application/json');160 echo json_encode(array("STORED", $tagName, $tagValue));161 168 exit; 162 169 break;
Note: See TracChangeset
for help on using the changeset viewer.