/**
  * {@inheritDocs}
  */
 public function match($pathinfo)
 {
     // The 'q' variable is pervasive in Drupal, so it's best to just keep
     // it even though it's very un-Symfony.
     $path = drupal_get_normal_path(substr($pathinfo, 1));
     if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
         menu_rebuild();
     }
     $original_map = arg(NULL, $path);
     $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
     $ancestors = menu_get_ancestors($parts);
     $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
     if ($router_item) {
         // Allow modules to alter the router item before it is translated and
         // checked for access.
         drupal_alter('menu_get_item', $router_item, $path, $original_map);
         // The requested path is an unalaised Drupal route.
         return array('_drupal' => true, '_controller' => function ($_router_item) {
             $router_item = $_router_item;
             if (!$router_item['access']) {
                 throw new AccessDeniedException();
             }
             if ($router_item['include_file']) {
                 require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
             }
             return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
         }, '_route' => $router_item['path']);
     }
     throw new ResourceNotFoundException();
 }
 function getParentPath($path, &$item)
 {
     if (!isset($this->parents[$path])) {
         $parent_path = $this->_findParentPath($path, $item);
         if (is_string($parent_path)) {
             $parent_path = drupal_get_normal_path($parent_path);
         }
         $this->parents[$path] = $parent_path;
     }
     return $this->parents[$path];
 }
Beispiel #3
0
 /**
  * Get node by nid or url key
  * @param mixed $node, options of $nid or $urlKey
  */
 public function getNode($node)
 {
     // return \node_view(\node_load($nid), 'teaser');
     // return \entity_load('node', array($nid));
     if (is_numeric($node)) {
         $nid = $node;
     } else {
         $normal_path = \drupal_get_normal_path($node);
         $nid = str_ireplace("node/", '', $normal_path);
     }
     $node = \node_load($nid);
     // error_log("nid: $nid");
     // error_log("node: ".print_r($node, true));
     return $node;
 }
Beispiel #4
0
 /**
  * Create menu links.
  *
  * @param array $links
  *   An array of menu link arrays.
  * @param array $defaults
  *   An array of defaults to use for each link. This avoids having to repeat
  *   values in each menu link, like 'menu_name' for example.
  */
 public static function createLinks(array &$links, array $defaults = array())
 {
     foreach ($links as &$link) {
         $link += $defaults;
         if (!url_is_external($link['link_path'])) {
             $link['link_path'] = drupal_get_normal_path($link['link_path']);
         }
         if ($mlid = menu_link_save($link)) {
             $link['mlid'] = $mlid;
             if (!empty($link['children'])) {
                 static::createLinks($link['children'], array('plid' => $mlid) + $defaults);
             }
         } else {
             // Add error logging.
         }
     }
 }
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Application $app An Application instance
  */
 public function register(Application $app)
 {
     $app['drupal.bootstrap.class'] = 'Bangpound\\Bridge\\Drupal\\Bootstrap';
     $app['drupal.class'] = 'Druplex';
     $app['legacy.request_matcher'] = $app->share($app->extend('legacy.request_matcher', function (RequestMatcher $matcher, $c) {
         $matcher->matchAttribute('_legacy', 'drupal');
         return $matcher;
     }));
     $app['drupal.listener.header'] = $app->share(function ($c) {
         return new HeaderListener($c['legacy.request_matcher']);
     });
     $app['drupal.bootstrap'] = $app->share(function () use($app) {
         /** @var Bootstrap $bootstrap */
         $bootstrap = new $app['drupal.bootstrap.class']();
         $bootstrap->setEventDispatcher($app['dispatcher']);
         require_once $app['web_dir'] . '/includes/bootstrap.inc';
         drupal_bootstrap(NULL, TRUE, $bootstrap);
         return $bootstrap;
     });
     $app->before(function (Request $request) use($app) {
         $app['drupal.bootstrap'];
         define('DRUPAL_ROOT', getcwd());
         drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
         $pathinfo = $request->getPathInfo();
         // The 'q' variable is pervasive in Drupal, so it's best to just keep
         // it even though it's very un-Symfony.
         $path = drupal_get_normal_path(substr($pathinfo, 1));
         if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
             menu_rebuild();
         }
         $original_map = arg(NULL, $path);
         $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
         $ancestors = menu_get_ancestors($parts);
         $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
         if ($router_item) {
             // Allow modules to alter the router item before it is translated and
             // checked for access.
             drupal_alter('menu_get_item', $router_item, $path, $original_map);
             // The requested path is an unalaised Drupal route.
             $request->attributes->add(array('_route' => $router_item['path'], '_legacy' => 'drupal'));
         }
     }, 33);
 }
 /**
  * Build the raw trail.
  */
 function buildTrail($path)
 {
     $path = drupal_get_normal_path($path);
     $trail_reverse = array();
     $front_normal_path = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
     $front_menu_item = crumbs_get_router_item($front_normal_path);
     $front_menu_item['href'] = '<front>';
     while (strlen($path) && $path !== '<front>' && $path !== $front_normal_path) {
         if (isset($trail_reverse[$path])) {
             // We found a loop! To prevent infinite recursion, we
             // remove the loopy paths from the trail and finish directly with <front>.
             while (isset($trail_reverse[$path])) {
                 array_pop($trail_reverse);
             }
             break;
         }
         $item = crumbs_get_router_item($path);
         // If this menu item is a default local task and links to its parent,
         // skip it and start the search from the parent instead.
         if ($item && $item['type'] & MENU_LINKS_TO_PARENT) {
             $path = $item['tab_parent_href'];
             $item = crumbs_get_router_item($item['tab_parent_href']);
         }
         // For a path to be included in the trail, it must resolve to a valid
         // router item, and the access check must pass.
         if ($item && $item['access']) {
             $trail_reverse[$path] = $item;
         }
         $parent_path = $this->parentFinder->getParentPath($path, $item);
         if ($parent_path === $path) {
             // This is again a loop, but with just one step.
             // Not as evil as the other kind of loop.
             break;
         }
         $path = $parent_path;
     }
     unset($trail_reverse['<front>']);
     $trail_reverse[$front_normal_path] = $front_menu_item;
     return array_reverse($trail_reverse);
 }
