A simple framework that all plugins should extend. Aside from the implementation of Gdn_IPlugin, this class provides some convenience methods to make plugin development easier and faster.
Since: 2.0
Author: Tim Gunter (tim@vanillaforums.com)
Inheritance: extends Gdn_Pluggable, implements Gdn_IPlugin
Beispiel #1
0
 /**
  * Plugin initialization.
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Get keys from config
     $this->privateKey = c('Recaptcha.PrivateKey');
     $this->publicKey = c('Recaptcha.PublicKey');
 }
 public function __construct()
 {
     parent::__construct();
     if (!C('Garden.Locales.DeveloperMode', FALSE)) {
         SaveToConfig('Garden.Locales.DeveloperMode', TRUE);
     }
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $AnalyticsServer = C('Garden.Analytics.Remote', 'analytics.vanillaforums.com');
     $AnalyticsServer = str_replace(array('http://', 'https://'), '', $AnalyticsServer);
     $this->AnalyticsServer = $AnalyticsServer;
     $this->TickExtra = array();
 }
Beispiel #4
0
 /**
  * QnAPlugin constructor.
  */
 public function __construct()
 {
     parent::__construct();
     if (Gdn::addonManager()->isEnabled('Reactions', \Vanilla\Addon::TYPE_ADDON) && c('Plugins.QnA.Reactions', true)) {
         $this->Reactions = true;
     }
     if ((Gdn::addonManager()->isEnabled('Reputation', \Vanilla\Addon::TYPE_ADDON) || Gdn::addonManager()->isEnabled('badges', \Vanilla\Addon::TYPE_ADDON)) && c('Plugins.QnA.Badges', true)) {
         $this->Badges = true;
     }
 }
 public function __construct()
 {
     parent::__construct();
     if (Gdn::PluginManager()->CheckPlugin('Reactions') && C('Plugins.QnA.Reactions', TRUE)) {
         $this->Reactions = TRUE;
     }
     if (Gdn::ApplicationManager()->CheckApplication('Reputation') && C('Plugins.QnA.Badges', TRUE)) {
         $this->Badges = TRUE;
     }
 }
 /**
  * PocketsPlugin constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // Switch our HTML wrapper when we're in a table view.
     if (c('Vanilla.Discussions.Layout') == 'table') {
         // Admin checks add a column.
         $useAdminChecks = c('Vanilla.AdminCheckboxes.Use') && Gdn::session()->checkPermission('Garden.Moderation.Manage');
         $colspan = c('Plugins.Pockets.Colspan', $useAdminChecks ? 6 : 5);
         $this->Locations['BetweenDiscussions']['Wrap'] = ['<tr><td colspan="' . $colspan . '">', '</td></tr>'];
     }
 }
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     if (function_exists('ValidateUsernameRegex')) {
         $this->ValidateUsernameRegex = ValidateUsernameRegex();
     } else {
         $this->ValidateUsernameRegex = "[\\d\\w_]{3,20}";
     }
     // Whether to handle drawing quotes or leave it up to some other plugin
     $this->HandleRenderQuotes = c('Plugins.Quotes.RenderQuotes', true);
 }
 /**
  * Setup some variables for instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->mediaCache = null;
     $this->mediaCacheExpire = 60 * 60 * 6;
     $this->AssetPath = Asset('/plugins/editor');
     $this->pluginInfo = Gdn::pluginManager()->getPluginInfo('editor', Gdn_PluginManager::ACCESS_PLUGINNAME);
     $this->ForceWysiwyg = c('Plugins.editor.ForceWysiwyg', false);
     // Check for additional formats
     $this->EventArguments['formats'] =& $this->Formats;
     $this->fireEvent('GetFormats');
 }
 /**
  * Permission checks & property prep.
  */
 public function __construct()
 {
     parent::__construct();
     $this->_MediaCache = NULL;
     $this->CanUpload = Gdn::Session()->CheckPermission('Plugins.Attachments.Upload.Allow', FALSE);
     $this->CanDownload = Gdn::Session()->CheckPermission('Plugins.Attachments.Download.Allow', FALSE);
     if ($this->CanUpload) {
         $PermissionCategory = CategoryModel::PermissionCategory(Gdn::Controller()->Data('Category'));
         if (!GetValue('AllowFileUploads', $PermissionCategory, TRUE)) {
             $this->CanUpload = FALSE;
         }
     }
 }
   public function __construct() {
      parent::__construct();
      
      // 2.0.18+
      // Ensure that when ProxyConnect is turned on, we always have its SearchPath indexed
      try {
         $ProxyConnectSearchPathName = 'ProxyConnect RIMs';
         $CustomSearchPaths = Gdn::PluginManager()->SearchPaths(TRUE);

         if (!in_array($ProxyConnectSearchPathName, $CustomSearchPaths)) {
            $InternalPluginFolder = $this->GetResource('internal');
            Gdn::PluginManager()->AddSearchPath($InternalPluginFolder, 'ProxyConnect RIMs');
         }
      } catch (Exception $e) {}
   }
 /**
  * Permission checks & property prep.
  */
 public function __construct()
 {
     parent::__construct();
     if (!class_exists('MediaModel')) {
         require __DIR__ . '/class.mediamodel.php';
     }
     $this->_MediaCache = null;
     $this->CanUpload = checkPermission('Plugins.Attachments.Upload.Allow');
     $this->CanDownload = checkPermission('Plugins.Attachments.Download.Allow');
     if ($this->CanUpload) {
         $PermissionCategory = CategoryModel::permissionCategory(Gdn::controller()->data('Category'));
         if (!val('AllowFileUploads', $PermissionCategory, true)) {
             $this->CanUpload = false;
         }
     }
 }
 /**
  * Setup some variables for instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->mediaCache = null;
     $this->mediaCacheExpire = 60 * 60 * 6;
     $this->AssetPath = Asset('/plugins/editor');
     $this->pluginInfo = Gdn::pluginManager()->getPluginInfo('editor', Gdn_PluginManager::ACCESS_PLUGINNAME);
     $this->ForceWysiwyg = c('Plugins.editor.ForceWysiwyg', false);
     // Check upload permissions
     $this->canUpload = Gdn::session()->checkPermission('Plugins.Attachments.Upload.Allow', false);
     if ($this->canUpload) {
         $PermissionCategory = CategoryModel::permissionCategory(Gdn::controller()->data('Category'));
         if (!val('AllowFileUploads', $PermissionCategory, true)) {
             $this->canUpload = false;
         }
     }
     // Check against config, too
     if (!c('Garden.AllowFileUploads', false)) {
         $this->canUpload = false;
     }
 }
 public function __construct()
 {
     parent::__construct();
     // If cloudflare isn't telling us a client IP, bust outta here!
     $CloudflareClientIP = val('HTTP_CF_CONNECTING_IP', $_SERVER, NULL);
     if (is_null($CloudflareClientIP)) {
         return;
     }
     $RequestAddress = Gdn::Request()->RequestAddress();
     $CloudflareRequest = FALSE;
     foreach ($this->CloudflareSourceIPs as $CloudflareIPRange) {
         // Not a cloudflare origin server
         if (!ip_in_range($RequestAddress, $CloudflareIPRange)) {
             continue;
         }
         Gdn::Request()->RequestAddress($CloudflareClientIP);
         $CloudflareRequest = TRUE;
         break;
     }
     // Let people know that the CF plugin is turned on.
     if ($CloudflareRequest && !headers_sent()) {
         header("X-CF-Powered-By: CF-Vanilla v" . $this->GetPluginKey('Version'));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->allowModeratorIgnore = C('Plugins.Ignore.AllowModeratorIgnore', TRUE);
     $this->FireEvent('Init');
 }
Beispiel #15
0
 public function __construct($Class = 'BBCode')
 {
     parent::__construct();
     $this->Class = $Class;
 }
 public function __construct($Sender = '')
 {
     parent::__construct($Sender, self::$ApplicationFolder);
 }
Beispiel #17
0
 /**
  * The public constructor of the class.
  */
 public function __construct()
 {
     $this->safeStyles = c('Garden.Html.SafeStyles');
     parent::__construct();
 }
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->Replacement = c('Plugins.CivilTongue.Replacement', '');
 }
