本文整理汇总了PHP中is_admin_theme函数的典型用法代码示例。如果您正苦于以下问题:PHP is_admin_theme函数的具体用法?PHP is_admin_theme怎么用?PHP is_admin_theme使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_admin_theme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsAdminThemeDependsOnFrontController
/**
* Starting from Omeka 1.3, is_admin_theme() should respond to a front
* controller parameter, NOT a constant, as using a constant reduces
* testability to zero.
*
* Since this test is flagged as an admin test, is_admin_theme() should be
* true by default. Then it should be false when we change the front
* controller param.
*/
public function testIsAdminThemeDependsOnFrontController()
{
$this->_frontController->setParam('admin', false);
$this->assertFalse(is_admin_theme());
$this->_frontController->setParam('admin', true);
$this->assertTrue(is_admin_theme());
}
示例2: preDispatch
/**
* Add the appropriate view scripts directories for a given request.
* This is pretty much the glue between the plugin broker and the
* View object, since it uses data from the plugin broker to determine what
* script paths will be available to the view.
*
* @param Zend_Controller_Request_Abstract $request Request object.
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// Getting the module name from the request object is pretty much the main
// reason why this needs to be in a controller plugin and can't be localized
// to the view script.
$moduleName = $request->getModuleName();
$isPluginModule = !in_array($moduleName, array('default', null));
$themeType = is_admin_theme() ? 'admin' : 'public';
$pluginScriptDirs = $this->_pluginMvc->getViewScriptDirs($themeType);
// Remove the current plugin, if any, from the set of "normal" plugin paths
if ($isPluginModule && isset($pluginScriptDirs[$moduleName])) {
$currentPluginScriptDirs = $pluginScriptDirs[$moduleName];
unset($pluginScriptDirs[$moduleName]);
}
// Add all the "normal" plugin paths
foreach ($pluginScriptDirs as $modulePaths) {
$this->_addPathsToView($modulePaths);
}
// Add the theme and core paths
$this->_addThemePaths($themeType);
// Add plugin and theme-override paths for current plugin
if ($isPluginModule) {
if (isset($currentPluginScriptDirs)) {
$this->_addPathsToView($currentPluginScriptDirs);
}
$this->_addOverridePathForPlugin($themeType, $moduleName);
}
}
示例3: _addHomepageRoute
/**
* Adds the homepage route to the router (as specified by the navigation settings page)
* The route will not be added if the user is currently on the admin theme.
*
* @param Zend_Controller_Router_Rewrite $router The router
*/
private function _addHomepageRoute($router)
{
// Don't add the route if the user is on the admin theme
if (!is_admin_theme()) {
$homepageUri = get_option(Omeka_Form_Navigation::HOMEPAGE_URI_OPTION_NAME);
$homepageUri = trim($homepageUri);
$withoutAdminUri = $this->_leftTrim($this->_leftTrim($homepageUri, ADMIN_BASE_URL), '/' . ADMIN_WEB_DIR);
if ($withoutAdminUri != $homepageUri) {
// homepage uri is an admin link
$homepageUri = WEB_ROOT . '/' . ADMIN_WEB_DIR . $withoutAdminUri;
$this->addRedirectRouteForDefaultRoute(self::HOMEPAGE_ROUTE_NAME, $homepageUri, array(), $router);
} else {
// homepage uri is not an admin link
// left trim root directory off of the homepage uri
$homepageUri = $this->_leftTrim($homepageUri, PUBLIC_BASE_URL);
// make sure the new homepage is not the default homepage
if ($homepageUri == '' || $homepageUri == self::DEFAULT_ROUTE_NAME || $homepageUri == PUBLIC_BASE_URL) {
return;
}
$homepageRequest = new Zend_Controller_Request_Http();
$homepageRequest->setBaseUrl(WEB_ROOT);
// web root includes server and root directory
$homepageRequest->setRequestUri($homepageUri);
$router->route($homepageRequest);
$dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
if ($dispatcher->isDispatchable($homepageRequest)) {
// homepage is an internal link
$router->addRoute(self::HOMEPAGE_ROUTE_NAME, new Zend_Controller_Router_Route(self::DEFAULT_ROUTE_NAME, $homepageRequest->getParams()));
} else {
// homepage is some external link or a broken internal link
$this->addRedirectRouteForDefaultRoute(self::HOMEPAGE_ROUTE_NAME, $homepageUri, array(), $router);
}
}
}
}
示例4: hookDefineRoutes
/**
* Defines public routes.
*
* @return void
*/
public function hookDefineRoutes($args)
{
if (is_admin_theme()) {
return;
}
$args['router']->addConfig(new Zend_Config_Ini(dirname(__FILE__) . '/routes.ini', 'routes'));
}
示例5: recordUrl
/**
* Return a URL to a record.
*
* @uses Omeka_Record_AbstractRecord::getCurrentRecord()
* @uses Omeka_Record_AbstractRecord::getRecordUrl()
* @uses Omeka_View_Helper_Url::url()
* @uses Omeka_View_Helper_GetRecordFullIdentifier::getRecordFullIdentifier()
* @throws Omeka_View_Exception
* @param Omeka_Record_AbstractRecord|string $record
* @param string|null $action
* @param bool $getAbsoluteUrl
* @param array $queryParams
* @return string
*/
public function recordUrl($record, $action = null, $getAbsoluteUrl = false, $queryParams = array())
{
if (is_admin_theme() && !get_option('clean_url_use_admin')) {
return parent::recordUrl($record, $action, $getAbsoluteUrl, $queryParams);
}
// Get the current record from the view if passed as a string.
if (is_string($record)) {
$record = $this->view->getCurrentRecord($record);
}
if (!$record instanceof Omeka_Record_AbstractRecord) {
throw new Omeka_View_Exception(__('Invalid record passed while getting record URL.'));
}
// Get the clean url if any.
$cleanUrl = $this->_getCleanUrl($record, $action);
if ($cleanUrl) {
$url = $cleanUrl;
if ($getAbsoluteUrl) {
$url = $this->view->serverUrl() . $url;
}
if ($queryParams) {
$query = http_build_query($queryParams);
// Append params if query is already part of the URL.
if (strpos($url, '?') === false) {
$url .= '?' . $query;
} else {
$url .= '&' . $query;
}
}
return $url;
}
return parent::recordUrl($record, $action, $getAbsoluteUrl, $queryParams);
}
示例6: _addHomepageRoute
/**
* Adds the homepage route to the router (as specified by the navigation settings page)
* The route will not be added if the user is currently on the admin theme.
*
* @param Zend_Controller_Router_Rewrite $router The router
*/
private function _addHomepageRoute($router)
{
// Don't add the route if the user is on the admin theme
if (is_admin_theme()) {
return;
}
$homepageUri = trim(get_option(Omeka_Form_Navigation::HOMEPAGE_URI_OPTION_NAME));
if (strpos($homepageUri, ADMIN_BASE_URL) === 0) {
// homepage uri is an admin link
$this->_addHomepageRedirect($homepageUri, $router);
} else {
if (strpos($homepageUri, '?') === false) {
// left trim root directory off of the homepage uri
$relativeUri = $this->_leftTrim($homepageUri, PUBLIC_BASE_URL);
// make sure the new homepage is not the default homepage
if ($relativeUri == '' || $relativeUri == '/') {
return;
}
$homepageRequest = new Zend_Controller_Request_Http();
$homepageRequest->setRequestUri($homepageUri);
$router->route($homepageRequest);
$dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
if ($dispatcher->isDispatchable($homepageRequest)) {
// homepage is an internal link
$router->addRoute(self::HOMEPAGE_ROUTE_NAME, new Zend_Controller_Router_Route('/', $homepageRequest->getParams()));
return;
}
}
}
// homepage is some external link, a broken internal link, or has a
// query string
$this->_addHomepageRedirect($homepageUri, $router);
}
示例7: indexAction
public function indexAction()
{
if (!is_admin_theme()) {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->redirector->gotoUrl(MASTER_URL);
}
}
示例8: _preventAdminAccess
protected function _preventAdminAccess($request)
{
$user = current_user();
// If we're logged in, then prevent access to the admin for guest users
if ($user && $user->role == 'guest' && is_admin_theme()) {
$this->_getRedirect()->gotoUrl(WEB_ROOT . '/guest-user/user/me');
}
}
示例9: _getBrowseRecordsPerPage
/**
* Use global settings for determining browse page limits.
*
* @return int
*/
public function _getBrowseRecordsPerPage()
{
if (is_admin_theme()) {
return (int) get_option('per_page_admin');
} else {
return (int) get_option('per_page_public');
}
}
示例10: indexAction
public function indexAction()
{
if (is_admin_theme()) {
// There is no API endpoint on the admin theme.
$this->_helper->redirector('index', 'index');
}
$this->view->title = get_option('site_title');
$this->view->site_url = Omeka_Record_Api_AbstractRecordAdapter::getResourceUrl('/site');
$this->view->resource_url = Omeka_Record_Api_AbstractRecordAdapter::getResourceUrl('/resources');
}
示例11: filterElementsSelectOptions
public function filterElementsSelectOptions($elementSets)
{
//make this magic happen only on the advanced search page
if (!is_admin_theme()) {
$elementsWeWant = array('Title', 'Date', 'Text', 'Creator', 'Description', 'To', 'From', 'Email Body', 'Local URL', 'Date Published', 'Date Accessed', 'Contributor Name', 'Contributor Age', 'Contributor Gender', 'Contributor Race', 'Current Location');
foreach ($elementSets as $elementSet => $elements) {
foreach ($elements as $id => $element) {
if (!in_array($element, $elementsWeWant)) {
unset($elementSets[$elementSet][$id]);
}
}
}
}
return $elementSets;
}
示例12: replaceDigitalObjectRelations
/**
* This is a filter function.
*
* If the relation text begins with thumb:, then the thumb: portion
* is stripped and the remaining urn is displayed as a thumbnail.
* If the relation text begins with full:, the full: portion
* is stripped and the remaining urn is displayed as a link.
*
* Any other relation text not meeting the criteria is simply returned as is.
*
* @param string - the text from the Relation field
* @return string - this will be an img tag if thumb:, a href tag if full:, or currently existing text.
*/
public function replaceDigitalObjectRelations($text, $args)
{
//If the relation has a full string, check to see if it has a thumb relation. If so, then
//display the thumb and link it out to the full image. Otherwise just make it a link.
if (preg_match(get_option('digitalobjectlinkerplugin_preg_full_image_string'), $text)) {
//Strip the full: from the text.
$fulllink = substr($text, strlen(get_option('digitalobjectlinkerplugin_full_image_tag')));
//The only way that I could find to get all relations during the filter was to pull the relations from the database.
//Trying to pull from the metadata function seemed to throw this into an infinite loop.
//This first gets the element_id for the 'Relation' element from the 'Element' table (omeka_elements if you are looking in the db).
//Second, it then finds all of the 'Relation' element texts from the 'ElementText' table (omeka_element_texts) using
//the record ID which was passed in from the filter and the element_id that was retrieved.
$element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Dublin Core', 'Relation');
$elementID = $element->id;
//Record ID that was passed in from the filter.
$recordID = $args['record']->id;
//We no longer need the element object that we retrieved so releas it.
release_object($element);
//Create the select for the ElementText table.
$select = get_db()->select()->from(array(get_db()->ElementText), array('text'))->where('record_id=' . $recordID . ' AND element_id = ' . $elementID);
//Fetch all of the relations. They come back as an array in this form:
//array(0 => array('text' => full:urn...), 1 => array('text' => thumb:urn....))
$relations = get_db()->getTable('ElementText')->fetchAll($select);
//Logger::log($relations);
//As long as at least one relation was returned, we can continue.
if (count($relations) > 0) {
foreach ($relations as $relation) {
//Make sure the relation is not the full relation that we are filtering. If it isn't,
//check to see if it is the thumb relation.
if ($relation['text'] != $text && preg_match(get_option('digitalobjectlinkerplugin_preg_thumb_string'), $relation['text'])) {
//Create a thumb image that links out to the full image.
$thumblink = substr($relation['text'], strlen(get_option('digitalobjectlinkerplugin_thumb_tag')));
if (!empty($thumblink)) {
//Determine the width and height of the thumb.
$width = is_admin_theme() ? get_option('digitalobjectlinkerplugin_width_admin') : get_option('digitalobjectlinkerplugin_width_public');
return "<div class=\"item-relation\"><a href=\"" . $fulllink . "\" target=\"_blank\"><img src=\"" . $thumblink . "\" alt=\"" . $thumblink . "\" height=\"" . $width . "\"></img></a></div>";
}
}
}
}
//If it reaches this point, the relations did not contain a thumbnail so return a plain link.
return "<a href=\"" . $fulllink . "\" target=\"_blank\">" . $fulllink . "</a>";
} elseif (!preg_match(get_option('digitalobjectlinkerplugin_preg_thumb_string'), $text)) {
return $text;
} else {
return "<div></div>";
}
}
示例13: showAction
public function showAction()
{
parent::showAction();
$db = $this->_helper->db;
$itemTable = $db->getTable('Item');
$itemAlias = $itemTable->getTableAlias();
$select = $itemTable->getSelectForFindBy(array(), is_admin_theme() ? 10 : 5);
$rrTable = $db->getTable('RecordRelationsRelation');
$rrAlias = $rrTable->getTableAlias();
$select->joinInner(array($rrAlias => $rrTable->getTableName()), "{$rrAlias}.subject_id = {$itemAlias}.id", array());
$select->where("{$rrAlias}.object_id = ?", $this->view->collection->id);
$select->where("{$rrAlias}.object_record_type = 'Collection'");
$select->where("{$rrAlias}.property_id = ?", get_record_relations_property_id(DCTERMS, 'isPartOf'));
$select->where("{$rrAlias}.subject_record_type = 'Item'");
$this->view->items = $itemTable->fetchObjects($select);
}
开发者ID:kent-state-university-libraries,项目名称:MultiCollections,代码行数:16,代码来源:MultiCollectionsController.php
示例14: preDispatch
/**
* Add the appropriate view scripts directories for a given request.
* This is pretty much the glue between the plugin broker and the
* View object, since it uses data from the plugin broker to determine what
* script paths will be available to the view.
*
* @param Zend_Controller_Request_Abstract $request Request object.
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// Getting the module name from the request object is pretty much the main
// reason why this needs to be in a controller plugin and can't be localized
// to the view script.
$moduleName = $request->getModuleName();
$isPluginModule = !in_array($moduleName, array('default', null));
$themeType = is_admin_theme() ? 'admin' : 'public';
if ($isPluginModule) {
// Make it so that plugin view/assets load before the theme (and only for the specific plugin/theme).
$this->_setupPathsForPlugin($moduleName, $themeType);
} else {
// Make it so that plugin view/assets load after the theme (and for all possibly plugins).
$this->_setupPathsForTheme($themeType);
}
}
示例15: _getBrowseRecordsPerPage
/**
* Return the number of results to display per page.
*
* An authorized user can modify this using the "per_page" query parameter.
*
* @return int
*/
protected function _getBrowseRecordsPerPage()
{
// Return the per page if the current user has permission to modify it.
if ($this->_helper->acl->isAllowed('modifyPerPage', 'Search')) {
$perPage = (int) $this->getRequest()->get('per_page');
if ($perPage) {
return $perPage;
}
}
if (is_admin_theme()) {
$perPage = (int) get_option('per_page_admin');
} else {
$perPage = (int) get_option('per_page_public');
}
return $perPage;
}