/**
* Implementation of theme_menu_item().
*
* Add active class to current menu item links.
*/
function phptemplate_menu_item($mid, $children = '', $leaf = TRUE)
{
    $item = menu_get_item($mid);
    // get current menu item
    $class = 'menu-' . str_replace(' ', '-', strtolower(str_replace('?', '', $item['title'])));
    $active_class = in_array($mid, _menu_get_active_trail()) ? ' active-trail' : '';
    // decide whether to add the active class to this menu item
    if (drupal_get_normal_path($item['path']) == $_GET['q'] || drupal_is_front_page() && $item['path'] == '<front>' || in_array($mid, _menu_get_active_trail())) {
        $active_class = ' active';
        // set active class
    } else {
        // otherwise...
        $active_class = '';
        // do nothing
    }
    return '<li class="' . ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) . $active_class . ' ' . $class . '">' . menu_item_link($mid) . $children . "</li>\n";
}
Beispiel #8
0
/**
 * Override or insert variables into page templates.
 *
 * @param $vars
 *   A sequential array of variables to pass to the theme template.
 * @param $hook
 *   The name of the theme function being called.
 */
function genesis_preprocess_page(&$vars, $hook)
{
    global $theme;
    // Don't display empty help from node_help().
    if ($vars['help'] == "<div class=\"help\"> \n</div>") {
        $vars['help'] = '';
    }
    // Add conditional stylesheets.
    if (!module_exists('conditional_styles')) {
        $vars['styles'] .= $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'], '');
    }
    // Set variables for the logo and site_name.
    if (!empty($vars['logo'])) {
        // Return the site_name even when site_name is disabled in theme settings.
        $vars['logo_alt_text'] = variable_get('site_name', '');
        $vars['site_logo'] = '<a href="' . $vars['front_page'] . '" title="' . t('Home page') . '" rel="home"><img src="' . $vars['logo'] . '" alt="' . $vars['logo_alt_text'] . ' ' . t('logo') . '" /></a>';
    }
    if (!empty($vars['site_name'])) {
        $vars['site_name'] = '<a href="' . $vars['front_page'] . '" title="' . t('Home page') . '" rel="home">' . $vars['site_name'] . '</a>';
    }
    // Set variables for the primary and secondary links.
    if (!empty($vars['primary_links'])) {
        $vars['primary_menu'] = theme('links', $vars['primary_links'], array('class' => 'primary-links clear-block'));
    }
    if (!empty($vars['secondary_links'])) {
        $vars['secondary_menu'] = theme('links', $vars['secondary_links'], array('class' => 'secondary-links clear-block'));
    }
    // Section class. The section class is printed on the body element and allows you to theme site sections.
    // We use the path alias otherwise all nodes will be in "section-node".
    $path_alias = drupal_get_path_alias($_GET['q']);
    if (!$vars['is_front']) {
        list($section, ) = explode('/', $path_alias, 2);
        $vars['section_class'] = 'class="' . safe_string('section-' . $section) . '"';
    }
    // Body Classes. In Genesis these are printed on the #container wrapper div, not on the body.
    $classes = explode(' ', $vars['body_classes']);
    // Remove the useless page-arg(0) class.
    if ($class = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-]+!s', '', 'page-' . drupal_strtolower(arg(0))), $classes)) {
        unset($classes[$class]);
    }
    /** 
     * Optional Region body classes
     * Uncomment the following if you need to set
     * a body class for each active region.
     */
    /*		
    if (!empty($vars['leaderboard'])) {
      $classes[] = 'leaderboard';
    }
    if (!empty($vars['header'])) {
      $classes[] = 'header-blocks';
    }
    if (!empty($vars['secondary_content'])) {
      $classes[] = 'secondary-content';
    }
    if (!empty($vars['tertiary_content'])) {
      $classes[] = 'tertiary-content';
    }
    if (!empty($vars['footer'])) {
      $classes[] = 'footer';
    }
    */
    /**
     * Additional body classes to help out themers.
     */
    if (!$vars['is_front']) {
        $normal_path = drupal_get_normal_path($_GET['q']);
        // Set a class based on Drupals internal path, e.g. page-node-1.
        // Using the alias is fragile because path alias's can change, $normal_path is more reliable.
        $classes[] = safe_string('page-' . $normal_path);
        if (arg(0) == 'node') {
            if (arg(1) == 'add') {
                $classes[] = 'page-node-add';
                // Add .node-add class.
            } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
                $classes[] = 'page-node-' . arg(2);
                // Add .node-edit or .node-delete classes.
            }
        }
    }
    $vars['classes'] = implode(' ', $classes);
    // Concatenate with spaces.
}
Beispiel #9
0
 /**
  * @return string
  */
 function getFrontNormalPath()
 {
     if (isset($this->frontNormalPath)) {
         return $this->frontNormalPath;
     }
     return $this->frontNormalPath = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
 }
