Plugin Directory

Changeset 1818322


Ignore:
Timestamp:
02/08/2018 03:08:15 PM (8 years ago)
Author:
chen420
Message:

tagging version 0.2.9

Location:
tinywebdb-api
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • tinywebdb-api/tags/0.2.9/docs/README.md

    r1770235 r1818322  
    99Requires at least: 4.0 
    1010Tested up to: 4.9 
    11 Stable tag: 0.2.8 
     11Stable tag: 0.2.9 
    1212License: GPLv2 or later 
    1313License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    9090Active "Store A Value" and some enhancement.
    9191
     92= 0.2.9 =
     93Active log viewer and some enhancement.
     94
    9295= 1.0.0 =
  • tinywebdb-api/tags/0.2.9/menus.php

    r1699752 r1818322  
    44
    55}
     6
     7function wp_tinywebdb_api_logtailmenu() {
     8    echo '<div class="wrap">';
     9    if (function_exists('screen_icon')) {
     10        screen_icon();
     11    }
     12    echo "<h2>TinyWebDB Log Tail</h2>";
     13
     14    echo "<table class=\"wp-list-table widefat striped pages\">";
     15    echo "<thead><tr>";
     16    echo "<th> Log Name </th>";
     17    echo "<th> Size </th>";
     18    echo "</tr></thead>\n";
     19
     20        $listDir = array();
     21        if($handler = opendir(WP_CONTENT_DIR)) {
     22            while (($sub = readdir($handler)) !== FALSE) {
     23                if ( substr($sub, 0, 10) == "tinywebdb_") {
     24            $listDir[] = $sub;
     25                }
     26            }
     27            closedir($handler);
     28        sort($listDir);
     29        foreach ($listDir as $sub) {
     30        echo "<tr>";
     31            echo "<td><a href=" . menu_page_url( 'tinywebdb_log' ,false) . "&logfile=" . $sub . ">$sub</a></td>\n";
     32            echo "<td>" . filesize(WP_CONTENT_DIR. "/" . $sub) . "</td>\n";
     33        echo "</tr>";
     34            }
     35        }
     36
     37    echo "</table>";
     38    if($_GET['logfile']) {
     39        $logfile = substr($_GET['logfile'], 0, 24);
     40    echo "<h2>Log file : " . WP_CONTENT_DIR. "/" .$logfile . "</h2>";
     41    $lines = wp_tinywebdb_api_read_tail(WP_CONTENT_DIR. "/" .$logfile, 20);
     42    foreach ($lines as $line) {
     43            echo $line . "<br>";
     44        }
     45    }
     46}
     47
     48function wp_tinywebdb_api_read_tail($file, $lines) {
     49    //global $fsize;
     50    $handle = fopen($file, "r");
     51    $linecounter = $lines;
     52    $pos = -2;
     53    $beginning = false;
     54    $text = array();
     55    while ($linecounter> 0) {
     56        $t = " ";
     57        while ($t != "\n") {
     58            if(fseek($handle, $pos, SEEK_END) == -1) {
     59                $beginning = true;
     60                break;
     61            }
     62            $t = fgetc($handle);
     63            $pos --;
     64        }
     65        $linecounter --;
     66        if ($beginning) {
     67            rewind($handle);
     68        }
     69        $text[$lines-$linecounter-1] = fgets($handle);
     70        if ($beginning) break;
     71    }
     72    fclose ($handle);
     73    return array_reverse($text);
     74}
     75
    676
    777//***** Options Menu *****
  • tinywebdb-api/tags/0.2.9/readme.txt

    r1770245 r1818322  
    1010Requires PHP: 5.2.4 
    1111Tested up to: 4.9 
    12 Stable tag: 0.2.8.1 
     12Stable tag: 0.2.9
    1313License: GPLv2 or later 
    1414License URI: http://www.gnu.org/licenses/gpl-2.0.html 
  • tinywebdb-api/tags/0.2.9/tinywebdb-api.php

    r1770242 r1818322  
    99Author: Hong Chen
    1010Author URI: http://edu2web.com/tinywebdb-api/
    11 Version: 0.2.8
     11Version: 0.2.9
    1212*/
    1313
    1414
    1515define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php");
    16 define("TINYWEBDB_VER", "0.2.8");
     16define("TINYWEBDB_VER", "0.2.9");
    1717
    1818//***** Hooks *****
     
    6262            $tagValue = get_query_var('value');              // $_REQUEST['value']; //
    6363            $apiKey = get_query_var('apikey');
    64             error_log("Wp TinyWebDB API : storeavalue: " . __FILE__ . "/" . __LINE__ . " ($apiKey) $tagName -- $tagValue");
     64            $log_message = sprintf("%s:%s\n", date_i18n('Y-m-d H:i:s'), "storeavalue: ($apiKey) $tagName -- $tagValue");
     65            $file_name = WP_CONTENT_DIR . '/tinywebdb_' . date_i18n('Y-m-d')  . '.log';
     66            error_log($log_message, 3, $file_name);
    6567            $setting_apikey = get_option("wp_tinywebdb_api_key");
    6668            if (empty($tagName)) exit("tagName is empty.");
     
    9092//Just a boring function to insert the menus
    9193function wp_tinywebdb_api_add_pages() {
    92     add_options_page("TinyWebDB Settings", "TinyWebDB API", "manage_options", __FILE__, "wp_tinywebdb_api_optionsmenu");
     94    add_menu_page("TinyWebDB", "TinyWebDB", "manage_options", "tinywebdb_api", "wp_tinywebdb_api_optionsmenu", '', 81);
     95    add_submenu_page("tinywebdb_api", "TinyWebDB", "Log tail", "manage_options", "tinywebdb_log", "wp_tinywebdb_api_logtailmenu");
    9396}
    9497
  • tinywebdb-api/trunk/docs/README.md

    r1770235 r1818322  
    99Requires at least: 4.0 
    1010Tested up to: 4.9 
    11 Stable tag: 0.2.8 
     11Stable tag: 0.2.9 
    1212License: GPLv2 or later 
    1313License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    9090Active "Store A Value" and some enhancement.
    9191
     92= 0.2.9 =
     93Active log viewer and some enhancement.
     94
    9295= 1.0.0 =
  • tinywebdb-api/trunk/menus.php

    r1699752 r1818322  
    44
    55}
     6
     7function wp_tinywebdb_api_logtailmenu() {
     8    echo '<div class="wrap">';
     9    if (function_exists('screen_icon')) {
     10        screen_icon();
     11    }
     12    echo "<h2>TinyWebDB Log Tail</h2>";
     13
     14    echo "<table class=\"wp-list-table widefat striped pages\">";
     15    echo "<thead><tr>";
     16    echo "<th> Log Name </th>";
     17    echo "<th> Size </th>";
     18    echo "</tr></thead>\n";
     19
     20        $listDir = array();
     21        if($handler = opendir(WP_CONTENT_DIR)) {
     22            while (($sub = readdir($handler)) !== FALSE) {
     23                if ( substr($sub, 0, 10) == "tinywebdb_") {
     24            $listDir[] = $sub;
     25                }
     26            }
     27            closedir($handler);
     28        sort($listDir);
     29        foreach ($listDir as $sub) {
     30        echo "<tr>";
     31            echo "<td><a href=" . menu_page_url( 'tinywebdb_log' ,false) . "&logfile=" . $sub . ">$sub</a></td>\n";
     32            echo "<td>" . filesize(WP_CONTENT_DIR. "/" . $sub) . "</td>\n";
     33        echo "</tr>";
     34            }
     35        }
     36
     37    echo "</table>";
     38    if($_GET['logfile']) {
     39        $logfile = substr($_GET['logfile'], 0, 24);
     40    echo "<h2>Log file : " . WP_CONTENT_DIR. "/" .$logfile . "</h2>";
     41    $lines = wp_tinywebdb_api_read_tail(WP_CONTENT_DIR. "/" .$logfile, 20);
     42    foreach ($lines as $line) {
     43            echo $line . "<br>";
     44        }
     45    }
     46}
     47
     48function wp_tinywebdb_api_read_tail($file, $lines) {
     49    //global $fsize;
     50    $handle = fopen($file, "r");
     51    $linecounter = $lines;
     52    $pos = -2;
     53    $beginning = false;
     54    $text = array();
     55    while ($linecounter> 0) {
     56        $t = " ";
     57        while ($t != "\n") {
     58            if(fseek($handle, $pos, SEEK_END) == -1) {
     59                $beginning = true;
     60                break;
     61            }
     62            $t = fgetc($handle);
     63            $pos --;
     64        }
     65        $linecounter --;
     66        if ($beginning) {
     67            rewind($handle);
     68        }
     69        $text[$lines-$linecounter-1] = fgets($handle);
     70        if ($beginning) break;
     71    }
     72    fclose ($handle);
     73    return array_reverse($text);
     74}
     75
    676
    777//***** Options Menu *****
  • tinywebdb-api/trunk/readme.txt

    r1770245 r1818322  
    1010Requires PHP: 5.2.4 
    1111Tested up to: 4.9 
    12 Stable tag: 0.2.8.1 
     12Stable tag: 0.2.9
    1313License: GPLv2 or later 
    1414License URI: http://www.gnu.org/licenses/gpl-2.0.html 
  • tinywebdb-api/trunk/tinywebdb-api.php

    r1770242 r1818322  
    99Author: Hong Chen
    1010Author URI: http://edu2web.com/tinywebdb-api/
    11 Version: 0.2.8
     11Version: 0.2.9
    1212*/
    1313
    1414
    1515define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php");
    16 define("TINYWEBDB_VER", "0.2.8");
     16define("TINYWEBDB_VER", "0.2.9");
    1717
    1818//***** Hooks *****
     
    6262            $tagValue = get_query_var('value');              // $_REQUEST['value']; //
    6363            $apiKey = get_query_var('apikey');
    64             error_log("Wp TinyWebDB API : storeavalue: " . __FILE__ . "/" . __LINE__ . " ($apiKey) $tagName -- $tagValue");
     64            $log_message = sprintf("%s:%s\n", date_i18n('Y-m-d H:i:s'), "storeavalue: ($apiKey) $tagName -- $tagValue");
     65            $file_name = WP_CONTENT_DIR . '/tinywebdb_' . date_i18n('Y-m-d')  . '.log';
     66            error_log($log_message, 3, $file_name);
    6567            $setting_apikey = get_option("wp_tinywebdb_api_key");
    6668            if (empty($tagName)) exit("tagName is empty.");
     
    9092//Just a boring function to insert the menus
    9193function wp_tinywebdb_api_add_pages() {
    92     add_options_page("TinyWebDB Settings", "TinyWebDB API", "manage_options", __FILE__, "wp_tinywebdb_api_optionsmenu");
     94    add_menu_page("TinyWebDB", "TinyWebDB", "manage_options", "tinywebdb_api", "wp_tinywebdb_api_optionsmenu", '', 81);
     95    add_submenu_page("tinywebdb_api", "TinyWebDB", "Log tail", "manage_options", "tinywebdb_log", "wp_tinywebdb_api_logtailmenu");
    9396}
    9497
Note: See TracChangeset for help on using the changeset viewer.