1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 04:40:44 +02:00

SiteInfo renamed and e_shortcode added. Also support for plugin.xml added for menu only installations.

This commit is contained in:
CaMer0n
2009-09-19 17:36:36 +00:00
parent 2ca07156d7
commit d728309c72
9 changed files with 271 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<?php
if (!defined('e107_INIT')) { exit; }
$text = "<div style='text-align:center'>
<a href='http://validator.w3.org/check?uri=".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'><img src='".e_PLUGIN_ABS."siteinfo_menu/images/valid-xhtml11.png' alt='Valid XHTML 1.1!' height='31' width='88' /></a><br />
<a href='http://jigsaw.w3.org/css-validator/validator?uri=".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'><img src='".e_PLUGIN_ABS."siteinfo_menu/images/vcss.png' alt='Valid CSS!' height='31' width='88' /></a>
</div>";
$caption = (file_exists(THEME."images/compliance_menu.png") ? "<img src='".THEME_ABS."images/compliance_menu.png' alt='' /> ".COMPLIANCE_L1 : COMPLIANCE_L1);
$ns->tablerender($caption, $text, 'compliance');
?>

View File

@@ -0,0 +1,83 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/siteinfo/counter_menu.php,v $
| $Revision: 1.1 $
| $Date: 2009-09-19 17:36:35 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
$text = "";
if (isset($pref['statActivate']) && $pref['statActivate'] == true)
{
$pageName = preg_replace("/(\?.*)|(\_.*)|(\.php)/", "", basename (e_SELF));
$logfile = e_PLUGIN."log/logs/logp_".date("z.Y", time()).".php";
if(!is_readable($logfile))
{
if(ADMIN && !$pref['statCountAdmin'])
{
$text = COUNTER_L1;
}
$total = 1;
$unique = 1;
$siteTotal = 1;
$siteUnique = 1;
$totalever = 1;
$uniqueever = 1;
}
else
{
$text = "";
require($logfile);
if($sql -> db_Select("logstats", "*", "log_id='statTotal' OR log_id='statUnique' OR log_id='pageTotal'"))
{
while($row = $sql -> db_Fetch())
{
if($row['log_id'] == "statTotal")
{
$siteTotal += $row['log_data'];
}
else if($row['log_id'] == "statUnique")
{
$siteUnique += $row['log_data'];
}
else
{
$dbPageInfo = unserialize($row['log_data']);
$totalPageEver = ($dbPageInfo[$pageName]['ttlv'] ? $dbPageInfo[$pageName]['ttlv'] : 0);
$uniquePageEver = ($dbPageInfo[$pageName]['unqv'] ? $dbPageInfo[$pageName]['unqv'] : 0);
}
}
}
$total = ($pageInfo[$pageName]['ttl'] ? $pageInfo[$pageName]['ttl'] : 0);
$unique = ($pageInfo[$pageName]['unq'] ? $pageInfo[$pageName]['unq'] : 0);
$totalever = ($pageInfo[$pageName]['ttlv'] ? $pageInfo[$pageName]['ttlv'] : 0) + $totalPageEver + $total;
$uniqueever = ($pageInfo[$pageName]['unqv'] ? $pageInfo[$pageName]['unqv'] : 0) + $uniquePageEver + $unique;
}
$text .= "<b>".COUNTER_L2."</b><br />".COUNTER_L3.": $total<br />".COUNTER_L5.": $unique<br /><br />
<b>".COUNTER_L4."</b><br />".COUNTER_L3.": $totalever<br />".COUNTER_L5.": $uniqueever<br /><br />
<b>".COUNTER_L6."</b><br />".COUNTER_L3.": $siteTotal<br />".COUNTER_L5.": $siteUnique";
$ns->tablerender(COUNTER_L7, $text, 'counter');
unset($dbPageInfo);
}
else
{
if(ADMIN)
{
$text .= "<span class='smalltext'>".COUNTER_L8."</span>";
$ns->tablerender(COUNTER_L7, $text, 'counter');
}
}
?>

View File