Beispiel #10
0
function bookmark(){   //<span class="bookmarks" > print $bookmark; </span>
	global $user;
	global $base_url;	
	//if( ($user->uid == 1) || ( is_array($user->roles)  && in_array("Developer", $user->roles)  )    ){	
	$themepath = base_path() . path_to_theme().'/images';
	//$top = "<img src='$themepath/bkg_hook_top.png' alt='' title='' />";	
	$bookmark = "<img src='$themepath/icon_bookmark.png' alt='Bookmark' title='Bookmark' valign='bottom' width='24' height='23' />";
	$clipi = "<img src='$themepath/icon_clip_page.png' alt='Clip page' title='Clip page' valign='bottom' width='22' height='19'  />";
	$sep = "<div class='sep' ></div>";
	if(!$user->uid){ 	
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )  ){
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){
			
			$clip = $sep.'<span class="clip" ><a  class="rpxnow"  onclick="return false;" href="https://alim.rpxnow.com/openid/v2/signin?token_url='.$base_url.'/rpx/end_point" title="Clip" >'.$clipi.'</a></span>';
			}
		}
		
		$log = '<div id="bookmark-right-menu" ><div class="top" ></div><div class="middle" >'.$sep.'<span class="bookmarks" ><a  class="rpxnow"   onclick="return false;" href="https://alim.rpxnow.com/openid/v2/signin?token_url='.$base_url.'/rpx/end_point" title="Bookmark" >'.$bookmark.'</a></span>'.$clip.$sep.'</div><div class="bottom" ></div></div>'; 
		return $log; 
	}
	$path = drupal_urlencode(drupal_get_normal_path(drupal_get_path_alias($_GET['q'])));
	$query_variables = $_GET;
	unset($query_variables['q']);
	$query_string = '';
	foreach ($query_variables as $key => $value) {
		$query_string .= '&' . $key . '=' . $value;
	}
	
	if (!empty($path)) {
		if (!empty($query_string)) {
			$path .= '?' . $query_string;
		}
		
		
		$out = '<div id="bookmark-right-menu" ><div class="top" ></div><div class="middle" >'.$sep;
		$out .=  '<span class="bookmarks" ><a id="show-book-menu" href="#" title="Bookmark" >'.$bookmark.'</a></span>';
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )  ){
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){
			$out .=  $sep.'<span class="clip" ><a id="show-clip-menu" href="#" title="clip" >'.$clipi.'</a></span>';
			}
		}
		$out .=   $sep.'</div><div class="bottom" ></div></div>';
		$out .= '<div id="popup-bookmark" style="display:none;" ><div class="mybookmark-inner" >';//print_r($query_variables);
		$out .= '<a href="#" class="mymenu" id="dialog-mymenu" title="View the list of bookmarked pages"  >My Bookmarks</a>';
		$out .= l('<nobr>Bookmark this page</nobr>', 'bookmarks/item/addpage/' . base64_encode($path), array('attributes' => array('id' => 'bookmarks_add' , 'class' => 'popups' , 'title' => 'Bookmark the current page / Add this page to My Bookmarks '  ) , 'html' => TRUE  ));
        $out .= l(t('Organize Bookmarks'), 'bookmarks/mine',array('attributes' => array(  'class' => 'org-bm' , 'id' => 'bm-org-bm' , 
		'title' => 'Organise book mark' ) )  );

		$out .=  l( t('Set Last'), 'bookmarks/lastpage/'.base64_encode($path) ,array('attributes' => array(  'class' => 'bm-last' , 'id' => 'bm-lastpage' , 
		'title' => 'Set this page as the last page you were reading so that you can return to it easily on your next visit to alim.org' ) )  );
		//$out .= '<em style="font-size:8px;"> </em>';
		//if(  isset($user->profile_last_read ) && $user->profile_last_read != ''  ) 
		$menuid1 = db_result(db_query("SELECT value as lpage FROM {profile_values} WHERE fid='%d' AND uid= '%d'", 12 , $user->uid ));
		if(  isset($menuid1) && $menuid1 != ''  ) 
		$out .=  '<span id="mark-lastpage" >'.l( t('Go to Last'), $menuid1 ,array('attributes' => array(  'class' => 'bm-golast' ,
		'title' => 'Go to the last place you were reading.'  ) )  ).'</span>';
		else
		$out .=  '<span id="mark-lastpage" >'.l( t('Al-Qur\'an'), 'library/quran/surah/arabic/1/ARB' ,array('attributes' => array(  'class' => 'bm-golast' , 
		'title' => 'Go to the last place you were reading'  ) )  ).'</span>';			
		$out .=  '</div></div>';
		
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )   ){		
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){			
				$out .= '<div id="popup-clip-menu" style="display:none;" ><div class="mybookmark-inner" >';		
				$out .= l('Clip this Page' , 'node/add/clippings' , array( 'attributes' => array('class' => 'popups pop-clip-one' , 'id' => 'clip-btn-all' ,
				'title' => 'Clip the whole page and save to your notebook') , 'html' => TRUE ) ); 		
				$out .= '<a class="pop-clip-two" href="#" title="Clip the selected text from this page" id="clip-btn-sel" >Clip the selected text</a>';
				$out .= '<a class="pop-clip-three"  href="/user/clippings" title="Go to my notebook"  >My NoteBook</a>';
				$out .= '</div></div>';
			}
		
		}
		$out .= '<div style="display:none" id="bm-nice-menu" >Loading....</div>';
		return $out;
	}
	
	return '';
	
	//}
	//return '';
	
}
Beispiel #11
0
function fs_core_links__system_main_menu($variables)
{
    $to_render = drupal_get_form('search_block_form');
    $search_box = drupal_render($to_render);
    $pieces = explode('/', drupal_get_path_alias());
    $path = '';
    $parent_candidates = array();
    foreach ($pieces as $piece) {
        $path .= $piece . '/';
        $parent_candidates[] = drupal_get_normal_path(rtrim($path, '/'));
    }
    $html = '<ul class="nav navbar-nav">';
    $class = array();
    foreach ($variables['links'] as $key => $link) {
        if (is_array($link)) {
            if (array_key_exists('#attributes', $link)) {
                $class = $link['#attributes']['class'];
                //Adds the dropdown class if the expanded class is found
                $expanded = array_search("expanded", $class);
                if (strlen($expanded) > 0) {
                    $class[$expanded] .= " dropdown";
                }
            }
            if (array_key_exists('#href', $link)) {
                if (in_array($link['#href'], $parent_candidates)) {
                    $class[] = 'active-trail';
                }
            }
            //Builds the submenu string
            $submenu_string = "";
            if (array_key_exists('#below', $link)) {
                if (count($link['#below']) > 0) {
                    $submenu_links = $link['#below'];
                    $submenu_string = '<ul class="nav navbar-nav">';
                    foreach ($submenu_links as $skey => $submenu_link) {
                        if ($skey != '#sorted' && $skey != '#theme_wrappers') {
                            $sub_menu_class = $submenu_link['#attributes']['class'];
                            //Gets current item classes
                            $submenu_string .= '<li ' . drupal_attributes(array('class' => $sub_menu_class)) . '>' . l($submenu_link['#title'], $submenu_link['#href'], $submenu_link) . '</li>';
                        }
                    }
                    $submenu_string .= '</ul>';
                }
            }
            if ($key != '#sorted' && $key != '#theme_wrappers') {
                $html .= '<li' . drupal_attributes(array('class' => $class)) . '>' . l($link['#title'], $link['#href'], $link) . $submenu_string . '</li>';
            }
        }
    }
    $html .= '<li id="search-header" class="pull-right search-header">
                ' . $search_box . '
              </li>';
    $html .= '  </ul>';
    return $html;
}
Beispiel #12
0
/**
 * Custom function that returns the nid of the group being used for <front>.
 */
