
內容簡介
GeneralStats 是一款高效能的 WordPress 統計資訊外掛,可在控制台、小工具或側邊欄顯示網站各項數據(如文章數、留言數、使用者數等),支援快取機制、Ajax 即時更新與多站網路,並提供開發者 API。
【主要功能】
• 支援控制台小工具與側邊欄小工具顯示統計資訊
• 內建快取機制,提升效能並可自訂記憶體用量
• 提供開發者 API,可自訂統計項目與顯示位置
• 支援 Ajax 即時更新統計數據(使用 jQuery)
• 完整支援多站網路(Multisite)環境
• 完整相容 HTTPS / SSL / TLS 網站
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
fully settings page configurable with GUI or manually
easy to integrate (ships with multi/sidebar- and dashboard-widget functionality)
possible to integrate in “Right Now” box or to display as widget on the dashboard
high performing with caching technology and customizable memory usage
cache-purge mechanism via actions (triggers) for other plugins
optional Ajax refresh with jQuery
fully compatible with https/SSL/TLS-sites
stats-update by e-mail
API for developers
fully multisite network compatible
clean uninstall
Please find the version for WordPress
3.8 and higher here
3.3 to 3.7 here
2.8 to 3.2 here
2.3 to 2.7 here
2.1 and 2.2 here
minor 2.1 here
Plugin’s website: https://www.bernhard-riedl.com/projects/
Author’s website: https://www.bernhard-riedl.com/
Attention! – Geeks’ stuff ahead! 😉
API
With GeneralStats 2.00 and higher you can use a function-call to display individual stat(-blocks) on different positions on your page.
Parameters can either be passed as an array or a URL query type string (e.g. “display=0&format=0”). Please note that WordPress parses all arguments as strings, thus booleans have to be 0 or 1 if used in query type strings whereas for arrays real booleans should be used. Furthermore you have to use the prefix stats_ to select different stats in a query_string. – For example: stat_0=Community&stat_12=Pages Word-Count.
function $generalstats->count($params=array())
$params:
stat: a stat-id of the following list
0 => ‘Users’
1 => ‘Categories’
2 => ‘Posts’
3 => ‘Comments’
4 => ‘Pages’
5 => ‘Links’
6 => ‘Tags’
7 => ‘Link-Categories’
10 => ‘Words_in_Posts’
11 => ‘Words_in_Comments’
12 => ‘Words_in_Pages’
thousands_separator: divides counts by thousand delimiters; default , => e.g. 1,386,267
display: if you want to return the stats-information (e.g. for storing in a variable) instead of echoing it with this function-call, set this to false; default setting is true
format_container: This option can be used to format the span container with css. Please note, that it should only be used to provide individual formats in case the class-style itself cannot be changed.
no_refresh: If set to true, GeneralStats will not produce any Ajax-Refresh-code, even if you have enabled the Ajax refresh in the admin menu.
The following example outputs the number of post tags:
count('stat=6');
?>
function $generalstats->output($params=array())
$params:
stat_selected: this array has to hold the id of the selected stat as key and the description as array-value, e.g. 6 => 'Post-Tags'; fallback to selected stats in Admin Menu
0 => ‘Users’
1 => ‘Categories’
2 => ‘Posts’
3 => ‘Comments’
4 => ‘Pages’
5 => ‘Links’
6 => ‘Tags’
7 => ‘Link-Categories’
10 => ‘Words_in_Posts’
11 => ‘Words_in_Comments’
12 => ‘Words_in_Pages’
before_list: default
after_list: default
format_stat: default
, %name and %count will be replaced by the attributes of the stat-entry
thousands_separator: divides numbers by thousand delimiters default , => e.g. 1,386,267
use_container: if set to true (default value) and the same selected stats and format is used as set in the admin menu, GeneralStats wraps the output in a html div with the class generalstats-refreshable-output – the class generalstats-output will be used for all other output; if you set use_container to false, no container div will be generated
display: if you want to return the stats-information (e.g. for storing in a variable) instead of echoing it with this function-call, set this to false; default setting is true
format_container: This option can be used to format the div container with css. Please note, that it should only be used to provide individual formats in case the class-style itself cannot be changed.
no_refresh: If set to true, GeneralStats will not produce any Ajax-Refresh-code, even if you have enabled the Ajax refresh in the admin menu.
The following example outputs the users and posts-counts with the title ‘Community-Members’ and ‘My Post-Count’:
array(
0 => 'Community-Members',
2 => 'My Post-Count'
)
);
$generalstats->output($params);
?>
Shortcodes
How-to for shortcodes
General Example:
Enter the following text anywhere in a post or page to show your current pages-count:
There are [generalstats_count stat=4] pages on my weblog
Available Shortcodes:
generalstats_output
Invokes $generalstats->output($params). Please note that you have to use the prefix stats_ to select stats. – For example: stat_0="Community" stat_12="Pages Word-Count"
generalstats_count
Invokes $generalstats->count($params).
Filters
How-To for filters
Available Filters:
generalstats_defaults
In case you want to set the default parameters globally rather than handing them over on every function call, you can add the filter generalstats_defaults in for example generalstats.php or your own customization plugin (recommended).
Please note that parameters which you hand over to a function call ($generalstats->output or $generalstats->count) will always override the defaults parameters, even if they have been set by a filter or in the admin menu.
generalstats_dashboard_widget
Receives an array which is used for the dashboard-widget-function call to $generalstats->output($params). display and use_container will automatically be set to true.
generalstats_dashboard_right_now
Receives an array which is used for the dashboard-right-now-box-function call to $generalstats->output($params). display and use_container will automatically be set to true.
generalstats_mail_stats_content
Receives an array which is used for the mail-stats-function call to $generalstats->output($params). display and use_container will automatically be set to false.
Available Actions:
generalstats_force_cache_refresh_stat
Gets triggered by GeneralStats’ forced cache refresh; receives a stat-id as parameter.
generalstats_force_cache_refresh_stats
Gets triggered by GeneralStats’ forced cache refresh; receives an array with stat-ids as parameter.
