mirror of
https://github.com/dokuwiki/dokuwiki-plugin-pluginrepo.git
synced 2025-07-29 12:11:15 +00:00
code style changes
This commit is contained in:
2
cron.php
2
cron.php
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the popularity per plugin/template from the popularity database tables
|
* Calculate the popularity per plugin/template from the popularity database tables
|
||||||
* Check for version and base discrepancies and update the 'devel:badextensions' page
|
* Check for version and base discrepancies and update the 'devel:badextensions' page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$TIMEFRAME = 60 * 60 * 24 * 365 * 2; // in seconds
|
$TIMEFRAME = 60 * 60 * 24 * 365 * 2; // in seconds
|
||||||
|
|
||||||
$TIME = time() - $TIMEFRAME;
|
$TIME = time() - $TIMEFRAME;
|
||||||
|
@ -200,7 +200,11 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
global $conf;
|
global $conf;
|
||||||
/** @var PDO $db */
|
/** @var PDO $db */
|
||||||
try {
|
try {
|
||||||
$db = new PDO($this->getConf('db_name'), $this->getConf('db_user'), $this->getConf('db_pass'));
|
$db = new PDO(
|
||||||
|
$this->getConf('db_name'),
|
||||||
|
$this->getConf('db_user'),
|
||||||
|
$this->getConf('db_pass')
|
||||||
|
);
|
||||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
|
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
|
||||||
@ -273,7 +277,9 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
} else {
|
} else {
|
||||||
[$bundledINsql, $bundledINvalues] = $this->prepareINstmt('bundled', $this->bundled);
|
[$bundledINsql, $bundledINvalues] = $this->prepareINstmt('bundled', $this->bundled);
|
||||||
|
|
||||||
$where_filtered = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = A.plugin)"
|
$where_filtered = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag
|
||||||
|
FROM plugin_tags
|
||||||
|
WHERE plugin_tags.plugin = A.plugin)"
|
||||||
. " AND A.securityissue = ''"
|
. " AND A.securityissue = ''"
|
||||||
. " AND (A.downloadurl <> '' OR A.plugin " . $bundledINsql . ")";
|
. " AND (A.downloadurl <> '' OR A.plugin " . $bundledINsql . ")";
|
||||||
$values = $bundledINvalues;
|
$values = $bundledINvalues;
|
||||||
@ -563,7 +569,8 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
$plugins[$i]['thumbnailurl'] = null;
|
$plugins[$i]['thumbnailurl'] = null;
|
||||||
} else {
|
} else {
|
||||||
$plugins[$i]['screenshoturl'] = ml($plugins[$i]['screenshot'], '', true, '&', true);
|
$plugins[$i]['screenshoturl'] = ml($plugins[$i]['screenshot'], '', true, '&', true);
|
||||||
$plugins[$i]['thumbnailurl'] = ml($plugins[$i]['screenshot'], ['w' => 120, 'h' => 70], true, '&', true);
|
$size = ['w' => 120, 'h' => 70];
|
||||||
|
$plugins[$i]['thumbnailurl'] = ml($plugins[$i]['screenshot'], $size, true, '&', true);
|
||||||
}
|
}
|
||||||
unset($plugins[$i]['screenshot']);
|
unset($plugins[$i]['screenshot']);
|
||||||
unset($plugins[$i]['email']); // no spam
|
unset($plugins[$i]['email']); // no spam
|
||||||
@ -728,7 +735,9 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
if ($filter['showall']) {
|
if ($filter['showall']) {
|
||||||
$shown = "1";
|
$shown = "1";
|
||||||
} else {
|
} else {
|
||||||
$shown = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag FROM plugin_tags WHERE plugin_tags.plugin = B.plugin)
|
$shown = "'" . $this->obsoleteTag . "' NOT IN(SELECT tag
|
||||||
|
FROM plugin_tags
|
||||||
|
WHERE plugin_tags.plugin = B.plugin)
|
||||||
AND B.securityissue = ''";
|
AND B.securityissue = ''";
|
||||||
}
|
}
|
||||||
if ($filter['plugintype'] == 32) {
|
if ($filter['plugintype'] == 32) {
|
||||||
@ -814,19 +823,24 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var PDOStatement $stmt */
|
/** @var PDOStatement $stmt */
|
||||||
$stmt = $db->prepare('DELETE FROM plugins WHERE plugin = ?');
|
$stmt = $db->prepare('DELETE FROM plugins
|
||||||
|
WHERE plugin = ?');
|
||||||
$stmt->execute([$plugin]);
|
$stmt->execute([$plugin]);
|
||||||
|
|
||||||
$stmt = $db->prepare('DELETE FROM plugin_tags WHERE plugin = ?');
|
$stmt = $db->prepare('DELETE FROM plugin_tags
|
||||||
|
WHERE plugin = ?');
|
||||||
$stmt->execute([$plugin]);
|
$stmt->execute([$plugin]);
|
||||||
|
|
||||||
$stmt = $db->prepare('DELETE FROM plugin_similar WHERE plugin = ? OR other = ?');
|
$stmt = $db->prepare('DELETE FROM plugin_similar
|
||||||
|
WHERE plugin = ? OR other = ?');
|
||||||
$stmt->execute([$plugin, $plugin]);
|
$stmt->execute([$plugin, $plugin]);
|
||||||
|
|
||||||
$stmt = $db->prepare('DELETE FROM plugin_conflicts WHERE plugin = ? OR other = ?');
|
$stmt = $db->prepare('DELETE FROM plugin_conflicts
|
||||||
|
WHERE plugin = ? OR other = ?');
|
||||||
$stmt->execute([$plugin, $plugin]);
|
$stmt->execute([$plugin, $plugin]);
|
||||||
|
|
||||||
$stmt = $db->prepare('DELETE FROM plugin_depends WHERE plugin = ? OR other = ?');
|
$stmt = $db->prepare('DELETE FROM plugin_depends
|
||||||
|
WHERE plugin = ? OR other = ?');
|
||||||
$stmt->execute([$plugin, $plugin]);
|
$stmt->execute([$plugin, $plugin]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,7 +1088,8 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
$db->exec('CREATE TABLE plugin_depends (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
|
$db->exec('CREATE TABLE plugin_depends (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
|
||||||
$db->exec('CREATE TABLE plugin_similar (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
|
$db->exec('CREATE TABLE plugin_similar (plugin varchar(50) NOT NULL, other varchar(50) NOT NULL);');
|
||||||
$db->exec('CREATE TABLE plugin_tags (plugin varchar(50) NOT NULL, tag varchar(255) NOT NULL);');
|
$db->exec('CREATE TABLE plugin_tags (plugin varchar(50) NOT NULL, tag varchar(255) NOT NULL);');
|
||||||
$db->exec('CREATE TABLE plugins (plugin varchar(50) PRIMARY KEY NOT NULL, name varchar(255) default NULL,
|
$db->exec('CREATE TABLE plugins (
|
||||||
|
plugin varchar(50) PRIMARY KEY NOT NULL, name varchar(255) default NULL,
|
||||||
description varchar(255) default NULL, author varchar(255) default NULL, email varchar(255) default NULL,
|
description varchar(255) default NULL, author varchar(255) default NULL, email varchar(255) default NULL,
|
||||||
compatible varchar(255) default NULL, lastupdate date default NULL, downloadurl varchar(255) default NULL,
|
compatible varchar(255) default NULL, lastupdate date default NULL, downloadurl varchar(255) default NULL,
|
||||||
bugtracker varchar(255) default NULL, sourcerepo varchar(255) default NULL,
|
bugtracker varchar(255) default NULL, sourcerepo varchar(255) default NULL,
|
||||||
@ -1082,8 +1097,7 @@ class helper_plugin_pluginrepo_repository extends Plugin
|
|||||||
screenshot varchar(255) default NULL, tags varchar(255) default NULL,
|
screenshot varchar(255) default NULL, tags varchar(255) default NULL,
|
||||||
securitywarning varchar(255) default NULL, securityissue varchar(255) NOT NULL,
|
securitywarning varchar(255) default NULL, securityissue varchar(255) NOT NULL,
|
||||||
bestcompatible varchar(50) default NULL, popularity int default 0,
|
bestcompatible varchar(50) default NULL, popularity int default 0,
|
||||||
updatemessage varchar(50) default NULL);'
|
updatemessage varchar(50) default NULL);');
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* - w: image width (only charts, default 450px)
|
* - w: image width (only charts, default 450px)
|
||||||
* - h: image height (only charts, default 180px)
|
* - h: image height (only charts, default 180px)
|
||||||
* - o: ordered by 'cnt' for counts (default) or 'val' for values ('val' is only default for line chart)
|
* - o: ordered by 'cnt' for counts (default) or 'val' for values ('val' is only default for line chart)
|
||||||
* - p: if true use percentages(default), otherwise absolute numbers (absolute numbers is only default for line chart)
|
* - p: if true use percentages(default), otherwise absolute numbers (absolute is only default for line chart)
|
||||||
* - s: (optional) start date, show only submits after this date
|
* - s: (optional) start date, show only submits after this date
|
||||||
* - e: (optional) end date, when start date set, show only until this date
|
* - e: (optional) end date, when start date set, show only until this date
|
||||||
* - d: (optional) when no start date set, shows the submits of last d days
|
* - d: (optional) when no start date set, shows the submits of last d days
|
||||||
@ -204,7 +204,7 @@ function buildUnencodedURLparams($params, $sep = '&')
|
|||||||
$amp = true;
|
$amp = true;
|
||||||
}
|
}
|
||||||
return $url;
|
return $url;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the number, as percentage or number
|
* Format the number, as percentage or number
|
||||||
|
@ -119,7 +119,8 @@ function getRepository()
|
|||||||
} else {
|
} else {
|
||||||
$feed .= '<screenshoturl>' . hsc($plugin['screenshot']) . '</screenshoturl>';
|
$feed .= '<screenshoturl>' . hsc($plugin['screenshot']) . '</screenshoturl>';
|
||||||
}
|
}
|
||||||
$feed .= '<thumbnailurl>' . hsc(ml($plugin['screenshot'], ['cache' => 'cache', 'w' => 120, 'h' => 70], true, '&', true)) . '</thumbnailurl>';
|
$param = ['cache' => 'cache', 'w' => 120, 'h' => 70];
|
||||||
|
$feed .= '<thumbnailurl>' . hsc(ml($plugin['screenshot'], $param, true, '&', true)) . '</thumbnailurl>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed .= '<downloadurl>' . hsc($plugin['downloadurl']) . '</downloadurl>';
|
$feed .= '<downloadurl>' . hsc($plugin['downloadurl']) . '</downloadurl>';
|
||||||
|
@ -105,7 +105,7 @@ class syntax_plugin_pluginrepo_news extends SyntaxPlugin
|
|||||||
* headline: headline of new block
|
* headline: headline of new block
|
||||||
* link: link shown at the bottom of the news block
|
* link: link shown at the bottom of the news block
|
||||||
* linktext: text for the link
|
* linktext: text for the link
|
||||||
* style: 'sameauthor' shows extensions of the same author (only on extension page), otherwise random picked
|
* style: 'sameauthor' shows extensions of the same author (only on extension page), otherwise random pick
|
||||||
* ..more see functions below
|
* ..more see functions below
|
||||||
* @return boolean rendered correctly? (however, returned value is not used at the moment)
|
* @return boolean rendered correctly? (however, returned value is not used at the moment)
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -164,20 +164,23 @@ class syntax_plugin_pluginrepo_table extends SyntaxPlugin
|
|||||||
$searchNS = $ID;
|
$searchNS = $ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$R->doc .= '<p>';
|
$intro = $this->getLang('t_searchintro_' . noNS($ID));
|
||||||
$R->doc .= $this->getLang('t_searchintro_' . noNS($ID));
|
$url = wl();
|
||||||
$R->doc .= '</p>';
|
$R->doc .= <<<HTML
|
||||||
|
<p>
|
||||||
$R->doc .= '<form action="' . wl() . '" accept-charset="utf-8" class="plugin-search" id="dw__search2" method="get">';
|
$intro
|
||||||
$R->doc .= ' <div class="no">';
|
</p>
|
||||||
$R->doc .= ' <input type="hidden" name="do" value="search" />';
|
<form action="{$url}" accept-charset="utf-8" class="plugin-search" id="dw__search2" method="get">
|
||||||
$R->doc .= ' <input type="hidden" id="dw__ns" name="ns" value="' . $searchNS . '" />';
|
<div class="no">
|
||||||
$R->doc .= ' <input type="text" id="qsearch2__in" accesskey="f" name="id" class="edit" />';
|
<input type="hidden" name="do" value="search" />
|
||||||
$R->doc .= ' <input type="submit" value="' . $this->getLang('t_btn_search') . '" class="button" title="'
|
<input type="hidden" id="dw__ns" name="ns" value="$searchNS" />
|
||||||
. $this->getLang('t_btn_searchtip') . '" />';
|
<input type="text" id="qsearch2__in" accesskey="f" name="id" class="edit" />
|
||||||
$R->doc .= ' <div id="qsearch2__out" class="ajax_qsearch JSpopup"></div>';
|
<input type="submit" value="{$this->getLang('t_btn_search')}"
|
||||||
$R->doc .= ' </div>';
|
class="button" title="{$this->getLang('t_btn_searchtip')}" />
|
||||||
$R->doc .= '</form>';
|
<div id="qsearch2__out" class="ajax_qsearch JSpopup"></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,7 +265,7 @@ class syntax_plugin_pluginrepo_table extends SyntaxPlugin
|
|||||||
}
|
}
|
||||||
$min = $tag['cnt'];
|
$min = $tag['cnt'];
|
||||||
}
|
}
|
||||||
$this->cloud_weight($tags, $min, $max, 5);
|
$this->cloudWeight($tags, $min, $max, 5);
|
||||||
|
|
||||||
ksort($tags);
|
ksort($tags);
|
||||||
if (count($tags) > 0) {
|
if (count($tags) > 0) {
|
||||||
@ -284,7 +287,7 @@ class syntax_plugin_pluginrepo_table extends SyntaxPlugin
|
|||||||
* @param int $max
|
* @param int $max
|
||||||
* @param int $levels
|
* @param int $levels
|
||||||
*/
|
*/
|
||||||
public function cloud_weight(&$tags, $min, $max, $levels)
|
public function cloudWeight(&$tags, $min, $max, $levels)
|
||||||
{
|
{
|
||||||
// calculate tresholds
|
// calculate tresholds
|
||||||
$tresholds = [];
|
$tresholds = [];
|
||||||
|
Reference in New Issue
Block a user