function unl_fourone_og_get_front_group_id()
{
    $front_nid = 0;
    $front_url = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
    $front_url = trim($front_url, '/');
    $front = explode('/', $front_url);
    if (isset($front[0], $front[1]) && $front[0] == 'node' && ctype_digit($front[1])) {
        $front_nid = $front[1];
    }
    return $front_nid;
}
                        <div id="third-parties">
                            <div class="trial-link uppercase strong trial-footer open-trial-dialog">Free Trial</div>
                            <small>Hosted on:</small><span class="rackspace"></span>
                            <small>Trusted by:</small><span class="verisign"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div id="legal">
            <div class="container">
                <div class="row">
                    <div id="made-in-canada" class="col-sm-5"><span class="maple-leaf"></span><small>Proudly designed and built in Canada, eh.</small></div>
                    <div id="copyright" class="col-sm-7"><small>Copyright &#169; 2015 Klipfolio Inc.<br class="visible-xs"/> All Rights Reserved.<br class="visible-xs"/> <?php 
print l(t("Terms of use"), drupal_get_normal_path("legal/terms-of-use"));
?>
</small></div>
                </div>
            </div>
        </div>
    </footer>

    <div class="responsive-indicator"></div>

    <script src="/<?php 
print path_to_theme();
?>
/js/bootstrap.min.js"></script>
    <?php 
