当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_match_path函数代码示例

本文整理汇总了PHP中drupal_match_path函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_match_path函数的具体用法?PHP drupal_match_path怎么用?PHP drupal_match_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_match_path函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rice_preprocess_page

/**
 * Override or insert variables into the page template.
 */
function rice_preprocess_page(&$vars)
{
    // CSS
    drupal_add_css(drupal_get_path('theme', 'rice') . '/css/colors.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/css/columnal.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/css/custom.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/css/feed.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.carousel.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.transitions.css');
    drupal_add_css(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.theme.css');
    drupal_add_css('https://fonts.googleapis.com/css?family=Cinzel');
    // JS
    drupal_add_js(drupal_get_path('theme', 'rice') . '/js/jquery-1.8.0.min.js');
    drupal_add_js(drupal_get_path('theme', 'rice') . '/js/modernizr.js');
    drupal_add_js(drupal_get_path('theme', 'rice') . '/js/moment-with-locales.js');
    drupal_add_js(drupal_get_path('theme', 'rice') . '/js/tools.js');
    drupal_add_js(drupal_get_path('theme', 'rice') . '/js/owl-carousel/owl.carousel.js');
    // Condition: Path
    $match = "<front>";
    $path = drupal_get_path_alias($_GET['q']);
    $path_matches = drupal_match_path($path, $match);
    if ($path != $_GET['q']) {
        $path_matches = $path_matches || drupal_match_path($_GET['q'], $matches);
    }
    if ($path_matches) {
        //drupal_add_css(drupal_get_path('theme', 'rice').'/css/style.css');
    }
    //Condition: Role
    $role = 'anonymous user';
    if (in_array($role, $vars['user']->roles)) {
        //drupal_add_css(drupal_get_path('theme', 'rice').'/anonymous.css');
    }
}
开发者ID:BlackholeMind,项目名称:Drupal-7-Rice-Theme,代码行数:36,代码来源:template.php

示例2: hook_colorbox_active_alter

/**
 * Allows to override activation of Colobox for the current URL.
 *
 * @param $active
 *   A boolean indicating whether colorbox should be active for the current
 *   URL or not.
 */
function hook_colorbox_active_alter(&$active)
{
    $path = drupal_get_path_alias($_GET['q']);
    if (drupal_match_path($path, 'admin/config/colorbox_test')) {
        // Enable colorbox for this URL.
        $active = TRUE;
    }
}
开发者ID:drupdateio,项目名称:gvj,代码行数:15,代码来源:colorbox.api.php

示例3: andromeda_page_alter

/**
 * Implementation of hook_page_alter()
 */
function andromeda_page_alter(&$page)
{
    //match pages and unset sidebar on matched pages
    $pages = drupal_strtolower(theme_get_setting('andromeda_sidebar_visibility'));
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
    if (drupal_match_path($path, $pages)) {
        unset($page['sidebar']);
    }
}
开发者ID:espixxl,项目名称:topguay,代码行数:12,代码来源:template.php

示例4: hook_content_lock_path_protected

/**
 * Control protected paths for node edit forms.
 *
 * The hook is typically implemented to check if a path should be protected for
 * CSRF attacks on the node edit forms.
 *
 * @param string $path
 *   The path to check protection for.
 *
 * @return bool
 *   TRUE is the path should be protected.
 *   Note: this grant is permissive rather than restrictive.
 *
 * @see hook_field_access()
 */
function hook_content_lock_path_protected($path)
{
    if (strpos($path, 'node/') === 0) {
        $paths_patterns = array('node/*/edit', 'node/*/revisions/*/revert');
        foreach ($paths_patterns as $protected_pattern) {
            if (drupal_match_path($path, $protected_pattern)) {
                return TRUE;
            }
        }
    }
}
开发者ID:CuBoulder,项目名称:cu-express-drops-7,代码行数:26,代码来源:content_lock.api.php

示例5: match

 public function match($path)
 {
     $record_path = $this->record['path'];
     $record_type = $this->record['type'];
     switch ($record_type) {
         case 'wildcard':
             return drupal_match_path($path, $record_path);
         case 'regex':
             $regex_result = preg_match_all('^' . $record_path . '^', $path);
             return !($regex_result === 0 || $regex_result === false);
     }
     return false;
 }
开发者ID:ryne-andal,项目名称:ablecore,代码行数:13,代码来源:MenuPathRelationship.php

示例6: govdexsupport_js_alter

/**
 * Implement hook_js_alter()
 * Attempt to replace the system jQuery on non admin and non node admin pages with a newer version provided by the theme
 */
function govdexsupport_js_alter(&$javascript)
{
    $node_admin_paths = array('node/*/edit', 'node/add', 'node/add/*', 'node/*/extend_review_date');
    $replace_jquery = TRUE;
    if (path_is_admin(current_path())) {
        $replace_jquery = FALSE;
    } else {
        foreach ($node_admin_paths as $node_admin_path) {
            if (drupal_match_path(current_path(), $node_admin_path)) {
                $replace_jquery = FALSE;
            }
        }
    }
    // Swap out jQuery to use an updated version of the library.
    if ($replace_jquery) {
        $javascript['misc/jquery.js']['data'] = '//code.jquery.com/jquery-2.1.4.min.js';
    }
}
开发者ID:govCMS,项目名称:govdex-support,代码行数:22,代码来源:template.php

示例7: tao_css_stripped

/**
 * Strips CSS files from a Drupal CSS array whose filenames start with
 * prefixes provided in the $match argument.
 */
function tao_css_stripped($match = array('modules/*'), $exceptions = NULL)
{
    // Set default exceptions
    if (!is_array($exceptions)) {
        $exceptions = array('modules/system/system.css', 'modules/update/update.css', 'modules/openid/openid.css', 'modules/acquia/*');
    }
    $css = drupal_add_css();
    $match = implode("\n", $match);
    $exceptions = implode("\n", $exceptions);
    foreach (array_keys($css['all']['module']) as $filename) {
        if (drupal_match_path($filename, $match) && !drupal_match_path($filename, $exceptions)) {
            unset($css['all']['module'][$filename]);
        }
    }
    // This servers to move the "all" CSS key to the front of the stack.
    // Mainly useful because modules register their CSS as 'all', while
    // Tao has a more media handling.
    ksort($css);
    return $css;
}
开发者ID:cableman,项目名称:ereolen,代码行数:24,代码来源:template.php

示例8: _carbon_get_layout

/**
 * Returns the name of the layout class associated with the current path.  The
 * layout name is used as a body class, which causes the page to be styled
 * with the corresponding layout.  This function makes it possible to use
 * different layouts on various pages of a site.
 *
 * @return <string>
 *   The name of the layout associated with the current page.
 */
function _carbon_get_layout() {
  $layout_patterns = _carbon_variable_get('layout', array('<global>' => 'body-layout-fixed-abc'));
  $global_layout = $layout_patterns['<global>'];
  unset($layout_patterns['<global>']);

  $alias_path = drupal_get_path_alias($_GET['q']);
  $path = $_GET['q'];
  foreach ($layout_patterns as $pattern => $layout) {
    if (drupal_match_path($alias_path, $pattern) ||
        drupal_match_path($path, $pattern)) {
      return $layout;
    }
  }
  return $global_layout;
}
开发者ID:rtdean93,项目名称:tbytam,代码行数:24,代码来源:template.php

示例9: get_available_sorts

 public function get_available_sorts()
 {
     $sorts = array();
     /*
     foreach( $this->available_sorts as $key => $sort ) {
       if( $sort['status'] ) {
         $sorts[$key]['title'] = $sort['title'];
         $sorts[$key]['default'] = $sort['default'];
       }
     }
     */
     $default_sorts = $this->default_sorts();
     foreach ($default_sorts as $sort_name => $sort) {
         // get the settings for this page
         $visibility_type = $sort->visibility['type'];
         $visibility_pages = $sort->visibility['pages'];
         if ($visibility_type < 2) {
             $path = drupal_get_path_alias($_GET['q']);
             // Compare with the internal and path alias (if any).
             $page_match = drupal_match_path($path, $visibility_pages);
             if ($path != $_GET['q']) {
                 $page_match = $page_match || drupal_match_path($_GET['q'], $visibility_pages);
             }
             // When $block->visibility has a value of 0, the block is displayed on
             // all pages except those listed in $block->pages. When set to 1, it
             // is displayed only on those pages listed in $block->pages.
             $page_match = !($visibility_type xor $page_match);
             if ($page_match) {
                 foreach ($sort->fields as $key => $value) {
                     $sorts[$key]['title'] = $value['display_value'];
                     $sorts[$key]['default'] = $value['sort'];
                 }
             }
         }
     }
     return $sorts;
 }
开发者ID:sraj4,项目名称:EthicsPublicHtmlProd,代码行数:37,代码来源:ApacheSolr_Custom_Query.php

示例10: bootstrap_psdpt_preprocess_page


//.........这里部分代码省略.........
                $suggestions[] = 'page__panels__' . $wxt_active . '__front';
            }
            // Add the panel page machine name to the template suggestions.
            $suggestions[] = 'page__' . $panel_page['name'];
            // Merge the suggestions in to the existing suggestions
            // (as more specific than the existing suggestions).
            $variables['theme_hook_suggestions'] = array_merge($variables['theme_hook_suggestions'], $suggestions);
            $variables['panels_layout'] = TRUE;
        } else {
            $suggestions[] = 'page__' . $wxt_active;
            // Splash Page.
            if (current_path() == 'splashify-splash') {
                $suggestions[] = 'page__splash__' . $wxt_active;
            }
            // Merge the suggestions in to the existing suggestions (as more specific
            // than the existing suggestions).
            $variables['theme_hook_suggestions'] = array_merge($variables['theme_hook_suggestions'], $suggestions);
        }
    }
    // Header Navigation + Language Switcher.
    $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-header') : menu_navigation_links('menu-wet-header');
    $nav_bar_markup = theme('links__menu_menu_wet_header', array('links' => $menu, 'attributes' => array('id' => 'menu', 'class' => array('links', 'clearfix')), 'heading' => array('text' => 'Language Selection', 'level' => 'h2')));
    $nav_bar_markup = strip_tags($nav_bar_markup, '<h2><li><a>');
    if (module_exists('wetkit_language')) {
        $language_link_markup = '<li id="' . $theme_menu_prefix . '-lang">' . strip_tags($variables['menu_lang_bar'], '<a><span>') . '</li>';
        if ($wxt_active == 'gcweb') {
            $variables['menu_bar'] = '<ul class="list-inline margin-bottom-none">' . $language_link_markup . '</ul>';
        } else {
            if ($wxt_active == 'gcwu_fegc') {
                $variables['menu_bar'] = '<ul id="gc-bar" class="list-inline">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . $language_link_markup . '</ul>';
            } else {
                if ($wxt_active == 'gc_intranet') {
                    $variables['menu_bar'] = '<ul id="gc-bar" class="list-inline">' . $language_link_markup . '</ul>';
                } else {
                    $variables['menu_bar'] = '<ul class="text-right">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . $language_link_markup . '</ul>';
                }
            }
        }
    } else {
        $variables['menu_bar'] = '<ul class="text-right">' . preg_replace("/<h([1-6]{1})>.*?<\\/h\\1>/si", '', $nav_bar_markup) . '</ul>';
    }
    // Custom Search Box.
    if (module_exists('custom_search')) {
        $custom_search_form_name = 'custom_search_blocks_form_1';
        $custom_search = array('#pre_render' => array('__wetkit_custom_search_prerender'), '#cache' => array('keys' => array('bootstrap_psdpt', 'custom_search', $custom_search_form_name), 'expire' => CACHE_TEMPORARY, 'granularity' => DRUPAL_CACHE_PER_USER), '#custom_search_form_name' => $custom_search_form_name, '#wxt_active' => $wxt_active);
        $variables['custom_search'] = $custom_search;
        // CDN Support.
        if ($wxt_active == 'gcweb') {
            $gcweb_cdn = theme_get_setting('gcweb_cdn');
            if (!empty($gcweb_cdn)) {
                $variables['gcweb_cdn'] = TRUE;
            } else {
                $variables['gcweb_cdn'] = FALSE;
            }
        }
        // Visibility settings.
        $pages = drupal_strtolower(theme_get_setting('wetkit_search_box'));
        // Convert the Drupal path to lowercase.
        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
        // Compare the lowercase internal and lowercase path alias (if any).
        $page_match = drupal_match_path($path, $pages);
        if ($path != $_GET['q']) {
            $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
        }
        // When $visibility has a value of 0 (VISIBILITY_NOTLISTED),
        // the block is displayed on all pages except those listed in $pages.
        // When set to 1 (VISIBILITY_LISTED), it is displayed only on those
        // pages listed in $pages.
        $visibility = 0;
        $page_match = !(0 xor $page_match);
        if ($page_match) {
            $variables['search_box'] = render($variables['custom_search']);
            $variables['search_box'] = str_replace('type="text"', 'type="search"', $variables['search_box']);
        } else {
            $variables['search_box'] = '';
        }
    }
    // Terms Navigation.
    $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-terms') : menu_navigation_links('menu-wet-terms');
    $class = $wxt_active == 'gcwu_fegc' || $wxt_active == 'gc_intranet' ? array('list-inline') : array('links', 'clearfix');
    $terms_bar_markup = theme('links__menu_menu_wet_terms', array('links' => $menu, 'attributes' => array('id' => 'gc-tctr', 'class' => $class), 'heading' => array()));
    $variables['page']['menu_terms_bar'] = $terms_bar_markup;
    // Mid Footer Region.
    if (module_exists('menu_block')) {
        $menu_name = 'mid_footer_menu';
        $data = array('#pre_render' => array('_wetkit_menu_tree_build_prerender'), '#cache' => array('keys' => array('bootstrap_psdpt', 'menu', 'footer', $menu_name), 'expire' => CACHE_TEMPORARY, 'granularity' => DRUPAL_CACHE_PER_ROLE), '#menu_name' => $menu_name);
        $variables['page']['footer']['minipanel'] = $data;
    }
    // Unset powered by block.
    unset($variables['page']['footer']['system_powered-by']);
    // Footer Navigation.
    $menu = $is_multilingual ? i18n_menu_navigation_links('menu-wet-footer') : menu_navigation_links('menu-wet-footer');
    $class = $wxt_active == 'gcwu_fegc' || $wxt_active == 'gc_intranet' ? array('list-inline') : array('links', 'clearfix');
    $footer_bar_markup = theme('links__menu_menu_wet_footer', array('links' => $menu, 'attributes' => array('id' => 'menu', 'class' => $class), 'heading' => array()));
    $variables['page']['menu_footer_bar'] = $footer_bar_markup;
    // Footer Navigation (gcweb).
    if ($wxt_active == 'gcweb') {
        $variables['gcweb'] = array('feedback' => array('en' => 'http://www.canada.ca/en/contact/feedback.html', 'fr' => 'http://www.canada.ca/fr/contact/retroaction.html'), 'social' => array('en' => 'http://www.canada.ca/en/social/index.html', 'fr' => 'http://www.canada.ca/fr/sociaux/index.html'), 'mobile' => array('en' => 'http://www.canada.ca/en/mobile/index.html', 'fr' => 'http://www.canada.ca/fr/mobile/index.html'));
    }
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:101,代码来源:page.vars.php