@@ -0,0 +1,89 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: e_shortcode.php,v 1.1 2009-09-19 17:36:35 e107coders Exp $
*
* Siteinfo shortcode batch
*/
if (!defined('e107_INIT')) { exit; }
class siteinfo_shortcodes // must match the folder name of the plugin.
{
function sc_sitebutton()
{
$e107 = e107::getInstance();
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $e107->tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON);
//TODO use CSS class?
return '<a href="'.SITEURL.'"><img src="'.$path.'" alt="'.SITENAME.'" /></a>';
}
function sc_sitedisclaimer()
{
$e107 = e107::getInstance();
return $e107->tp->toHtml(SITEDISCLAIMER, true, 'constants defs');
}
function sc_sitename($parm)
{
return ($parm == 'link') ? "<a href='".SITEURL."' title=\"".SITENAME."\">".SITENAME."</a>" : SITENAME;
}
function sc_sitedescription()
{
global $pref;
return SITEDESCRIPTION.(defined('THEME_DESCRIPTION') && $pref['displaythemeinfo'] ? THEME_DESCRIPTION : '');
}
function sc_sitetag()
{
return SITETAG;
}
function sc_logo($parm)
{
parse_str($parm); // Optional {LOGO=file=file_name} or {LOGO=link=url} or {LOGO=file=file_name&link=url}
// Paths to image file, link are relative to site base
if (isset($file) && $file && is_readable($file))
{
$logo = e_HTTP.$file; // HTML path
$path = e_BASE.$file; // PHP path
}
else if (is_readable(THEME.'images/e_logo.png'))
{
$logo = THEME_ABS.'images/e_logo.png'; // HTML path
$path = THEME.'images/e_logo.png'; // PHP path
}
else
{
$logo = e_IMAGE_ABS.'logo.png'; // HTML path
$path = e_IMAGE.'logo.png'; // PHP path
}
$dimensions = getimagesize($path);
$image = "<img class='logo' src='".$logo."' style='width: ".$dimensions[0]."px; height: ".$dimensions[1]."px' alt='".SITENAME."' />\n";
if (isset($link) && $link)
{
if ($link == 'index')
{
$image = "<a href='".e_HTTP."index.php'>".$image."</a>";
}
else
{
$image = "<a href='".e_HTTP.$link."'>".$image."</a>";
}
}
return $image;
}
function sc_theme_disclaimer($parm)
{
global $pref;
return (defined('THEME_DISCLAIMER') && $pref['displaythemeinfo'] ? THEME_DISCLAIMER : '');
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,26 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/siteinfo/languages/English.php,v $
| $Revision: 1.1 $
| $Date: 2009-09-19 17:36:36 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
define("COMPLIANCE_L1", "W3C Compliance");
define("SITEBUTTON_MENU_L1", "Link to us");
define("POWEREDBY_L1", "Powered by");
define("COUNTER_L1", "Admin visits aren't being counted.");
define("COUNTER_L2", "This page today ...");
define("COUNTER_L3", "total");
define("COUNTER_L4", "This page ever ...");
define("COUNTER_L5", "unique");
define("COUNTER_L6", "Site ...");
define("COUNTER_L7", "Counter");
define("COUNTER_L8", "Admin message: <b>Stat logging is disabled.</b><br />To activate, you need to install the Statistic Logging plugin from your <a href='".e_ADMIN."plugin.php'>plugin manager</a>, then activate it from the <a href='".e_PLUGIN."log/admin_config.php'>configuration screen</a>.");
?>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: plugin.xml,v 1.1 2009-09-19 17:36:35 e107coders Exp $ -->
<e107Plugin name="Siteinfo" version="1.0" compatibility="0.8" installRequired="false" >
<folder>siteinfo</folder>
<category>menu</category>
</e107Plugin>

View File

@@ -0,0 +1,34 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/siteinfo/powered_by_menu.php,v $
| $Revision: 1.1 $
| $Date: 2009-09-19 17:36:35 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
$text = "
<div style='text-align: center'>
<div class='spacer'>
<a href='http://e107.org' rel='external'><img src='".e_IMAGE_ABS."button.png' alt='e107' style='border: 0px; width: 88px; height: 31px' /></a>
</div>
<div class='spacer'>
<a href='http://php.net' rel='external'><img src='".e_IMAGE_ABS."generic/php-small-trans-light.gif' alt='PHP' style='border: 0px; width: 88px; height: 31px' /></a>
</div>
<div class='spacer'>
<a href='http://mysql.com' rel='external'><img src='".e_IMAGE_ABS."generic/poweredbymysql-88.png' alt='MySQL' style='border: 0px; width: 88px; height: 31px' /></a>
</div>
</div>";
$ns -> tablerender(POWEREDBY_L1, $text, 'powered_by');
?>

View File

@@ -0,0 +1,22 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/siteinfo/sitebutton_menu.php,v $
| $Revision: 1.1 $
| $Date: 2009-09-19 17:36:36 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
echo "parm=".$parm; //FIXME - just for testing only.
$ns->tablerender(SITEBUTTON_MENU_L1, "<div style='text-align:center'>\n<a href='".SITEURL."'><img src='".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : e_IMAGE_ABS.SITEBUTTON)."' alt='".SITEBUTTON_MENU_L1."' style='border: 0px; width: 88px; height: 31px' /></a>\n</div>", 'sitebutton');
?>