print $page_bottom;
Beispiel #14
0
 * @see adaptivetheme_preprocess_node()
 * @see adaptivetheme_process_node()
 */
?>

<?php 
$wrapper_classes = array();
//$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') {
Beispiel #15
0
/_css/screen_ie8.css" />
	<![endif]-->	
	<script type="text/javascript">
	var doJscrollFAQ = false;
	</script>
  </head>

<body>
      <?php 
    echo $closure;
    ?>
	<?php 
    if ($is_front || $nav[1] == "search") {
        $par_node = node_load(1, NULL, TRUE);
    } else {
        $norm = explode('/', drupal_get_normal_path($nav[1]));
        $par_node = node_load(arg(1), NULL, TRUE);
    }
    $nid = $par_node->field_header[0]['nid'];
    $loaded_node = node_load($nid, NULL, TRUE);
    ?>
		

<!--   <div id="bgimg" style="background:url('/<?php 
    echo $loaded_node->field_image[0]['filepath'];
    ?>
') no-repeat center center;"></div> -->

	<!-- START main-container -->
	<div id="main-container">
 *     configured element type.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @ingroup views_templates
 */
?>
<div class="row">
    <div class="col-sm-4">
        <?php 
print $fields['field_image']->content;
?>
    </div>
    <div class="col-sm-7">
        <?php 
print $fields['title']->content;
?>
        <?php 
print $fields['body']->content;
?>
        <span class="more-link"><?php 
print l("Read More", drupal_get_path_alias("node/" . $row->nid));
?>
</span>
        or <span><?php 
print l("See more " . $fields['field_example_category']->content . " KPIs", drupal_get_normal_path("resources/kpi-examples/" . strtolower(str_replace(" ", "-", $fields['field_example_category']->content))));
?>
</span>
    </div>
</div>

 private static function createBreadcrumb($args)
 {
     if (!empty($args['groups_page_path']) && function_exists('hostsite_set_breadcrumb') && function_exists('drupal_get_normal_path')) {
         $path = drupal_get_normal_path($args['groups_page_path']);
         $node = menu_get_object('node', 1, $path);
         $breadcrumb[$node->title] = $args['groups_page_path'];
         hostsite_set_breadcrumb($breadcrumb);
     }
 }
Beispiel #18
0
/**
 * Override or insert variables into all templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered.
 */
