protected function setUp()
 {
     // Create a test file on the file system.
     $this->testFile = tempnam(TMP_FILES, 'SubmissionFile');
     // Mock a press
     import('classes.press.Press');
     $press = new Press();
     $press->setPrimaryLocale('en_US');
     $press->setPath('press-path');
     $press->setId(SUBMISSION_FILE_DAO_TEST_PRESS_ID);
     // Mock a request
     $mockRequest = $this->getMock('PKPRequest', array('getContext'));
     $mockRequest->expects($this->any())->method('getContext')->will($this->returnValue($press));
     Registry::get('request', true, $mockRequest);
     // Register a mock monograph DAO.
     $monographDao = $this->getMock('MonographDAO', array('getById'));
     $monograph = new Monograph();
     $monograph->setId(SUBMISSION_FILE_DAO_TEST_SUBMISSION_ID);
     $monograph->setPressId(SUBMISSION_FILE_DAO_TEST_PRESS_ID);
     $monographDao->expects($this->any())->method('getById')->will($this->returnValue($monograph));
     DAORegistry::registerDAO('MonographDAO', $monographDao);
     // Register a mock genre DAO.
     $genreDao = $this->getMock('GenreDAO', array('getById'));
     DAORegistry::registerDAO('GenreDAO', $genreDao);
     $genreDao->expects($this->any())->method('getById')->will($this->returnCallback(array($this, 'getTestGenre')));
     $this->_cleanFiles();
     $application = PKPApplication::getApplication();
     $request = $application->getRequest();
     if (is_null($request->getRouter())) {
         $router = new PKPRouter();
         $request->setRouter($router);
     }
 }
 /**
  * @covers FormValidatorControlledVocab
  * @covers FormValidator
  */
 public function testIsValid()
 {
     // Test form
     $form = new Form('some template');
     // Mock a ControlledVocab object
     import('lib.pkp.classes.controlledVocab.ControlledVocab');
     $mockControlledVocab = $this->getMock('ControlledVocab', array('enumerate'));
     $mockControlledVocab->setId(1);
     $mockControlledVocab->setAssocType(ASSOC_TYPE_CITATION);
     $mockControlledVocab->setAssocId(333);
     $mockControlledVocab->setSymbolic('testVocab');
     // Set up the mock enumerate() method
     $mockControlledVocab->expects($this->any())->method('enumerate')->will($this->returnValue(array(1 => 'vocab1', 2 => 'vocab2')));
     // Mock the ControlledVocabDAO
     $mockControlledVocabDao = $this->getMock('ControlledVocabDAO', array('getBySymbolic'));
     // Set up the mock getBySymbolic() method
     $mockControlledVocabDao->expects($this->any())->method('getBySymbolic')->with('testVocab', ASSOC_TYPE_CITATION, 333)->will($this->returnValue($mockControlledVocab));
     DAORegistry::registerDAO('ControlledVocabDAO', $mockControlledVocabDao);
     // Instantiate validator
     $validator = new FormValidatorControlledVocab($form, 'testData', FORM_VALIDATOR_REQUIRED_VALUE, 'some.message.key', 'testVocab', ASSOC_TYPE_CITATION, 333);
     $form->setData('testData', '1');
     self::assertTrue($validator->isValid());
     $form->setData('testData', '2');
     self::assertTrue($validator->isValid());
     $form->setData('testData', '3');
     self::assertFalse($validator->isValid());
 }
