Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
HookRegistry Class Reference

Static Public Member Functions

static call ($hookName, $args=null)
 
static clear ($hookName)
 
static & getCalledHooks ()
 
static & getHooks ()
 
static register ($hookName, $callback)
 
static rememberCalledHooks ($askOnly=false, $updateTo=true)
 
static resetCalledHooks ($leaveAlive=false)
 
static setHooks ($hookName, $callbacks)
 

Detailed Description

Class for linking core functionality with plugins.

Definition at line 17 of file HookRegistry.inc.php.

Member Function Documentation

static HookRegistry::call (   $hookName,
  $args = null 
)
static

Call each callback registered against $hookName in sequence. The first callback that returns a value that evaluates to true will interrupt processing and this function will return its return value; otherwise, all callbacks will be called in sequence and the return value of this call will be the value returned by the last callback.

Parameters
$hookNamestring The name of the hook to register against
$argsstring Hooks are called with this as the second param
Returns
mixed

Definition at line 71 of file HookRegistry.inc.php.

References getCalledHooks(), and getHooks().

Referenced by ThemePlugin\_displayCssCallback(), PressDAO\_fromRow(), MonographDAO\_fromRow(), PKPSocialMediaDAO\_fromRow(), FooterLinkDAO\_fromRow(), IdentificationCodeDAO\_fromRow(), MarketDAO\_fromRow(), PublicationDateDAO\_fromRow(), SeriesDAO\_fromRow(), RepresentativeDAO\_fromRow(), ReviewerSubmissionDAO\_fromRow(), SeriesEditorSubmissionDAO\_fromRow(), SalesRightsDAO\_fromRow(), FooterCategoryDAO\_fromRow(), LibraryFileDAO\_fromRow(), PKPAuthorDAO\_fromRow(), CategoryDAO\_fromRow(), PublicationFormatDAO\_fromRow(), SubmissionCommentDAO\_fromRow(), GenreDAO\_fromRow(), PublishedMonographDAO\_fromRow(), NotificationDAO\_fromRow(), PKPAcronPlugin\_parseCrontab(), AccessKeyDAO\_returnAccessKeyFromRow(), PKPEmailTemplateDAO\_returnBaseEmailTemplateFromRow(), CommentDAO\_returnCommentFromRow(), CurrencyDAO\_returnCurrencyFromRow(), PKPEmailTemplateDAO\_returnEmailTemplateFromRow(), ChapterDAO\_returnFromRow(), CodelistItemDAO\_returnFromRow(), PKPGiftDAO\_returnGiftFromRow(), LanguageDAO\_returnLanguageFromRow(), PKPEmailTemplateDAO\_returnLocaleEmailTemplateFromRow(), ReviewFormElementDAO\_returnReviewFormElementFromRow(), ReviewFormDAO\_returnReviewFormFromRow(), ReviewFormResponseDAO\_returnReviewFormResponseFromRow(), PKPAuthorDAO\_returnSimpleAuthorFromRow(), SiteDAO\_returnSiteFromRow(), TemporaryFileDAO\_returnTemporaryFileFromRow(), VersionDAO\_returnVersionFromRow(), EditorAction\addReviewer(), EventLogDAO\build(), EmailLogDAO\build(), EditorAction\clearReview(), ReviewerAction\confirmReview(), PageHandler\css(), DAO\DAO(), CatalogBookHandler\download(), FileManager\downloadFile(), PressSiteSettingsForm\execute(), ThankReviewerForm\execute(), Mail\getBccString(), PluginRegistry\getCategories(), PKPRequest\getCompleteUrl(), PKPRouter\getContextByName(), BlockPlugin\getContextMap(), PKPRequest\getQueryString(), Request\getRequestedPressPath(), PKPUsageEventPlugin\getUsageEvent(), PublicationFormatTombstoneManager\insertTombstoneByPublicationFormat(), PKPLocale\installLocale(), PluginRegistry\loadCategory(), PKPValidation\login(), EditorAction\recordDecision(), PKPRequest\redirectSSL(), PKPLocale\registerLocaleFile(), DAO\retrieve(), DAO\retrieveCached(), DAO\retrieveLimit(), DAO\retrieveRange(), SubmissionSearch\retrieveResults(), PKPSubmissionHandler\saveStep(), EditorAction\setDueDates(), and DAO\update().

static HookRegistry::clear (   $hookName)
static

Clear hooks registered against the given name.

Parameters
$hookNamestring Name of hook

Definition at line 41 of file HookRegistry.inc.php.

References getHooks().

Referenced by PKPRequestTest\testRedirectUrl().

static& HookRegistry::getHooks ( )
static

Get the current set of hook registrations.

Definition at line 21 of file HookRegistry.inc.php.

References Registry\get().

Referenced by call(), clear(), FileManager\downloadFile(), PKPUsageEventPlugin\getUsageEvent(), register(), and setHooks().

static HookRegistry::register (   $hookName,
  $callback 
)
static
static HookRegistry::rememberCalledHooks (   $askOnly = false,
  $updateTo = true 
)
static

Set/query the flag that triggers storing of called hooks.

Parameters
$askOnlyboolean When set to true, the flag will not be changed but only returned.
$updateToboolean When $askOnly is set to 'true' then this parameter defines the value of the flag.
Returns
boolean The current value of the flag.

Definition at line 110 of file HookRegistry.inc.php.

Referenced by resetCalledHooks().

static HookRegistry::resetCalledHooks (   $leaveAlive = false)
static

Switch off the function to store hooks and delete all stored hooks. Always call this after using otherwise we get a severe memory.

Parameters
$leaveAliveboolean Set this to true if you only want to delete hooks stored so far but if you want to record future hook calls, too.

Definition at line 125 of file HookRegistry.inc.php.

References getCalledHooks(), and rememberCalledHooks().

Referenced by PKPRequestTest\testGetBasePath(), PKPRequestTest\testGetBaseUrl(), PKPRouterTestCase\testGetIndexUrl(), PKPRequestTest\testGetProtocolNoHttpsVariable(), PKPRouterTestCase\testGetRequestedContextPathWithFullContextParameters(), PKPRouterTestCase\testGetRequestedContextPathWithFullPathInfo(), and PKPRequestTest\testGetRequestPath().

static HookRegistry::setHooks (   $hookName,
  $callbacks 
)
static

Set the hooks table for the given hook name to the supplied array of callbacks.

Parameters
$hookNamestring Name of hook to set
$callbacksarray Array of callbacks for this hook

Definition at line 32 of file HookRegistry.inc.php.

References getHooks().

Referenced by FileManager\downloadFile().


The documentation for this class was generated from the following file: