Exemplo n.º 1
0
 function displaynode_h3list($start = 0, $h = 3)
 {
     if ($start != '0' && $start != '') {
         $this->bulletlist .= $this->depth == 1 ? "<h{$h}>" : "<li>";
         $class = $this->classname[$start] == '' ? '' : ' class="' . $this->classname[$start] . '"';
         $url = $this->urls[$start];
         if ($this->onclicks[$start] != '') {
             $onclick = ' onclick="' . $this->onclicks[$start] . '"';
         } else {
             $onclick = "";
         }
         if ($url != '') {
             $this->bulletlist .= "<a href=\"{$url}\"" . $onclick . $class . ">";
         }
         //start link
         $this->bulletlist .= $this->htmls[$start] ? $this->htmls[$start] : $this->nodes[$start];
         if ($url != '') {
             $this->bulletlist .= "</a>";
         }
         //finish link
         $this->bulletlist .= $this->depth == 1 ? "</h{$h}>" : "";
     }
     if (isset($this->children[$start]) && is_array($this->children[$start])) {
         $this->depth = $this->depth + 1;
         if ($this->depth > 1) {
             $this->bulletlist .= "<ul" . JOJO::onlyif($this->liststyle, ' style="list-style-type: ' . $this->liststyle . ';"') . ">\n";
         }
         for ($i = 0; $i < count($this->children[$start]); $i++) {
             $this->displaynode_h3list($this->children[$start][$i], $h);
         }
         if ($this->depth > 1) {
             $this->bulletlist .= "</ul>\n";
         }
         $this->depth = $this->depth - 1;
     }
     if ($start != '0' && $start != '') {
         //$this->bulletlist .= "</li>\n";
         $this->bulletlist .= $this->depth == 1 ? "" : "</li>";
     }
 }
Exemplo n.º 2
0
<?php

/**
 *                    Jojo CMS - Internal links plugin
 *                ================
 *
 * Copyright 2007-2008 Robbie MacKay <*****@*****.**>
 *
 * See the enclosed file license.txt for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Robbie MacKay <*****@*****.**>
 * @license http://www.fsf.org/copyleft/lgpl.html GNU Lesser General Public License
 * @link    http://rjmackay.wordpress.org/code/
 * @package internal_links
 */
/* Remove the Sitemap page */
JOJO::deleteQuery("DELETE FROM `page` WHERE pg_link='internal_links_scan.php'");
/**
 * Sitemap filter
 *
 * Receives existing sitemap and adds articles section
 */
function _article_sitemap($sitemap)
{
    $limit = 15;
    $articlesperpage = 40;
    /* Create tree and add index and feed links at the top */
    $articletree = new hktree();
    $articletree->addNode('index', 0, 'Article Index', JOJO_Plugin_Jojo_article::_getPrefix() . '/');
    $articletree->addNode('index-rss', 'index', 'Articles RSS Feed', JOJO_Plugin_Jojo_article::_getPrefix('rss'));
    /* Get the article content from the database */
    $articles = JOJO_Plugin_Jojo_article::getArticles($limit);
    $n = count($articles);
    foreach ($articles as $a) {
        $articletree->addNode($a['articleid'], 0, $a['ar_title'], $a['url']);
    }
    /* Get number of articles for pagination */
    $now = strtotime('now');
    $articlescount = JOJO::selectQuery("SELECT COUNT(*) AS numarticles FROM article WHERE ar_livedate<{$now} AND (ar_expirydate<=0 OR ar_expirydate>{$now})");
    $numarticles = $articlescount[0]['numarticles'];
    $numpages = ceil($numarticles / $articlesperpage);
    /* calculate pagination */
    if ($numpages == 1) {
        if ($limit < $numarticles) {
            $articletree->addNode('p1', 0, 'More Articles', 'articles/');
        }
    } else {
        for ($p = 1; $p <= $numpages; $p++) {
            $url = $p == 1 ? 'articles/' : 'articles/p' . $p . '/';
            $articletree->addNode('p' . $p, 0, 'Page ' . $p, $url);
        }
    }
    /* Remove any other links to the articles section form the sitemap */
    foreach ($sitemap as $k => $section) {
        $sitemap[$k]['tree'] = JOJO_Plugin_Jojo_article::_sitemapRemoveSelf($section['tree']);
    }
    /* Add to the sitemap array */
    $sitemap['articles'] = array('title' => 'Articles', 'tree' => $articletree->asArray(), 'order' => 2, 'header' => '', 'footer' => '');
    /* Tags are broken at the moment.
            //tags
            if (tableexists('tag')) {
                $tagtree = new hktree();
                //$articletree->liststyle = 'disc';
                $tagtree->addNode('index',0,'Tag Index','tags/');
                $limit = 20;
                //Article listing
                $tags = JOJO::selectQuery("SELECT * FROM tag WHERE 1 ORDER BY tag LIMIT " . $limit);
                $n = count($tags);
                for ($i=0;$i<$n;$i++) {
                    $tags[$i]['url'] =  'tags/'.JOJO::cleanURL($tags[$i]['tag']).'/';
                    $tagtree->addNode($tags[$i]['tag'],0,$tags[$i]['tag'],$tags[$i]['url']);
                }
    
                if ($n) {
                    // Add to the sitemap array
                    $sitemapsection = array();
                    $sitemapsection['title'] = 'Tags';
                    $sitemapsection['tree'] = $tagtree->asArray();
                    $sitemapsection['order'] = 5;
                    $sitemapsection['header'] = '';
                    $sitemapsection['footer'] = '';
                    $sitemap[] = $sitemapsection;
                }
            }
    
             */
    return $sitemap;
}
Exemplo n.º 4
0
<?php

/**
 *                    Jojo CMS - Internal links plugin
 *                ================
 *
 * Copyright 2007-2008 Robbie MacKay <*****@*****.**>
 *
 * See the enclosed file license.txt for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Robbie MacKay <*****@*****.**>
 * @license http://www.fsf.org/copyleft/lgpl.html GNU Lesser General Public License
 * @link    http://rjmackay.wordpress.org/code/
 * @package internal_links
 */
/* Add a Sitemap page is one does not exist */
Jojo::updateQuery("UPDATE page SET pg_link='JOJO_Plugin_internal_links_scan' WHERE pg_link='internal_links_scan.php'");
$data = JOJO::selectQuery("SELECT * FROM page WHERE pg_link='JOJO_Plugin_internal_links_scan'");
if (count($data) == 0) {
    echo "Adding <b>scan</b> Page to menu<br />";
    $data = JOJO::selectQuery("SELECT * FROM page WHERE pg_title = 'Not on Menu'");
    $_NOT_NO_MENU_ID = $data[0]['pageid'];
    JOJO::insertQuery("INSERT INTO page SET pg_title='Scan', pg_link='internal_links_scan.php', pg_url='scan.php', pg_desc='page used for xinha existing page links', pg_parent={$_NOT_NO_MENU_ID}");
}
/* Add Google sitemap (sitemap.xml) page if one does not exist */
/* $data = JOJO::selectQuery("SELECT * FROM page WHERE pg_link = 'xml_sitemap.php'");
if (count($data) == 0) {
    echo "Adding <b>Google Sitemap</b> Page<br />";
    JOJO::insertQuery("INSERT INTO page SET pg_title = 'XML Sitemap', pg_link = 'xml_sitemap.php', pg_url = 'sitemap.xml', pg_parent=" . JOJO::cleanInt($_NOT_NO_MENU_ID) . ", pg_order=0, pg_mainnav='no', pg_body = ''");
} */