Exemple #3
0
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     $this->addLocaleData();
     $this->import('pidResourceDAO');
     $this->import('pidHandler');
     $pidResourceDao = new pidResourceDao();
     DAORegistry::registerDAO('pidResourceDAO', $pidResourceDao);
     $this->journal =& Request::getJournal();
     $isEnabled = $this->getEnabled();
     if ($success) {
         if ($isEnabled === true) {
             HookRegistry::register('Template::Author::Submission::Status', array(&$this, 'submissionStatus'));
             HookRegistry::register('Template::sectionEditor::Submission::Status', array(&$this, 'submissionStatus'));
             HookRegistry::register('Template::Article::PID', array(&$this, 'articleTemplate'));
             HookRegistry::register('ArticleDAO::_updateArticle', array(&$this, 'publishedArticlePidHandler'));
             //Older OJS Versions
             HookRegistry::register('articledao::_updatearticle', array(&$this, 'publishedArticlePidHandler'));
             //Newer OJS Versions
         }
         HookRegistry::register('OAIDAOinc::_getRecord', array(&$this, 'OAIRecordsHandler'));
         HookRegistry::register('OAIDAOinc::_listRecords', array(&$this, 'OAIRecordsHandler'));
     }
     return $success;
 }
 /**
  * Register the plugin, if enabled
  * @param $category string
  * @param $path string
  * @return boolean
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         // HookRegistry::register('Installer::postInstall',array(&$this, 'postInstallCallback'));
         if ($this->getEnabled()) {
             $this->addHelpData();
             // Add DAOs
             $this->import('CrosswalkDAO');
             $this->import('Crosswalk');
             $this->import('Search');
             $this->import('SearchIndex');
             $this->import('SearchDAO');
             $crosswalkDao = new CrosswalkDAO();
             DAORegistry::registerDAO('CrosswalkDAO', $crosswalkDao);
             $searchDao = new SearchDAO();
             DAORegistry::registerDAO('SearchDAO', $searchDao);
             /**
              * Set hooks
              */
             // Record handling & harvesting
             HookRegistry::register('Harvester::insertRecord', array(&$this, 'insertRecordCallback'));
             HookRegistry::register('Harvester::updateRecord', array(&$this, 'updateRecordCallback'));
             HookRegistry::register('Harvester::deleteRecord', array(&$this, 'deleteRecordCallback'));
             // User interface
             HookRegistry::register('Templates::Common::Header::Navbar', array(&$this, 'navBarCallback'));
             HookRegistry::register('Template::Admin::Index::SiteManagement', array(&$this, 'siteManagementCallback'));
             HookRegistry::register('LoadHandler', array(&$this, 'loadHandlerCallback'));
             HookRegistry::register('PluginRegistry::loadCategory', array(&$this, 'callbackLoadCategory'));
             // Rebuild index
             HookRegistry::register('rebuildSearchIndex::flush', array(&$this, 'callbackFlush'));
         }
         return true;
     }
     return false;
 }
 /**
  * @see LazyLoadPlugin::register()
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         // Dataverse Study objects
         $this->import('classes.DataverseStudyDAO');
         $dataverseStudyDao = new DataverseStudyDAO($this->getName());
         $returner =& DAORegistry::registerDAO('DataverseStudyDAO', $dataverseStudyDao);
         // Files associated with Dataverse studies
         $this->import('classes.DataverseFileDAO');
         $dataverseFileDao = new DataverseFileDAO($this->getName());
         $returner =& DAORegistry::registerDAO('DataverseFileDAO', $dataverseFileDao);
         // Handler for public (?) access to Dataverse-related information (i.e., terms of Use)
         HookRegistry::register('LoadHandler', array(&$this, 'setupPublicHandler'));
         // Add data citation to submissions & reading tools
         HookRegistry::register('TemplateManager::display', array(&$this, 'handleTemplateDisplay'));
         // Add data citation to article landing page
         HookRegistry::register('Templates::Article::MoreInfo', array(&$this, 'addDataCitationArticle'));
         // Enable TinyMCEditor in textarea fields
         HookRegistry::register('TinyMCEPlugin::getEnableFields', array(&$this, 'getTinyMCEEnabledFields'));
         // Include data policy in About page
         HookRegistry::register('Templates::About::Index::Policies', array(&$this, 'addPolicyLinks'));
         // Add data publication options to author submission suppfile form:
         HookRegistry::register('Templates::Author::Submit::SuppFile::AdditionalMetadata', array(&$this, 'suppFileAdditionalMetadata'));
         HookRegistry::register('authorsubmitsuppfileform::initdata', array(&$this, 'suppFileFormInitData'));
         HookRegistry::register('authorsubmitsuppfileform::readuservars', array(&$this, 'suppFileFormReadUserVars'));
         HookRegistry::register('authorsubmitsuppfileform::execute', array(&$this, 'authorSubmitSuppFileFormExecute'));
         // Add Dataverse deposit options to suppfile form for completed submissions
         HookRegistry::register('Templates::Submission::SuppFile::AdditionalMetadata', array(&$this, 'suppFileAdditionalMetadata'));
         HookRegistry::register('suppfileform::initdata', array(&$this, 'suppFileFormInitData'));
         HookRegistry::register('suppfileform::readuservars', array(&$this, 'suppFileFormReadUserVars'));
         HookRegistry::register('suppfileform::execute', array(&$this, 'suppFileFormExecute'));
         // Notify ArticleDAO of additional metadata fields in suppfile form
         HookRegistry::register('articledao::getAdditionalFieldNames', array(&$this, 'articleMetadataFormFieldNames'));
         // Validate suppfile forms: warn if Dataverse deposit selected but no file uploaded
         HookRegistry::register('authorsubmitsuppfileform::Constructor', array(&$this, 'suppFileFormConstructor'));
         HookRegistry::register('suppfileform::Constructor', array(&$this, 'suppFileFormConstructor'));
         // Metadata form: update cataloguing information. Prevent update if study locked.
         HookRegistry::register('metadataform::Constructor', array(&$this, 'metadataFormConstructor'));
         HookRegistry::register('metadataform::execute', array(&$this, 'metadataFormExecute'));
         // Handle suppfile insertion: prevent duplicate insertion of a suppfile
         HookRegistry::register('suppfiledao::_insertsuppfile', array(&$this, 'handleSuppFileInsertion'));
         // Handle suppfile deletion: only necessary for completed submissions
         HookRegistry::register('suppfiledao::_deletesuppfilebyid', array(&$this, 'handleSuppFileDeletion'));
         // Add form validator to check whether submission includes data files
         HookRegistry::register('authorsubmitstep4form::Constructor', array(&$this, 'addAuthorSubmitFormValidator'));
         // Create study for author submissions
         HookRegistry::register('Author::SubmitHandler::saveSubmit', array(&$this, 'handleAuthorSubmission'));
         // Release or delete studies according to editor decision
         HookRegistry::register('SectionEditorAction::unsuitableSubmission', array(&$this, 'handleUnsuitableSubmission'));
         HookRegistry::register('SectionEditorAction::recordDecision', array(&$this, 'handleEditorDecision'));
         // Release studies on article publication
         HookRegistry::register('articledao::_updatearticle', array(&$this, 'handleArticleUpdate'));
         // Get content for plugin notifications
         HookRegistry::register('NotificationManager::getNotificationContents', array(&$this, 'getNotificationContents'));
     }
     return $success;
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         $this->import('ReportClass.MultiPaperReportDAO');
         $PaperReportDAO = new MultiPaperReportDAO();
         DAORegistry::registerDAO('MultiPaperReportDAO', $PaperReportDAO);
     }
     $this->addLocaleData();
     return $success;
 }
Exemple #7
0
 /**
  * @copydoc PHPUnit_Framework_TestCase::tearDown()
  */
 protected function tearDown()
 {
     // Restore registry keys.
     foreach ($this->getMockedRegistryKeys() as $mockedRegistryKey) {
         Registry::set($mockedRegistryKey, $this->registryBackup[$mockedRegistryKey]);
     }
     // Restore DAOs.
     foreach ($this->getMockedDAOs() as $mockedDao) {
         DAORegistry::registerDAO($mockedDao, $this->daoBackup[$mockedDao]);
     }
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && Config::getVar('general', 'installed')) {
         $this->import('ArticleReportDAO');
         $articleReportDAO = new ArticleReportDAO();
         DAORegistry::registerDAO('ArticleReportDAO', $articleReportDAO);
     }
     $this->addLocaleData();
     return $success;
 }
 protected function setUp()
 {
     // Register a mock monograph DAO.
     $monographDao =& $this->getMock('MonographDAO', array('getMonograph'));
     $monograph = new Monograph();
     $monograph->setId(SUBMISSION_FILE_DAO_TEST_SUBMISSION_ID);
     $monograph->setPressId(SUBMISSION_FILE_DAO_TEST_PRESS_ID);
     $monographDao->expects($this->any())->method('getMonograph')->will($this->returnValue($monograph));
     DAORegistry::registerDAO('MonographDAO', $monographDao);
     $this->_cleanFiles();
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         $this->import('ArticleReportDAO');
         $articleReportDAO = new ArticleReportDAO();
         DAORegistry::registerDAO('ArticleReportDAO', $articleReportDAO);
     }
     $this->addLocaleData();
     return $success;
 }
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         $this->addLocaleData();
         $this->import('PagSeguroDAO');
         $CreditDao =& new PagSeguroDAO();
         DAORegistry::registerDAO('PagSeguroDAO', $CreditDao);
         return true;
     }
     return false;
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     $this->addLocaleData();
     if ($success && $this->getEnabled()) {
         $this->import('classes.BookForReviewDAO');
         $this->import('classes.BookForReviewAuthorDAO');
         $bfrAuthorDao = new BookForReviewAuthorDAO($this->getName());
         DAORegistry::registerDAO('BookForReviewAuthorDAO', $bfrAuthorDao);
         $bfrDao = new BookForReviewDAO($this->getName());
         DAORegistry::registerDAO('BookForReviewDAO', $bfrDao);
         $request = $this->getRequest();
         $journal = $request->getJournal();
         if ($journal) {
             $mode = $this->getSetting($journal->getId(), 'mode');
             $coverPageIssue = $this->getSetting($journal->getId(), 'coverPageIssue');
             $coverPageAbstract = $this->getSetting($journal->getId(), 'coverPageAbstract');
         }
         // Handler for editor books for review pages
         HookRegistry::register('LoadHandler', array($this, 'setupEditorHandler'));
         // Editor link to books for review pages
         HookRegistry::register('Templates::Editor::Index::AdditionalItems', array($this, 'displayEditorHomeLink'));
         // Editor link to book for review metadata in submission view
         HookRegistry::register('Templates::Submission::Metadata::Metadata::AdditionalEditItems', array($this, 'displayEditorMetadataLink'));
         // Append book metadata to book review article
         HookRegistry::register('Templates::Article::Header::Metadata', array($this, 'displayBookMetadata'));
         // Ensure book for review user assignments are transferred when merging users
         HookRegistry::register('UserAction::mergeUsers', array($this, 'mergeBooksForReviewAuthors'));
         // If using book for review cover page as article cover page
         // then include cover page handlers for issue toc and article abstract views
         if ($coverPageIssue) {
             HookRegistry::register('Templates::Issue::Issue::ArticleCoverImage', array($this, 'displayArticleCoverPageIssue'));
         }
         if ($coverPageAbstract) {
             HookRegistry::register('Templates::Article::Article::ArticleCoverImage', array($this, 'displayArticleCoverPageAbstract'));
         }
         // If publishing books available for review and managing book reviewers
         // then include additional links, pages, and handlers
         if ($mode == BFR_MODE_FULL) {
             // Handler for public books for review pages
             HookRegistry::register('LoadHandler', array($this, 'setupPublicHandler'));
             // Navigation bar link to books for review page
             HookRegistry::register('Templates::Common::Header::Navbar::CurrentJournal', array($this, 'displayHeaderLink'));
             // Handler for author books for review pages
             HookRegistry::register('LoadHandler', array($this, 'setupAuthorHandler'));
             // Display author's books for review during submission
             HookRegistry::register('Author::SubmitHandler::saveSubmit', array($this, 'saveSubmitHandler'));
             HookRegistry::register('Templates::Author::Submit::Step5::AdditionalItems', array($this, 'displayAuthorBooksForReview'));
             // Author link to books for review pages
             HookRegistry::register('Templates::Author::Index::AdditionalItems', array($this, 'displayAuthorHomeLink'));
         }
     }
     return $success;
 }
 /**
  * Called when a plugin is registered in the registry
  *
  * @param $category
  *  String. Name of category plugin was registered in.
  * @return boolean
  *  True IFF plugin initialized successfully.  If false, the plugin will not
  *  be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         $this->import('IpSubscriptionsDAO');
         $ipDao = new IpSubscriptionsDAO($this->getName());
         $returner =& DAORegistry::registerDAO('IpSubscriptionsDAO', $ipDao);
         // Grant / deny access based on subscriber IP address
         HookRegistry::register('IssueAction::subscriptionRequired', array($this, 'validSubscriptionIp'));
     }
     return $success;
 }
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         //$this->addLocaleData();
         Locale::requireComponents(array(LOCALE_COMPONENT_PKP_USER));
         $this->import('PopularArticlesDAO');
         $PopularArticlesDAO =& new PopularArticlesDAO();
         $ret =& DAORegistry::registerDAO('PopularArticlesDAO', $PopularArticlesDAO);
     }
     return $success;
 }
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         Registry::set('RpositoryPlugIn', $this);
         HookRegistry::register('articledao::_updatearticle', array(&$this, 'callback_update'));
         HookRegistry::register('publishedarticledao::_updatepublishedarticle', array(&$this, 'callback_update'));
         $this->import('RpositoryDAO');
         $rpositoryDao = new RpositoryDAO();
         DAORegistry::registerDAO('RpositoryDAO', $rpositoryDao);
         return true;
     }
     return false;
 }
Exemple #16
0
 /**
  * Register the plugin, attaching to hooks as necessary.
  * @param $category string
  * @param $path string
  * @return boolean
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             $this->import('StaticPagesDAO');
             $staticPagesDao = new StaticPagesDAO($this->getName());
             $returner =& DAORegistry::registerDAO('StaticPagesDAO', $staticPagesDao);
             HookRegistry::register('LoadHandler', array(&$this, 'callbackHandleContent'));
         }
         return true;
     }
     return false;
 }
 /**
  * Register plugin
  * @return bool
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) {
             return true;
         }
         $this->addLocaleData();
         $this->import('PayPalDAO');
         $payPalDao = new PayPalDAO();
         DAORegistry::registerDAO('PayPalDAO', $payPalDao);
         return true;
     }
     return false;
 }
 private function registerMockCaptchaDAO($returnValueForGetCaptcha)
 {
     // Mock the CaptchaDAO
     $mockCaptchaDAO = $this->getMock('CaptchaDAO', array('getCaptcha', 'deleteObject'));
     // Set up the mock getCaptcha() method
     $mockCaptchaDAO->expects($this->any())->method('getCaptcha')->with('test captcha id')->will($this->returnValue($returnValueForGetCaptcha));
     // Set up the mock deleteObject() method
     if (is_null($returnValueForGetCaptcha)) {
         $mockCaptchaDAO->expects($this->never())->method('deleteObject');
     } else {
         $mockCaptchaDAO->expects($this->any())->method('deleteObject')->with($returnValueForGetCaptcha)->will($this->returnValue(true));
     }
     DAORegistry::registerDAO('CaptchaDAO', $mockCaptchaDAO);
 }
 /**
  * Register the plugin, if enabled; note that this plugin
  * runs under both Journal and Site contexts.
  * @param $category string
  * @param $path string
  * @return boolean
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             HookRegistry::register('TemplateManager::display', array(&$this, 'handleTemplateDisplay'));
             HookRegistry::register('LoadHandler', array(&$this, 'handleLoadHandler'));
             $this->import('Referral');
             $this->import('ReferralDAO');
             $referralDao = new ReferralDAO();
             DAORegistry::registerDAO('ReferralDAO', $referralDao);
         }
         return true;
     }
     return false;
 }
Exemple #20
0
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $isEnabled = $this->getSetting(0, 'enabled');
     $success = parent::register($category, $path);
     if ($success && $isEnabled === true) {
         HookRegistry::register('Templates::Admin::Index::AdminFunctions', array(&$this, 'displayMenuOption'));
         HookRegistry::register('Templates::Manager::Index::ManagementPages', array(&$this, 'displayMenuOption'));
         HookRegistry::register('LoadHandler', array(&$this, 'handleRequest'));
         HookRegistry::register('TemplateManager::display', array(&$this, 'logRequest'));
         $this->import('LogEntryDAO');
         $logEntryDao =& new LogEntryDAO();
         DAORegistry::registerDAO('LogEntryDAO', $logEntryDao);
     }
     return $success;
 }
Exemple #21
0
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         HookRegistry::register('Templates::Admin::Index::AdminFunctions', array($this, 'displayMenuOption'));
         HookRegistry::register('Templates::Manager::Index::ManagementPages', array($this, 'displayMenuOption'));
         HookRegistry::register('LoadHandler', array($this, 'handleRequest'));
         HookRegistry::register('TemplateManager::display', array($this, 'logRequest'));
         HookRegistry::register('FileManager::downloadFile', array($this, 'logRequestInline'));
         $this->import('CounterReportDAO');
         $counterReportDao = new CounterReportDAO();
         DAORegistry::registerDAO('CounterReportDAO', $counterReportDao);
     }
     return $success;
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         if ($this->getEnabled()) {
             $this->import('TimedViewReportDAO');
             $timedViewReportDao =& new TimedViewReportDAO();
             DAORegistry::registerDAO('TimedViewReportDAO', $timedViewReportDao);
             $this->import('TimedViewReportForm');
             $this->addLocaleData();
             HookRegistry::register('TemplateManager::display', array(&$this, 'logRequest'));
             HookRegistry::register('PluginRegistry::loadCategory', array(&$this, 'callbackLoadCategory'));
         }
     }
     return $success;
 }
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function PKPUsageStatsLoader($args)
 {
     $plugin = PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_plugin = $plugin;
     if ($plugin->getSetting(CONTEXT_ID_NONE, 'compressArchives')) {
         $this->setCompressArchives(true);
     }
     $arg = current($args);
     switch ($arg) {
         case 'autoStage':
             if ($plugin->getSetting(0, 'createLogFiles')) {
                 $this->_autoStage = true;
             }
             break;
         case 'externalLogFiles':
             $this->_externalLogFiles = true;
             break;
     }
     // Define the base filesystem path.
     $args[0] = $plugin->getFilesPath();
     parent::FileLoader($args);
     if ($plugin->getEnabled()) {
         // Load the metric type constant.
         PluginRegistry::loadCategory('reports');
         import('classes.statistics.StatisticsHelper');
         $statsHelper = new StatisticsHelper();
         $geoLocationTool = $statsHelper->getGeoLocationTool();
         $this->_geoLocationTool = $geoLocationTool;
         $plugin->import('UsageStatsTemporaryRecordDAO');
         $statsDao = new UsageStatsTemporaryRecordDAO();
         DAORegistry::registerDAO('UsageStatsTemporaryRecordDAO', $statsDao);
         $this->_counterRobotsListFile = $this->_getCounterRobotListFile();
         $contextDao = Application::getContextDAO();
         /* @var $contextDao ContextDAO */
         $contextFactory = $contextDao->getAll();
         /* @var $contextFactory DAOResultFactory */
         $contextsByPath = array();
         while ($context = $contextFactory->next()) {
             /* @var $context Context */
             $contextsByPath[$context->getPath()] = $context;
         }
         $this->_contextsByPath = $contextsByPath;
         $this->checkFolderStructure(true);
     }
 }
 protected function setUp()
 {
     // Create a test file on the file system.
     $this->testFile = tempnam(TMP_FILES, 'SubmissionFile');
     // Register a mock monograph DAO.
     $monographDao =& $this->getMock('MonographDAO', array('getMonograph'));
     $monograph = new Monograph();
     $monograph->setId(SUBMISSION_FILE_DAO_TEST_SUBMISSION_ID);
     $monograph->setPressId(SUBMISSION_FILE_DAO_TEST_PRESS_ID);
     $monographDao->expects($this->any())->method('getMonograph')->will($this->returnValue($monograph));
     DAORegistry::registerDAO('MonographDAO', $monographDao);
     // Register a mock genre DAO.
     $genreDao =& $this->getMock('GenreDAO', array('getById'));
     DAORegistry::registerDAO('GenreDAO', $genreDao);
     $genreDao->expects($this->any())->method('getById')->will($this->returnCallback(array($this, 'getTestGenre')));
     $this->_cleanFiles();
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         $this->import('ThesisDAO');
         $thesisDao = new ThesisDAO($this->getName());
         $returner =& DAORegistry::registerDAO('ThesisDAO', $thesisDao);
         // Handler for public thesis abstract pages
         HookRegistry::register('LoadHandler', array($this, 'setupPublicHandler'));
         // Navigation bar link to thesis abstract page
         HookRegistry::register('Templates::Common::Header::Navbar::CurrentJournal', array($this, 'displayHeaderLink'));
         // Journal Manager link to thesis abstract management pages
         HookRegistry::register('Templates::Manager::Index::ManagementPages', array($this, 'displayManagerLink'));
         // Search results link to thesis abstract page
         HookRegistry::register('Templates::Search::SearchResults::PreResults', array($this, 'displaySearchLink'));
     }
     return $success;
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True if plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         $this->import('DRIVERDAO');
         $driverDao = new DRIVERDAO();
         DAORegistry::registerDAO('DRIVERDAO', $driverDao);
         // Add DRIVER set to OAI results
         HookRegistry::register('OAIDAO::getJournalSets', array($this, 'sets'));
         HookRegistry::register('JournalOAI::records', array($this, 'recordsOrIdentifiers'));
         HookRegistry::register('JournalOAI::identifiers', array($this, 'recordsOrIdentifiers'));
         HookRegistry::register('OAIDAO::_returnRecordFromRow', array($this, 'addSet'));
         HookRegistry::register('OAIDAO::_returnIdentifierFromRow', array($this, 'addSet'));
         // consider DRIVER article in article tombstones
         HookRegistry::register('ArticleTombstoneManager::insertArticleTombstone', array($this, 'insertDRIVERArticleTombstone'));
     }
     return $success;
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         $this->import('ExternalFeedDAO');
         $externalFeedDao = new ExternalFeedDAO($this->getName());
         $returner =& DAORegistry::registerDAO('ExternalFeedDAO', $externalFeedDao);
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $this->getStyleSheetFile());
         // Journal home page display
         HookRegistry::register('TemplateManager::display', array(&$this, 'displayHomepage'));
         // Register also as a block plugin
         HookRegistry::register('PluginRegistry::loadCategory', array(&$this, 'callbackLoadCategory'));
         // Journal Manager link to externalFeed management pages
         HookRegistry::register('Templates::Manager::Index::ManagementPages', array($this, 'displayManagerLink'));
     }
     return $success;
 }
 /**
  * Register the plugin, attaching to hooks as necessary.
  * @param $category string
  * @param $path string
  * @return boolean
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             $this->import('BlogPagesDAO');
             if (checkPhpVersion('5.0.0')) {
                 // WARNING: see http://pkp.sfu.ca/wiki/index.php/Information_for_Developers#Use_of_.24this_in_the_constructor
                 $blogPagesDao = new BlogPagesDAO($this->getName());
             } else {
                 $blogPagesDao =& new BlogPagesDAO($this->getName());
             }
             $returner =& DAORegistry::registerDAO('BlogPagesDAO', $blogPagesDao);
             HookRegistry::register('LoadHandler', array(&$this, 'callbackHandleContent'));
         }
         return true;
     }
     return false;
 }
 /**
  * Register the plugin, attaching to hooks as necessary.
  * @param $category string
  * @param $path string
  * @return boolean
  */
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             // Register the static pages DAO.
             import('plugins.generic.staticPages.classes.StaticPagesDAO');
             $staticPagesDao = new StaticPagesDAO();
             DAORegistry::registerDAO('StaticPagesDAO', $staticPagesDao);
             HookRegistry::register('Templates::Management::Settings::website', array($this, 'callbackShowWebsiteSettingsTabs'));
             // Intercept the LoadHandler hook to present
             // static pages when requested.
             HookRegistry::register('LoadHandler', array($this, 'callbackHandleContent'));
             // Register the components this plugin implements to
             // permit administration of static pages.
             HookRegistry::register('LoadComponentHandler', array($this, 'setupGridHandler'));
         }
         return true;
     }
     return false;
 }
 /**
  * @covers ValidatorControlledVocab
  */
 public function testValidatorControlledVocab()
 {
     // Mock a ControlledVocab object
     $mockControlledVocab = $this->getMock('ControlledVocab', array('enumerate'));
     $mockControlledVocab->setId(1);
     $mockControlledVocab->setAssocType(ASSOC_TYPE_CITATION);
     $mockControlledVocab->setAssocId(333);
     $mockControlledVocab->setSymbolic('testVocab');
     // Set up the mock enumerate() method
     $mockControlledVocab->expects($this->any())->method('enumerate')->will($this->returnValue(array(1 => 'vocab1', 2 => 'vocab2')));
     // Mock the ControlledVocabDAO
     $mockControlledVocabDAO = $this->getMock('ControlledVocabDAO', array('getBySymbolic'));
     // Set up the mock getBySymbolic() method
     $mockControlledVocabDAO->expects($this->any())->method('getBySymbolic')->with('testVocab', ASSOC_TYPE_CITATION, 333)->will($this->returnValue($mockControlledVocab));
     DAORegistry::registerDAO('ControlledVocabDAO', $mockControlledVocabDAO);
     $validator = new ValidatorControlledVocab('testVocab', ASSOC_TYPE_CITATION, 333);
     self::assertTrue($validator->isValid('1'));
     self::assertTrue($validator->isValid('2'));
     self::assertFalse($validator->isValid('3'));
 }