Beispiel #19
0
 /**
  * Loads and instantiates the model.
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     require_once dirname(__FILE__) . '/LikeModel.php';
     $this->LikeModel = new LikeModel();
 }
Beispiel #20
0
 public function Base_Render_Before($Sender)
 {
     if (property_exists($Sender, 'Form') && $Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
         $Sender->AddCssFile('plugins/Morf/design/morf.css');
         $Sender->AddJsFile('plugins/Morf/js/jquery.placeheld.js');
         $Language = ArrayValue(0, explode('-', Gdn::Locale()->Current()));
         foreach (array($Language, 'en') as $Language) {
             $LanguageJsFile = 'vendors/jquery.dynDateTime/lang/calendar-' . $Language . '.js';
             if (file_exists(Gdn_Plugin::GetResource($LanguageJsFile))) {
                 $Sender->AddDefinition('CalendarLanguage', $Language);
                 break;
             }
         }
         $Session = Gdn::Session();
         if ($Session->CheckPermission('Plugins.Morf.Upload.Allow')) {
             $Sender->AddJsFile('plugins/Morf/js/jquery-fieldselection.js');
             $Sender->AddJsFile('plugins/Morf/js/jquery.uploader.js');
         }
         $Sender->AddJsFile('plugins/Morf/js/morf.js');
         $Sender->AddDefinition('SessionUserID', $Session->UserID);
     }
 }
 public function __construct()
 {
     $this->LocalePath = PATH_UPLOADS . '/LocaleDeveloper';
     $this->Form = new Gdn_Form();
     parent::__construct();
 }
 public function __construct()
 {
     parent::__construct();
     $this->ReportEnabled = C('Plugins.Reporting.ReportEnabled', TRUE);
     $this->AwesomeEnabled = C('Plugins.Reporting.AwesomeEnabled', TRUE);
 }
 /**
  * Setup some variables and change emoji set.
  */
 public function __construct()
 {
     parent::__construct();
 }
 public function __construct()
 {
     parent::__construct();
     $this->defaultMessage = "<b>Howdy, Stranger!</b>\n" . "It looks like you've been lurking for a while.\n\n" . "If you register, we will remember what you have read and notify you about new comments. " . "You will also be able to participate in discussions.\n\n" . "So if you'd like to get involved, register for an account, it'll only take you a minute!";
 }