1
0
Fork 0
SemmelstatzR/semmelstatzR-templates.php
2011-12-19 18:47:48 +00:00

124 Zeilen
6 KiB
PHP

<?php
/**
* file semmelstatzR_templates.php
*
* @package SemmelstatzR
* @version $Rev$
* @since 1.0.0
* @author SEM-Team
* @copyright (c)2011 SEM-Team
* @link http://sourceforge.net/projects/semmelstatz/
* @license http://www.gnu.org/licenses/gpl-3.0.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*
*/
/**
* based upon semmelstatz
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
*
* @license http://www.gnu.org/licenses/gpl-2.0.html
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
if(!current_user_can('manage_statz')) {
die(semr_i18n("Restricted Area"));
}
// entry format: functionname, needed param, type of return, remarks, manual example (no function call)
$aTemplates = array(
array("sem_showTotalPosts", "", semr_i18n("Integer"), semr_i18n("Number of all Posts"), ""),
array("sem_showTotalComments", "", semr_i18n("Integer"), semr_i18n("Number of all Comments"), ""),
array("sem_showTotalUsers", "", semr_i18n("Integer"), semr_i18n("Total Number of all visitors since statistics started"), ""),
array("sem_showAverageUserPerDay", "", semr_i18n("Decimal"), semr_i18n("Average of daily visitors"), ""),
array("sem_showFirstPostDate", "", semr_i18n("Date (d.m.y)"), semr_i18n("Date of the first post"), ""),
array("sem_showPostDays", "", semr_i18n("Integer"), semr_i18n("Days since first post"), ""),
array("sem_showFirstCommentDate", "", semr_i18n("Date (d.m.y)"), semr_i18n("Date of the first comment"), ""),
array("sem_showCommentDays", "", semr_i18n("Integer"), semr_i18n("Days since first comment"), ""),
array("sem_showPostsPerDay", "", semr_i18n("Decimal"), semr_i18n("Average of posts per day"), ""),
array("sem_showCommentsPerDay", "", semr_i18n("Decimal"), semr_i18n("Average of comments per day"), ""),
array("sem_showNumCommenters", "", semr_i18n("Integer"), semr_i18n("Total of all commentators"), ""),
array("sem_showStatzStartDate", "", semr_i18n("Date (d.m.y)"), semr_i18n("Date of commencement of statistics"), ""),
array("sem_showStatzDays", "", semr_i18n("Integer"), semr_i18n("Period of the statistics in days"), ""),
array("sem_showNumUsersOnline", "", semr_i18n("Integer"), semr_i18n("Number of users online"), ""),
array("sem_showLastComments", "10", semr_i18n("Formatted list"), semr_i18n("The 'n' newest comments with author, post, sorted by date desc<br/>CSS-ID: #lastcomments"), "n/a"),
array("sem_showLastPosts", "10", semr_i18n("Formatted list"), semr_i18n("The 'n' newest posts with title, sorted bei date desc<br/>CSS_ID: #lastposts"), "n/a"),
array("sem_showMostReads", "10", semr_i18n("Formatted list"), semr_i18n("'n' most readed posts/pages with hits in brackets<br/>CSS-ID: #mostreads"), "n/a"),
array("sem_showPostHitsInLoop", "get_the_ID()", semr_i18n("Integer"), semr_i18n("Shows count of hits of a post. Only works in the LOOP"), "only in LOOP")
);
print "<form>";
print "<div class='wrap'>";
print "<div id='icon-template' class='icon32'><br /></div>";
print "<h2>SemmelstatzR &gt; ".semr_i18n("Template-Functions")."</h2>";
print "<br />";
print "<table class='statzelement'>";
print "<thead>";
print "<tr>";
print "<th style='text-align:left;'>".semr_i18n("Function")."</th>";
print "<th style='text-align:left;width:26em;'>".semr_i18n("Syntax")."</th>";
print "<th style='text-align:left;'>".semr_i18n("Returns")."</th>";
print "<th style='text-align:left;'>".semr_i18n("Example")."</th>";
print "<th style='text-align:left;'>".semr_i18n("Remarks")."</th>";
print "</tr>";
print "</thead>";
print "<tbody>";
// loop the functions array
foreach ($aTemplates as $value) {
if(empty($value[4])) {
$funcret = call_user_func($value[0]);
} else {
$funcret = $value[4];
}
print "<tr>";
print "<td>$value[0]</td>";
print "<td><input type='text' value='<?php $value[0]($value[1]); ?>' class='regular-text' /></td>";
print "<td>$value[2]</td>";
print "<td>$funcret</td>";
print "<td>$value[3]</td>";
print "</tr>";
}
print "<tr>";
print "<td colspan='5'>";
print semr_i18n("All functions (except the last one) you have to use outside the LOOP. Display of blog index page will be incorrect if semmelstatzR is deactivated and if you do not check for the existence of the templatefunctions using <code>if (function_exists...</code>");
/*
print "S&auml;mtliche Funktionen (bis auf die letzte) sind au&szlig;erhalb des LOOPS zu verwenden. Wird
SEMMELSTATZ deaktiviert, und die Verf&uuml;gbarkeit der Templatefunktion ist nicht mittels
<code>if (function_exists...</code> sichergestellt, wird die Indexseite des Blogs fehlerhaft bzw.
&uuml;berhaupt nicht dargestellt.";
*
*/
print "</td>";
print "</tr>";
print "</tbody>";
print "</table>";
print "<hr />";
if (function_exists('sem_showCopyright')) sem_showCopyright();
print "</div>";
print "</form>";
?>