public function __construct()
 {
     $this->_check();
     $this->setLayout("backend");
     $this->assignToLayout("sidebar", new View("../../plugins/paw_users/admin/sidebar"));
     Observer::observe("view_backend_layout_head", "UserController::_loadCSS");
 }
 /**
  * Registers the plugin and controller in the system as well as the observers.
  */
 public static function Init()
 {
     // Register plugin
     Plugin::setInfos(array('id' => self::PLUGIN_ID, 'title' => __('Page Part Forms'), 'description' => __('Allows to create custom page part forms'), 'version' => self::PLUGIN_VERSION, 'license' => 'AGPL', 'author' => 'THE M', 'website' => 'http://github.com/them/frog_page_part_forms/', 'update_url' => 'http://github.com/them/frog_page_part_forms/raw/master/frog-plugins.xml', 'require_frog_version' => '0.9.5'));
     // Register controller
     Plugin::addController(self::PLUGIN_ID, __('Page Part Forms'), 'administrator, developer', true);
     // Add extra scripting for JSON
     Plugin::addJavascript(self::PLUGIN_ID, "labs_json.js");
     // The callbacks for the backend
     Observer::observe('view_page_page_metadata', __CLASS__ . '::callback_view_page_page_metadata');
     Observer::observe('view_page_edit_popup', __CLASS__ . '::callback_view_page');
 }
 public function __construct()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url("login"));
         die;
     }
     // GET SETTINGS
     $settings = array_merge(array("grid-size" => 3, "widget-position" => serialize(array("events" => array("part" => 1, "order" => 1), "rss_reader" => array("part" => 2, "order" => 1)))), Plugin::getAllSettings("dashboard"));
     // UNSERIALIZE SETTINGS
     foreach ($settings as $key => $value) {
         if (is_string($value)) {
             if (@unserialize($value) !== false) {
                 $settings[$key] = unserialize($value);
             }
         }
     }
     $this->settings = $settings;
     // OBSERVER
     DashboardWidgets::init($settings["widget-position"]);
     Observer::observe("view_backend_layout_head", "DashboardController::loadFiles");
 }
Example #4
0
     */
    Observer::notify('after_page_load');
    /**
     * Блок служит для помещения в него виджета с произволным PHP кодом,
     * который выполняется после загрузки HTML
     */
    Block::run('POST');
});
Observer::observe('view_page_edit_plugins', function ($page) {
    $blocks = Widget_Manager::get_blocks_by_layout($page->layout());
    echo View::factory('widgets/page/edit', array('page' => $page, 'pages' => Model_Page_Sitemap::get(TRUE)->exclude(array($page->id))->flatten(), 'widgets' => Widget_Manager::get_widgets_by_page($page->id), 'blocks' => Arr::get($blocks, $page->layout())));
});
Observer::observe('page_add_after_save', function ($page) {
    $post_data = Request::current()->post('widgets');
    if (!empty($post_data['from_page_id'])) {
        Widget_Manager::copy($post_data['from_page_id'], $page->id);
    }
});
Observer::observe('page_edit_after_save', function ($page) {
    $post_data = Request::current()->post('widget');
    if (!is_array($post_data)) {
        return;
    }
    foreach ($post_data as $widget_id => $block) {
        Widget_Manager::update_location_by_page($page->id, $widget_id, $block);
    }
});
Observer::observe(array('widget_after_delete', 'widget_set_location', 'widget_after_edit', 'widget_after_add'), function () {
    Cache::instance()->delete_tag('layout_blocks');
});
Route::set('handler', 'handler/<id>', array('id' => '[0-9]+'))->defaults(array('directory' => 'system', 'controller' => 'handler'));
Example #5
0
 * @package Plugins
 * @subpackage shopping-cart
 *
 * @author Stefan Miller <*****@*****.**>
 * Copyright (C) 2014 Stefan Miller <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 *
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
/**
 * Root location where Files plugin lives.
 */
define('SC_FILES_ROOT', PATH_PUBLIC . 'wolf/plugins/shopping_cart');
/**
 * Root location where files get uploaded to as an absolute path.
 */
define('SC_FILES_DIR', CMS_ROOT . DS . 'public');
/**
 * Root location where files get uploaded to as a URL.
 */
