Changeset 1818322
- Timestamp:
- 02/08/2018 03:08:15 PM (8 years ago)
- Location:
- tinywebdb-api
- Files:
-
- 8 edited
- 1 copied
-
tags/0.2.9 (copied) (copied from tinywebdb-api/trunk)
-
tags/0.2.9/docs/README.md (modified) (2 diffs)
-
tags/0.2.9/menus.php (modified) (1 diff)
-
tags/0.2.9/readme.txt (modified) (1 diff)
-
tags/0.2.9/tinywebdb-api.php (modified) (3 diffs)
-
trunk/docs/README.md (modified) (2 diffs)
-
trunk/menus.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tinywebdb-api.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tinywebdb-api/tags/0.2.9/docs/README.md
r1770235 r1818322 9 9 Requires at least: 4.0 10 10 Tested up to: 4.9 11 Stable tag: 0.2. 811 Stable tag: 0.2.9 12 12 License: GPLv2 or later 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 90 90 Active "Store A Value" and some enhancement. 91 91 92 = 0.2.9 = 93 Active log viewer and some enhancement. 94 92 95 = 1.0.0 = -
tinywebdb-api/tags/0.2.9/menus.php
r1699752 r1818322 4 4 5 5 } 6 7 function 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 48 function 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 6 76 7 77 //***** Options Menu ***** -
tinywebdb-api/tags/0.2.9/readme.txt
r1770245 r1818322 10 10 Requires PHP: 5.2.4 11 11 Tested up to: 4.9 12 Stable tag: 0.2. 8.112 Stable tag: 0.2.9 13 13 License: GPLv2 or later 14 14 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
tinywebdb-api/tags/0.2.9/tinywebdb-api.php
r1770242 r1818322 9 9 Author: Hong Chen 10 10 Author URI: http://edu2web.com/tinywebdb-api/ 11 Version: 0.2. 811 Version: 0.2.9 12 12 */ 13 13 14 14 15 15 define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php"); 16 define("TINYWEBDB_VER", "0.2. 8");16 define("TINYWEBDB_VER", "0.2.9"); 17 17 18 18 //***** Hooks ***** … … 62 62 $tagValue = get_query_var('value'); // $_REQUEST['value']; // 63 63 $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); 65 67 $setting_apikey = get_option("wp_tinywebdb_api_key"); 66 68 if (empty($tagName)) exit("tagName is empty."); … … 90 92 //Just a boring function to insert the menus 91 93 function 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"); 93 96 } 94 97 -
tinywebdb-api/trunk/docs/README.md
r1770235 r1818322 9 9 Requires at least: 4.0 10 10 Tested up to: 4.9 11 Stable tag: 0.2. 811 Stable tag: 0.2.9 12 12 License: GPLv2 or later 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 90 90 Active "Store A Value" and some enhancement. 91 91 92 = 0.2.9 = 93 Active log viewer and some enhancement. 94 92 95 = 1.0.0 = -
tinywebdb-api/trunk/menus.php
r1699752 r1818322 4 4 5 5 } 6 7 function 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 48 function 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 6 76 7 77 //***** Options Menu ***** -
tinywebdb-api/trunk/readme.txt
r1770245 r1818322 10 10 Requires PHP: 5.2.4 11 11 Tested up to: 4.9 12 Stable tag: 0.2. 8.112 Stable tag: 0.2.9 13 13 License: GPLv2 or later 14 14 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
tinywebdb-api/trunk/tinywebdb-api.php
r1770242 r1818322 9 9 Author: Hong Chen 10 10 Author URI: http://edu2web.com/tinywebdb-api/ 11 Version: 0.2. 811 Version: 0.2.9 12 12 */ 13 13 14 14 15 15 define("TINYWEBDB", "tools.php?page=tinywebdb-api/tinywebdb-api.php"); 16 define("TINYWEBDB_VER", "0.2. 8");16 define("TINYWEBDB_VER", "0.2.9"); 17 17 18 18 //***** Hooks ***** … … 62 62 $tagValue = get_query_var('value'); // $_REQUEST['value']; // 63 63 $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); 65 67 $setting_apikey = get_option("wp_tinywebdb_api_key"); 66 68 if (empty($tagName)) exit("tagName is empty."); … … 90 92 //Just a boring function to insert the menus 91 93 function 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"); 93 96 } 94 97
Note: See TracChangeset
for help on using the changeset viewer.