function LCNG_preprocess_page(&$vars)
{
    $vars['tabs'] = menu_primary_local_tasks();
    $vars['tabs2'] = menu_secondary_local_tasks();
    if (arg(0) == 'user') {
        $vars['tabs'] = "";
    }
    if (arg(0) == "user" && !is_numeric(arg(1))) {
        $vars['template_file'] = 'page-userauth';
    }
    if (drupal_is_front_page() && !user_is_logged_in()) {
        $vars['template_file'] = 'page-front-anonymous';
    }
    if (drupal_is_front_page() && user_is_logged_in()) {
        $vars['template_file'] = 'page-h2panel';
    }
    if (arg(0) == "user" && is_numeric(arg(1)) || arg(0) == "start") {
        $vars['template_file'] = 'page-h2panel';
    }
    // Set variables for the logo and site_name.
    if (!empty($vars['logo'])) {
        // Return the site_name even when site_name is disabled in theme settings.
        $vars['logo_alt_text'] = variable_get('site_name', '');
        $vars['site_logo'] = '<a href="' . $vars['front_page'] . '" title="' . t('Home page') . '" rel="home"><img src="' . $vars['logo'] . '" alt="' . $vars['logo_alt_text'] . ' ' . t('logo') . '" /></a>';
    }
    if (!empty($vars['site_name'])) {
        $vars['site_name'] = '<a href="' . $vars['front_page'] . '" title="' . t('Home page') . '" rel="home">' . $vars['site_name'] . '</a>';
    }
    // Set variables for the primary and secondary links.
    if (!empty($vars['primary_links'])) {
        $vars['primary_menu'] = theme('links', $vars['primary_links'], array('class' => 'primary-links clear-block'));
    }
    if (!empty($vars['secondary_links'])) {
        $vars['secondary_menu'] = theme('links', $vars['secondary_links'], array('class' => 'secondary-links clear-block'));
    }
    // Section class. The section class is printed on the body element and allows you to theme site sections.
    // We use the path alias otherwise all nodes will be in "section-node".
    $path_alias = drupal_get_path_alias($_GET['q']);
    if (!$vars['is_front']) {
        list($section, ) = explode('/', $path_alias, 2);
        $vars['section_class'] = 'class="' . safe_string('section-' . $section) . '"';
    }
    // Body Classes. In Genesis these are printed on the #container wrapper div, not on the body.
    $classes = explode(' ', $vars['body_classes']);
    // Remove the useless page-arg(0) class.
    if ($class = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-]+!s', '', 'page-' . drupal_strtolower(arg(0))), $classes)) {
        unset($classes[$class]);
    }
    /**
     * Additional body classes to help out themers.
     */
    if (!$vars['is_front']) {
        $normal_path = drupal_get_normal_path($_GET['q']);
        // Set a class based on Drupals internal path, e.g. page-node-1.
        // Using the alias is fragile because path alias's can change, $normal_path is more reliable.
        $classes[] = safe_string('page-' . $normal_path);
        if (arg(0) == 'node') {
            if (arg(1) == 'add') {
                $classes[] = 'page-node-add';
                // Add .node-add class.
            } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
                $classes[] = 'page-node-' . arg(2);
                // Add .node-edit or .node-delete classes.
            }
        }
    }
    $status = $vars['title'];
    switch ($status) {
        case "Access denied":
        case "Page not found":
            $classes[] = 'page-error';
            // Add error page class.
            break;
    }
    $vars['classes'] = implode(' ', $classes);
    // Concatenate with spaces.
}
Beispiel #19
0
/**
 * Helper function for returning the relative source path.
 *
 * @param string $source_link
 *    The source link.
 *
 * @return string
 *    The relative link to the entity or boolean false.
 */
function theme_get_relative_link($source_link)
{
    global $language_url, $base_url, $base_path;
    $langcode = $language_url->prefix;
    $http_host = $base_url . $base_path . $langcode;
    // Format absolute internal link as a relative internal link.
    $link = preg_replace('/^' . preg_quote($http_host, '/') . '/', '', $source_link);
    // Strip possible leading forward slash.
    if (!is_null($link)) {
        $link = preg_replace('/^\\//', '', $link);
    }
    // Get the internal source link.
    if (!is_null($link)) {
        $link = drupal_get_normal_path($link, $langcode);
    } else {
        return (bool) $link;
    }
    return $link;
}
Beispiel #20
0
/**
 * Implements template_preprocess_page().
 *
 * @see gbif_navigation_node_view().
 * @see http://www.dibe.gr/blog/set-path-determining-active-trail-drupal-7-menu
 * @see https://drupal.org/node/1292590 for setting active user menu.
 */