示例11: get_layout

 function get_layout()
 {
     $alias = drupal_get_path_alias($_GET['q']);
     foreach ($this->layouts as $k => $layout) {
         if ($k == 0) {
             continue;
         }
         $page_list = isset($layout->pages) ? $layout->pages : '';
         if (empty($page_list)) {
             continue;
         }
         if (drupal_match_path($_GET['q'], $page_list) || drupal_match_path($alias, $page_list)) {
             return $k;
         }
     }
     return 0;
 }
开发者ID:themesidea,项目名称:metamorph,代码行数:17,代码来源:core.php

示例12: engageny_show_banners

/**
 * Get banner to show into current page in accord with settings
 *
 * @return <array>
 *    Banners to show
 */
function engageny_show_banners()
{
    $banners = engageny_get_banners(FALSE);
    $display_banners = array();
    // Current path alias
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
    // Check visibility for each banner
    foreach ($banners as $banner) {
        // Pages
        $pages = drupal_strtolower($banner['image_visibility']);
        // Check path for alias, and (if required) for path
        $page_match = drupal_match_path($path, $pages);
        if ($path != $_GET['q']) {
            $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
        }
        // Add banner to visible banner
        if ($page_match) {
            $display_banners[] = $banner;
        }
    }
    return $display_banners;
}
开发者ID:nhamm18213,项目名称:test,代码行数:28,代码来源:template.php

