Plugin Directory

Changeset 1699752


Ignore:
Timestamp:
07/20/2017 03:48:41 PM (9 years ago)
Author:
chen420
Message:

tagging version 0.2.7

Location:
tinywebdb-api
Files:
4 added
4 edited
7 copied

Legend:

Unmodified
Added
Removed
  • tinywebdb-api/tags/0.2.7/menus.php

    r1523028 r1699752  
    2222    }
    2323    $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';
    2525    $setting_apikey = get_option("wp_tinywebdb_api_key");
    2626
     
    7070          </tr>
    7171          </tr>
    72                   <tr class="inactive">
     72                  <tr class="active">
    7373            <th class="check-column" scope="row">
    7474            </th>
  • tinywebdb-api/tags/0.2.7/readme.txt

    r1524519 r1699752  
    1 ===  TinyWebDB API  ===
    21Contributors: chen420
    32Plugin URI: https://github.com/edu2web/tinywebdb-api
    4 Author URI: http://edu2web.com/tinywebdb-api/
     3Author URI: https://github.com/chen420
     4Document URI: http://edu2web.com/tinywebdb-api/
    55Donate link: http://edu2web.com/tinywebdb-api/donate/
    66Tags: appinventor, tinywebdb, api
    77Requires at least: 4.0
    8 Tested up to: 4.6.1
    9 Stable tag: 0.2.6
     8Tested up to: 4.8
     9Stable tag: 0.2.7
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • tinywebdb-api/tags/0.2.7/tinywebdb-api.php

    r1524519 r1699752  
    99Author: Hong Chen
    1010Author URI: http://edu2web.com/tinywebdb-api/
    11 Version: 0.2.6
     11Version: 0.2.7
    1212*/
    1313
    1414
    1515define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php");
    16 define("TINYWEBDB_VER", "0.2.6");
     16define("TINYWEBDB_VER", "0.2.7");
    1717
    1818//***** Hooks *****
  • tinywebdb-api/tags/0.2.7/tinywebdb.php

    r1524519 r1699752  
    44
    55  class TinyWebDB {
    6  
     6
    77    private static $initiated = false;
    8  
     8
    99    public static function init() {
    1010        if ( ! self::$initiated ) {
     
    1212        }
    1313    }
    14  
     14
    1515    public static function init_hooks() {
    1616      self::$initiated = true;
    17  
     17
    1818    }
    19  
     19
    2020    public function __construct() {
    21  
     21
    2222      global $wp_query;
    2323      if ($wp_query->is_404) {
     
    2525          $wp_query->is_archive = true;
    2626      }
    27  
     27
    2828    }
    29  
     29
    3030    public function __destruct() {
    3131      return true;
    3232    }
    33  
     33
    3434    public static function get_action() {
    3535      global $wpdb;
    36  
     36
    3737        $request = $_SERVER['REQUEST_URI'];
    3838        if (!isset($_SERVER['REQUEST_URI'])) {
     
    4040            if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != '') { $request.='?'.$_SERVER['QUERY_STRING']; }
    4141        }
    42        
     42
    4343        $url_trigger = get_option("wp_tinywebdb_api_url_trigger");
    4444        if ($url_trigger=='') {
    4545            $url_trigger = 'api';
    4646        }
    47    
     47
    4848        if (isset($_POST['action'])) {
    4949            $request = '/' . $url_trigger . '/'.$_POST['action'].'/';
    5050        }
    51    
     51
    5252        if ( strpos('/'.$request, '/'.$url_trigger.'/') ) {
    53  
     53
    5454        $tinywebdb_key = explode($url_trigger.'/', $request);
    5555        $tinywebdb_key = $tinywebdb_key[1];
     
    5757        $action = $tinywebdb_key[0];
    5858        $action = $wpdb->escape($action);
    59    
     59
    6060        return $action;
    6161        }
    6262      return "No match!";
    6363    }
    64  
     64
    6565    function wp_tinywebdb_api_get_postid($tagName){
    66  
     66
    6767      $postid = NULL;
    6868      $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
    7471        if ($tagtype == 'id') {
    7572            $postid = $tagName;
     
    8885            }
    8986        }
    90  
     87
    9188        return $postid;
    9289    }
    93  
     90
    9491    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
    10195        if ($tagtype == 'id') {
    10296            $tagName = $postid;
     
    107101            $tagName = $slug;
    108102        }
    109  
     103
    110104        return $tagName;
    111105    }
    112  
     106
    113107    public static function getvalue($tagName) {
    114  
     108
    115109      $bedtag = array("id" => "0", "post_author" => "0", "post_content" => "ERROR BAD tag SUPPLIED");
    116  
     110
    117111      // this action enable from v 0.1.x
    118112      // JSON_API , Post Parameters : tag
    119113
    120114      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';
    125116
    126117        $posts = get_posts('numberposts=10');
     
    135126      } else {
    136127        $postid = TinyWebDB::wp_tinywebdb_api_get_postid($tagName);
    137         $tagValue = get_post($postid);
     128        $post = get_post($postid);
    138129        if (is_null($tagValue)) $tagValue = $bedtag;    //reports a get_post failure
    139130        // $tagName = wp_tinywebdb_api_get_tagName($postid);
    140         return $tagValue;
     131        return $post->post_content;
    141132      }
    142133    }
    143  
     134
    144135    public static function storeavalue($tagName, $tagValue) {
    145136 
     
    147138      $tagValue = stripslashes($tagValue);
    148139      $tagValue = trim($tagValue, '"');
    149      
    150       $post = get_post( $postid ); 
     140
     141      $post = get_post( $postid );
    151142      if (empty($post)) {
    152143
     
    158149          'post_status'   => 'publish',
    159150        );
    160  
     151
    161152        // Insert the post into the database
    162153        $postid = wp_insert_post( $args );
  • tinywebdb-api/trunk/menus.php

    r1523028 r1699752  
    2222    }
    2323    $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';
    2525    $setting_apikey = get_option("wp_tinywebdb_api_key");
    2626
     
    7070          </tr>
    7171          </tr>
    72                   <tr class="inactive">
     72                  <tr class="active">
    7373            <th class="check-column" scope="row">
    7474            </th>
  • tinywebdb-api/trunk/readme.txt

    r1524519 r1699752  
    1 ===  TinyWebDB API  ===
    21Contributors: chen420
    32Plugin URI: https://github.com/edu2web/tinywebdb-api
    4 Author URI: http://edu2web.com/tinywebdb-api/
     3Author URI: https://github.com/chen420
     4Document URI: http://edu2web.com/tinywebdb-api/
    55Donate link: http://edu2web.com/tinywebdb-api/donate/
    66Tags: appinventor, tinywebdb, api
    77Requires at least: 4.0
    8 Tested up to: 4.6.1
    9 Stable tag: 0.2.6
     8Tested up to: 4.8
     9Stable tag: 0.2.7
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • tinywebdb-api/trunk/tinywebdb-api.php

    r1524519 r1699752  
    99Author: Hong Chen
    1010Author URI: http://edu2web.com/tinywebdb-api/
    11 Version: 0.2.6
     11Version: 0.2.7
    1212*/
    1313
    1414
    1515define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php");
    16 define("TINYWEBDB_VER", "0.2.6");
     16define("TINYWEBDB_VER", "0.2.7");
    1717
    1818//***** Hooks *****
  • tinywebdb-api/trunk/tinywebdb.php

    r1524519 r1699752  
    44
    55  class TinyWebDB {
    6  
     6
    77    private static $initiated = false;
    8  
     8
    99    public static function init() {
    1010        if ( ! self::$initiated ) {
     
    1212        }
    1313    }
    14  
     14
    1515    public static function init_hooks() {
    1616      self::$initiated = true;
    17  
     17
    1818    }
    19  
     19
    2020    public function __construct() {
    21  
     21
    2222      global $wp_query;
    2323      if ($wp_query->is_404) {
     
    2525          $wp_query->is_archive = true;
    2626      }
    27  
     27
    2828    }
    29  
     29
    3030    public function __destruct() {
    3131      return true;
    3232    }
    33  
     33
    3434    public static function get_action() {
    3535      global $wpdb;
    36  
     36
    3737        $request = $_SERVER['REQUEST_URI'];
    3838        if (!isset($_SERVER['REQUEST_URI'])) {
     
    4040            if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != '') { $request.='?'.$_SERVER['QUERY_STRING']; }
    4141        }
    42        
     42
    4343        $url_trigger = get_option("wp_tinywebdb_api_url_trigger");
    4444        if ($url_trigger=='') {
    4545            $url_trigger = 'api';
    4646        }
    47    
     47
    4848        if (isset($_POST['action'])) {
    4949            $request = '/' . $url_trigger . '/'.$_POST['action'].'/';
    5050        }
    51    
     51
    5252        if ( strpos('/'.$request, '/'.$url_trigger.'/') ) {
    53  
     53
    5454        $tinywebdb_key = explode($url_trigger.'/', $request);
    5555        $tinywebdb_key = $tinywebdb_key[1];
     
    5757        $action = $tinywebdb_key[0];
    5858        $action = $wpdb->escape($action);
    59    
     59
    6060        return $action;
    6161        }
    6262      return "No match!";
    6363    }
    64  
     64
    6565    function wp_tinywebdb_api_get_postid($tagName){
    66  
     66
    6767      $postid = NULL;
    6868      $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
    7471        if ($tagtype == 'id') {
    7572            $postid = $tagName;
     
    8885            }
    8986        }
    90  
     87
    9188        return $postid;
    9289    }
    93  
     90
    9491    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
    10195        if ($tagtype == 'id') {
    10296            $tagName = $postid;
     
    107101            $tagName = $slug;
    108102        }
    109  
     103
    110104        return $tagName;
    111105    }
    112  
     106
    113107    public static function getvalue($tagName) {
    114  
     108
    115109      $bedtag = array("id" => "0", "post_author" => "0", "post_content" => "ERROR BAD tag SUPPLIED");
    116  
     110
    117111      // this action enable from v 0.1.x
    118112      // JSON_API , Post Parameters : tag
    119113
    120114      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';
    125116
    126117        $posts = get_posts('numberposts=10');
     
    135126      } else {
    136127        $postid = TinyWebDB::wp_tinywebdb_api_get_postid($tagName);
    137         $tagValue = get_post($postid);
     128        $post = get_post($postid);
    138129        if (is_null($tagValue)) $tagValue = $bedtag;    //reports a get_post failure
    139130        // $tagName = wp_tinywebdb_api_get_tagName($postid);
    140         return $tagValue;
     131        return $post->post_content;
    141132      }
    142133    }
    143  
     134
    144135    public static function storeavalue($tagName, $tagValue) {
    145136 
     
    147138      $tagValue = stripslashes($tagValue);
    148139      $tagValue = trim($tagValue, '"');
    149      
    150       $post = get_post( $postid ); 
     140
     141      $post = get_post( $postid );
    151142      if (empty($post)) {
    152143
     
    158149          'post_status'   => 'publish',
    159150        );
    160  
     151
    161152        // Insert the post into the database
    162153        $postid = wp_insert_post( $args );
Note: See TracChangeset for help on using the changeset viewer.