Пример #1
0
<?php

if (!defined('IN_CMS')) {
    exit;
}
/**
 * Image manipulation plugin for Wolf CMS <http://www.wolfcms.org> based on the Kohana Image.
 *
 * @package Plugins
 * @subpackage image
 *
 * @author Devi Mandiri <devi[dot]mandiri[at]gmail[dot]com>
 * @license UNLICENSE - http://unlicense.org
 *
 * Kohana license refer to http://kohanaframework.org/license
 */
Plugin::setInfos(array('id' => 'image', 'type' => 'both', 'title' => __('Image'), 'description' => __('Image manipulation using GD library. Allows images to be resized, cropped, etc.'), 'version' => '1.0.1', 'license' => 'Unlicense', 'author' => 'Devi Mandiri', 'website' => 'http://github.com/devi/wolf-image', 'update_url' => 'http://devi.web.id/wolf-plugin-versions.xml', 'require_wolf_version' => '0.7.3'));
AutoLoader::addFile('Image', PLUGINS_ROOT . '/image/image.class.php');
Plugin::addController('image', '', false, false);
// manipulate image on the fly
Dispatcher::addRoute(array('/wolfimage?:any' => '/plugin/image/wolfimage/$1'));
Пример #2
0
<?php

if (!defined('IN_CMS')) {
    exit;
}
Plugin::setInfos(array('id' => 'adduserdata', 'title' => 'Add user data', 'description' => 'Add data to the user table', 'version' => '0.1.0', 'license' => 'MIT', 'author' => 'svanlaere', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml', 'require_wolf_version' => '0.7.6'));
AutoLoader::addFile('Kint', PLUGINS_ROOT . DS . 'adduserdata/kint/kint.class.php');
Plugin::addController('adduserdata', 'User data', 'admin_view', true);
Observer::observe('user_after_add', 'add_user_key');
function add_user_key($user_name, $user_id)
{
    // some random string
    $random = sha1(microtime() . rand());
    // insert random string into user_key colomn
    Record::update('User', array('user_key' => $random), 'id = :user_id', array(':user_id' => (int) $user_id));
}
Пример #3
0
/**
 * Root location where Banner plugin lives.
 */
define('BANNER_ROOT', URI_PUBLIC.'wolf/plugins/banner');

//	watch for banner requests
Observer::observe('page_requested', 'banner_catch_click');
Observer::observe('page_requested', 'banner_count_display');
Observer::observe('page_requested', 'banner_catch_json_request');


// Add the plugin's tab and controller
Plugin::addController('banner', __('Banners'),'banner_view,banner_new,banner_edit,banner_delete,banner_settings');

// Load the Comment class into the system.
AutoLoader::addFile('Banner', CORE_ROOT.'/plugins/banner/Banner.php');

//Plugin::addJavascript('banner', 'banner/js/jquery.maskedinput-1.2.2.min.js');

function bannerBySize($div,$width,$height) {

	$imguri = Plugin::getSetting('imguri','banner');
	$cssclass = Plugin::getSetting('cssclass','banner');
	

	if (!$banner = Banner::findBySize($width,$height)) return "<!-- could not load banner -->";
	$banner->dcount++;
	$banner->updated = date('Y-m-d H:i:s');
	$banner->save();
	$banner->image = "/{$imguri}/{$banner->image}";
	
Пример #4
0
 private static function registerModel()
 {
     AutoLoader::addFile('CalendarEvent', CALENDAR_ROOT . '/models/CalendarEvent.php');
 }
Пример #5
0
 * @package Plugins
 * @subpackage comment
 *
 * @author Philippe Archambault <*****@*****.**>
 * @author Bebliuc George <*****@*****.**>
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Philippe Archambault, Bebliuc George & Martijn van der Kleijn, 2008
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
Plugin::setInfos(array('id' => 'comment', 'title' => __('Comments'), 'description' => __('Provides interface to add page comments.'), 'version' => '1.2.1', 'license' => 'GPL', 'author' => 'Philippe Archambault', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml', 'require_wolf_version' => '0.5.5'));
/**
 * Root location where Comment plugin lives.
 */
define('COMMENT_ROOT', URI_PUBLIC . 'wolf/plugins/comment');
// Load the Comment class into the system.
AutoLoader::addFile('Comment', CORE_ROOT . '/plugins/comment/Comment.php');
// Add the plugin's tab and controller
Plugin::addController('comment', __('Comments'));
// Observe the necessary events.
Observer::observe('view_page_edit_plugins', 'comment_display_dropdown');
Observer::observe('page_found', 'comment_save');
Observer::observe('view_backend_list_plugin', 'comment_display_moderatable_count');
if (Plugin::isEnabled('statistics_api')) {
    Observer::observe('stats_comment_after_add', 'StatisticsEvent::registerEvent');
}
/**
 * Allows for a dropdown box with comment status on the edit page view in the backend.
 *
 * @param Page $page The object instance for the page that is being edited.
 */
function comment_display_dropdown(&$page)
Пример #6
0
	'author'      => 'Shannon Brooks',
	'website'     => 'http://www.brooksworks.com/',
	'require_wolf_version' => '0.7.2'
));

//	define paths
define ('FACTS_PLUGIN_ROOT',CORE_ROOT.'/plugins/facts');

//	watch for requests
Observer::observe('page_requested', 'facts_catch_click');

// Add the plugin's tab and controller
Plugin::addController('facts', __('Facts'),'facts_view,facts_new,facts_edit,facts_delete,facts_settings');

// Load the class into the system.
AutoLoader::addFile('Fact', CORE_ROOT.'/plugins/facts/Fact.php');

// redirect urls already set up
function facts_catch_click($args) {

	//	check for fact click
	if (preg_match('#^/fact-supporting-info/(\d+)$#i',$args,$matches)) {
		
		//	update the click count
		$id = (int)$matches[1];
		if (!$fact = Fact::findById($id)) return $args;
		$fact->clicks++;
		$fact->save();
		
		//	redirect to the requested url
		header ('HTTP/1.1 301 Moved Permanently', true);
Пример #7
0
 * @package frog
 * @subpackage plugin.fsearch
 *
 * @author Andrew Crookston <*****@*****.**>
 * @version 0.1.0
 * @since Frog version 0.9.5
 * @license http://www.gnu.org/licenses/gpl.html GPL License
 * @copyright Andrew Crookston, 2009
 *
 * @todo Only supports text in the Body-part. Should be able to choose fields via settings
 * @todo Known issue: Will not filter out markup like Textile or Markdown. Filters out HTML and PHP etc..
 * @todo Add a disable.php for rolling back the database changes when disabling the plugin
 */
Plugin::setInfos(array('id' => 'fsearch', 'title' => 'FSearch - Frog MySQL Search', 'description' => 'Provides MySQL full-text search capabilities.', 'version' => '1.1.0', 'license' => 'GPLv3', 'author' => 'Andrew Crookston (CA Systems)', 'website' => 'http://www.casystems.se', 'update_url' => 'http://www.casystems.se/frog-plugin-versions.xml', 'require_frog_version' => '0.9.5'));
// Load the FSearch class into the system
AutoLoader::addFile('FSearch', CORE_ROOT . '/plugins/fsearch/FSearch.php');
// Add observers for page editing
Observer::observe('view_page_edit_plugins', 'fsearch_display_select');
Observer::observe('part_edit_after_save', 'fsearch_clean_contents');
/**
 * Retrieve an array with all pages matching the search phrase.
 * 
 * @param Search $search A string containing MySQL full-text search query.
 * @return Array Returns an array of Page objects, if any.
 */
function fsearch($search)
{
    $pages = FSearch::search(array('search' => $search, 'limit' => 10));
    return $pages;
}
/**
Пример #8
0
 // DEFINE AND LOAD STUFF
 global $pawUsers, $pawUsers_FrontendObserver;
 define("pawUsers_URL", PLUGINS_URI . "paw_users/");
 define("pawUsers_PATH", dirname(__FILE__));
 define("pawUsers_STATUS", "Alpha");
 define("pawUsers_VERSION", "0.1.0");
 require_once "system/func.general.php";
 require_once "system/func.users.php";
 // ADD CLASSES
 AutoLoader::addFile("UserController", pawUsers_PATH . "/system/controller.user.php");
 AutoLoader::addFile("LoginController", pawUsers_PATH . "/system/controller.login.php");
 AutoLoader::addFile("pawUsers", pawUsers_PATH . "/system/class.users.php");
 AutoLoader::addFile("pawUserFields", pawUsers_PATH . "/system/class.fields.php");
 AutoLoader::addFile("pawBlacklist", pawUsers_PATH . "/system/class.blacklist.php");
 AutoLoader::addFile("pawPermissions", pawUsers_PATH . "/system/class.permissions.php");
 AutoLoader::addFile("Parsedown", pawUsers_PATH . "/system/class.parsedown.php");
 // INIT CLASS
 $pawUsers = new pawUsers();
 $pawUsers->_set();
 $pawUsers_FrontendObserver = true;
 if ($pawUsers->config["frontend_observer"] == 1) {
     $pawUsers_FrontendObserver = false;
 }
 // START FRONT-END OBSERVER
 function paw_users_frontend($path)
 {
     global $pawUsers, $pawUsers_FrontendObserver;
     $pawUsers->load();
     if (!defined("CMS_BACKEND") && $pawUsers_FrontendObserver === false) {
         // ACCOUNT FORMS
         if (isset($_POST["account"]) && isset($_POST["account"]["pawusers"]) && $_POST["account"]["pawusers"] == "account-observer") {
Пример #9
0
    die;
}
define("DASHBOARD_LOG_EMERG", 0);
define("DASHBOARD_LOG_ALERT", 1);
define("DASHBOARD_LOG_CRIT", 2);
define("DASHBOARD_LOG_ERR", 3);
define("DASHBOARD_LOG_WARNING", 4);
define("DASHBOARD_LOG_NOTICE", 5);
define("DASHBOARD_LOG_INFO", 6);
define("DASHBOARD_LOG_DEBUG", 7);
/*
|	REGISTER WIDGET
*/
AutoLoader::addFile("DateDifference", dirname(__FILE__) . DS . "DateDifference.php");
AutoLoader::addFile("DashboardLogEntry", dirname(__FILE__) . DS . "DashboardLogEntry.php");
AutoLoader::addFile("DashboardEvents", dirname(__FILE__) . DS . "DashboardEvents.php");
DashboardWidgets::addWidget(array("id" => "events", "title" => "Event Logbook", "description" => __("Keep up to date with what is happening with your site."), "enable" => "dashboard_events_widget_enable", "disable" => "dashboard_events_widget_disable", "uninstall" => "dashboard_events_widget_uninstall"), "dashboard_events_widget_render");
// INIT CLASS
global $dashboardEvents;
$dashboardEvents = new DashboardEvents();
/*
|	ENABLE EVENTS WIDGET
*/
function dashboard_events_widget_enable()
{
    $conn = Record::getConnection();
    $driver = strtolower($conn->getAttribute(PDO::ATTR_DRIVER_NAME));
    // MySQL SCHEMA
    if ($driver === "mysql") {
        $conn->exec("CREATE TABLE " . TABLE_PREFIX . "dashboard_log(\n\t\t\t\tid          INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tident       CHAR(16) NOT NULL,\n\t\t\t\tpriority    INT NOT NULL,\n\t\t\t\tmessage     VARCHAR(255),\n\t\t\t\tusername    VARCHAR(64),\n\t\t\t\tcreated_on  DATETIME DEFAULT NULL,\n\t\t\t\tPRIMARY KEY (id)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
    }
Пример #10
0
<?php

/*
|	Dashboard - Wolf CMS Dashboard Plugin
|	@file		./widgets/rss_reader/index.php
|	@author		SamBrishes <*****@*****.**>
|	@version	1.1.1 [1.1.0] - Alpha
|
|	@license	X11 / MIT License
|	@copyright	Copyright © 2015 SamBrishes, pytesNET
*/
if (!defined("IN_CMS")) {
    die;
}
/*
|	REGISTER WIDGET
*/
AutoLoader::addFile("DashboardRSSReader", dirname(__FILE__) . DS . "class.rss-reader.php");
DashboardWidgets::addWidget(array("id" => "rss_reader", "size" => 1, "title" => "RSS Feed Reader", "description" => __("A small RSS Feed Reader"), "settings" => array("fetch_method" => "javascript", "rss_url" => "http://www.wolfcms.org/rss.xml", "show_items" => 3, "max_chars" => 235)), "DashboardRSSReader::renderWidget", "DashboardRSSReader::renderSettings");
Observer::observe("dashboard_load_css", "DashboardRSSReader::loadStylesheet");
Observer::observe("dashboard_load_js", "DashboardRSSReader::loadJavascript");
Пример #11
0
	'require_wolf_version' => '0.7.2'
));

//	define paths
define ('DOWNLOADS_PLUGIN_ROOT',CORE_ROOT.'/plugins/downloads');

//	watch for download requests
Observer::observe('page_requested', 'downloads_catch_click');

// Add the plugin's tab and controller
Plugin::addController('downloads', __('Download Manager'),'downloads_view,downloads_new,downloads_edit,downloads_delete,downloads_settings');

// Load the class into the system.
AutoLoader::addFile('Download', CORE_ROOT.'/plugins/downloads/Download.php');
AutoLoader::addFile('DownloadTag', CORE_ROOT.'/plugins/downloads/DownloadTag.php');
AutoLoader::addFile('DownloadTagConnection', CORE_ROOT.'/plugins/downloads/DownloadTagConnection.php');

// redirect urls already set up
function downloads_catch_click($args) {

	//	check for download
	if (preg_match('#^/download-file/(\d+)#i',$args,$matches)) {
		
		//	update the click count of the banner
		$id = (int)$matches[1];
		if (!$download = Download::findById($id)) return $args;
		$download->downloads++;
		$download->save();
		
		//	redirect to the requested url
		header ('HTTP/1.1 301 Moved Permanently', true);
Пример #12
0
<?php

defined('IN_CMS') || exit;
Plugin::setInfos(array('id' => 'ckeditor', 'title' => __('CKEditor'), 'description' => __('CKEditor Wysiwyg filter'), 'version' => '2.1.2', 'license' => 'GPLv3', 'author' => 'andrewmman', 'website' => 'http://www.wolfcms.org/forum/topic1957.html', 'update_url' => 'http://andrewmman.byethost7.com/wolfplugins.xml', 'require_wolf_version' => '0.7.5', 'type' => 'both'));
Filter::add('ckeditor', 'ckeditor/filter/Ckeditor.php');
Plugin::addController('ckeditor', 'CKEditor', '', false);
AutoLoader::addFile('CkeditorPublicController', PLUGINS_ROOT . DS . 'ckeditor' . DS . 'classes' . DS . 'CkeditorPublicController.php');
AutoLoader::addFile('CkeditorPluginsController', PLUGINS_ROOT . DS . 'ckeditor' . DS . 'CkeditorPluginsController.php');
if (AuthUser::isLoggedIn()) {
    $CKFILTER_URI = '/wolf/plugins/ckeditor/';
    $CKPLUGINS_URI = $CKFILTER_URI . 'plugins/';
    // Routes needed by the filter to fetch user setup/settings and use filemanager
    Dispatcher::addRoute(array($CKFILTER_URI . 'ckeditor_config.js' => 'plugin/ckeditor/ck_config', $CKFILTER_URI . 'filemanager/:any' => 'plugin/ckeditor/filemanager/$1'));
    // Routes for custom plugins using CkeditorPluginsController
    Dispatcher::addRoute(array($CKPLUGINS_URI . 'wolf_pages.js' => 'ckeditor_plugins/wolf_pages'));
}
Observer::observe('dispatch_route_found', 'ckeditor_filter_setup');
function ckeditor_filter_setup()
{
    $config_path = USE_MOD_REWRITE ? 'ckeditor/' : '../../?/wolf/plugins/ckeditor/';
    $controllers = '(page|snippet)';
    $actions = '(add|edit)';
    $pattern = '/^' . ADMIN_DIR . '\\/' . $controllers . '\\/' . $actions . '/';
    if (preg_match($pattern, CURRENT_URI)) {
        Plugin::addJavascript('ckeditor', 'scripts/ckeditor/ckeditor.js');
        Plugin::addJavascript('ckeditor', 'scripts/init.js');
        /* nasty way of including scripts */
        Plugin::$javascripts[] = $config_path . 'ckeditor_config.js';
        // load it AFTER ckeditor_config!
        //         Plugin::addJavascript('ckeditor', 'scripts/user/config.js');
    }
Пример #13
0
 /**
  * Add a controller (tab) to the administration
  *
  * @param plugin_id     string  The folder name of the plugin
  * @param label         string  The tab label
  * @param permissions   string  List of roles that will have the tab displayed
  *                              separate by coma ie: 'administrator,developer'
  * @param show_tab      boolean Either 'true' or 'false'. Defaults to true.
  *
  * @return void
  */
 static function addController($plugin_id, $label, $permissions = false, $show_tab = true)
 {
     if (!isset(self::$plugins_infos[$plugin_id])) {
         return;
     }
     $class_name = Inflector::camelize($plugin_id) . 'Controller';
     $file = CORE_ROOT . '/plugins/' . $plugin_id . '/' . $class_name . '.php';
     if (!file_exists($file)) {
         if (defined('DEBUG') && DEBUG) {
             throw new Exception('Plugin controller file not found: ' . $file);
         }
         return false;
     }
     self::$controllers[$plugin_id] = (object) array('label' => ucfirst($label), 'class_name' => $class_name, 'file' => $file, 'permissions' => $permissions, 'show_tab' => $show_tab);
     AutoLoader::addFile($class_name, self::$controllers[$plugin_id]->file);
     return true;
 }
Пример #14
0
 /**
  * Add a controller (tab) to the administration
  *
  * @param plugin_id     string  The folder name of the plugin
  * @param label         string  The tab label
  * @param permissions   string  List of roles that will have the tab displayed
  *                              separate by coma ie: 'administrator,developer'
  * @param show_tab      boolean Either 'true' or 'false'. Defaults to true.
  *
  * @return void
  */
 static function addController($plugin_id, $label, $permissions = false, $show_tab = true)
 {
     $class_name = Inflector::camelize($plugin_id) . 'Controller';
     self::$controllers[$plugin_id] = (object) array('label' => ucfirst($label), 'class_name' => $class_name, 'file' => CORE_ROOT . '/plugins/' . $plugin_id . '/' . $class_name . '.php', 'permissions' => $permissions, 'show_tab' => $show_tab);
     AutoLoader::addFile($class_name, self::$controllers[$plugin_id]->file);
 }
Пример #15
0
<?php

if (!defined('IN_CMS')) {
    exit;
}
if (!defined('CALENDAR_USE_STORED_PROCEDURE')) {
    define('CALENDAR_USE_STORED_PROCEDURE', true);
}
Plugin::setInfos(array('id' => 'calendar', 'title' => __('Calendar'), 'description' => __('Calendar'), 'version' => '0.4', 'license' => 'GPL', 'author' => 'Jacek Ciach', 'require_wolf_version' => '0.7.8', 'website' => 'https://code.google.com/p/wolfcms-calendar-plugin/', 'update_url' => 'https://wolfcms-calendar-plugin.googlecode.com/svn/calendar-version.xml'));
define('CALENDAR_VIEWS', 'calendar/views');
Plugin::addController('calendar', __('Calendar'), 'admin_view', true);
AutoLoader::addFile('CalendarEvent', CORE_ROOT . '/plugins/calendar/models/CalendarEvent.php');
Behavior::add('calendar', 'calendar/behaviour.php');
function showCalendar($slug, $date = null)
{
    $date_begin = new DateTime($date);
    $date_begin->modify("first day of this month");
    $date_begin->modify("-1 week");
    $date_begin = $date_begin->format('Y-m-d');
    $date_end = new DateTime($date);
    $date_end->modify("last day of this month");
    $date_end->modify("+1 week");
    $date_end = $date_end->format('Y-m-d');
    $events = CalendarEvent::generateAllEventsBetween($date_begin, $date_end);
    $events_map = array();
    foreach ($events as $event) {
        $events_map[$event->value][] = $event->getTitle();
    }
    $calendar = new View(PLUGINS_ROOT . DS . CALENDAR_VIEWS . '/calendar_table', array('base_path' => BASE_URL . $slug, 'date' => $date, 'map' => $events_map));
    $calendar->display();
}
Пример #16
0
<?php

/*
|	Dashboard - Wolf CMS Dashboard Plugin
|	@file		./index.php
|	@author		SamBrishes <*****@*****.**>
|	@version	1.1.1 [1.1.0] - Alpha
|
|	@license	X11 / MIT License
|	@copyright	Copyright © 2015 SamBrishes, pytesNET
|				Copyright © 2011-2015 Martijn van der Kleijn <*****@*****.**>
|				Copyright © 2008-2011 Mika Tuupola
*/
if (!defined("IN_CMS")) {
    die;
}
define("WOLF_DASHBOARD", dirname(__FILE__));
define("WOLF_PATH_WIDGETS", PATH_PUBLIC . "wolf/plugins/dashboard/widgets/");
// SET PLUGIN INFOS
Plugin::setInfos(array("id" => "dashboard", "title" => "Dashboard", "description" => __("A Dashboard Page for your Wolf CMS administration."), "version" => "1.1.1", "license" => "MIT / X11", "author" => "SamBrishes, Martijn van der Kleijn (original Mika Tuupola)", "website" => "http://www.github.com/SamBrishes/wolfcms-dashboard", "require_wolf_version" => "0.8.3", "type" => "backend", "update_url" => "http://www.pytes.net/plugins/wolfcms.plugins.xml"));
AutoLoader::addFile("DashboardWidgets", dirname(__FILE__) . "/system/DashboardWidgets.php");
Plugin::addController("dashboard", __("Dashboard"), "admin_view", true);
Observer::observe("page_requested", "DashboardWidgets::loadWidgets");
Observer::observe("dispatch_route_found", "DashboardWidgets::loadWidgets");