function bvng_preprocess_page(&$variables)
{
    $req_path = $variables['page']['content']['requested_path'];
    $altered_path = FALSE;
    if (!empty($variables['node']->type)) {
        switch ($variables['node']->type) {
            case 'newsarticle':
                $altered_path = drupal_get_normal_path('newsroom/news');
                // taxonomy/term/566
                $variables['node']->type_title = t('GBIF News');
                break;
            case 'usesofdata':
                $altered_path = drupal_get_normal_path('newsroom/uses');
                // taxonomy/term/567
                $variables['node']->type_title = t('Featured Data Use');
                break;
            case 'event_ims':
                $altered_path = drupal_get_normal_path('newsroom/events');
                // taxonomy/term/569
                $variables['node']->type_title = t('Event Details');
                break;
            case 'resource_ims':
                $altered_path = drupal_get_normal_path('resources/summary');
                // taxonomy/term/569
                $variables['node']->type_title = t('Resource Details');
                break;
            case 'generictemplate':
                if (drupal_match_path($req_path, 'node/241')) {
                    $altered_path = 'user';
                }
                break;
        }
    } elseif (strpos($req_path, 'allnewsarticles') !== FALSE) {
        $altered_path = drupal_get_normal_path('newsroom/news');
        // taxonomy/term/566
    } elseif (strpos($req_path, 'alldatausearticles') !== FALSE) {
        $altered_path = drupal_get_normal_path('newsroom/uses');
        // taxonomy/term/567
    } elseif (strpos($req_path, 'resources') !== FALSE) {
        $altered_path = drupal_get_normal_path('resources/summary');
        // taxonomy/term/764
    } elseif (strpos($req_path, 'events') !== FALSE) {
        $altered_path = drupal_get_normal_path('newsroom/events');
        // taxonomy/term/569
    } elseif (drupal_match_path($req_path, 'user') || drupal_match_path($req_path, 'user/*')) {
        $altered_path = 'user';
    } elseif (strpos($req_path, 'mendeley') !== FALSE) {
        $altered_path = drupal_get_normal_path('mendeley');
    }
    if ($altered_path) {
        if ($altered_path != 'user') {
            menu_tree_set_path('gbif-menu', $altered_path);
            // can't use menu_tree_set_path for user, it'll mess the tabs.
        }
        menu_set_active_item($altered_path);
    } else {
        $active_path = menu_tree_get_path('gbif-menu');
        menu_tree_set_path('gbif-menu', $active_path);
        menu_set_active_item($req_path);
    }
    if (isset($variables['page']['content']['system_main']['nodes'])) {
        $node_count = _bvng_node_count($variables['page']['content']['system_main']['nodes']);
    } else {
        $node_count = NULL;
    }
    $variables['page']['highlighted_title'] = _bvng_get_title_data($node_count, $variables['user'], $req_path);
    // Manually set page title.
    if ($req_path == 'taxonomy/term/565') {
        drupal_set_title(t('GBIF Newsroom'));
    }
    // Relocate the search form to region 'highlighted'.
    if (isset($variables['page']['content']['system_main']['search_form'])) {
        unset($variables['page']['content']['system_main']['search_form']['advanced']);
        $search_form = $variables['page']['content']['system_main']['search_form'];
        $search_form['#attributes']['class'][] = 'banner_search_input';
        $variables['page']['highlighted'][] = $search_form;
        unset($variables['page']['content']['system_main']['search_form']);
    }
    // Load javascript only when needed.
    switch ($req_path) {
        case 'node/223':
            // contact/directoryofcontacts
            drupal_add_js(drupal_get_path('theme', 'bvng') . '/js/contacts.js', array('type' => 'file', 'scope' => 'footer'));
            break;
    }
    if (drupal_is_front_page()) {
        drupal_add_js(libraries_get_path('leaflet') . '/leaflet.js', array('type' => 'file', 'scope' => 'footer', 'weight' => 10));
        drupal_add_js(libraries_get_path('moment') . '/moment.js', array('type' => 'file', 'scope' => 'footer', 'weight' => 20));
        drupal_add_js(drupal_get_path('theme', 'bvng') . '/js/cfg', array('type' => 'file', 'scope' => 'footer', 'weight' => 30));
        drupal_add_js(drupal_get_path('theme', 'bvng') . '/js/frontPageWidgets.js', array('type' => 'file', 'scope' => 'footer', 'weight' => 50));
        $variables['search_form'] = module_invoke('search', 'block_view', 'search_form');
        $variables['logo'] = drupal_get_path('theme', 'bvng') . '/images/logo_white.png';
        $variables['site_name'] = "Global Biodiversity Information Facility";
    }
    // Load javascript for every pages.
    // drupal_add_js(drupal_get_path('theme', 'bvng') . '/js/bootstrap.min.js', array('type' => 'file', 'scope' => 'footer'));
    drupal_add_js('http://dev.gbif.org/issues/s/en_UKkby86d-1988229788/6096/5/1.4.0-m2/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=a2e9eca4', array('type' => 'file', 'scope' => 'footer', 'async_js' => TRUE));
}
 *   <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
 * @endcode
 *
 * @see template_preprocess_search_api_page_result()
 */
