Changeset 1699752
- Timestamp:
- 07/20/2017 03:48:41 PM (9 years ago)
- Location:
- tinywebdb-api
- Files:
-
- 4 added
- 4 edited
- 7 copied
-
tags/0.2.7 (copied) (copied from tinywebdb-api/trunk)
-
tags/0.2.7/LICENSE (copied) (copied from tinywebdb-api/trunk/LICENSE)
-
tags/0.2.7/docs (added)
-
tags/0.2.7/docs/README.md (added)
-
tags/0.2.7/master (copied) (copied from tinywebdb-api/trunk/master)
-
tags/0.2.7/menus.php (copied) (copied from tinywebdb-api/trunk/menus.php) (2 diffs)
-
tags/0.2.7/readme.txt (copied) (copied from tinywebdb-api/trunk/readme.txt) (1 diff)
-
tags/0.2.7/tinywebdb-api.php (copied) (copied from tinywebdb-api/trunk/tinywebdb-api.php) (1 diff)
-
tags/0.2.7/tinywebdb.php (copied) (copied from tinywebdb-api/trunk/tinywebdb.php) (10 diffs)
-
trunk/docs (added)
-
trunk/docs/README.md (added)
-
trunk/menus.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tinywebdb-api.php (modified) (1 diff)
-
trunk/tinywebdb.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tinywebdb-api/tags/0.2.7/menus.php
r1523028 r1699752 22 22 } 23 23 $setting_url_trigger = get_option("wp_tinywebdb_api_url_trigger") or $setting_url_trigger = 'api'; 24 $setting_tagtype = get_option("wp_tinywebdb_api_tag_type") or $setting_tagtype = ' id';24 $setting_tagtype = get_option("wp_tinywebdb_api_tag_type") or $setting_tagtype = 'slug'; 25 25 $setting_apikey = get_option("wp_tinywebdb_api_key"); 26 26 … … 70 70 </tr> 71 71 </tr> 72 <tr class=" inactive">72 <tr class="active"> 73 73 <th class="check-column" scope="row"> 74 74 </th> -
tinywebdb-api/tags/0.2.7/readme.txt
r1524519 r1699752 1 === TinyWebDB API ===2 1 Contributors: chen420 3 2 Plugin URI: https://github.com/edu2web/tinywebdb-api 4 Author URI: http://edu2web.com/tinywebdb-api/ 3 Author URI: https://github.com/chen420 4 Document URI: http://edu2web.com/tinywebdb-api/ 5 5 Donate link: http://edu2web.com/tinywebdb-api/donate/ 6 6 Tags: appinventor, tinywebdb, api 7 7 Requires at least: 4.0 8 Tested up to: 4. 6.19 Stable tag: 0.2. 68 Tested up to: 4.8 9 Stable tag: 0.2.7 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
tinywebdb-api/tags/0.2.7/tinywebdb-api.php
r1524519 r1699752 9 9 Author: Hong Chen 10 10 Author URI: http://edu2web.com/tinywebdb-api/ 11 Version: 0.2. 611 Version: 0.2.7 12 12 */ 13 13 14 14 15 15 define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php"); 16 define("TINYWEBDB_VER", "0.2. 6");16 define("TINYWEBDB_VER", "0.2.7"); 17 17 18 18 //***** Hooks ***** -
tinywebdb-api/tags/0.2.7/tinywebdb.php
r1524519 r1699752 4 4 5 5 class TinyWebDB { 6 6 7 7 private static $initiated = false; 8 8 9 9 public static function init() { 10 10 if ( ! self::$initiated ) { … … 12 12 } 13 13 } 14 14 15 15 public static function init_hooks() { 16 16 self::$initiated = true; 17 17 18 18 } 19 19 20 20 public function __construct() { 21 21 22 22 global $wp_query; 23 23 if ($wp_query->is_404) { … … 25 25 $wp_query->is_archive = true; 26 26 } 27 27 28 28 } 29 29 30 30 public function __destruct() { 31 31 return true; 32 32 } 33 33 34 34 public static function get_action() { 35 35 global $wpdb; 36 36 37 37 $request = $_SERVER['REQUEST_URI']; 38 38 if (!isset($_SERVER['REQUEST_URI'])) { … … 40 40 if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != '') { $request.='?'.$_SERVER['QUERY_STRING']; } 41 41 } 42 42 43 43 $url_trigger = get_option("wp_tinywebdb_api_url_trigger"); 44 44 if ($url_trigger=='') { 45 45 $url_trigger = 'api'; 46 46 } 47 47 48 48 if (isset($_POST['action'])) { 49 49 $request = '/' . $url_trigger . '/'.$_POST['action'].'/'; 50 50 } 51 51 52 52 if ( strpos('/'.$request, '/'.$url_trigger.'/') ) { 53 53 54 54 $tinywebdb_key = explode($url_trigger.'/', $request); 55 55 $tinywebdb_key = $tinywebdb_key[1]; … … 57 57 $action = $tinywebdb_key[0]; 58 58 $action = $wpdb->escape($action); 59 59 60 60 return $action; 61 61 } 62 62 return "No match!"; 63 63 } 64 64 65 65 function wp_tinywebdb_api_get_postid($tagName){ 66 66 67 67 $postid = NULL; 68 68 $tagName = wp_strip_all_tags($tagName); 69 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 70 if ($tagtype=='') { 71 $tagtype = 'id'; 72 } 73 69 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 70 74 71 if ($tagtype == 'id') { 75 72 $postid = $tagName; … … 88 85 } 89 86 } 90 87 91 88 return $postid; 92 89 } 93 90 94 91 function wp_tinywebdb_api_get_tagName($postid){ 95 96 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 97 if ($tagtype=='') { 98 $tagtype = 'id'; 99 } 100 92 93 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 94 101 95 if ($tagtype == 'id') { 102 96 $tagName = $postid; … … 107 101 $tagName = $slug; 108 102 } 109 103 110 104 return $tagName; 111 105 } 112 106 113 107 public static function getvalue($tagName) { 114 108 115 109 $bedtag = array("id" => "0", "post_author" => "0", "post_content" => "ERROR BAD tag SUPPLIED"); 116 110 117 111 // this action enable from v 0.1.x 118 112 // JSON_API , Post Parameters : tag 119 113 120 114 if (empty($tagName)) { 121 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 122 if ($tagtype=='') { 123 $tagtype = 'id'; 124 } 115 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 125 116 126 117 $posts = get_posts('numberposts=10'); … … 135 126 } else { 136 127 $postid = TinyWebDB::wp_tinywebdb_api_get_postid($tagName); 137 $ tagValue= get_post($postid);128 $post = get_post($postid); 138 129 if (is_null($tagValue)) $tagValue = $bedtag; //reports a get_post failure 139 130 // $tagName = wp_tinywebdb_api_get_tagName($postid); 140 return $ tagValue;131 return $post->post_content; 141 132 } 142 133 } 143 134 144 135 public static function storeavalue($tagName, $tagValue) { 145 136 … … 147 138 $tagValue = stripslashes($tagValue); 148 139 $tagValue = trim($tagValue, '"'); 149 150 $post = get_post( $postid ); 140 141 $post = get_post( $postid ); 151 142 if (empty($post)) { 152 143 … … 158 149 'post_status' => 'publish', 159 150 ); 160 151 161 152 // Insert the post into the database 162 153 $postid = wp_insert_post( $args ); -
tinywebdb-api/trunk/menus.php
r1523028 r1699752 22 22 } 23 23 $setting_url_trigger = get_option("wp_tinywebdb_api_url_trigger") or $setting_url_trigger = 'api'; 24 $setting_tagtype = get_option("wp_tinywebdb_api_tag_type") or $setting_tagtype = ' id';24 $setting_tagtype = get_option("wp_tinywebdb_api_tag_type") or $setting_tagtype = 'slug'; 25 25 $setting_apikey = get_option("wp_tinywebdb_api_key"); 26 26 … … 70 70 </tr> 71 71 </tr> 72 <tr class=" inactive">72 <tr class="active"> 73 73 <th class="check-column" scope="row"> 74 74 </th> -
tinywebdb-api/trunk/readme.txt
r1524519 r1699752 1 === TinyWebDB API ===2 1 Contributors: chen420 3 2 Plugin URI: https://github.com/edu2web/tinywebdb-api 4 Author URI: http://edu2web.com/tinywebdb-api/ 3 Author URI: https://github.com/chen420 4 Document URI: http://edu2web.com/tinywebdb-api/ 5 5 Donate link: http://edu2web.com/tinywebdb-api/donate/ 6 6 Tags: appinventor, tinywebdb, api 7 7 Requires at least: 4.0 8 Tested up to: 4. 6.19 Stable tag: 0.2. 68 Tested up to: 4.8 9 Stable tag: 0.2.7 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
tinywebdb-api/trunk/tinywebdb-api.php
r1524519 r1699752 9 9 Author: Hong Chen 10 10 Author URI: http://edu2web.com/tinywebdb-api/ 11 Version: 0.2. 611 Version: 0.2.7 12 12 */ 13 13 14 14 15 15 define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php"); 16 define("TINYWEBDB_VER", "0.2. 6");16 define("TINYWEBDB_VER", "0.2.7"); 17 17 18 18 //***** Hooks ***** -
tinywebdb-api/trunk/tinywebdb.php
r1524519 r1699752 4 4 5 5 class TinyWebDB { 6 6 7 7 private static $initiated = false; 8 8 9 9 public static function init() { 10 10 if ( ! self::$initiated ) { … … 12 12 } 13 13 } 14 14 15 15 public static function init_hooks() { 16 16 self::$initiated = true; 17 17 18 18 } 19 19 20 20 public function __construct() { 21 21 22 22 global $wp_query; 23 23 if ($wp_query->is_404) { … … 25 25 $wp_query->is_archive = true; 26 26 } 27 27 28 28 } 29 29 30 30 public function __destruct() { 31 31 return true; 32 32 } 33 33 34 34 public static function get_action() { 35 35 global $wpdb; 36 36 37 37 $request = $_SERVER['REQUEST_URI']; 38 38 if (!isset($_SERVER['REQUEST_URI'])) { … … 40 40 if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != '') { $request.='?'.$_SERVER['QUERY_STRING']; } 41 41 } 42 42 43 43 $url_trigger = get_option("wp_tinywebdb_api_url_trigger"); 44 44 if ($url_trigger=='') { 45 45 $url_trigger = 'api'; 46 46 } 47 47 48 48 if (isset($_POST['action'])) { 49 49 $request = '/' . $url_trigger . '/'.$_POST['action'].'/'; 50 50 } 51 51 52 52 if ( strpos('/'.$request, '/'.$url_trigger.'/') ) { 53 53 54 54 $tinywebdb_key = explode($url_trigger.'/', $request); 55 55 $tinywebdb_key = $tinywebdb_key[1]; … … 57 57 $action = $tinywebdb_key[0]; 58 58 $action = $wpdb->escape($action); 59 59 60 60 return $action; 61 61 } 62 62 return "No match!"; 63 63 } 64 64 65 65 function wp_tinywebdb_api_get_postid($tagName){ 66 66 67 67 $postid = NULL; 68 68 $tagName = wp_strip_all_tags($tagName); 69 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 70 if ($tagtype=='') { 71 $tagtype = 'id'; 72 } 73 69 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 70 74 71 if ($tagtype == 'id') { 75 72 $postid = $tagName; … … 88 85 } 89 86 } 90 87 91 88 return $postid; 92 89 } 93 90 94 91 function wp_tinywebdb_api_get_tagName($postid){ 95 96 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 97 if ($tagtype=='') { 98 $tagtype = 'id'; 99 } 100 92 93 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 94 101 95 if ($tagtype == 'id') { 102 96 $tagName = $postid; … … 107 101 $tagName = $slug; 108 102 } 109 103 110 104 return $tagName; 111 105 } 112 106 113 107 public static function getvalue($tagName) { 114 108 115 109 $bedtag = array("id" => "0", "post_author" => "0", "post_content" => "ERROR BAD tag SUPPLIED"); 116 110 117 111 // this action enable from v 0.1.x 118 112 // JSON_API , Post Parameters : tag 119 113 120 114 if (empty($tagName)) { 121 $tagtype = get_option("wp_tinywebdb_api_tag_type"); 122 if ($tagtype=='') { 123 $tagtype = 'id'; 124 } 115 $tagtype = get_option("wp_tinywebdb_api_tag_type") or $tagtype = 'slug'; 125 116 126 117 $posts = get_posts('numberposts=10'); … … 135 126 } else { 136 127 $postid = TinyWebDB::wp_tinywebdb_api_get_postid($tagName); 137 $ tagValue= get_post($postid);128 $post = get_post($postid); 138 129 if (is_null($tagValue)) $tagValue = $bedtag; //reports a get_post failure 139 130 // $tagName = wp_tinywebdb_api_get_tagName($postid); 140 return $ tagValue;131 return $post->post_content; 141 132 } 142 133 } 143 134 144 135 public static function storeavalue($tagName, $tagValue) { 145 136 … … 147 138 $tagValue = stripslashes($tagValue); 148 139 $tagValue = trim($tagValue, '"'); 149 150 $post = get_post( $postid ); 140 141 $post = get_post( $postid ); 151 142 if (empty($post)) { 152 143 … … 158 149 'post_status' => 'publish', 159 150 ); 160 151 161 152 // Insert the post into the database 162 153 $postid = wp_insert_post( $args );
Note: See TracChangeset
for help on using the changeset viewer.