hit counter
This commit is contained in:
parent
b3cb86cd33
commit
62bcc0be74
@ -20,7 +20,6 @@ Social Networks
|
||||
|
||||
- [Twitter](https://twitter.com/bludit)
|
||||
- [Facebook](https://www.facebook.com/bluditcms)
|
||||
- [Google+](https://plus.google.com/+Bluditcms)
|
||||
- [Youtube](https://www.youtube.com/channel/UCuLu0Z_CHBsTiYTDz129x9Q?view_as=subscriber)
|
||||
|
||||
Requirements
|
||||
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hallo",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Gute Nacht",
|
||||
"hello": "Hallo",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hola",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Salut",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Cześć",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -359,5 +359,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Привет",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -364,5 +364,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Merhaba",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -363,5 +363,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Вітаю",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
@ -362,5 +362,6 @@
|
||||
"good-night": "Good night",
|
||||
"hello": "Hello",
|
||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||
"select-cover-image": "Select cover image"
|
||||
"select-cover-image": "Select cover image",
|
||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
|
||||
}
|
7
bl-plugins/hit-counter/languages/en.json
Normal file
7
bl-plugins/hit-counter/languages/en.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Hit Counter",
|
||||
"description": "Show the number of visits or unique visitors in the sidebar of your site."
|
||||
}
|
||||
}
|
10
bl-plugins/hit-counter/metadata.json
Normal file
10
bl-plugins/hit-counter/metadata.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.2",
|
||||
"releaseDate": "2018-10-20",
|
||||
"license": "MIT",
|
||||
"compatible": "3.2",
|
||||
"notes": ""
|
||||
}
|
85
bl-plugins/hit-counter/plugin.php
Normal file
85
bl-plugins/hit-counter/plugin.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
class pluginHitCounter extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'label'=>'Hit Counter',
|
||||
'showUniqueVisitors'=>false
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Check if the plugin Simple Stats is activated
|
||||
if (!pluginActivated('pluginSimpleStats')) {
|
||||
// Show an alert about the dependency of the plugin
|
||||
$html = '<div class="alert alert-warning" role="alert">';
|
||||
$html .= $L->get('This plugin depends on the following plugins.');
|
||||
$html .= '<ul class="m-0"><li>Simple Stats</li></ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
// Hidden form buttons. Save and Cancel buttons.
|
||||
$this->formButtons = false;
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Show the description of the plugin in the settings
|
||||
$html = '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $this->description();
|
||||
$html .= '</div>';
|
||||
|
||||
// Label of the plugin to show in the sidebar
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
// Form "select" element for enable or disable Unique visitors properties
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Show unique visitors').'</label>';
|
||||
$html .= '<select name="showUniqueVisitors">';
|
||||
$html .= '<option value="true" '.($this->getValue('showUniqueVisitors')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('showUniqueVisitors')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteSidebar()
|
||||
{
|
||||
// Init counter to 0
|
||||
$counter = 0;
|
||||
|
||||
// Check if the plugin Simple Stats is activated
|
||||
if (pluginActivated('pluginSimpleStats')) {
|
||||
// Get the object of the plugin Simple Stats
|
||||
global $plugins;
|
||||
$simpleStats = $plugins['all']['pluginSimpleStats'];
|
||||
$currentDate = Date::current('Y-m-d');
|
||||
|
||||
if ($this->getValue('showUniqueVisitors')) {
|
||||
// Get the unique visitors from today
|
||||
$counter = $simpleStats->uniqueVisitors($currentDate);
|
||||
} else {
|
||||
// Get the visits from today
|
||||
$counter = $simpleStats->visits($currentDate);
|
||||
}
|
||||
}
|
||||
|
||||
// Show in the sidebar the number of visitors
|
||||
$html = '<div class="plugin plugin-hit-counter">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<div class="counter">'.$counter.'</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user