本文整理汇总了PHP中fire_plugin_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP fire_plugin_hook函数的具体用法?PHP fire_plugin_hook怎么用?PHP fire_plugin_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fire_plugin_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editSettingsAction
public function editSettingsAction()
{
$form = new Omeka_Form_GeneralSettings();
$bootstrap = $this->getInvokeArg('bootstrap');
$derivatives = $bootstrap->getResource('Filederivatives');
if (isset($derivatives) && !$derivatives->getStrategy() instanceof Omeka_File_Derivative_Strategy_ExternalImageMagick) {
$form->removeElement('path_to_convert');
}
$form->setDefaults($bootstrap->getResource('Options'));
fire_plugin_hook('general_settings_form', array('form' => $form));
$form->removeDecorator('Form');
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$options = $form->getValues();
// Everything except the CSRF hash should correspond to a
// valid option in the database.
unset($options['settings_csrf']);
foreach ($options as $key => $value) {
set_option($key, $value);
}
$this->_helper->flashMessenger(__('The general settings have been updated.'), 'success');
$this->_helper->redirector('edit-settings');
} else {
$this->_helper->flashMessenger(__('There were errors found in your form. Please edit and resubmit.'), 'error');
}
}
}
示例2: nl_queueNeatlineEditor
/**
* Include static files for the editor.
*
* @param NeatlineExhibit The exhibit.
*/
function nl_queueNeatlineEditor($exhibit)
{
nl_queueGoogleMapsApi();
queue_css_file('dist/neatline-editor');
queue_js_file('dist/neatline-editor');
queue_js_file('dist/ckeditor/ckeditor');
queue_js_file('bootstrap');
fire_plugin_hook('neatline_editor_static', array('exhibit' => $exhibit));
}
示例3: init
public function init()
{
parent::init();
$this->setAction(WEB_ROOT . '/commenting/comment/add');
$this->setAttrib('id', 'comment-form');
$user = current_user();
/************************************************************
*REVISIONS
* Ver Date Author Description
* -------- ---------- -------------- ----------------------
* 1.0 09/02/2015 mrs175 1. added validators/form limitations for author name, email, and comment
************************************************************/
//Validators
//------------------------------------------------------------------
$notEmptyValidator = array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Please fill in this box.'), Zend_Validate_NotEmpty::INVALID => __('Please only use letters numbers and punctuation.'))));
$alphaNumericValidator = array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '#^[a-zA-Z0-9.*@+!\\-_%\\#\\^&$ ]*$#u', 'messages' => array(Zend_Validate_Regex::INVALID => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::ERROROUS => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::NOT_MATCH => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'))));
//form element options
//----------------------------------------------------------
$nameOptions = array('label' => __('Name (required)'), 'required' => true, 'size' => '25', 'maxlength' => '25', 'validators' => array($notEmptyValidator, $alphaNumericValidator));
$emailOptions = array('label' => __('Email (required)'), 'required' => true, 'size' => '100', 'maxlength' => '70', 'validators' => array($notEmptyValidator));
$commentOptions = array('label' => __('1500 character limit'), 'id' => 'comment-form-body', 'rows' => "8", 'cols' => "50", 'maxlength' => '1500', 'required' => true, 'filters' => array(array('StripTags', array('allowTags' => array('p', 'span', 'em', 'strong', 'a', 'ul', 'ol', 'li'), 'allowAttribs' => array('style', 'href')))), 'validators' => array($notEmptyValidator));
//Adding Elements to the form
//-------------------------------------------------------------------------------
//auto-filling the email and name boxes for logged in users
//then making them read only, so logged in users must use their registered name and email
if ($user) {
$emailOptions['value'] = $user->email;
$emailOptions['readonly'] = true;
$emailOptions['onfocus'] = "this.blur()";
$nameOptions['value'] = $user->name;
$nameOptions['readonly'] = true;
$nameOptions['onfocus'] = "this.blur()";
}
$this->addElement('text', 'author_name', $nameOptions);
$this->addElement('text', 'author_email', $emailOptions);
$this->addElement('textarea', 'body', $commentOptions);
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessage('Please enter an email address like stuff@email.com');
$this->getElement('author_email')->addValidator($emailValidator, true, array());
if (get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
$this->addElement('captcha', 'captcha', array('label' => __("Please verify you're a human"), 'captcha' => array('captcha' => 'ReCaptcha', 'pubkey' => get_option('recaptcha_public_key'), 'privkey' => get_option('recaptcha_private_key'), 'ssl' => true)));
$this->getElement('captcha')->removeDecorator('ViewHelper');
}
$request = Zend_Controller_Front::getInstance()->getRequest();
$params = $request->getParams();
$record_id = $this->_getRecordId($params);
$record_type = $this->_getRecordType($params);
$this->addElement('hidden', 'record_id', array('value' => $record_id, 'decorators' => array('ViewHelper')));
$this->addElement('hidden', 'path', array('value' => $request->getPathInfo(), 'decorators' => array('ViewHelper')));
if (isset($params['module'])) {
$this->addElement('hidden', 'module', array('value' => $params['module'], 'decorators' => array('ViewHelper')));
}
$this->addElement('hidden', 'record_type', array('value' => $record_type, 'decorators' => array('ViewHelper')));
fire_plugin_hook('commenting_form', array('comment_form' => $this));
$this->addElement('submit', 'submit', array('label' => __('Submit')));
}
示例4: init
/**
* @return Zend_Controller_Router_Rewrite
*/
public function init()
{
$router = parent::init();
$front = $this->getBootstrap()->getResource('Frontcontroller');
if ($front->getParam('api')) {
// The API route is the only valid route for an API request.
$router->addRoute('api', new Omeka_Controller_Router_Api());
} else {
$router->addConfig(new Zend_Config_Ini(CONFIG_DIR . '/routes.ini', 'routes'));
fire_plugin_hook('define_routes', array('router' => $router));
$this->_addHomepageRoute($router);
}
return $router;
}
示例5: applySearchFilters
public function applySearchFilters($select, $params, $retrieveInfos = false)
{
// For Url /search?query...
// Set the query string if not passed.
if (!isset($params['query'])) {
$params['query'] = '';
}
// Set the query type if not passed.
if (!isset($params['query_type'])) {
$params['query_type'] = 'full_text';
}
// Set the base select statement.
$select->reset(Zend_Db_Select::COLUMNS);
$select->columns(array('record_type', 'record_id', 'title'));
// Set the where clause according to the query type.
if ('exact_match' == $params['query_type']) {
$where = '`search_texts`.`text` LIKE ?';
$params['query'] = "%{$params['query']}%";
} else {
if ('boolean' == $params['query_type']) {
$where = 'MATCH (`search_texts`.`text`) AGAINST (? IN BOOLEAN MODE)';
} else {
$where = 'MATCH (`search_texts`.`text`) AGAINST (?)';
}
}
$select->where($where, $params['query']);
// Must fire the "search_sql" hook here instead of relying on the native
// "search_text_browse_sql" hook to ensure that the subsequent WHERE
// clauses are not reset. This hook can be used when a custom search
// strategy is added using the "search_query_types" filter.
fire_plugin_hook('search_sql', array('select' => $select, 'params' => $params));
// Search only those record types that are configured to be searched.
$searchRecordTypes = get_custom_search_record_types();
if ($searchRecordTypes) {
$select->where('`search_texts`.`record_type` IN (?)', array_keys($searchRecordTypes));
}
// Search on an specific record type.
if (isset($params['record_types'])) {
$select->where('`search_texts`.`record_type` IN (?)', $params['record_types']);
}
// Restrict access to private records.
$showNotPublic = Zend_Registry::get('bootstrap')->getResource('Acl')->isAllowed(current_user(), 'Search', 'showNotPublic');
if (!$showNotPublic) {
$select->where('`search_texts`.`public` = 1');
}
if ($retrieveInfos) {
$select->joinLeft(array('hierarchies' => 'omeka_hierarchies'), 'search_texts.record_id = hierarchies.id', array('hierarchies.atom_top_parent_id', 'hierarchies.atom_id', 'search_texts.record_id as id'));
}
}
示例6: render
public function render($content)
{
$type = $this->getType();
$record = $this->getRecord();
//hooks echo the content, so stuff the hook results into an output buffer
//then put that ob content into a variable
ob_start();
fire_plugin_hook("admin_" . $type . "_panel_buttons", array('view' => $this, 'record' => $record));
$buttonsHtml = ob_get_contents();
ob_end_clean();
ob_start();
fire_plugin_hook("admin_" . $type . "_panel_fields", array('view' => $this, 'record' => $record));
$fieldsHtml = ob_get_contents();
ob_end_clean();
//this div was supplied by ActionPanelHook to allow for this replacement
$html = str_replace("<div id='button-field-line'></div>", $buttonsHtml, $content);
return $html . $fieldsHtml;
}
示例7: editNavigationAction
public function editNavigationAction()
{
require_once APP_DIR . '/forms/Navigation.php';
$form = new Omeka_Form_Navigation();
fire_plugin_hook('navigation_form', array('form' => $form));
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$form->saveFromPost();
$this->_helper->flashMessenger(__('The navigation settings have been updated.'), 'success');
$this->_helper->redirector('edit-navigation');
} else {
$this->_helper->flashMessenger(__('The navigation settings were not saved because of missing or invalid values. All changed values have been restored.'), 'error');
foreach ($form->getMessages() as $msg) {
$this->_helper->flashMessenger($msg, 'error');
}
}
}
}
示例8: editAction
public function editAction()
{
$this->view->addHelperPath(USER_PROFILES_DIR . '/helpers', 'UserProfiles_View_Helper_');
$allTypes = $this->_helper->db->getTable('UserProfilesType')->findAll();
$typeId = $this->getParam('type');
//if no typeId
if (!$typeId) {
$typeId = $allTypes['0']->id;
}
$profileType = $this->_helper->db->getTable('UserProfilesType')->find($typeId);
$userId = $this->_getParam('id');
if ($userId) {
$user = $this->_helper->db->getTable('User')->find($userId);
} else {
$user = current_user();
$userId = $user->id;
}
$this->view->user = $user;
$userProfile = $this->_helper->db->getTable()->findByUserIdAndTypeId($userId, $typeId);
if (!$userProfile) {
$userProfile = new UserProfilesProfile();
$userProfile->setOwner($user);
$userProfile->type_id = $typeId;
$userProfile->setRelationData(array('subject_id' => $userId));
}
if (!is_allowed($userProfile, 'edit')) {
throw new Omeka_Controller_Exception_403();
}
if ($this->_getParam('submit')) {
$userProfile->setPostData($_POST);
if ($userProfile->save(false)) {
fire_plugin_hook('user_profiles_save', array('post' => $_POST, 'profile' => $userProfile, 'type' => $profileType));
$this->redirect("user-profiles/profiles/user/id/{$userId}/type/{$typeId}");
} else {
$this->_helper->flashMessenger($userProfile->getErrors());
}
}
$this->view->userprofilesprofile = $userProfile;
$this->view->userprofilestype = $profileType;
$this->view->profile_types = apply_filters('user_profiles_type', $allTypes);
}
示例9: preDispatch
/**
* Determine whether or not to filter form submissions for various controllers.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
**/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// Don't purify if the request is not a post
if (!$request->isPost()) {
return;
}
// Don't purify if the post is empty
$post = $request->getPost();
if (empty($post)) {
return;
}
// Don't purify if the purifier is not enabled
if (get_option('html_purifier_is_enabled') != '1') {
return;
}
// Don't purify if there is no purifier
$htmlPurifierFilter = new Omeka_Filter_HtmlPurifier();
$purifier = Omeka_Filter_HtmlPurifier::getHtmlPurifier();
if (!$purifier) {
return;
}
// To process the items form, implement a 'filterItemsForm' method
if ($this->isFormSubmission($request)) {
$controllerName = $request->getControllerName();
$filterMethodName = 'filter' . ucwords($controllerName) . 'Form';
if (method_exists($this, $filterMethodName)) {
$this->{$filterMethodName}($request, $htmlPurifierFilter);
}
}
// Let plugins hook into this to process form submissions in their own way.
fire_plugin_hook('html_purifier_form_submission', array('purifier' => $purifier));
// No processing for users form, since it's already properly filtered by
// User::filterPostData(). No processing for tags form, none of the tags
// should be HTML. The only input on the tags form is the 'new_tag'
// field on the edit page. No processing on the item-types form since
// there are no HTML fields.
}
示例10: perform
public function perform()
{
if (!($itemIds = $this->_options['itemIds'])) {
return;
}
$delete = $this->_options['delete'];
$metadata = $this->_options['metadata'];
$custom = $this->_options['custom'];
foreach ($itemIds as $id) {
$item = $this->_getItem($id);
if ($delete == '1') {
$item->delete();
} else {
foreach ($metadata as $key => $value) {
if ($value === '') {
unset($metadata[$key]);
}
}
update_item($item, $metadata);
fire_plugin_hook('items_batch_edit_custom', array('item' => $item, 'custom' => $custom));
}
release_object($item);
}
}
示例11: init
public function init()
{
parent::init();
$this->setAction(WEB_ROOT . '/commenting/comment/add');
$this->setAttrib('id', 'comment-form');
$user = current_user();
$urlOptions = array('label' => __('Website'));
$emailOptions = array('label' => __('Email (required)'), 'required' => true, 'validators' => array(array('validator' => 'EmailAddress')));
$nameOptions = array('label' => __('Your name'));
if ($user) {
$emailOptions['value'] = $user->email;
$nameOptions['value'] = $user->name;
}
$this->addElement('text', 'author_name', $nameOptions);
$this->addElement('text', 'author_url', $urlOptions);
$this->addElement('text', 'author_email', $emailOptions);
$this->addElement('textarea', 'body', array('label' => __('Comment'), 'description' => __("Allowed tags:") . " <p>, <a>, <em>, <strong>, <ul>, <ol>, <li>", 'id' => 'comment-form-body', 'rows' => 6, 'required' => true, 'filters' => array(array('StripTags', array('allowTags' => array('p', 'span', 'em', 'strong', 'a', 'ul', 'ol', 'li'), 'allowAttribs' => array('style', 'href'))))));
//assume registered users are trusted and don't make them play recaptcha
if (!$user && get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
$this->addElement('captcha', 'captcha', array('label' => __("Please verify you're a human"), 'captcha' => array('captcha' => 'ReCaptcha', 'pubkey' => get_option('recaptcha_public_key'), 'privkey' => get_option('recaptcha_private_key'), 'ssl' => true)));
$this->getElement('captcha')->removeDecorator('ViewHelper');
}
$request = Zend_Controller_Front::getInstance()->getRequest();
$params = $request->getParams();
$record_id = $this->_getRecordId($params);
$record_type = $this->_getRecordType($params);
$this->addElement('hidden', 'record_id', array('value' => $record_id, 'decorators' => array('ViewHelper')));
$this->addElement('hidden', 'path', array('value' => $request->getPathInfo(), 'decorators' => array('ViewHelper')));
if (isset($params['module'])) {
$this->addElement('hidden', 'module', array('value' => $params['module'], 'decorators' => array('ViewHelper')));
}
$this->addElement('hidden', 'record_type', array('value' => $record_type, 'decorators' => array('ViewHelper')));
$this->addElement('hidden', 'parent_comment_id', array('id' => 'parent-id', 'value' => null, 'decorators' => array('ViewHelper')));
fire_plugin_hook('commenting_form', array('comment_form' => $this));
$this->addElement('submit', 'submit', array('label' => __('Submit')));
}
示例12: editSettingsAction
public function editSettingsAction()
{
require_once APP_DIR . '/forms/GeneralSettings.php';
$form = new Omeka_Form_GeneralSettings();
$form->setDefaults($this->getInvokeArg('bootstrap')->getResource('Options'));
fire_plugin_hook('general_settings_form', array('form' => $form));
$form->removeDecorator('Form');
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$options = $form->getValues();
// Everything except the CSRF hash should correspond to a
// valid option in the database.
unset($options['settings_csrf']);
foreach ($options as $key => $value) {
set_option($key, $value);
}
$this->_helper->flashMessenger(__('The general settings have been updated.'), 'success');
$this->_helper->redirector('edit-settings');
} else {
$this->_helper->flashMessenger(__('There were errors found in your form. Please edit and resubmit.'), 'error');
}
}
}
示例13: __
} else {
?>
<h2><?php
echo __('You have no collections.');
?>
</h2>
<?php
if (is_allowed('Collections', 'add')) {
?>
<p><?php
echo __('Get started by adding your first collection.');
?>
</p>
<a href="<?php
echo html_escape(url('collections/add'));
?>
" class="add big green button"><?php
echo __('Add a Collection');
?>
</a>
<?php
}
}
?>
<?php
fire_plugin_hook('admin_collections_browse', array('collections' => $collections, 'view' => $this));
?>
<?php
echo foot();
示例14: __
?>
<div class="field">
<div class="two columns alpha">
<?php
echo $this->formLabel('featured', __('Featured/Non-Featured'));
?>
</div>
<div class="five columns omega inputs">
<?php
echo $this->formSelect('featured', @$_REQUEST['featured'], array(), label_table_options(array('1' => __('Only Featured Items'), '0' => __('Only Non-Featured Items'))));
?>
</div>
</div>
<?php
fire_plugin_hook('admin_items_search', array('view' => $this));
?>
</div>
<?php
if (!isset($buttonText)) {
$buttonText = __('Search for items');
}
?>
<?php
if (isset($useSidebar) && $useSidebar) {
?>
<div class="three columns omega">
<div id="save" class="panel">
<input type="submit" class="submit big green button" name="submit_search" id="submit_search_advanced" value="<?php
echo $buttonText;
?>
示例15: __
}
?>
<!-- The following prints a citation for this item. -->
<div id="item-citation" class="element">
<h3><?php
echo __('Citation');
?>
</h3>
<div class="element-text"><?php
echo metadata('item', 'citation', array('no_escape' => true));
?>
</div>
</div>
<?php
fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item));
?>
<ul class="item-pagination navigation">
<li id="previous-item" class="previous"><?php
echo link_to_previous_item_show();
?>
</li>
<li id="next-item" class="next"><?php
echo link_to_next_item_show();
?>
</li>
</ul>
</div> <!-- End of Primary. -->