define('BASE_SC_FILES_DIR', URL_PUBLIC . 'public');
// DO NOT EDIT AFTER THIS LINE -----------------------------------------------
Plugin::setInfos(array('id' => 'shopping_cart', 'title' => 'Shopping Cart', 'description' => 'A shopping cart inventory administration module', 'version' => '0.0.1', 'author' => 'Stefan Miller', 'website' => 'http://www.artisticdigital.com', 'require_wolf_version' => '0.7.0'));
Plugin::addController('shopping_cart', __('Shopping Cart'), 'admin_view', true);
// Make sure possible hack attempts get registered if the statistics API is available.
if (Plugin::isEnabled('statistics_api')) {
    Observer::observe('stats_shopping_cart_hack_attempt', 'StatisticsEvent::registerEvent');
}
Example #6
0
/**
 * Provides Page not found page types.
 *
 * @package Plugins
 * @subpackage page-not-found
 *
 * @author Philippe Archambault <*****@*****.**>
 * @copyright Philippe Archambault, 2008
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
Plugin::setInfos(array('id' => 'page_not_found', 'title' => __('Page not found'), 'description' => __('Provides Page not found page types.'), 'version' => '1.0.0', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml'));
Behavior::add('page_not_found', '');
Observer::observe('page_not_found', 'behavior_page_not_found');
/**
 * Presents browser with a custom 404 page.
 */
function behavior_page_not_found($url)
{
    $page = Page::findByBehaviour('page_not_found');
    if (is_a($page, 'Page')) {
        header("HTTP/1.0 404 Not Found");
        header("Status: 404 Not Found");
        $page->_executeLayout();
        exit;
        // need to exit otherwise true error page will be sent
    }
}
|	@file		./index.php
|	@author		svanlaere
|	@version	1.0.0 [1.0.0] - Stable
|
|	@license	X11 / MIT License
|	@copyright	Copyright © 2015 pytesNET
*/
if (!defined("IN_CMS")) {
    exit;
}
// SET PLUGIN INFOS
Plugin::setInfos(array("id" => "themer", "title" => "Themer", "description" => __("A WordPress AdminTheme configuration plugin."), "version" => "1.0.0", "license" => "GPL", "author" => "svanlaere", "website" => "http://www.wolfcms.org/forum/", "require_wolf_version" => "0.7.5", "type" => "backend"));
Plugin::addController("themer", __("Wordpress admin theme"), "admin_view", false);
if (Plugin::isEnabled("themer")) {
    if (!defined("THEMER")) {
        define("THEMER", PLUGINS_ROOT . "/themer");
    }
    if (!defined("THEMER_VIEW")) {
        define("THEMER_VIEW", "themer/views/");
    }
    function themer_customize_admin_theme($path)
    {
        $admin_theme = Setting::get("theme");
        $settings = Plugin::getAllSettings("themer");
        if ($admin_theme == "wordpress-3.8") {
            echo new View(THEMER . DS . "views" . DS . "head", array("color" => $settings["color"], "sidebar_width" => $settings["sidebar_width"]));
        }
        return $path;
    }
    Observer::observe("view_backend_layout_head", "themer_customize_admin_theme");
}
Example #8
0
            if (empty($folder['sections'])) {
                continue;
            }
            $folder_section = Model_Navigation::get_section($folder['name'], $ds_section);
            foreach ($folder['sections'] as $id => $section) {
                $section->add_to_menu($folder_section);
            }
        }
        foreach ($sections_list as $type => $sections) {
            foreach ($sections as $id => $section) {
                $section->add_to_menu($ds_section);
            }
        }
        $_create_section = Model_Navigation::get_section(__('Create section'), $ds_section, 999);
        foreach ($types as $id => $type) {
            $_create_section->add_page(new Model_Navigation_Page(array('name' => $type, 'url' => Route::get('datasources')->uri(array('controller' => 'section', 'directory' => 'datasources', 'action' => 'create', 'id' => $id)), 'permissions' => $id . '.section.create')));
        }
        unset($sections_list, $folders, $root_section);
    } catch (Exception $ex) {
    }
});
Observer::observe('update_search_index', function () {
    $ds_ids = Datasource_Data_Manager::get_all();
    foreach ($ds_ids as $ds_id => $data) {
        $ds = Datasource_Data_Manager::load($ds_id);
        if (!$ds->loaded()) {
            continue;
        }
        $ds->update_index();
    }
});
Example #9
0
 * ru_register_page()           Use this on the page you want to have for registrations eg mysite.com/register
 * ru_login_page()		Use this on the page you want to have for logging in eg mysite.com/login
 * ru_confirm_page()		This is the page a user clicks through to validate their account
 * ru_auth_required_page()	Users who are not authorised to view the requested page will be redirected here
 * ru_reset_page()		Will allow a user to have an email sent to them with a lnk to reset their password
 * ru_logout()			A page to logout a user and return them to the hompage
 */
