/** * * Process the MagicWords * * @param Parser $parser * @param string $text * @param StripState $stripState * @return boolean */ function onParserBeforeInternalParse(&$parser, &$text, &$stripState) { $config = \PageAttachment\Configuration\StaticConfiguration::getInstance(); $pageAttachmentDefinedMagicWord = false; $allowAttachments = false; $magicWord1 = \MagicWord::get(self::MagicWord_NOATTACHMENTS); if ($magicWord1->matchAndRemove($text)) { $pageAttachmentDefinedMagicWord = true; $allowAttachments = false; } $magicWord2 = \MagicWord::get(self::MagicWord_ALLOWATTACHMENTS); if ($magicWord2->matchAndRemove($text)) { $pageAttachmentDefinedMagicWord = true; $allowAttachments = true; } if ($pageAttachmentDefinedMagicWord == true) { if ($allowAttachments == true) { if ($config->isAllowAttachmentsUsingMagicWord()) { $parser->mOutput->addHeadItem('<script> pageAttachment__ALLOW_ATTACHMENTS__ = true; </script>'); } } else { if ($config->isDisallowAttachmentsUsingMagicWord()) { $parser->mOutput->addHeadItem('<script> pageAttachment__ALLOW_ATTACHMENTS__ = false; </script>'); } } } return true; }
function __construct($security, $session) { $this->security = $security; $this->session = $session; $this->runtimeConfig = new \PageAttachment\Configuration\RuntimeConfiguration(); $this->staticConfig = \PageAttachment\Configuration\StaticConfiguration::getInstance(); }
function __construct($security, $session, $auditLogManager) { $this->security = $security; $this->session = $session; $this->auditLogManager = $auditLogManager; $this->cacheManager = new \PageAttachment\Cache\CacheManager(); $this->fileManager = new \PageAttachment\File\FileManager($security, $this->cacheManager); $this->notificationManager = \PageAttachment\Notification\NotificationManagerFactory::getNotificationManager(); $this->staticConfig = \PageAttachment\Configuration\StaticConfiguration::getInstance(); }
function __construct($security, $requestHelper, $session, $attachmentManager, $resource) { global $wgUser; $this->security = $security; $this->requestHelper = $requestHelper; $this->session = $session; $this->dateHelper = new \PageAttachment\Utility\DateUtil(); $this->attachmentManager = $attachmentManager; $this->resource = $resource; $this->runtimeConfig = new \PageAttachment\Configuration\RuntimeConfiguration(); $this->fileManager = new \PageAttachment\File\FileManager($this->security); $this->staticConfig = \PageAttachment\Configuration\StaticConfiguration::getInstance(); }