summaryrefslogtreecommitdiff
path: root/lib/plugins/popularity
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/popularity')
-rw-r--r--lib/plugins/popularity/action.php2
-rw-r--r--lib/plugins/popularity/admin.php6
-rw-r--r--lib/plugins/popularity/helper.php34
-rw-r--r--lib/plugins/popularity/lang/ca/lang.php5
-rw-r--r--lib/plugins/popularity/lang/eu/lang.php5
-rw-r--r--lib/plugins/popularity/lang/ja/intro.txt2
-rw-r--r--lib/plugins/popularity/lang/ko/intro.txt2
-rw-r--r--lib/plugins/popularity/lang/lt/lang.php5
-rw-r--r--lib/plugins/popularity/lang/ro/lang.php5
-rw-r--r--lib/plugins/popularity/plugin.info.txt2
10 files changed, 51 insertions, 17 deletions
diff --git a/lib/plugins/popularity/action.php b/lib/plugins/popularity/action.php
index 9e2e78d11..d5ec0f5c5 100644
--- a/lib/plugins/popularity/action.php
+++ b/lib/plugins/popularity/action.php
@@ -15,7 +15,7 @@ class action_plugin_popularity extends Dokuwiki_Action_Plugin {
*/
var $helper;
- function action_plugin_popularity(){
+ function __construct(){
$this->helper = $this->loadHelper('popularity', false);
}
diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php
index bd2d090e1..0cf174e0d 100644
--- a/lib/plugins/popularity/admin.php
+++ b/lib/plugins/popularity/admin.php
@@ -20,7 +20,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
var $helper;
var $sentStatus = null;
- function admin_plugin_popularity(){
+ function __construct(){
$this->helper = $this->loadHelper('popularity', false);
}
@@ -87,7 +87,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
//If there was an error the last time we tried to autosubmit, warn the user
if ( $this->helper->isAutoSubmitEnabled() ){
- if ( @file_exists($this->helper->autosubmitErrorFile) ){
+ if ( file_exists($this->helper->autosubmitErrorFile) ){
echo $this->getLang('autosubmitError');
echo io_readFile( $this->helper->autosubmitErrorFile );
}
@@ -144,7 +144,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
.'<input type="hidden" name="do" value="admin" />'
.'<input type="hidden" name="page" value="popularity" />';
}
- $form .= '<input type="submit" class="button" value="'.$this->getLang('submit').'"/>'
+ $form .= '<button type="submit">'.$this->getLang('submit').'</button>'
.'</fieldset>'
.'</form>';
return $form;
diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php
index eacde06d0..27755b0ed 100644
--- a/lib/plugins/popularity/helper.php
+++ b/lib/plugins/popularity/helper.php
@@ -30,7 +30,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
var $popularityLastSubmitFile;
- function helper_plugin_popularity(){
+ function __construct(){
global $conf;
$this->autosubmitFile = $conf['cachedir'].'/autosubmit.txt';
$this->autosubmitErrorFile = $conf['cachedir'].'/autosubmitError.txt';
@@ -74,14 +74,16 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Check if autosubmit is enabled
+ *
* @return boolean TRUE if we should send data once a month, FALSE otherwise
*/
function isAutoSubmitEnabled(){
- return @file_exists($this->autosubmitFile);
+ return file_exists($this->autosubmitFile);
}
/**
* Send the data, to the submit url
+ *
* @param string $data The popularity data
* @return string An empty string if everything worked fine, a string describing the error otherwise
*/
@@ -97,6 +99,8 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Compute the last time the data was sent. If it has never been sent, we return 0.
+ *
+ * @return int
*/
function lastSentTime(){
$manualSubmission = @filemtime($this->popularityLastSubmitFile);
@@ -107,6 +111,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Gather all information
+ *
* @return string The popularity data as a string
*/
function gatherAsString(){
@@ -124,6 +129,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Gather all information
+ *
* @return array The popularity data as an array
*/
function _gather(){
@@ -247,9 +253,26 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
$data['php_exectime'] = $phptime;
$data['php_extension'] = get_loaded_extensions();
+ // plugin usage data
+ $this->_add_plugin_usage_data($data);
+
return $data;
}
+ protected function _add_plugin_usage_data(&$data){
+ $pluginsData = array();
+ trigger_event('PLUGIN_POPULARITY_DATA_SETUP', $pluginsData);
+ foreach($pluginsData as $plugin => $d){
+ if ( is_array($d) ) {
+ foreach($d as $key => $value){
+ $data['plugin_' . $plugin . '_' . $key] = $value;
+ }
+ } else {
+ $data['plugin_' . $plugin] = $d;
+ }
+ }
+ }
+
/**
* Callback to search and count the content of directories in DokuWiki
*
@@ -288,17 +311,24 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
*
* @author <gilthans dot NO dot SPAM at gmail dot com>
* @link http://de3.php.net/manual/en/ini.core.php#79564
+ *
+ * @param string $v
+ * @return int|string
*/
function _to_byte($v){
$l = substr($v, -1);
$ret = substr($v, 0, -1);
switch(strtoupper($l)){
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'P':
$ret *= 1024;
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'T':
$ret *= 1024;
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'G':
$ret *= 1024;
+ /** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$ret *= 1024;
case 'K':
diff --git a/lib/plugins/popularity/lang/ca/lang.php b/lib/plugins/popularity/lang/ca/lang.php
index b30846118..9eb1655d2 100644
--- a/lib/plugins/popularity/lang/ca/lang.php
+++ b/lib/plugins/popularity/lang/ca/lang.php
@@ -1,7 +1,8 @@
<?php
+
/**
- * Catalan language file
- *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
* @author Carles Bellver <carles.bellver@cent.uji.es>
* @author Carles Bellver <carles.bellver@gmail.com>
* @author carles.bellver@cent.uji.es
diff --git a/lib/plugins/popularity/lang/eu/lang.php b/lib/plugins/popularity/lang/eu/lang.php
index b52ccaee1..b5b80357c 100644
--- a/lib/plugins/popularity/lang/eu/lang.php
+++ b/lib/plugins/popularity/lang/eu/lang.php
@@ -1,7 +1,8 @@
<?php
+
/**
- * Basque language file
- *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
* @author Inko Illarramendi <inko.i.a@gmail.com>
* @author Zigor Astarbe <astarbe@gmail.com>
*/
diff --git a/lib/plugins/popularity/lang/ja/intro.txt b/lib/plugins/popularity/lang/ja/intro.txt
index 09886f418..db9a34284 100644
--- a/lib/plugins/popularity/lang/ja/intro.txt
+++ b/lib/plugins/popularity/lang/ja/intro.txt
@@ -1,6 +1,6 @@
====== 利用状況調査 ======
-このツールは、ご利用中のwikiの情報を収集し、それをDokuWikiの開発者へ匿名で送信するものです。開発者はこのツールにより、DokuWikiが実際にどの様に利用されているかを理解し、そして実際の利用状況に基づいて今後の開発方針の決定することができます。
+この[[doku>ja:popularity|ツール]]は、ご利用中のwikiの情報を収集し、それをDokuWikiの開発者へ匿名で送信するものです。開発者はこのツールにより、DokuWikiが実際にどの様に利用されているかを理解し、そして実際の利用状況に基づいて今後の開発方針の決定することができます。
お使いのwikiの規模が大きくなってきたときは、このステップを定期的に繰り返すことを推奨しています。また、送信されたデータは匿名のIDで識別されます。
diff --git a/lib/plugins/popularity/lang/ko/intro.txt b/lib/plugins/popularity/lang/ko/intro.txt
index bc9bb9dd0..edc0f8733 100644
--- a/lib/plugins/popularity/lang/ko/intro.txt
+++ b/lib/plugins/popularity/lang/ko/intro.txt
@@ -1,6 +1,6 @@
====== 인기도 조사 ======
-설치된 위키의 익명 정보를 도쿠위키 개발자에게 보냅니다. 이 [[doku>ko:popularity|도구]]는 도쿠위키가 실제 사용자에게 어떻게 사용되는지 도쿠위키 개발자에게 알려줌으로써 이 후 개발 시 참고가 됩니다.
+설치된 위키의 익명 정보를 도쿠위키 개발자에게 보냅니다. 이 [[doku>ko:popularity|도구]]는 도쿠위키가 실제 사용자에게 어떻게 사용되는지 도쿠위키 개발자에게 알려줌으로써 이 후 개발 시 참조가 됩니다.
설치된 위키가 커짐에 따라서 이 과정을 반복할 필요가 있습니다. 반복된 데이터는 익명 ID로 구별되어집니다.
diff --git a/lib/plugins/popularity/lang/lt/lang.php b/lib/plugins/popularity/lang/lt/lang.php
index 88df29c50..dca350475 100644
--- a/lib/plugins/popularity/lang/lt/lang.php
+++ b/lib/plugins/popularity/lang/lt/lang.php
@@ -1,7 +1,8 @@
<?php
+
/**
- * Lithuanian language file
- *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
* @author audrius.klevas@gmail.com
* @author Arunas Vaitekunas <aras@fan.lt>
*/
diff --git a/lib/plugins/popularity/lang/ro/lang.php b/lib/plugins/popularity/lang/ro/lang.php
index 8ba119dcb..5be528bac 100644
--- a/lib/plugins/popularity/lang/ro/lang.php
+++ b/lib/plugins/popularity/lang/ro/lang.php
@@ -1,7 +1,8 @@
<?php
+
/**
- * Romanian language file
- *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
* @author Emanuel-Emeric Andrasi <n30@mandrivausers.ro>
* @author Emanuel-Emeric Andrași <n30@mandrivausers.ro>
* @author Emanuel-Emeric Andraşi <em.andrasi@mandrivausers.ro>
diff --git a/lib/plugins/popularity/plugin.info.txt b/lib/plugins/popularity/plugin.info.txt
index eadfffaa0..8ffc136a1 100644
--- a/lib/plugins/popularity/plugin.info.txt
+++ b/lib/plugins/popularity/plugin.info.txt
@@ -1,7 +1,7 @@
base popularity
author Andreas Gohr
email andi@splitbrain.org
-date 2013-10-14
+date 2015-07-15
name Popularity Feedback Plugin
desc Send anonymous data about your wiki to the DokuWiki developers
url http://www.dokuwiki.org/plugin:popularity