Am_HookManager
aMember Pro provides a flexible mechanism to change or add new behaviour to existing actions. It utilises the well-known Observer programming pattern.
To wait for an event the code must set up a "hook". Then, on some occasion, the core code or add-on code(!) sends Events (instances of Am_Event class or successors) to all interested parties. Parties handle events by executing pieces of code and, for some events, by adding return values to an event object. Then, the event object is returned to the called core code where it can be inspected and used. It is lengthy to explain, but easy to understand by example:
Setting Hooks. Method 1 - from any part of code
<?php
// you can enter this example to am/application/configs/site.php
// define handlers for an event
function my_custom_function1(Am_Event $event) { $event->addReturn($event->getX() + 1); }
function my_custom_function2(Am_Event $event) { $event->addReturn($event->getX() + 2); }
// setup hooks
Am_Di::getInstance()->hook->
->add('myCustomEvent', 'my_custom_function1')
->add('myCustomEvent', 'my_custom_function2');
// now raise the event with variable x = 5 and get returned event object
$event = Am_Di::getInstance()->hook->call('myCustomEvent', array('x' => 5));
// now check the return. it will be array(5+1, 5+2) == array(6, 7)
print_rr($event->getReturn());
Setting Hooks. Method 2 - from a plugin or a module
// within file am/application/default/plugins/misc/my.php
class MyPlugin extends Am_Plugin
{
function onMyCustomEvent(Am_Event $event)
{
$event->addReturn($event->getX() + 1);
}
}
You do not need to set up a hook in the plugin explicitly. Just add a
plugin function named onHookname()
to the plugin class, and, if the plugin is
enabled and configured, the hook will be set up automatically.
Example continues: within am/application/configs/site.php
// now raise the event with variable x = 5 and get returned event object
$event = Am_Di::getInstance()->hook->call('myCustomEvent', array('x' => 5));
// now check the return. it will be array(5+1, 5+2) == array(6, 7)
print_rr($event->getReturn());
Available Events
You can check for available core events in class Am_Event. There are many constants defined for events. Also, please note that different events may receive difference event objects (all derived for Am_Event parent). For example, event userBeforeInsert will receive object of Am_Event_UserBeforeInsert as parameter.
Here is a list of currently available events:
class Am_Event
{
/**
* Application Response Headers
*/
const APP_HEADERS = 'appHeaders';
/**
* Called after db upgrade
*/
const DB_UPGRADE = 'dbUpgrade';
/**
* @param User $user
* @param string $resource_id
* @param string $resource_type
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const USER_HAS_ACCESS = 'userHasAccess';
const GUEST_HAS_ACCESS = 'guestHasAccess';
/** Called every hour by cronjob */
const HOURLY = 'hourly';
/** Called every day by cronjob */
const DAILY = 'daily';
/** Called every week by cronjob */
const WEEKLY = 'weekly';
/** Called 1-st day of month by cronjob */
const MONTHLY = 'monthly';
/** Called 1-st day of year by cronjob */
const YEARLY = 'yearly';
/** Called every 5 minutes */
const EVERY_5MIN = 'every5min';
/** Called when aMember API stack initialization is finished */
const INIT_FINISHED = 'initFinished';
/** Called when an invoice becomes active_recuirring or paid, or free trial is started
*
* {@link Invoice Invoice}
* : invoice
*/
const INVOICE_STARTED = 'invoiceStarted';
const INVOICE_TERMS = 'invoiceTerms';
/** When billing plan terms are calculated
*
* {@link BillingPlan $billingPlan}
* : billingPlan
*
*/
const BILLING_PLAN_TERMS = 'billingPlanTerms';
/**
* Called when invoice status is changed
*
* Parameters:
* * {@link Invoice Invoice} invoice</li>
* * int status - new status of invoice</li>
* * int oldStatus - previous status of invoice</li>
*
*/
const INVOICE_STATUS_CHANGE = 'invoiceStatusChange';
/**
* Called just before customer record deletion.
* By triggering exception from the hook, deletion may be stopped
*
* * {@link User User} user
*/
const USER_BEFORE_DELETE = 'userBeforeDelete';
/**
* Called after customer record deletion.
*
* * {@link User User} user
*/
const USER_AFTER_DELETE = 'userAfterDelete';
/**
* Called before user record is inserted into table
*
* * {@link User User} user
*/
const USER_BEFORE_INSERT = 'userBeforeInsert';
/**
* Called after user record is inserted into table
*
* * {@link User User} user
*/
const USER_AFTER_INSERT = 'userAfterInsert';
/**
* Called before user record is updated in database
*
* * {@link User User} user
*/
const USER_BEFORE_UPDATE = 'userBeforeUpdate';
/**
* Called after user record is updated in database
*
* * {@link User User} user
*/
const USER_AFTER_UPDATE = 'userAfterUpdate';
/**
* Called once value of $user->unsubscribe field is changed
*
* <li>{@link User User} user</li>
* <li>int unsubscribed - new value of 'unsubscribed' field</li>
*
*/
const USER_UNSUBSCRIBED_CHANGED = 'userUnsubscribedChanged';
const GENERATE_LOGIN = 'generateLogin';
const GENERATE_PASSWORD = 'generatePassword';
const USER_NOTE_AFTER_INSERT = 'userNoteAfterInsert';
/**
* @param Am_Query $query
* @param string $filter
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const ADMIN_USERS_FILTER_INIT = "adminUsersFilterInit";
/**
* Can be used to customize the autocomplete query
* @param Am_Query $query
* @param string $term
*/
const ADMIN_USERS_AUTOCOMPLETE = "adminUsersAutocomplete";
/**
* Called after admin record deletion.
*
* * {@link Admin Admin} admin
*/
const ADMIN_AFTER_DELETE = 'adminAfterDelete';
/**
* Called after product record deletion.
*
* * {@link Product} product
*/
const PRODUCT_AFTER_DELETE = 'productAfterDelete';
const PRODUCT_AFTER_UPDATE = 'productAfterUpdate';
const PRODUCT_AFTER_INSERT = 'productAfterInsert';
/**
* Called just before coupon update
*
* @param Coupon $coupon
* @param Coupon $old
*/
const COUPON_BEFORE_UPDATE = 'couponBeforeUpdate';
const COUPON_IS_APPLICABLE = 'couponIsApplicable';
/**
* Called when customer password is changed, plain-text password
* is available in this hook
*
* * {@link User User} user
* * string password - plain-text password
*
* Event Class: Am_Event_SetPassword
*/
const SET_PASSWORD = 'setPassword';
const GET_PASSWORD_FORMATS = 'getPasswordFormats';
/** User (or affiliate) record is added after submitting signup form - before payment */
const SIGNUP_USER_ADDED = 'signupUserAdded';
/** User record is added after submitting signup form - before payment */
const SIGNUP_AFF_ADDED = 'signupAffAdded';
/** User record is updated after submitting signup form - before payment */
const SIGNUP_USER_UPDATED = 'signupUserUpdated';
const SIGNUP_LOAD_USER = 'signupLoadUser';
const SIGNUP_INVOICE_ITEMS = 'signupInvoiceItems';
/** User record is updated after submitting profile form*/
const PROFILE_USER_UPDATED = 'profileUserUpdated';
/** Called just before payment record insered into database. Is not called for free subscriptions */
const PAYMENT_BEFORE_INSERT = 'paymentBeforeInsert';
/** Payment record insered into database. Is not called for free subscriptions */
const PAYMENT_AFTER_INSERT = 'paymentAfterInsert';
/** Payment record with access inserted into database. Is not called for free subscriptions. Required to get access records. */
const PAYMENT_WITH_ACCESS_AFTER_INSERT = 'paymentWithAccessAfterInsert';
const PAYMENT_AFTER_DELETE = 'paymentAfterDelete';
const REFUND_AFTER_INSERT = 'refundAfterInsert';
const REFUND_AFTER_DELETE = 'refundAfterDelete';
/** Return array of objects to calculate invoice.
*
* @link Invoice::getCalculators()
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
* <code>
* function onInvoiceGetCalculators(Am_Event $event)
* {
* $calculators = $event->getReturn();
* $calculators[] = new MyInvoiceCalculator($event->getInvoice());
* $event->setReturn($calculators);
* }
* </code>
*/
const INVOICE_GET_CALCULATORS = 'invoiceGetCalculators';
/**
* Called before invoice calculation
* @var Invoice invoice
*/
const INVOICE_BEFORE_CALCULATE = 'invoiceBeforeCalculate';
/**
* Called when invoice calculation is finished
* @var Invoice invoice
*/
const INVOICE_CALCULATE = 'invoiceCalculate';
/**
* Check if we can authenticate user by third-party database
* @see Am_Event_AuthCheckLoggedIn
*/
const AUTH_CHECK_LOGGED_IN = 'authCheckLoggedIn';
/**
* Called upon succesful user login
* @see Am_Event_AuthAfterLogin
*/
const AUTH_AFTER_LOGIN = 'authAfterLogin';
/**
* If user login was failed through aMember users database,
* this event allows to create aMember account on-fly and
* login user
* @see Am_Event_AuthTryLogin
*/
const AUTH_TRY_LOGIN = 'authTryLogin';
const AUTH_SESSION_REFRESH = 'authSessionRefresh';
/**
* Very specific ability to create user if he requests his password.
* may be useful by plugins.
*/
const AUTH_LOST_PASS_USER_EMPTY = 'authLostPassUserEmpty';
/**
* Called on user logout
* @see Am_Event_AuthAfterLogout
*/
const AUTH_AFTER_LOGOUT = 'authAfterLogout';
const AUTH_ADMIN_AFTER_LOGIN = 'authAdminAfterLogin';
const AUTH_ADMIN_AFTER_LOGOUT = 'authAdminAfterLogout';
const AUTH_ADMIN_GET_PERMISSIONS = 'authAdminGetPermissions';
/**
* Called on user check during authentification
* You can reject valid user authentification
* by some creteria
*
* <code>
* $user = $event->getUser();
* $event->setResult(new Am_Auth_Result(-100, ___('You can not login becouse of...')));
* $event->stop();
* </code>
*
* @param User $user
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
* @link Am_Event::stop()
*/
const AUTH_CHECK_USER = 'authCheckUser';
const AUTH_CONTROLLER_SET_USER = 'authControllerSetUser';
const AUTH_CONTROLLER_HANDLER = 'authControllerHandler';
const AUTH_CONTROLLER_HTML = 'authControllerHTML';
/**
* Called on choose redirect url after login
*
* @param User $user
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const AUTH_GET_OK_REDIRECT = 'authGetOkRedirect';
/**
* Called to get list of member links
* @see Am_Event::addReturn()
*/
const GET_MEMBER_LINKS = 'getMemberLinks';
/**
* Called to get list of member links at left
* @see Am_Event::addReturn()
*/
const GET_LEFT_MEMBER_LINKS = 'getLeftMemberLinks';
/**
* @param User $user
* @param array|null $types
*/
const GET_ALLOWED_RESOURCES = 'getAllowedResources';
/**
* Called when user receives a subscription to product
* he was not subscribed earlier
* @see Am_Event_SubscriptionAdded
*/
const SUBSCRIPTION_ADDED = 'subscriptionAdded';
/**
* Called when user subscription access is deleted
* @see Am_Event_SubscriptionDeleted
*/
const SUBSCRIPTION_DELETED = 'subscriptionDeleted';
/**
* Called once for multiple changes, provides list of
* added and deleted products
* @see Am_Event::SUBSCRIPTION_ADDED
* @see Am_Event::SUBSCRIPTION_DELETED
* @see Am_Event_SubscriptionChanged
*/
const SUBSCRIPTION_CHANGED = 'subscriptionChanged';
/**
* Called when user information is changed
* @see Am_Event_SubscriptionUpdated
* @deprecated use Am_Event::USER_AFTER_UPDATE instead
*/
const SUBSCRIPTION_UPDATED = 'subscriptionUpdated';
/**
* Called when user record is deleted
* @see Am_Event_SubscriptionRemoved
* @deprecated use Am_Event::USER_AFTER_DELETE instead
*/
const SUBSCRIPTION_REMOVED = 'subscriptionRemoved';
/**
* Access record inserted
* NOTE - record may be in not-active state - check dates
* <li>{@link Access} access</li>
* @see Am_Event::SUBSCRIPTION_ADDED
*/
const ACCESS_AFTER_INSERT = 'accessAfterInsert';
const ACCESS_BEFORE_INSERT = 'accessBeforeInsert';
/**
* Access record updated
* <li>{@link Access} access</li>
* @var Access old - record before changes
*/
const ACCESS_AFTER_UPDATE = 'accessAfterUpdate';
/**
* Access record deleted
* NOTE - record may be in not-active state - check dates
* <li>{@link Access} access</li>
*/
const ACCESS_AFTER_DELETE = 'accessAfterDelete';
/**
* Called before invoice insertion
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_BEFORE_INSERT = 'invoiceBeforeInsert';
/**
* Called after invoice insertion
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_AFTER_INSERT = 'invoiceAfterInsert';
/**
* Called before invoice deletion
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_BEFORE_DELETE = 'invoiceBeforeDelete';
/**
* Called after invoice deletion
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_AFTER_DELETE = 'invoiceAfterDelete';
/**
* Called after invoice cancelation
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_AFTER_CANCEL= 'invoiceAfterCancel';
/**
* Called after invoice approved by admin
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_AFTER_APPROVE= 'invoiceAfterApprove';
/**
* Called after invoice payment refund(or chargeback)
* <li>{@link InvoiceRefund} refund</li>
*/
const INVOICE_PAYMENT_REFUND= 'invoicePaymentRefund';
/**
* Called on Invoice validate(before redirect to payment system);
* <li>{@link Invoice} invoice</li>
*/
const INVOICE_VALIDATE = 'invoiceValidate';
/**
* Called before panding notofication sent
<li>{@link array} sendCallback</li>
<li>{@link Am_Mail_Template} template</li>
<li>{@link Invoice} invoice</li>
*/
const PENDING_NOTIFICATION_BEFORE_SEND = 'pendingNotificationBeforeSend';
const SET_DISPLAY_INVOICE_PAYMENT_ID = 'setDisplayInvoicePaymentId';
const SET_DISPLAY_INVOICE_REFUND_ID = 'setDisplayInvoiceRefundId';
const PRE_CHECK_UNIQ_LOGIN = 'preCheckUniqLogin';
const PRE_CHECK_UNIQ_EMAIL = 'preCheckUniqEmail';
/**
* Called to check for username uniquiness
* @see Am_Event_CheckUniqLogin
*/
const CHECK_UNIQ_LOGIN = 'checkUniqLogin';
/**
* Called to check for e-mail uniquiness
* @see Am_Event_CheckUniqEmail
*/
const CHECK_UNIQ_EMAIL = 'checkUniqEmail';
/**
* Called to validate signup and profile form before processing
* This event triggered for each page on multi-page forms separately
* and get access only to variables on current page
* @see Am_Event_ValidateSavedForm
*/
const VALIDATE_SAVED_FORM = 'validateSavedForm';
/**
* Called to validate coupon before processing
*/
const VALIDATE_COUPON = 'validateCoupon';
/**
* This hook is executed in global PHP scope to include external libraries
* for example it is used by WP plugin to include WP API Stack
*/
const GLOBAL_INCLUDES = 'globalIncludes';
/**
* This hook is executed after {@link Am_Event::GLOBAL_INCLUDES} is finished
*/
const GLOBAL_INCLUDES_FINISHED = 'globalIncludesFinished';
/**
* This hook is called from admin-rebuild-db controller
* it may be used to add new items into "rebuild" UI
* @see Am_Event_Rebuild
*/
const REBUILD = 'rebuild';
const FOLDER_PROTECT_CODE = 'folderProtectCode';
/** Called to get exclusions for aMember database backup
* If your plugin has a table that must not be backed up,
* call $event->addReturn('tablewithoutprefix') on this hook */
const SKIP_BACKUP = 'skipBackup';
/**
* Mutliple GRID EVENTS are available for product form
*/
const PRODUCT_FORM = 'productForm';
/**
* Called to create setup forms
* @see Am_Event_SetupForms
*/
const SETUP_FORMS = 'setupForms';
/**
* Called to collect Email Template Types
* <li>{@link Am_Mail_TemplateTypes}</li>
*/
const SETUP_EMAIL_TEMPLATE_TYPES = 'setupEmailTemplateTypes';
/**
* Called when setup is update in admin UI
*/
const SETUP_UPDATED = 'setupUpdated';
/**
* Called to collect common tag sets or alter existing
*
* @link Am_Mail_TemplateTypes
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const EMAIL_TEMPLATE_TAG_SETS = 'emailTemplateTagSets';
/**
* Called to retrive tag options for specific template
*
* @param string $templateName
* @link Am_Mail_TemplateTypes
*/
const EMAIL_TEMPLATE_TAG_OPTIONS = 'emailTemplateTagOptions';
/**
* Can be used to check if email template is ok for user,
* Implements ability to add additional conditions to amember CP -> Protect Content -> Emails
*
* @param EmailTemplate $template
* @param User $user
* @return true if email template is ok for user, false otherwise.
* use $event->setReturn();
*
*
*/
const EMAIL_TEMPLATE_CHECK_CONDITIONS = 'emailTemplateCheckConditions';
/**
* Called on the thanks page
*
* <li>{@link Invoice} invoice (may be null)</li>
* <li><i>ThanksController</i> controller</li>
*/
const THANKS_PAGE = 'thanksPage';
/**
* Get list of avaialable admin permissions
*/
const GET_PERMISSIONS_LIST = 'getPermissionsList';
/**
* Get list of API controllers => permissions
*/
const GET_API_CONTROLLERS = 'getApiControllers';
/**
* Check permissions for remote API call
* call $event->addReturn(true); to allow access WITHOUT any checks
* throw exception to deny access
*/
const API_CHECK_PERMISSIONS = 'apiCheckPermissions';
/**
* Get list of avaialable file upload prefixes
*/
const GET_UPLOAD_PREFIX_LIST = 'getUploadPrefixList';
/**
* Get list of avaialable signup form types
*/
const SAVED_FORM_TYPES = 'savedFormTypes';
/**
* Ability to chage list of bricks for form via hooks
*
* list of bricks can be modified depends on currently logged in user
* and his subscription's status
*
* @param enum(signup, cart, profile...) $type
* @param string $code
* @param SavedForm $savedForm
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const SAVED_FORM_GET_BRICKS = 'savedFormGetBricks';
/**
* @param string $code
*/
const SIGNUP_STATE_SAVE = 'signupStateSave';
const SIGNUP_STATE_LOAD = 'signupStateLoad';
/**
* Add new pages into existing "pageable" controllers like AdminContentController
*/
const INIT_CONTROLLER_PAGES = 'initControllerPages';
/**
* Load available saved form bricks
*/
const LOAD_BRICKS = 'loadBricks';
/**
* Called on admin menu construction
* <li>{@link Am_Navigation_Admin} menu</li>
*/
const ADMIN_MENU = 'adminMenu';
/**
* Called on admin dashboard to display warnings
*/
const ADMIN_WARNINGS = 'adminWarnings';
/**
* Called on admin dashboard to display notice
*/
const ADMIN_NOTICE = 'adminNotice';
/**
* Called on user menu construction
* <li>{@link Am_Navigation_User} menu</li>
*/
const USER_MENU = 'userMenu';
const USER_MENU_ITEMS = 'userMenuItems';
/**
* Called on admin user view pages to create tabs
* @see Am_Event_UserTabs
*/
const USER_TABS = 'userTabs';
/**
* Called to get available admin user search conditions
*/
const USER_SEARCH_CONDITIONS = 'userSearchConditions';
/**
* Called to load available reports
*/
const LOAD_REPORTS = 'loadReports';
/**
* Called before render protected page
*/
const PAGE_BEFORE_RENDER = 'pageBeforeRender';
/**
* Called before view render, you can change variables from here
*/
const BEFORE_RENDER = 'beforeRender';
/**
* Called after view render, you can change output from there
* @see Am_Event_AfterRender
*/
const AFTER_RENDER = 'afterRender';
/**
* Called to get code to embed before </body> in the output view template
* Called once per load for first </body>
*/
const VIEW_BODY_APPEND = 'viewBodyAppend';
/** @deprecated, use INIT_ACCESS_TABLES instead */
const INIT_CONTENT_PAGES = 'initContentPages';
const INIT_ACCESS_TABLES = 'initAccessTables';
const LOAD_ADMIN_DASHBOARD_WIDGETS = 'loadAdminDashboardWidgets';
/**
* Add sample data to database (@link AdminBuildController)
* $user->save() will be called after hook finished
* <li>{@link User} user</li>
* <li>{@link string} $demoId</li>
* <li>{@link int} $usersCreated</li>
* <li>{@link int} $usersTotal</li>
*/
const BUILD_DEMO = 'buildDemo';
/**
* Update database structure
* <li>{@link dbsync} Am_DbSync desired database structure</li>
*/
const DB_SYNC = 'dbSync';
const ET_SYNC = 'etSync';
/**
* Choose a signup form based on request parameters
*
* @param User $user
* @param Am_Mvc_Request $request
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const LOAD_SIGNUP_FORM = 'loadSignupForm';
/**
* Choose a profile form based on user
*
* @param User $user
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const LOAD_PROFILE_FORM = 'loadProfileForm';
/**
* Called when 2 user records are merged
*
* @param User $target
* @param User $source
*/
const USER_MERGE = 'userMerge';
/**
* Called before 2 user records are going to be merged by admin
*
* @param User $target
* @param User $source
*/
const USER_BEFORE_MERGE = 'userBeforeMerge';
/**
* Insert Additional items to admin Clear Old Records controller
*
* to utilize, you have to call $event->addReturn($arr, 'mykey'), arr must have
* a format like this:
* <code>
* array(
* 'method' => array($this->getDi()->adminLogTable, 'clearOld'),
* 'title' => 'Admin Log',
* 'desc' => 'admin log table (used by admin only)',
* )
* </code>
*/
const CLEAR_ITEMS = 'clearItems';
/**
* Add ability to set custom placeholders to mail template.
* Am_Mail_Template $template is passed as a parameter;
*/
const MAIL_TEMPLATE_BEFORE_PARSE = 'mailTemplateBeforeParse';
const MAIL_TEMPLATE_BEFORE_SEND = 'mailTemplateBeforeSend';
/**
* Add ability to set custom placeholders to mail template.
* @param Am_SimpleTemplate $template
* @param string $body
* @param string $subject
* @param Am_Mail $mail
*/
const MAIL_SIMPLE_TEMPLATE_BEFORE_PARSE = 'mailSimpleTemplateBeforeParse';
const MAIL_SIMPLE_TEMPLATE_BEFORE_SEND = 'mailSimpleTemplateBeforeSend';
/**
* add input elements to form with two leading underscore
*
* @param Am_Form_Admin $form
*/
const MAIL_SIMPLE_INIT_FORM = 'mailSimpleInitForm';
/**
* add input elements to to Email Template Form
*
* @param Am_Form_Admin $form
*/
const EMAIL_TEMPLATE_INIT_FORM = 'emailTemplateInitForm';
/**
* To be used to customize pdf invoice totally
* @param Am_Pdf_Invoice $amPdfInvoice
* @param Zend_pdf $pdf
* @param User $user
* @param Invoice $invoice
* @param InvoicePayment $payment
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const PDF_INVOICE_BEFORE_RENDER = 'pdfInvoiceBeforeRender';
/**
* @param stdClass $col
* @param User $user
* @param Invoice $invoice
* @param InvoicePayment $payment
*/
const PDF_INVOICE_COL_LEFT = 'pdfInvoiceColLeft';
const PDF_INVOICE_COL_RIGHT = 'pdfInvoiceColRight';
/**
* @param User $user
* @param Invoice $invoice
* @param InvoicePayment $payment
* @param $styleBold
*/
const PDF_INVOICE_TOTALS = 'pdfInvoiceTotals';
/**
* @param Am_Pdf_Page_Decorator $page
* @param stdClass $pointer use $pointer->value to retrieve current offset and update it
* @param User $user
* @param Invoice $invoice
* @param InvoicePayment $payment
*/
const PDF_INVOICE_BEFORE_TABLE = 'pdfInvoiceBeforeTable';
const PDF_INVOICE_AFTER_TABLE = 'pdfInvoiceAfterTable';
/**
* Triggered when new invoice created on product upgrade
* you may change invoice settings before it is passed
* to paysystem plugin
*/
const BEFORE_PRODUCT_UPGRADE = 'beforeProductUpgrade';
/**
* Called immediately before form rendering
* may be user to change element styles
* @param Am_Form $form
*/
const FORM_BEFORE_RENDER = 'formBeforeRender';
/**
* Called during signup/renewal form display
* may be used to modify products list in order form
* @see Am_Event::getReturn()
* @see Am_Event::setReturn()
*/
const SIGNUP_FORM_GET_PRODUCTS = 'signupFormGetProducts';
const SIGNUP_FORM_DEFAULT_PRODUCT = 'signupFormDefaultProduct';
/**
* Called during signup/renewal form display
* may be used to modify billing plan list in order form
* @see Am_Event::getReturn()
* @see Am_Event::setReturn()
*/
const SIGNUP_FORM_GET_BILLING_PLANS = 'signupFormGetBillingPlans';
/**
* Called during signup/renewal form display
* may be used to modify products list in order form
* called AFTER products are filtered according to "require"/"disallow"
* conditions
* @see Am_Event::getReturn()
* @see Am_Event::setReturn()
*/
const SIGNUP_FORM_GET_PRODUCTS_FILTERED = 'signupFormGetProductsFiltered';
/**
* Called during signup/renewal form display
* may be used to modify paysystem list in order form
* @see Am_Event::getReturn()
* @see Am_Event::setReturn()
*/
const SIGNUP_FORM_GET_PAYSYSTEMS = 'signupFormGetPaysystems';
const CANCEL_PAGE_GET_PAYSYSTEMS = 'cancelPageGetPaysystems';
const PAY_PAGE_GET_PAYSYSTEMS = 'payPageGetPaysystems';
const PAY_PAGE_FORM = 'payPageForm';
const PAY_PAGE_INVOICE = 'payPageInvoice';
const ADMIN_ADD_INVOICE_FORM = 'adminAddInvoiceForm';
const ADMIN_ADD_INVOICE_INVOICE = 'adminAddInvoiceInvoice';
/**
* Triggered before signup data will be processed. (before invoice/user will be created)
* @param array $vars - contains data collected from all signup forms.
* May be usefull to make additional checks on data
*
*/
const SIGNUP_PAGE_BEFORE_PROCESS = 'signupPageBeforeProcess';
/**
* Triggered just before redirect to payment system
* @param Invoice $invoice
* @param mixed $controller
*/
const INVOICE_BEFORE_PAYMENT = 'invoiceBeforePayment';
/**
* Triggered just before redirect to payment system (on signup/renew page)
* @param Invoice $invoice
* @param array $vars
* @param Am_Form_Signup $form
*/
const INVOICE_BEFORE_PAYMENT_SIGNUP = 'invoiceBeforePaymentSignup';
/**
* Triggered in payment plugins processInvoice function to catch/modify
* actions
* @param Invoice $invoice
* @param Am_Paysystem_Abstract $request
* @param Am_Mvc_Request $request
* @return Am_Paysystem_Result
*/
const PAYMENT_BEFORE_PROCESS = 'paymentBeforeProcess';
/**
* Triggered just after new invoice instance create (on signup/renew page)
* may be used to attach some data from vars to invoice
*
* @param Invoice $invoice
* @param array $vars
* @param Am_Form_Signup $form
*/
const INVOICE_SIGNUP = 'invoiceSignup';
/**
* Triggered just after new invoice instance created on cart checkout page
* may be used to attach some data to invoice
*
* @param Invoice $invoice
*/
const CART_INVOICE_CHECKOUT = 'cartInvoiceCheckout';
/**
* Calculation of product (access) start date on first payment and renewals
* @param bool isFirstPayment
* @param Invoice $invoice
* @param InvoiceItem $item
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const CALCULATE_START_DATE = 'calculateStartDate';
/**
* Expand types constant to list of resource types
*
* @param enum(ResourceAccess::USER_VISIBLE_TYPES, ResourceAccess::USER_VISIBLE_PAGES) $type
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_RESOURCE_TYPES = 'getResourceTypes';
/**
* Ability to chage login regexp
*
* @param bool login_disallow_spaces
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_LOGIN_REGEX = 'getLoginRegex';
/**
* Ability to chage strong pass regexp
*
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_STRONG_PASSWORD_REGEX = 'getStrongPasswordRegex';
/**
* Ability to change affiliate redirect link, for example to add custom tracking params
* @param User $aff
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_AFF_REDIRECT_LINK = 'getAffRedirectLink';
/**
* Translate not default resources(newsletters, directories, etc.)
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_BASE_TRANSLATION_DATA = 'getBaseTranslationData';
/**
* Called to initialize blocks by plugins
* {@link Am_Blocks} blocks
*/
const INIT_BLOCKS = 'initBlocks';
/**
* Ability to change folder for PDF invoices storage
*
* @param InvoicePayment $payment
* @link Am_Event::getReturn()
* @link Am_Event::setReturn()
*/
const GET_PDF_FILES_DIR = 'getPdfFilesDir';
/**
* Ability to insert information to delete account confirmation screen;
* @param User $user;
* @link Am_Event::addReturn()
* @link Am_Event::setReturn()
*
*/
const RENDER_DELETE_ACCOUNT_CONFIRMATION = 'renderDeleteAccountConfirmation';
/**
* User confirmed personal data removal.
* Do necessary actions. Should return status: true -> success, otherwise array of errors.
*
* @param User $user;
* @link Am_Event::setReturn()
*
*/
const DELETE_PERSONAL_DATA = 'deletePersonalData';
/**
* Called when user request personal data to download or on delete personal data page
* If you store personal data in plugins, you can include it to display for user.
* array structure is:
* [
* ["name" => 'FIELD1 NAME', 'title' => 'FIELD1 TITLE', 'value' => 'FIELD1 VALUE'],
* ["name" => 'FIELD2 NAME', 'title' => 'FIELD2 TITLE', 'value' => 'FIELD2 VALUE'],
* ["name" => 'FIELD3 NAME', 'title' => 'FIELD3 TITLE', 'value' => 'FIELD3 VALUE'],
* ]
*
* if value is an array or object it will be json_encoded();
* @param User $user;
* @link Am_Event::setReturn()
*
*/
const BUILD_PERSONAL_DATA_ARRAY = 'buildPersonalDataArray';
/**
* Called before rendering of user menu items with Am_View_Helper_Menu->renderMenu()
* params
* [ 'container' => Am_Navigation_Container ]
* use getReturn() / setReturn() to change [options] array
*/
const MENU_BEFORE_RENDER = 'menuBeforeRender';
/**
* Called after rendering of user menu items with Am_View_Helper_Menu->renderMenu()
* params
* [ 'container' => Am_Navigation_Container, 'options' => array() ]
* use getReturn() / setReturn() to change html
*/
const MENU_AFTER_RENDER = 'menuAfterRender';
/**
* Allow plugin to init flexible actions
* Am_FlexibleAction_Interface objects shall be added with setReturn() with id
*/
const GET_FLEXIBLE_ACTIONS = 'getFlexibleActions';
/**
* Called just before Zend_Controller_Front->dispatch() call
* Allows to add custom dispatchers
* Call $event->stop() to cancel default ZF1 request processing
*/
const DISPATCH = 'dispatch';
/**
* Add SMS Transport from plugins
* Am_Sms_Transport_Interface objects shall be added with setReturn() with id
*/
const INIT_SMS_TRANSPORT = 'initSmsTransport';
/**
* Modify HTML refs
*/
const HTML_REFS = 'htmlRefs';
}