Plugin::setInfos(array('id' => 'registered_users', 'title' => 'Registered Users', 'description' => 'Allows you to manage new user registrations on your site.', 'version' => '1.0-dev', 'author' => 'Martijn van der Kleijn', 'require_wolf_version' => '0.7.7'));
// Only when the plugin is enabled
if (Plugin::isEnabled('registered_users')) {
    Plugin::addController('registered_users', 'Registered Users', 'admin_edit', true);
    Observer::observe('view_page_edit_plugins', 'registered_users_access_page_checkbox');
    Observer::observe('page_add_after_save', 'registered_users_add_page_permissions');
    Observer::observe('page_edit_after_save', 'registered_users_edit_page_permissions');
    Observer::observe('page_delete', 'registered_users_delete_page_permissions');
    Observer::observe('page_found', 'registered_users_page_found');
    Behavior::add('login_page', '');
    include 'classes/RegisteredUser.php';
    include 'classes/RUCommon.php';
    include 'observers/RUObservers.php';
    // @todo Switch this stupid stuff to use routes
    function ru_login_page()
    {
        $registered_users_class = new RegisteredUser();
        $loginpage = $registered_users_class->login_page();
        echo $loginpage;
    }
    function ru_register_page()
    {
        $registered_users_class = new RegisteredUser();
        $registerpage = $registered_users_class->registration_page();
Example #10
0
<?php

require_once "ImageResize.php";
Plugin::setInfos(array('id' => 'image_resize', 'title' => 'Image Resize', 'description' => 'Allows for dynamic resizing of images.', 'version' => '1.3.1', 'license' => 'GPL 3.0', 'author' => 'Peter Gassner', 'website' => 'http://www.naehrstoff.ch/code/image-resize-for-frog', 'update_url' => 'http://frog.naehrstoff.ch/plugin-versions.xml', 'require_frog_version' => '0.9.4'));
// Listen for page_not_found messages
Observer::observe('page_not_found', 'image_resize_try_resizing');
// Add the controller without showing a tab (fourth option)
Plugin::addController('image_resize', 'Image Resize', '', FALSE);
/**
 * Execute this function on page_not_found.
 * If the request is for an image file,
 * resize the image.
 */
function image_resize_try_resizing()
{
    // Require that visitor be logged in and has
    // permission to create files
    if (!AuthUser::isLoggedIn()) {
        AuthUser::load();
    }
    if (!AuthUser::hasPermission('administrator,developer,editor')) {
        return false;
    }
    // Check that gd library is available
    if (!ImageResize::gd_available()) {
        return false;
    }
    if (preg_match('#\\.(jpe?g|gif|png|wbmp)$#i', CURRENT_URI)) {
        // If requested file appears to be an accepted format, create the new image
        if (image_resize_scale(CURRENT_URI) && !DEBUG) {
            // If Frog isn't debugging, it writes to a file; redirect to it
Example #11
0
<?php

defined('SYSPATH') or die('No direct script access.');
Observer::observe('part_before_save', function ($part) {
    if (!$part->loaded()) {
        return;
    }
    $data = array('part_id' => $part->id, 'created_on' => date('Y-m-d H:i:s'), 'content' => Arr::get($part->original_values(), 'content'));
    DB::insert('part_revision')->columns(array_keys($data))->values($data)->execute();
});
Observer::observe('part_controls', function () {
    $url = Route::get('backend')->uri(array('controller' => 'part', 'action' => 'revision', 'id' => '<%=id%>'));
    echo '<a class="part-revision-button btn btn-default btn-xs" href="' . URL::site($url) . '">' . __('Part revision') . '</a>';
});
Example #12
0
 Observer::observe('layout_after_delete', 'dashboard_log_layout_delete');
 Observer::observe('layout_after_add', 'dashboard_log_layout_add');
 Observer::observe('layout_after_edit', 'dashboard_log_layout_edit');
 Observer::observe('snippet_after_delete', 'dashboard_log_snippet_delete');
 Observer::observe('snippet_after_add', 'dashboard_log_snippet_add');
 Observer::observe('snippet_after_edit', 'dashboard_log_snippet_edit');
 Observer::observe('comment_after_delete', 'dashboard_log_comment_delete');
 Observer::observe('comment_after_add', 'dashboard_log_comment_add');
 Observer::observe('comment_after_edit', 'dashboard_log_comment_edit');
 Observer::observe('comment_after_approve', 'dashboard_log_comment_approve');
 Observer::observe('comment_after_unapprove', 'dashboard_log_comment_unapprove');
 Observer::observe('plugin_after_enable', 'dashboard_log_plugin_enable');
 Observer::observe('plugin_after_disable', 'dashboard_log_plugin_disable');
 Observer::observe('admin_login_success', 'dashboard_log_admin_login');
 Observer::observe('admin_login_failed', 'dashboard_log_admin_login_failure');
 Observer::observe('admin_after_logout', 'dashboard_log_admin_logout');
 /* Page */
 function dashboard_log_page_add($page)
 {
     $linked_title = sprintf('<a href="%s">%s</a>', get_url('page/edit/' . $page->id), $page->title);
     $message = __('Page <b>:title</b> was created by :name', array(':title' => $linked_title, ':name' => AuthUser::getRecord()->name));
     dashboard_log_event($message, 'core');
 }
 function dashboard_log_page_edit($page)
 {
     $linked_title = sprintf('<a href="%s">%s</a>', get_url('page/edit/' . $page->id), $page->title);
     $message = __('Page <b>:title</b> was revised by :name', array(':title' => $linked_title, ':name' => AuthUser::getRecord()->name));
     dashboard_log_event($message, 'core');
 }
 function dashboard_log_page_delete($page)
 {
Example #13
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
Plugin::factory('page_not_found', array('title' => 'Page not found', 'description' => 'Provides Page not found type.', 'author' => 'ButscH'))->register();
Observer::observe('page_not_found', function ($message, $params) {
    throw new HTTP_Exception_Front_404($message, $params);
});
Example #14
0
 * @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;
}
/**
 * Adds a 'Make searchable' checkbox on the edit page view in the backend.
 *
 * @param Page $page The object instance for the page that is being edited.
Example #15
0
Plugin::setInfos(array('id' => 'multi_lang', 'title' => __('Multiple Languages'), 'description' => __('Provides language specific content when available based on user preferences.'), 'version' => '1.0.0', 'license' => 'GPL', 'author' => 'Martijn van der Kleijn', 'website' => 'http://freshcms.jules.it/', 'update_url' => 'http://freshcms.jules.it/plugin-versions.xml', 'require_cms_version' => '0.6.0'));
Plugin::addController('multi_lang', __('Multiple Languages'), 'administrator', false);
// Observe the necessary events.
$style = Plugin::getSetting('style', 'multi_lang');
$source = Plugin::getSetting('langsource', 'multi_lang');
if (false !== $style && $style == 'tab') {
    if ($source == 'uri') {
        Observer::observe('page_requested', 'replaceUri');
        Observer::observe('page_found', 'replaceContentByUri');
    } else {
        Observer::observe('page_found', 'replaceContent');
    }
} else {
    if (false !== $style && $style == 'page') {
        if ($source == 'header' || $source == 'preferences') {
            Observer::observe('page_found', 'replaceContent');
        }
    }
}
/**
 * Replaces the content of the 'body' part if a language specific part exists.
 *
 * @param Page $page Page object.
 */
function replaceContent($page)
{
    $source = Plugin::getSetting('langsource', 'multi_lang');
    $style = Plugin::getSetting('style', 'multi_lang');
    if (!$source || !$style) {
        return;
    }
Example #16
0
<?php

defined('SYSPATH') or die('No direct script access.');
if (IS_INSTALLED and ACL::check('system.search.settings')) {
    Observer::observe('view_setting_plugins', function () {
        echo View::factory('search/settings');
    });
    Observer::observe('save_settings', function ($settings) {
        $full_text_search = Arr::path($settings, 'search.full_text_search');
        Config::set('search', 'native', array('full_text_search' => (bool) $full_text_search));
    });
}
Example #17
0
        Observer::notify('log_event', $message, 'funky_cache', 7);
    }
    function funky_cache_show_select($page)
    {
        $enabled = isset($page->funky_cache_enabled) ? $page->funky_cache_enabled : funky_cache_by_default();
        print '
          <p><label for="page_funky_cache_enabled">' . __('Should cache') . '</label>
            <select id="page_funky_cache_enabled" name="page[funky_cache_enabled]">
              <option value="0"' . ($enabled == 0 ? ' selected="selected"' : '') . '>' . __('No') . '</option>
              <option value="1"' . ($enabled == 1 ? ' selected="selected"' : '') . '>' . __('Yes') . '</option>
             </select>
          </p>';
    }
} else {
    /* Stuff for frontend. */
    Observer::observe('page_found', 'funky_cache_create');
    //Observer::observe('page_requested', 'funky_cache_debug');
    function funky_cache_debug($page)
    {
        if (DEBUG) {
            print "Cache miss... ";
        }
    }
    function funky_cache_create($page)
    {
        if ($page->funky_cache_enabled) {
            $data['url'] = URI_PUBLIC . CURRENT_URI . URL_SUFFIX;
            // Correct URL for frontpage - should become index.html
            if ($data['url'] == URI_PUBLIC . URL_SUFFIX) {
                $data['url'] = URI_PUBLIC . 'index' . funky_cache_suffix();
            }
Example #18
0
<?php

defined('SYSPATH') or die('No direct script access.');
/**
 * Set the default cache driver
 */
Cache::$default = defined('CACHE_TYPE') ? CACHE_TYPE : 'file';
Observer::observe('modules::after_load', function () {
    if (IS_INSTALLED and ACL::check('system.cache.settings')) {
        Observer::observe('view_setting_plugins', function () {
            echo View::factory('cache/settings');
        });
        Observer::observe('validation_settings', function ($validation, $filter) {
            $filter->rule('cache.front_page', 'intval')->rule('cache.page_parts', 'intval')->rule('cache.tags', 'intval');
        });
    }
});
Example #19
0
}
/**
 * The FileManager allows users to upload and manipulate files.
 *
 * @package Plugins
 * @subpackage file_manager
 *
 * @author Philippe Archambault <*****@*****.**>
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Philippe Archambault & Martijn van der Kleijn, 2008
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
/**
 * Root location where Files plugin lives.
 */
define('FILES_ROOT', URI_PUBLIC . 'wolf/plugins/file_manager');
/**
 * Root location where files get uploaded to as an absolute path.
 */
define('FILES_DIR', CMS_ROOT . DS . 'public');
/**
 * Root location where files get uploaded to as a URL.
 */
define('BASE_FILES_DIR', URL_PUBLIC . 'public');
// DO NOT EDIT AFTER THIS LINE -----------------------------------------------
Plugin::setInfos(array('id' => 'file_manager', 'title' => __('File Manager'), 'description' => __('Provides interface to manage files from the administration.'), 'version' => '1.0.0', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml'));
Plugin::addController('file_manager', __('Files'), 'file_manager_view');
// Make sure possible hack attempts get registered if the statistics API is available.
if (Plugin::isEnabled('statistics_api')) {
    Observer::observe('stats_file_manager_hack_attempt', 'StatisticsEvent::registerEvent');
}
Example #20
0
    AutoLoader::addFile('Comment', CORE_ROOT . '/plugins/comment/Comment.php');
    Plugin::addController('comment', 'Comments');
    Observer::observe('view_page_edit_plugins', 'comment_display_dropdown');
    function comment_display_dropdown(&$page)
    {
        echo '
		<p><label for="page_comment_status">' . __('Comments') . '</label>
		   <select id="page_comment_status" name="page[comment_status]">
		     <option value="' . Comment::NONE . '"' . ($page->comment_status == Comment::NONE ? ' selected="selected"' : '') . '>&#8212; ' . __('none') . ' &#8212;</option>
		     <option value="' . Comment::OPEN . '"' . ($page->comment_status == Comment::OPEN ? ' selected="selected"' : '') . '>' . __('Open') . '</option>
		     <option value="' . Comment::CLOSED . '"' . ($page->comment_status == Comment::CLOSED ? ' selected="selected"' : '') . '>' . __('Closed') . '</option>
		   </select>
		</p>';
    }
} else {
    Observer::observe('page_found', 'comment_save');
    function comments(&$page)
    {
        global $__FROG_CONN__;
        $comments = array();
        $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'comment WHERE is_approved=1 AND page_id=?';
        $stmt = $__FROG_CONN__->prepare($sql);
        $stmt->execute(array($page->id));
        while ($comment = $stmt->fetchObject('Comment')) {
            $comments[] = $comment;
        }
        return $comments;
    }
    function comments_count(&$page)
    {
        global $__FROG_CONN__;
Example #21
0
    }
}, $plugin);
Observer::observe('user_after_delete', function ($id, $plugin) {
    $ds_id = $plugin->get('user_profile_ds_id');
    $ds = Datasource_Data_Manager::load($ds_id);
    if ($ds === NULL or $ds->type() != 'hybrid') {
        return;
    }
    $doc = $ds->get_empty_document()->load_by('f_profile_id', $id);
    if ($doc->loaded()) {
        $ds->remove_documents(array($doc->id));
    }
}, $plugin);
Observer::observe('view_user_profile_sidebar_list', function ($id, $plugin) {
    $ds_id = $plugin->get('user_profile_ds_id');
    $ds = Datasource_Data_Manager::load($ds_id);
    if ($ds === NULL or $ds->type() != 'hybrid') {
        return;
    }
    $doc = $ds->get_empty_document()->load_by('f_profile_id', $id);
    if ($doc->loaded()) {
        echo View::factory('datasource/hybrid/user_profile', array('fields' => $ds->record()->fields(), 'document' => $doc, 'datasource' => $ds));
    }
}, $plugin);
Observer::observe('datasource_after_remove', function ($id, $plugin) {
    $ds_id = $plugin->get('user_profile_ds_id');
    if ($ds_id == $id) {
        unset($plugin->user_profile_ds_id);
        $plugin->save_settings();
    }
}, $plugin);
Example #22
0
 */
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)
{
    echo '<p><label for="page_comment_status">' . __('Comments') . '</label><select id="page_comment_status" name="page[comment_status]">';
    echo '<option value="' . Comment::NONE . '"' . ($page->comment_status == Comment::NONE ? ' selected="selected"' : '') . '>&#8212; ' . __('none') . ' &#8212;</option>';
    echo '<option value="' . Comment::OPEN . '"' . ($page->comment_status == Comment::OPEN ? ' selected="selected"' : '') . '>' . __('Open') . '</option>';
    echo '<option value="' . Comment::CLOSED . '"' . ($page->comment_status == Comment::CLOSED ? ' selected="selected"' : '') . '>' . __('Closed') . '</option>';
    echo '</select></p>';
}
function comment_display_moderatable_count(&$plugin_name, &$plugin)
Example #23
0
	'version'     => '0.0.2',
	'license'     => 'GPL',
	'author'      => 'Shannon Brooks',
	'website'     => 'http://www.dogdoo.net',
	'require_wolf_version' => '0.7.2'
));

/**
 * 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');
	
Example #24
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));
}
Example #25
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
Observer::observe(array('page_add_after_save', 'page_edit_after_save'), function ($page) {
    if (!empty($page->behavior_id)) {
        $data = Request::current()->post('behavior');
        ORM::factory('Page_Behavior_Setting')->find_by_page($page)->set_page($page)->set('data', $data)->save();
    } else {
        $model = ORM::factory('Page_Behavior_Setting')->find_by_page($page);
        if ($model->loaded()) {
            $model->delete();
        }
    }
});
Observer::observe('modules::after_load', function () {
    Behavior::init();
});
Observer::observe(array('controller_before_page_edit', 'controller_before_page_add'), function () {
    Assets::js('controller.behavior', ADMIN_RESOURCES . 'js/controller/behavior.js', 'global');
});
Example #26
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
/*
* Set current lang
*/
Observer::observe('modules::after_load', function () {
    I18n::lang(Model_User::locale());
});
Example #27
0
<?php

defined('SYSPATH') or die('No direct script access.');
// При сохранении страницы обновление тегов
Observer::observe(array('page_add_after_save', 'page_edit_after_save'), function ($page) {
    $tags = Request::current()->post('page_tags');
    if ($tags !== NULL) {
        Model_Page_Tag::save_by_page($page->id, $tags);
    }
});
// Загрузка шаблона с тегами в блок с метатегами в редактор страницы
Observer::observe('view_page_edit_meta', function ($page) {
    echo View::factory('page/tags', array('tags' => Model_Page_Tag::find_by_page($page->id)));
});
Observer::observe('layout_backend_head_before', function () {
    echo '<script type="text/javascript">var TAG_SEPARATOR = "' . Model_Tag::SEPARATOR . '";</script>';
});
// При выводе списка стран запускается метод custom_filter и передача в него
// Database_query_builder, в этом обсервере можно дополнять этот запрос
Observer::observe('frontpage_custom_filter', function ($sql, $page) {
    $tags = Context::instance()->get('tag');
    if (empty($tags)) {
        return;
    }
    $sql->join(array(Model_Page_Tag::TABLE_NAME, 'pts'), 'inner')->distinct(TRUE)->on('pts.page_id', '=', 'page.id')->join(array(Model_Tag::TABLE_NAME, 'ts'))->on('pts.tag_id', '=', 'ts.id')->where('ts.name', 'in', explode(',', $tags));
});
Example #28
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
Assets_Package::add('core')->css('global', ADMIN_RESOURCES . 'css/common.css')->js(NULL, ADMIN_RESOURCES . 'js/core.min.js', 'backbone')->js('global', ADMIN_RESOURCES . 'js/backend.min.js', 'core');
Assets_Package::add('jquery')->js(NULL, ADMIN_RESOURCES . 'libs/jquery.min.js');
Assets_Package::add('bootstrap')->js(NULL, ADMIN_RESOURCES . 'libs/bootstrap-3.3.1/dist/js/bootstrap.min.js', 'jquery');
Assets_Package::add('underscore')->js(NULL, ADMIN_RESOURCES . 'libs/underscore-min.js', 'jquery');
Assets_Package::add('backbone')->js(NULL, ADMIN_RESOURCES . 'libs/backbone-min.js', 'underscore');
Assets_Package::add('jquery-ui')->js(NULL, ADMIN_RESOURCES . 'libs/jquery-ui/js/jquery-ui.min.js', 'jquery')->css(NULL, ADMIN_RESOURCES . 'libs/jquery-ui/css/jquery-ui.min.css', 'jquery');
Assets_Package::add('notify')->js(NULL, ADMIN_RESOURCES . 'libs/pnotify/jquery.pnotify.min.js', 'jquery')->css(NULL, ADMIN_RESOURCES . 'libs/pnotify/jquery.pnotify.default.css', 'jquery');
Assets_Package::add('dropzone')->css(NULL, ADMIN_RESOURCES . 'libs/dropzone/css/basic.css', 'jquery')->js(NULL, ADMIN_RESOURCES . 'libs/dropzone/dropzone.min.js', 'jquery');
Assets_Package::add('fancybox')->css(NULL, ADMIN_RESOURCES . 'libs/fancybox/jquery.fancybox.css', 'jquery')->js(NULL, ADMIN_RESOURCES . 'libs/fancybox/jquery.fancybox.pack.js', 'jquery');
Assets_Package::add('datepicker')->css(NULL, ADMIN_RESOURCES . 'libs/datepicker/jquery.datetimepicker.css', 'jquery')->js(NULL, ADMIN_RESOURCES . 'libs/datepicker/jquery.datetimepicker.min.js', 'jquery');
Assets_Package::add('prism')->css(NULL, ADMIN_RESOURCES . 'libs/prismjs/prism.css', 'jquery')->js(NULL, ADMIN_RESOURCES . 'libs/prismjs/prism.js', 'jquery');
Assets_Package::add('colorpicker')->css(NULL, ADMIN_RESOURCES . 'libs/colorpicker/css/colorpicker.css', 'jquery')->js(NULL, ADMIN_RESOURCES . 'libs/colorpicker/js/colorpicker.js', 'jquery');
Assets_Package::add('editable')->js(NULL, ADMIN_RESOURCES . 'libs/bootstrap-editable-1.5.1/js/bootstrap-editable.min.js', 'bootstrap');
Assets_Package::add('nestable')->js(NULL, ADMIN_RESOURCES . 'libs/nestable/jquery.nestable.min.js', 'bootstrap');
Assets_Package::add('ace')->js('ace-library', ADMIN_RESOURCES . 'libs/ace/src-min/ace.js', 'global')->js(NULL, ADMIN_RESOURCES . 'js/ace.js', 'global');
Assets_Package::add('steps')->js(NULL, ADMIN_RESOURCES . 'libs/steps/jquery.steps.min.js', 'jquery');
Assets_Package::add('chart')->js(NULL, ADMIN_RESOURCES . 'libs/highcharts/highcharts.js', 'jquery');
Assets_Package::add('ckeditor')->js('ckeditor-library', ADMIN_RESOURCES . 'libs/ckeditor/ckeditor.js', 'jquery')->js(NULL, ADMIN_RESOURCES . 'js/ckeditor.js', 'global');
WYSIWYG::add('ace');
WYSIWYG::add('ckeditor');
// Подключение пакета после загрузки модулей, чтобы определить текущий язык
Observer::observe('modules::after_load', function () {
    Assets_Package::add('select2')->js(NULL, ADMIN_RESOURCES . 'libs/select2/select2.min.js', 'jquery')->js(NULL . I18n::lang_short(), ADMIN_RESOURCES . 'libs/select2/select2_locale_' . I18n::lang_short() . '.js', 'select2');
    Assets_Package::add('validate')->js(NULL, ADMIN_RESOURCES . 'libs/validation/jquery.validate.min.js', 'jquery')->js(NULL . I18n::lang_short(), ADMIN_RESOURCES . 'libs/validation/localization/messages_' . I18n::lang_short() . '.min.js', 'validate');
});
Observer::observe('view_setting_plugins', function () {
    echo View::factory('ace/settings');
});
Example #29
0
}
// DEFINED ONLY FOR BACKWARDS SUPPORT - to be taken out before 0.9.0
$__FROG_CONN__ = $__CMS_CONN__;
Record::connection($__CMS_CONN__);
Record::getConnection()->exec("set names 'utf8'");
Setting::init();
use_helper('I18n');
AuthUser::load();
if (AuthUser::isLoggedIn()) {
    I18n::setLocale(AuthUser::getRecord()->language);
} else {
    I18n::setLocale(Setting::get('language'));
}
// Only add the cron web bug when necessary
if (defined('USE_POORMANSCRON') && USE_POORMANSCRON && defined('POORMANSCRON_INTERVAL')) {
    Observer::observe('page_before_execute_layout', 'run_cron');
    function run_cron()
    {
        $cron = Cron::findByIdFrom('Cron', '1');
        $now = time();
        $last = $cron->getLastRunTime();
        if ($now - $last > POORMANSCRON_INTERVAL) {
            echo $cron->generateWebBug();
        }
    }
}
Plugin::init();
// Setup admin routes
$admin_routes = array('/' . ADMIN_DIR => Setting::get('default_tab'), '/' . ADMIN_DIR . '/' => Setting::get('default_tab'), '/' . ADMIN_DIR . '/:any' => '$1');
Dispatcher::addRoute($admin_routes);
// run everything!
Example #30
0
<?php

$plugin_id = "page_versions";
$controller_name = 'PageVersionsController';
Plugin::setInfos(array('id' => $plugin_id, 'title' => 'Page Versions', 'description' => 'Stores all the previous versions of a page', 'version' => '0.1', 'author' => 'Jules Piccotti', 'website' => 'http://fresh.jules.it/page_versions'));
Plugin::addController($plugin_id, __('Page Versions'), null, false);
Plugin::addJavascript($plugin_id, "page_versions.js");
Behavior::add('version', 'page_versions/page_versions.php');
Behavior::add('current_version', 'page_versions/page_versions.php');
Observer::observe('page_add_after_save', $controller_name . '::callback_page_updated');
Observer::observe('page_edit_after_save', $controller_name . '::callback_page_updated');
Observer::observe('page_before_execute_find', $controller_name . '::callback_filter_out_versions');
//Observer::observe('pages_tree_item_found', $controller_name.'::callback_tree_item_found');