getInstance() публичный статический Метод

Get an instance by key
public static getInstance ( string $key = 'default' ) : static
$key string
Результат static
Пример #1
0
 function render_breadcrumbs()
 {
     $breadcrumbs = BreadCrumbs::getInstance();
     $html = "<ol class='" . $breadcrumbs->getCssClasses() . "'>\n";
     foreach ($breadcrumbs->toArray() as $crumb) {
         $html .= "<li class='" . $crumb['class'] . "'>";
         $html .= $crumb['link'] ? "<a title='" . $crumb['title'] . "' href='" . $crumb['link'] . "'>" . $crumb['title'] . "</a>" : $crumb['title'];
         $html .= "</li>\n";
     }
     $html .= "</ol>\n";
     return $html;
 }
Пример #2
0
function render_page($license = FALSE)
{
    global $locale, $data, $aidlink;
    include THEME . "/locale/" . LOCALESET . "locale.php";
    add_to_head('
	<!--[if lt IE 7]>
	<script type="text/javascript" src="' . THEME . 'js/ie-png.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/supersleight.js"></script>
	<link rel="stylesheet" type="text/css" href="' . THEME . 'css/lt7.css" />
	<![endif]-->
	<!--[if IE]>
	<link rel="stylesheet" type="text/css" href="' . THEME . 'css/ie.css" />
	<![endif]-->
	<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="' . THEME . 'css/ie7.css" />
	<![endif]-->
	<script type="text/javascript" src="' . THEME . 'js/jquery.cycle.all.min.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/cufon-yui.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/Debonair-Calibri.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/Cufon-Settings.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/slider-settings.js"></script>
	<script type="text/javascript" src="' . THEME . 'js/subnavie6.js"></script>
	');
    add_to_head("<link rel='stylesheet' href='" . THEME . "css/bootstrap_rewrite.css' type='text/css'/>");
    include THEME . "theme_db.php";
    $theme_settings = get_theme_settings("debonair");
    echo "<div id='wrapper'>\n";
    echo "<div class='container'>\n";
    echo "<div class='body-wrap'>\n";
    echo "<div class='body-inner-wrap'>\n";
    // start header ----
    $banner_path = fusion_get_settings("sitebanner");
    echo "<header class='clearfix m-t-10'>\n\t\t<a class='logo' href='" . BASEDIR . "index.php'><img src='" . ($banner_path !== "" ? BASEDIR . $banner_path : IMAGES . "php-fusion-logo.png") . "' alt='" . fusion_get_settings("sitename") . "'/></a>\n\t\t<div class='tagline'>Super Clean Web 2.0 Business Template</div>\n";
    echo "<div class='call-tag'>\n";
    if (iADMIN) {
        echo "<span class='display-inline-block m-r-10'><a href='" . ADMIN . $aidlink . "'>" . $locale['global_123'] . "</a></span>\n";
    }
    echo $locale['global_ML102'] . "\n";
    foreach (fusion_get_enabled_languages() as $lang => $lang_name) {
        echo "<a href='" . clean_request("lang=" . $lang, array(), FALSE) . "'>{$lang_name}</a>\n";
    }
    echo "<i id='theme_search' class='fa fa-search fa-fw'></i>";
    echo "</div>\n</header>\n";
    // end header ----
    // start nav ---
    echo showsublinks();
    // end nav --
    // Header Banner
    $banner_inclusion_url = explode(",", $theme_settings['main_banner_url']);
    if (in_array(START_PAGE, $banner_inclusion_url)) {
        // get the results of the banner
        $result = dbquery("SELECT * FROM " . DB_DEBONAIR . " where banner_language='" . LANGUAGE . "' order by banner_order ASC");
        // show banner
        echo "<aside class='banner'>\n";
        echo "<div id='slider-container'>\n";
        echo "<ul id='slider-box'>\n";
        if (dbrows($result)) {
            while ($data = dbarray($result)) {
                echo "<!--Slide " . $data['banner_id'] . "-->\n";
                echo "<li>\n";
                echo "<div class='inner-banner'>\n";
                echo "<div class='slider-corner'></div>\n";
                if ($data['banner_image']) {
                    echo "<div class='screen'><img src='" . THEME . "upload/" . $data['banner_image'] . "' alt='" . $data['banner_subject'] . "'/></div>\n";
                }
                if ($data['banner_description'] !== "") {
                    echo "<h2>" . $data['banner_subject'] . "</h2>\n";
                    echo "<p>" . parseubb(parsesmileys($data['banner_description'])) . "</p>\n";
                } else {
                    echo "<h1>" . $data['banner_subject'] . "</h1>\n";
                }
                if ($data['banner_link'] !== "") {
                    echo "<div class='button-position'>\n";
                    echo "<div class='btn-group'><a class='btn btn-success btn-sm' href='" . BASEDIR . $data['banner_link'] . "'>Learn more</a></div>\n";
                    echo "</div>\n";
                }
                echo "</div>\n</li>\n";
                echo "<!--End slide " . $data['banner_id'] . "-->\n";
            }
        } else {
            echo "<!--Slide Welcome-->\n\t\t\t <li>\n\t\t\t <div class='welcome-banner'><div class='slider-corner'></div>\n\t\t\t <h1>" . $locale['debonair_0500'] . "</h1>\n\t\t\t <h2>" . $locale['debonair_0501'] . "</h2>\n\t\t\t </div>\n\t\t\t </li>\n\t\t\t <!-- End Slide Welcome-->\n\t\t \t";
            echo "<!--Slide Customize-->\n\t\t\t <li>\n\t\t\t <div class='welcome-banner-2'><div class='slider-corner'></div>\n\t\t\t <h1>" . $locale['debonair_0502'] . "</h1>\n\t\t\t <h2>" . $locale['debonair_0502a'] . "</h2>\n\t\t\t <div class='button-position'>\n\t\t\t <p>" . $locale['debonair_0502c'] . "</p>\n\t\t\t </div></div>\n\t\t\t </li>\n\t\t\t <!-- End Slide Customize-->\n\t\t \t";
        }
        echo "</ul>\n";
        echo "<!-- Start Slider Nav-->\n<div class='slide-pager-container'>\n<div id='slide-pager'></div>\n</div>\n<!-- End Slider Nav-->\n</div>\n";
        echo "</aside>\n";
        // upperbanner
        echo "<div class='lower-banner'>\n<div class='row holder'>\n";
        // 3 columns
        for ($i = 1; $i <= 3; $i++) {
            echo "<div class='col-xs-12 col-sm-4 col'>\n";
            if ($theme_settings['ubanner_col_' . $i] !== "") {
                $data = uncomposeSelection($theme_settings['ubanner_col_' . $i]);
                if (!empty($data['selected']) && multilang_table("NS") ? !empty($data['options'][LANGUAGE]) : "") {
                    switch ($data['selected']) {
                        case "news":
                            if (db_exists(DB_NEWS) && isset($data['options'][LANGUAGE])) {
                                $result = dbquery("select * from " . DB_NEWS . "\n\t\t\t\t\t\t\t\t\t\t\t" . (multilang_table("NS") ? "WHERE news_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('news_visibility') . "\n\t\t\t\t\t\t\t\t\t\t\tAND (news_start='0'||news_start<=" . time() . ")\n\t\t\t\t\t\t\t\t\t\t\tAND (news_end='0'||news_end>=" . time() . ") AND news_draft='0'\n\t\t\t\t\t\t\t\t\t\t\tAND news_id='" . $data['options'][LANGUAGE] . "'\n\t\t\t\t\t\t\t\t\t\t\t");
                                if (dbrows($result) > 0) {
                                    $data = dbarray($result);
                                    echo "<h2 class='icon1'>" . $data['news_subject'] . "</h2>\n";
                                    echo "<p>" . fusion_first_words(parse_textarea($data['news_news']), 50) . "</p>\n";
                                    echo "<div class='link-holder'><a href='" . INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n";
                                } else {
                                    echo "<p>" . $locale['debonair_0600'] . "</p>\n";
                                }
                            } else {
                                echo "<p>" . $locale['debonair_0408'] . "</p>\n";
                            }
                            break;
                        case "blog":
                            if (db_exists(DB_BLOG) && isset($data['options'][LANGUAGE])) {
                                $result = dbquery("select * from " . DB_BLOG . "\n\t\t\t\t\t\t\t\t\t\t\t" . (multilang_table("BL") ? "WHERE blog_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('blog_visibility') . "\n\t\t\t\t\t\t\t\t\t\t\tAND (blog_start='0'||blog_start<=" . time() . ")\n\t\t\t\t\t\t\t\t\t\t\tAND (blog_end='0'||blog_end>=" . time() . ") AND blog_draft='0'\n\t\t\t\t\t\t\t\t\t\t\tAND blog_id='" . $data['options'][LANGUAGE] . "'\n\t\t\t\t\t\t\t\t\t\t\t");
                                if (dbrows($result) > 0) {
                                    $data = dbarray($result);
                                    echo "<h2 class='icon2'>" . $data['blog_subject'] . "</h2>\n";
                                    echo "<p>" . fusion_first_words(parse_textarea($data['blog_blog']), 50) . "</p>\n";
                                    echo "<div class='link-holder'><a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n";
                                } else {
                                    echo "<p>" . $locale['debonair_0600'] . "</p>\n";
                                }
                            } else {
                                echo "<p>" . $locale['debonair_0405'] . "</p>\n";
                            }
                            break;
                        case "articles":
                            if (db_exists(DB_ARTICLES) && isset($data['options'][LANGUAGE])) {
                                $result = dbquery("SELECT ta.article_id, ta.article_subject, ta.article_snippet, ta.article_article, ta.article_keywords, ta.article_breaks,\n\t\t\t\t\t\t\t\tta.article_datestamp, ta.article_reads, ta.article_allow_comments, ta.article_allow_ratings,\n\t\t\t\t\t\t\t\ttac.article_cat_id, tac.article_cat_name\n\t\t\t\t\t\t\t\tFROM " . DB_ARTICLES . " ta\n\t\t\t\t\t\t\t\tINNER JOIN " . DB_ARTICLE_CATS . " tac ON ta.article_cat=tac.article_cat_id\n\t\t\t\t\t\t\t\t" . (multilang_table("AR") ? "WHERE tac.article_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('article_visibility') . " AND article_id='" . $data['options'][LANGUAGE] . "' AND article_draft='0'");
                                if (dbrows($result) > 0) {
                                    $data = dbarray($result);
                                    echo "<h2 class='icon2'>" . $data['article_subject'] . "</h2>\n";
                                    echo "<p>" . fusion_first_words(parse_textarea($data['article_subject']), 50) . "</p>\n";
                                    echo "<div class='link-holder'><a href='" . INFUSIONS . "articles/articles.php?article_id=" . $data['article_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n";
                                } else {
                                    echo "<p>" . $locale['debonair_0600'] . "</p>\n";
                                }
                            } else {
                                echo "<p>" . $locale['debonair_0415'] . "</p>\n";
                            }
                            break;
                        case "cp":
                            $result = dbquery("SELECT page_id, page_title, page_content\n\t\t\t\t\t\t\t\t\t\tfrom " . DB_CUSTOM_PAGES . "\n\t\t\t\t\t\t\t\t\t\tWHERE " . groupaccess('page_access') . "\n\t\t\t\t\t\t\t\t\t\tAND page_id='" . $data['options'][LANGUAGE] . "'");
                            if (dbrows($result) > 0) {
                                $data = dbarray($result);
                                echo "<h2 class='icon3'>" . $data['page_title'] . "</h2>\n";
                                echo "<p>" . fusion_first_words(parse_textarea($data['page_content']), 50) . "</p>\n";
                                echo "<div class='link-holder'><a href='" . BASEDIR . "viewpage.php?page_id=" . $data['page_id'] . "' class='more'>" . $locale['debonair_0504'] . "</a></div>\n";
                            } else {
                                echo "<p>" . $locale['debonair_0600'] . "</p>\n";
                            }
                            break;
                    }
                }
            } else {
                echo "<h2 class='icon3'>" . $locale['debonair_0601'] . "</h2>\n";
                echo "<p>" . $locale['debonair_0602'] . "</p>\n";
            }
            echo "</div>\n";
        }
        echo "</div>\n</div>\n";
    } else {
        // show simple header
        echo "<aside class='banner m-b-15'>\n";
        echo "<div class='page-header'>\n";
        if (!iMEMBER) {
            echo "<a href='" . BASEDIR . "login.php' class='btn btn-sm btn-success pull-right'><span>" . $locale['register'] . "/" . $locale['login'] . "</span></a>";
        } else {
            echo "<a href='" . fusion_get_settings("opening_page") . "?logout=yes' class='btn btn-sm btn-success pull-right'><span>" . $locale['logout'] . "</span></a>";
        }
        echo "<div class='holder p-b-20 p-r-10'>\n";
        echo "<div class='clearfix'>\n";
        echo "<div class='pull-left m-r-5'><span class='fa fa-map-marker fa-fw'></i>\n</span></div>";
        echo "<div class='overflow-hide'>\n";
        echo render_breadcrumbs();
        echo "</div>\n</div>\n";
        $title_instance = \PHPFusion\BreadCrumbs::getInstance();
        $reference = $title_instance->toArray();
        // this will give you the whole breadcrumb array
        $debonAirTitle = !empty($reference) ? end($reference) : array('title' => $locale['home']);
        echo "<h1>" . $debonAirTitle['title'] . "</h1>\n";
        echo "</div>\n</div>\n";
        echo "</aside>\n";
    }
    // end of banner
    // Start of Inner page structure for Bootstrap
    $side_grid_settings = array('desktop_size' => 2, 'laptop_size' => 3, 'tablet_size' => 3, 'phone_size' => 4);
    $notices = getNotices();
    if ($notices) {
        echo renderNotices($notices);
    }
    echo "<section class='main-content'>\n<div class='main-content-inner'>\n";
    // now have to do bootstrap calculation
    // row 1 - go for max width
    if (defined('AU_CENTER') && AU_CENTER) {
        echo "<div class='row'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>" . AU_CENTER . "</div>\n</div>";
    }
    // row 2 - fluid setitngs depending on panel appearances
    echo "<div class='row'>\n";
    if (defined('LEFT') && LEFT) {
        echo "<div class='" . html_prefix($side_grid_settings) . "'>\n" . LEFT . "</div>\n";
    }
    // column left
    echo "<div class='" . html_prefix(center_grid_settings($side_grid_settings)) . "'>\n";
    echo U_CENTER . CONTENT . L_CENTER . "</div>\n";
    // column center
    if (defined('RIGHT') && RIGHT) {
        echo "<div class='" . html_prefix($side_grid_settings) . "'>\n" . RIGHT . "</div>\n";
    }
    // column right
    echo "</div>\n";
    // row 3
    if (defined('BL_CENTER') && BL_CENTER) {
        echo "<div class='row'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>" . BL_CENTER . "</div>\n</div>";
    }
    echo "</div>\n</section>\n";
    echo "</div>\n";
    // end body-inner-wrap
    // Begin Footer
    echo "<section class='lower-section'>\n";
    echo "<div class='row col-holder'>\n";
    // column 1
    echo "<div class='col-xs-12 col-sm-3'>\n";
    if ($theme_settings['lbanner_col_1'] !== "") {
        include "include/" . $theme_settings['lbanner_col_1'];
    }
    // column 2
    echo "</div>\n<div class='col-xs-12 col-sm-3'>\n";
    if ($theme_settings['lbanner_col_2'] !== "") {
        include "include/" . $theme_settings['lbanner_col_2'];
    }
    // column 3
    echo "</div>\n<div class='col-xs-12 col-sm-3'>\n";
    if ($theme_settings['lbanner_col_3'] !== "") {
        include "include/" . $theme_settings['lbanner_col_3'];
    }
    // column 4
    echo "</div>\n<div class='col-xs-12 col-sm-3'>\n";
    if ($theme_settings['lbanner_col_4'] !== "") {
        include "include/" . $theme_settings['lbanner_col_4'];
    }
    echo "</div>\n";
    echo "</div>\n";
    // start bottom
    echo "<div class='bottom'>\n";
    if ($theme_settings['facebook_url'] || $theme_settings['twitter_url']) {
        echo "<!-- Start Follow Us Links -->\n<div class='follow-box'> <strong>" . $locale['debonair_0510'] . "</strong><ul>\n";
        if ($theme_settings['facebook_url']) {
            echo "<li><a href='" . $theme_settings['facebook_url'] . "' class='facebook'>" . $locale['debonair_0511'] . "</a></li>\n";
        }
        if ($theme_settings['twitter_url']) {
            echo "<li><a href='" . $theme_settings['twitter_url'] . "' class='twitter'>" . $locale['debonair_0512'] . "</a></li>\n";
        }
        echo "</ul></div><!-- End Follow Us Links -->\n";
    }
    echo "<div class='txt-holder'><p><small>" . str_replace("<br />", "", showcopyright()) . "</small></p></div>\n\t</div>\n</div>";
    echo "</section>\n";
    echo "</div>\n <!--End Wrapper Sub Elements -->";
    echo "\n\t<div id='footer'>\n      <!--Start Footer Nav -->\n      <div class='footer-nav'>\n         <div class='w1'>\n            <div class='w2'>\n               <ul>\n                  <li><a href='" . BASEDIR . fusion_get_settings("opening_page") . "'>" . $locale['debonair_0505'] . "</a></li>\n\t\t\t\t  <li><a href='" . BASEDIR . "contact.php'>" . $locale['debonair_0506'] . "</a></li>\n";
    if (db_exists(DB_ARTICLES)) {
        echo "<li><a href='" . INFUSIONS . "articles/articles.php'>" . $locale['debonair_0507'] . "</a></li>\n";
    }
    if (db_exists(DB_NEWS)) {
        echo "<li><a href='" . INFUSIONS . "news/news.php'>" . $locale['debonair_0508'] . "</a></li>\n";
    }
    if (db_exists(DB_BLOG)) {
        echo "<li><a href='" . INFUSIONS . "blog/blog.php'>" . $locale['debonair_0509'] . "</a></li>\n";
    }
    echo "</ul>\n            </div>\n         </div>\n      </div>\n      <!--End Footer Nav -->\n   </div>\n\t";
    echo '<script type="text/javascript">Cufon.now();</script>';
}
 /**
  * Displays Site Links Navigation Bar
  * @param string $sep     - Custom seperator text
  * @param string $class   - Class
  * @param array  $options - Expansions 9.1
  * @param int    $id      - 0 for root , Sitelink_ID to show child only
  * @return string
  */
 function showsublinks($sep = "", $class = "", array $options = array(), $id = 0)
 {
     $pageInfo = pathinfo($_SERVER['SCRIPT_NAME']);
     $start_page = $pageInfo['dirname'] !== "/" ? ltrim($pageInfo['dirname'], "/") . "/" : "";
     $site_path = ltrim(fusion_get_settings("site_path"), "/");
     $start_page = str_replace($site_path, "", $start_page);
     $start_page .= $pageInfo['basename'];
     if (fusion_get_settings("site_seo") && defined('IN_PERMALINK') && !isset($_GET['aid'])) {
         global $filepath;
         $start_page = $filepath;
     }
     static $data = array();
     $res =& $res;
     if (empty($data)) {
         $data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "WHERE link_position >= 2" . (multilang_table("SL") ? " AND link_language='" . LANGUAGE . "'" : "") . " AND " . groupaccess('link_visibility') . " ORDER BY link_cat, link_order");
     }
     if ($id == 0) {
         $res = "<div id='pf-navbar' class='navbar navbar-default' role='navigation'>\n";
         $res .= "<div class='navbar-header'>\n";
         $res .= "<!---Menu Header Start--->\n";
         $res .= "<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#phpfusion-menu' aria-expanded='false'>\n\t\t\t\t\t<span class='sr-only'>Toggle navigation</span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n      \t\t\t</button>\n";
         $res .= "<a class='navbar-brand visible-xs hidden-sm hidden-md hidden-lg' href='#'>" . fusion_get_settings("sitename") . "</a>\n";
         $res .= "<!---Menu Header End--->\n";
         $res .= "</div>\n";
         $res .= "<div class='navbar-collapse collapse' id='phpfusion-menu'>\n";
         $res .= "<ul " . (fusion_get_settings("bootstrap") ? "class='nav navbar-nav primary'" : "id='main-menu' class='primary sm sm-simple'") . ">\n";
         $res .= "<!---Menu Item Start--->\n";
     }
     //else {
     //$res .= "<ul".(fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "").">\n";
     //}
     if (!empty($data)) {
         $i = 0;
         foreach ($data[$id] as $link_id => $link_data) {
             $li_class = $class;
             // Attempt to calculate a relative link
             $secondary_active = FALSE;
             if ($start_page !== $link_data['link_url']) {
                 $link_instance = \PHPFusion\BreadCrumbs::getInstance();
                 $link_instance->showHome(FALSE);
                 $reference = $link_instance->toArray();
                 if (!empty($reference)) {
                     foreach ($reference as $refData) {
                         if (!empty($refData['link']) && $link_data['link_url'] !== "index.php") {
                             if (stristr($refData['link'], str_replace("index.php", "", $link_data['link_url']))) {
                                 $secondary_active = TRUE;
                             }
                             break;
                         }
                     }
                 }
             }
             if ($link_data['link_name'] != "---" && $link_data['link_name'] != "===") {
                 $link_target = $link_data['link_window'] == "1" ? " target='_blank'" : "";
                 if ($i == 0 && $id > 0) {
                     $li_class .= ($li_class ? " " : "") . "first-link";
                 }
                 if ($start_page == $link_data['link_url'] || $secondary_active == TRUE || $start_page == fusion_get_settings("opening_page") && $i == 0 && $id === 0) {
                     $li_class .= ($li_class ? " " : "") . "current-link active";
                 }
                 if (preg_match("!^(ht|f)tp(s)?://!i", $link_data['link_url'])) {
                     $itemlink = $link_data['link_url'];
                 } else {
                     $itemlink = BASEDIR . $link_data['link_url'];
                 }
                 $has_child = false;
                 $l_1 = "";
                 $l_2 = "";
                 if (isset($data[$link_id])) {
                     $has_child = true;
                     $l_1 = "class='dropdown-toggle' data-toggle='dropdown' ";
                     $l_2 = " <i class='caret'></i>\n";
                     $li_class .= " dropdown";
                 }
                 $res .= "<li" . ($li_class ? " class='" . $li_class . "'" : "") . ">" . $sep . "\n";
                 $res .= "<a " . $l_1 . "href='" . $itemlink . "'" . $link_target . ">" . $link_data['link_name'] . $l_2 . "</a>\n";
                 if ($has_child) {
                     $res .= "<ul" . (fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "") . ">\n";
                     $res .= "<li>" . $sep . "\n";
                     $res .= "<a href='" . $itemlink . "'" . $link_target . ">" . $link_data['link_name'] . "</a>\n";
                     $res .= "</li>\n";
                     $res .= showsublinks($sep, $class, $options, $link_data['link_id']);
                     $res .= "</ul>\n";
                 }
                 $res .= "</li>\n";
             } elseif ($link_data['link_cat'] > 0) {
                 echo "<li class='divider'></li>";
             }
             $i++;
         }
     }
     if ($id == 0) {
         $res .= "<!---Menu Item End--->\n";
         $res .= "</ul>\n";
         $res .= "</div>\n</div>\n";
         //} else {
         //$res .= "</ul>\n";
         //}
     }
     /** Smart Menus */
     /* add_to_jquery("
        $('li.dropdown').hover(
        function(e) {
        $(this).addClass('open');
        },
        function(e) {
        $(this).removeClass('open');
        }
        );
        "); */
     return $res;
 }
 /**
  * Displays Site Links Navigation Bar
  * @param string $sep     - Custom seperator text
  * @param string $class   - Class
  * @param array  $options -
  *
  * Default $options parameters:
  * id - unique navbar id
  * container - true for container mode
  * navbar_class - switch between navbar-default, navbar-inverse or custom class
  * item_class - the default li class
  * separator - default li separator
  * callback_data - replace default data callback
  *
  * @param int    $id      - 0 for root , Sitelink_ID to show child only
  * @return string
  */
 function showsublinks($sep = "", $class = "", array $options = array(), $id = 0)
 {
     $default_options = array("id" => "", "container" => FALSE, "navbar_class" => "navbar-default", "item_class" => $class, "separator" => $sep, "callback_data" => array(), "links_per_page" => fusion_get_settings("links_per_page"), "grouping" => fusion_get_settings("links_grouping"), "show_banner" => false, "show_header" => false);
     $options += $default_options;
     if (empty($options['id'])) {
         $options['id'] = md5(str_shuffle(str_replace(" ", "_", fusion_get_settings("sitename"))));
     }
     $pageInfo = pathinfo($_SERVER['REQUEST_URI']);
     $start_page = $pageInfo['dirname'] !== "/" ? ltrim($pageInfo['dirname'], "/") . "/" : "";
     $site_path = ltrim(fusion_get_settings("site_path"), "/");
     $start_page = str_replace($site_path, "", $start_page);
     $start_page .= $pageInfo['basename'];
     if (fusion_get_settings("site_seo") && defined('IN_PERMALINK') && !isset($_GET['aid'])) {
         global $filepath;
         $start_page = $filepath;
     }
     $res =& $res;
     if (empty($data) && empty($options['callback_data'])) {
         $data = \PHPFusion\SiteLinks::get_SiteLinksData(array('link_position' => array(2, 3)));
         // Is Equivalent to:
         //$data = dbquery_tree_full(DB_SITE_LINKS, "link_id", "link_cat", "WHERE link_position >= 2".(multilang_table("SL") ? " AND link_language='".LANGUAGE."'" : "")." AND ".groupaccess('link_visibility')." ORDER BY link_cat ASC, link_order ASC");
     } else {
         $data = $options['callback_data'];
     }
     /**
      * Change hierarchy data when grouping is on
      */
     if ($options['grouping'] == true) {
         if (count($data[0]) > $options['links_per_page']) {
             $more_index = 9 * 10000000;
             $base_data = $data[0];
             $data[$more_index] = array_slice($base_data, $options['links_per_page'], 9, TRUE);
             $data[0] = array_slice($base_data, 0, $options['links_per_page'], TRUE);
             $more[$more_index] = array("link_id" => $more_index, "link_cat" => 0, "link_name" => fusion_get_locale("global_700"), "link_url" => "#", "link_icon" => "", "link_visibility" => 0, "link_position" => 2, "link_window" => 0, "link_order" => $options['links_per_page'], "link_language" => LANGUAGE);
             $data[0] += $more;
         }
     }
     $banner = fusion_get_settings("sitebanner") && $options['show_banner'] == true ? "<img src='" . BASEDIR . fusion_get_settings("sitebanner") . "' alt='" . fusion_get_settings("sitename") . "'/>" : fusion_get_settings("sitename");
     if (empty($id)) {
         $res = "<div id='" . $options['id'] . "' class='navbar " . $options['navbar_class'] . "' role='navigation'>\n";
         $res .= $options['container'] ? "<div class='container'>\n" : "";
         $res .= "<div class='navbar-header'>\n";
         $res .= "<!---Menu Header Start--->\n";
         $res .= "<button type='button' class='navbar-toggle collapsed' data-toggle='collapse' data-target='#phpfusion-menu' aria-expanded='false'>\n\t\t\t\t\t<span class='sr-only'>Toggle navigation</span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n\t\t\t\t\t<span class='icon-bar'></span>\n      \t\t\t</button>\n";
         if ($options['show_header']) {
             $res .= "<a class='navbar-brand' href='" . BASEDIR . fusion_get_settings('opening_page') . "'>{$banner}</a>\n";
         } else {
             $res .= "<a class='navbar-brand visible-xs hidden-sm hidden-md hidden-lg' href='" . BASEDIR . fusion_get_settings('opening_page') . "'>" . fusion_get_settings("sitename") . "</a>\n";
         }
         $res .= "<!---Menu Header End--->\n";
         $res .= "</div>\n";
         $res .= "<div class='navbar-collapse collapse' id='" . $id . "-menu'>\n";
         $res .= "<ul " . (fusion_get_settings("bootstrap") ? "class='nav navbar-nav primary'" : "id='main-menu' class='primary sm sm-simple'") . ">\n";
         $res .= "<!---Menu Item Start--->\n";
     }
     if (!empty($data)) {
         $i = 0;
         $default_link_data = array("link_id" => 0, "link_name" => "", "link_cat" => 0, "link_url" => "", "link_icon" => "", "link_active" => FALSE, "link_title" => FALSE, "link_disabled" => FALSE, "link_window" => FALSE);
         foreach ($data[$id] as $link_id => $link_data) {
             $link_data += $default_link_data;
             $link_data['link_name'] = parsesmileys(parseubb($link_data['link_name']));
             $li_class = $options['item_class'];
             if ($link_data['link_disabled']) {
                 $li_class = "disabled";
             } else {
                 if ($link_data['link_title'] == TRUE) {
                     $li_class = "dropdown-header";
                 }
             }
             // Attempt to calculate a relative link
             $secondary_active = FALSE;
             if ($start_page !== $link_data['link_url']) {
                 $link_instance = \PHPFusion\BreadCrumbs::getInstance();
                 $link_instance->showHome(FALSE);
                 $reference = $link_instance->toArray();
                 if (!empty($reference)) {
                     foreach ($reference as $refData) {
                         if (!empty($link_data['link_url']) && !empty($refData['link']) && $link_data['link_url'] !== "index.php") {
                             if (stristr($refData['link'], str_replace("index.php", "", $link_data['link_url']))) {
                                 $secondary_active = TRUE;
                             }
                             break;
                             // match found
                         }
                     }
                 }
             }
             if ($link_data['link_name'] != "---" && $link_data['link_name'] != "===") {
                 $link_target = $link_data['link_window'] == "1" ? " target='_blank'" : "";
                 if ($i == 0 && $id > 0) {
                     $li_class .= ($li_class ? " " : "") . "first-link";
                 }
                 if ($start_page == $link_data['link_url'] || fusion_get_settings('site_path') . $start_page == $link_data['link_url'] || $secondary_active == TRUE || $start_page == fusion_get_settings("opening_page") && $i == 0 && $id === 0) {
                     $li_class .= ($li_class ? " " : "") . "current-link active";
                 }
                 $itemlink = BASEDIR . $link_data['link_url'];
                 if (preg_match("!^(ht|f)tp(s)?://!i", $link_data['link_url']) || !empty(BASEDIR) && stristr($link_data['link_url'], BASEDIR)) {
                     $itemlink = $link_data['link_url'];
                 }
                 $has_child = false;
                 $l_1 = "";
                 $l_2 = "";
                 $tab_index = "";
                 if (isset($data[$link_id])) {
                     $has_child = true;
                     $l_1 = "class='dropdown-toggle' data-toggle='dropdown' ";
                     $l_1 .= empty($id) && $has_child ? "data-submenu " : "";
                     $l_2 = empty($id) ? " <i class='caret'></i>\n" : "";
                     $li_class .= !empty($id) ? " dropdown-submenu" : " dropdown";
                     $tab_index .= !empty($id) ? "tabindex='0'" : "";
                 }
                 $res .= "<li" . ($li_class ? " class='" . $li_class . "'" : "") . ">" . $sep . "\n";
                 $res .= "<a " . $l_1 . "href='" . $itemlink . "'" . $link_target . " {$tab_index}>\n";
                 $res .= !empty($link_data['link_icon']) ? "<i class='" . $link_data['link_icon'] . "'></i>" : "";
                 $res .= $link_data['link_name'] . $l_2 . "</a>\n";
                 if ($has_child) {
                     $res .= "<ul" . (fusion_get_settings("bootstrap") ? " class='dropdown-menu'" : "") . ">\n";
                     if (!empty($link_data['link_url']) and $link_data['link_url'] !== "#") {
                         $res .= "<li>" . $options['separator'] . "\n";
                         $res .= "<a href='" . $itemlink . "'" . $link_target . ">\n";
                         $res .= !empty($link_data['link_icon']) ? "<i class='" . $link_data['link_icon'] . "'></i>" : "";
                         $res .= $link_data['link_name'] . "</a>\n";
                         $res .= "</li>\n";
                     }
                     $res .= showsublinks($sep, $class, $options, $link_data['link_id']);
                     $res .= "</ul>\n";
                 }
                 $res .= "</li>\n";
             } elseif ($link_data['link_cat'] > 0) {
                 $res .= "<li class='divider'></li>";
             }
             $i++;
         }
     }
     if (empty($id)) {
         $res .= "<!---Menu Item End--->\n";
         $res .= "</ul>\n";
         $res .= $options['container'] ? "</div>\n" : "";
         $res .= "</div>\n</div>\n";
     }
     return $res;
 }
Пример #5
0
/**
 * Get breadcrumbs
 *
 * @return array Keys of elements: title, link
 */
function get_breadcrumbs()
{
    return BreadCrumbs::getInstance()->toArray();
}