示例13: _bvng_get_title_data

/**
 * Helper function for showing the title and subtitle of a site section in the
 * highlighted region.
 *
 * The description is retrieved from the description of the menu item.
 */
function _bvng_get_title_data($node_count = NULL, $user = NULL, $req_path = NULL)
{
    $status = drupal_get_http_header("status");
    // This way disassociates the taxanavigation voc, is more reasonable, but a bit heavy.
    // Only 'GBIF Newsroom' has a shorter name in the nav.
    $source_menu = strpos($req_path, 'user') !== FALSE ? 'user-menu' : 'gbif-menu';
    $active_menu_item = menu_link_get_preferred(current_path(), $source_menu);
    if (strpos(current_path(), 'user') !== FALSE) {
        switch ($req_path) {
            case 'user/login':
                $title = array('name' => t('Login to GBIF'), 'description' => '');
                break;
            case 'user/register':
                $title = array('name' => t('Register New GBIF Account'), 'description' => t('Please, register to the GBIF data portal for downloading data, or login if you already have an account'));
                break;
            case 'user/password':
                $title = array('name' => t('Request a new password'), 'description' => t('Please enter your username or the registered email address in order to reset your password'));
                break;
            case 'node/241':
                $title = array('name' => t('Thanks for registering!'), 'description' => t('Please verify your email address'));
                break;
            default:
                if (isset($user->uid) && $user->uid !== 0) {
                    $user = user_load($user->uid);
                    $name = '';
                    $name .= _bvng_get_field_value('user', $user, 'field_firstname');
                    $name .= ' ';
                    $name .= _bvng_get_field_value('user', $user, 'field_lastname');
                    $title = array('name' => $name, 'description' => t('User account and personal settings'));
                } elseif ($status == '403 Forbidden') {
                    $title = array('name' => t('You need to log in to visit this page'), 'description' => t('403 Forbidden: proper permission required'));
                } elseif (isset($user->uid) && $user->uid == 0) {
                    $title = array('name' => t('Log in to GBIF'), 'description' => '');
                }
                break;
        }
    } elseif ($status == '404 Not Found') {
        $title = array('name' => t("Hmm, the page can't be found"), 'description' => t('404 Not Found'));
    } elseif ($status == '403 Forbidden') {
        $title = array('name' => t('You need to log in to visit this page'), 'description' => t('403 Forbidden: proper permission required'));
    } elseif ($active_menu_item) {
        // The resource/summary and resources/keyinformation are shared by two menu parents
        // so we force the title here.
        if (drupal_match_path($req_path, 'taxonomy/term/764') || drupal_match_path($req_path, 'node/234') || drupal_match_path($req_path, 'resources/archive')) {
            $title = array('name' => t('Resources'), 'description' => t('Tools and information to support the GBIF community'));
        } else {
            $parent = menu_link_load($active_menu_item['plid']);
            $title = array('mild' => $parent['mlid'], 'name' => $parent['link_title'] == 'GBIF News' ? 'GBIF Newsroom' : $parent['link_title'], 'description' => $parent['options']['attributes']['title']);
        }
    } elseif (strpos(current_path(), 'taxonomy/term') !== FALSE) {
        $term = taxonomy_term_load(arg(2));
        $title = array('name' => format_plural($node_count, 'Item tagged with "@term"', 'Items tagged with "@term"', array('@term' => $term->name)));
    } elseif (strpos(current_path(), 'search') !== FALSE) {
        $title = array('name' => t('Search GBIF'));
    }
    return $title;
}
开发者ID:mwagdi,项目名称:gbif-portal,代码行数:63,代码来源:template.php

示例14: drupal_get_path_alias

//$item = menu_get_item();
//if ($item['path'] == 'blog' ||$item['path'] == 'taxonomy/term/%' || $item['path'] == 'post-date/%') {
//$wrapper_classes[] = 'blog';
//}
//if (isset($vars['node']) && $vars['node']->type == 'article') {
//$wrapper_classes[] = 'blog-single';
//}
$path_alias = drupal_get_path_alias();
$path = drupal_get_normal_path($_GET['q']);
$path_tearm = "taxonomy/term/*";
$path_view = "blog" . PHP_EOL . "post-date/*";
$path_node = "blog/*";
if (drupal_match_path($path_alias, $path_view) || drupal_match_path($path, $path_tearm)) {
    $wrapper_classes[] = 'blog';
}
if (drupal_match_path($path_alias, $path_node)) {
    $wrapper_classes[] = 'blog-single';
}
?>



<?php 
if (trim(implode(' ', $wrapper_classes)) == 'blog-single') {
    ?>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript">stLight.options({publisher: "ur-6a7e320d-37d8-511-633d-4264e3ae8c", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
<?php 
}
?>
开发者ID:aman4you,项目名称:sselling,代码行数:30,代码来源:md-blog.tpl.php


注:本文中的drupal_match_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。