?>
<li class="search-result">
 
 
  <h3 class="title">
    <?php 
print $url ? l($title, $url['path'], $url['options']) : check_plain($title);
?>
  </h3>
 <?php 
$node_path = explode('/', drupal_get_normal_path($url['path']));
$nid = $node_path[1];
$n = node_load($nid);
if ($n->field_os2web_base_field_summary) {
    print "<pre>" . $n->field_os2web_base_field_summary['und'][0]['value'] . "</pre>";
}
?>
<!--
  <div class="search-snippet-info">
    <?php 
//if ($snippet) :
?>
      <p class="search-snippet"><?php 
// print $snippet;
?>
</p>
  <!--[if lt IE 9]><script src="<?php 
global $base_url;
print $base_url;
?>
/profiles/vp_profile/themes/vp_theme/js/html5.js"></script><![endif]-->
</head>
<body<?php 
print $attributes;
?>
>
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable"><?php 
print t('Skip to main content');
?>
</a>
    <?php 
print l(t('Accessibility Help'), drupal_get_normal_path('accessibility', 'en'), array('attributes' => array('class' => array('element-invisible', 'element-focusable'))));
?>
  </div>
  <?php 
print $page_top;
?>
  <?php 
print $page;
?>
  <?php 
print $page_bottom;
?>
</body>
</html>
Beispiel #23
0
            $path = drupal_lookup_path('source', $url[1] . '/' . $url[2]);
            $path = explode('/', $path);
            $path = $path[1];
            $node2 = node_load($path);
            $pagepath = drupal_get_normal_path(arg(0) . '/' . arg(1));
            $pagepath = explode('/', $pagepath);
            $pagepath = $pagepath[1];
            $node3 = node_load($pagepath);
            $breadcrumbwritten = 1;
            echo '<a href="/">Home</a> &raquo; <a href="/community/' . $url[2] . '">' . $node2->title . '</a> &raquo; <a href="/community/' . $url[2] . '/' . $url[3] . '">Recent Resources</a> &raquo; ' . $node3->title;
        } elseif (array_key_exists(3, $url) && $url[3] == 'links' && count($url) == 5) {
            $path = drupal_lookup_path('source', $url[1] . '/' . $url[2]);
            $path = explode('/', $path);
            $path = $path[1];
            $node2 = node_load($path);
            $pagepath = drupal_get_normal_path(arg(0) . '/' . arg(1));
            $pagepath = explode('/', $pagepath);
            $pagepath = $pagepath[1];
            $node3 = node_load($pagepath);
            $breadcrumbwritten = 1;
            echo '<a href="/">Home</a> &raquo; <a href="/community/' . $url[2] . '">' . $node2->title . '</a> &raquo; <a href="/community/' . $url[2] . '/' . $url[3] . '">Recent Links</a> &raquo; ' . $node3->title;
        }
    }
    if ($breadcrumbwritten == 0) {
        print $breadcrumb;
    }
    ?>
        </div>
      <?php 
}
?>
Beispiel #24
0
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
// Initialize configuration variables, using values from settings.php if available.
$conf = variable_initialize(isset($conf) ? $conf : array());
// Add file.inc for various file functions used in phpfreechat
require_once './includes/file.inc';
// Add common.inc to be able to use drupal_get_path later
require_once './includes/common.inc';
// Add user module to handle user permissions in phpfreechat
require_once drupal_get_path('module', 'user') . '/user.module';
// We will need to load the current node
if (!function_exists('arg')) {
    // Use HTTP_REFERER to extract the node ID
    $path = str_replace(array($base_url . '/', '/?q='), '', $_SERVER['HTTP_REFERER']);
    // Get the real path from the current request
    require_once './includes/path.inc';
    $args = explode('/', drupal_get_normal_path($path));
    $result = db_query('SELECT * FROM {node} n INNER JOIN {phpfreechat} pfc ON pfc.nid = n.nid WHERE n.nid = :nid', array(':nid' => $args[1]));
    $node = $result->fetchObject();
    if ($_SESSION['drupal_user']) {
        $user =& $_SESSION['drupal_user'];
    }
}
// Starting phpfreechat module
require_once drupal_get_path('module', 'phpfreechat') . '/phpfreechat.module';
$params = phpfreechat_load_params();
// Load global params
$params = phpfreechat_prepare_params($params, $node, $user);
// Prepare params for current node
// This is the phpFreeChat file with the code that gets everything going.
require_once drupal_get_path('module', 'phpfreechat') . '/phpfreechat/src/phpfreechat.class.php';
$chat = new phpFreeChat($params);