2015-06-11 16:44:52 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Global functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HTML selection helper function
|
|
|
|
*
|
|
|
|
* @param string $a - First item to compare
|
|
|
|
* @param string $b - Second item to compare
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function is_selected($a, $b)
|
|
|
|
{
|
|
|
|
return ($a === $b) ? 'selected' : '';
|
|
|
|
}
|
|
|
|
|
2015-06-16 11:11:35 -04:00
|
|
|
/**
|
|
|
|
* Inverse of selected helper function
|
|
|
|
*
|
|
|
|
* @param string $a - First item to compare
|
|
|
|
* @param string $b - Second item to compare
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function is_not_selected($a, $b)
|
|
|
|
{
|
|
|
|
return ($a !== $b) ? 'selected' : '';
|
|
|
|
}
|
|
|
|
|
2015-06-11 16:44:52 -04:00
|
|
|
/**
|
2015-07-02 14:04:04 -04:00
|
|
|
* Determine whether to show the sub-menu
|
2015-06-11 16:44:52 -04:00
|
|
|
*
|
2015-07-02 14:04:04 -04:00
|
|
|
* @return bool
|
2015-06-11 16:44:52 -04:00
|
|
|
*/
|
2015-07-02 14:04:04 -04:00
|
|
|
function is_view_page()
|
2015-06-11 16:44:52 -04:00
|
|
|
{
|
2015-07-02 14:04:04 -04:00
|
|
|
$blacklist = ['edit', 'add', 'update', 'login', 'logout'];
|
|
|
|
$page_segments = explode("/", $_SERVER['REQUEST_URI']);
|
2015-06-16 11:11:35 -04:00
|
|
|
|
2015-07-02 14:04:04 -04:00
|
|
|
$intersect = array_intersect($page_segments, $blacklist);
|
2015-06-24 16:01:35 -04:00
|
|
|
|
2015-07-02 14:04:04 -04:00
|
|
|
return empty($intersect);
|
2015-06-16 11:11:35 -04:00
|
|
|
}
|
|
|
|
|
2015-11-11 15:28:51 -05:00
|
|
|
// End of functions.php
|