exit; } /* Copyright 2008, 2009 Vanilla Forums Inc. This file is part of Garden. Garden 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. Garden 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 Garden. If not, see <http://www.gnu.org/licenses/>. Contact Vanilla Forums Inc. at support [at] vanillaforums [dot] com */ // Define the plugin: $PluginInfo['Debugger'] = array('Description' => 'The debugger plugin displays database queries, their benchmarks, and page processing benchmarks at the bottom of each screen of the application.', 'Version' => '1.0', 'RequiredApplications' => FALSE, 'RequiredTheme' => FALSE, 'RequiredPlugins' => FALSE, 'HasLocale' => FALSE, 'RegisterPermissions' => array('Plugins.Debugger.View', 'Plugins.Debugger.Manage'), 'PluginUrl' => 'http://vanillaforums.org/addons/debugger', 'Author' => "Mark O'Sullivan", 'AuthorEmail' => '*****@*****.**', 'AuthorUrl' => 'http://markosullivan.ca'); // Install the debugger database. $tmp = Gdn::FactoryOverwrite(TRUE); Gdn::FactoryInstall(Gdn::AliasDatabase, 'Gdn_DatabaseDebug', dirname(__FILE__) . DS . 'class.database.debug.php', Gdn::FactorySingleton, array('Database')); Gdn::FactoryOverwrite($tmp); unset($tmp); class DebuggerPlugin extends Gdn_Plugin { // Specifying "Base" as the class name allows us to make the method get called for every // class that implements a base class's method. For example, Base_Render_After // would allow all controllers that call Controller.Render() to have that method // be called. It saves you from having to go: // Table_Render_After, Row_Render_After, Item_Render_After, // SignIn_Render_After, etc. and it essentially *_Render_After public function Base_Render_Before($Sender) { $Sender->AddCssFile('/plugins/Debugger/style.css'); } public function Base_AfterBody_Handler($Sender) {
include_once $Gdn_Path; } // Include the application's hooks. $Hooks_Path = PATH_APPLICATIONS . DS . $ApplicationFolder . DS . 'settings' . DS . 'class.hooks.php'; if (file_exists($Hooks_Path)) { include_once $Hooks_Path; } } unset($Gdn_EnabledApplications); unset($Gdn_Path); unset($Hooks_Path); // If there is a hooks file in the theme folder, include it. $ThemeName = C('Garden.Theme', 'default'); $ThemeHooks = PATH_THEMES . DS . $ThemeName . DS . 'class.' . strtolower($ThemeName) . 'themehooks.php'; if (file_exists($ThemeHooks)) { include_once $ThemeHooks; } // Set up the plugin manager (doing this early so it has fewer classes to // examine to determine if they are plugins). Gdn::FactoryInstall(Gdn::AliasPluginManager, 'Gdn_PluginManager', PATH_LIBRARY . DS . 'core' . DS . 'class.pluginmanager.php', Gdn::FactorySingleton); Gdn::PluginManager()->IncludePlugins(); Gdn::PluginManager()->RegisterPlugins(); Gdn::FactoryOverwrite($FactoryOverwriteBak); unset($FactoryOverwriteBak); Gdn::Authenticator()->StartAuthenticator(); /// Include a user-defined bootstrap. if (file_exists(PATH_ROOT . DS . 'conf' . DS . 'bootstrap.after.php')) { require_once PATH_ROOT . DS . 'conf' . DS . 'bootstrap.after.php'; } // Include "Render" functions now - this way pluggables and custom confs can override them. require_once PATH_LIBRARY_CORE . DS . 'functions.render.php';
if (!is_array($FileUndefinedTranslation)) { $FileUndefinedTranslation = array(); } $Index = count($FileUndefinedTranslation); $FileUndefinedTranslation[$Index]['Path'] = $Path; $FileUndefinedTranslation[$Index]['Codes'] = $Codes; ++$Count; if ($MaxScanFiles > 0 && $Count >= $MaxScanFiles) { break; } } if ($SkipTranslated) { $T = Gdn::FactoryOverwrite(True); $DefaultLocale = new Gdn_Locale(C('Garden.Locale'), $Applications, array()); Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', PATH_LIBRARY_CORE . '/class.locale.php', Gdn::FactorySingleton, $DefaultLocale); Gdn::FactoryOverwrite($T); } // save it foreach ($UndefinedTranslation as $File => $FileUndefinedTranslation) { $Directory = dirname($File); if (!is_dir($Directory)) { mkdir($Directory, 0777, True); } $FileContent = ''; foreach ($FileUndefinedTranslation as $Index => $InfoArray) { $Codes = $InfoArray['Codes']; if (count($Codes) == 0) { continue; } $RelativePath = $InfoArray['Path']; $FileContent .= "\n\n// {$RelativePath}";
public function Gdn_Dispatcher_BeforeDispatch_Handler($Sender) { if (C('Plugins.LocaleDeveloper.CaptureDefinitions')) { // Install the developer locale. $_Locale = new DeveloperLocale(Gdn::Locale()->Current(), C('EnabledApplications'), C('EnabledPlugins')); $tmp = Gdn::FactoryOverwrite(TRUE); Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', NULL, Gdn::FactorySingleton, $_Locale); Gdn::FactoryOverwrite($tmp); unset($tmp); } }
{ $this->EventArguments['Code'] = $Code; $this->FireEvent('BeforeTranslate'); $Result = parent::Translate($Code, $Default); return $Result; } } $TcLocale = Gdn::Locale(); if (is_null($TcLocale)) { $CurrentLocale = C('Garden.Locale', 'en-CA'); $EnabledApplicationFolders = Gdn::ApplicationManager()->EnabledApplicationFolders(); $EnabledPluginFolders = Gdn::PluginManager()->EnabledPluginFolders(); $TcLocale = new TranslationCollectorLocale($CurrentLocale, $EnabledApplicationFolders, $EnabledPluginFolders); $Overwrite = Gdn::FactoryOverwrite(True); Gdn::FactoryInstall(Gdn::AliasLocale, 'TranslationCollectorLocale', Null, Gdn::FactorySingleton, $TcLocale); Gdn::FactoryOverwrite($Overwrite); } } class TranslationCollectorPlugin implements Gdn_IPlugin { private $_Definition = array(); private $_EnabledApplication = 'Dashboard'; private $_SkipApplications = array(); public function __construct() { $this->_Definition = self::GetLocaleDefinitions(); $this->_SkipApplications = C('Plugins.TranslationCollector.SkipApplications', array()); } public static function GetLocaleDefinitions() { $Locale = Gdn::Locale();