Esempio n. 1
0
function bm_list_recent()
{
    global $BMRECENTBOOKS;
    $books = bm_get_books();
    if (!empty($books)) {
        echo '<ul>';
        $books = array_slice($books, 0, $BMRECENTBOOKS, true);
        foreach ($books as $book) {
            $url = bm_get_url('book') . $book->slug;
            $title = strip_tags(strip_decode($book->title));
            echo "<li><a href=\"{$url}\">{$title}</a></li>";
        }
        echo '</ul>';
    }
}
 public function page_read()
 {
     if ($this->auth()) {
         $id = (string) $this->xml->data->slug;
         if (file_exists(GSDATAPAGESPATH . $id . '.xml')) {
             $page = getXML(GSDATAPAGESPATH . $id . '.xml');
             $page->content = strip_decode($page->content);
             $page->metak = strip_decode($page->metak);
             $page->metad = strip_decode($page->metad);
             $page->title = strip_decode($page->title);
             $wrapper = array('status' => 'success', 'message' => 'page_read ok', 'response' => $page);
             return json_encode($wrapper);
         } else {
             $error = array('status' => 'error', 'message' => sprintf(i18n_r('API_ERR_NOPAGE'), $id));
             return json_encode($error);
         }
     }
 }
Esempio n. 3
0
function nm_update_sitemap_xml($xml)
{
    if (!defined('NMNOSITEMAP') || !NMNOSITEMAP) {
        $posts = nm_get_posts();
        $tags = array();
        $excludetags = defined('NMSITEMAPEXCLUDETAGS') && (NMSITEMAPEXCLUDETAGS === true || NMSITEMAPEXCLUDETAGS === 1);
        foreach ($posts as $post) {
            $url = nm_get_url('post') . $post->slug;
            $file = NMPOSTPATH . $post->slug . '.xml';
            $date = makeIso8601TimeStamp(date('Y-m-d H:i:s', strtotime($post->date)));
            $item = $xml->addChild('url');
            $item->addChild('loc', $url);
            $item->addChild('lastmod', $date);
            $item->addChild('changefreq', 'monthly');
            $item->addChild('priority', '0.5');
            if (!$excludetags && !empty($post->tags)) {
                foreach (explode(',', nm_lowercase_tags(strip_decode($post->tags))) as $tag) {
                    if (substr($tag, 0, 1) != '_') {
                        if (!in_array($tag, $tags)) {
                            $url = nm_get_url('tag') . rawurlencode($tag);
                            $item = $xml->addChild('url');
                            $item->addChild('loc', $url);
                            $item->addChild('lastmod', $date);
                            $item->addChild('changefreq', 'monthly');
                            $item->addChild('priority', '0.5');
                            $tags[] = $tag;
                        }
                    }
                }
            }
        }
    }
    return $xml;
}
Esempio n. 4
0
function get_cat_list($cat, $page)
{
    $cfile = array();
    $cfile = get_filecat($cat);
    $numitems = 7;
    //determine offset
    $page_ = $page - 1;
    $total = count($cfile);
    $offset = $page_ * $numitems;
    $total_pages = ceil($total / $numitems);
    for ($i = $offset; $i < $offset + $numitems and $i < $total; $i++) {
        $file = CONTENTPATH . $cfile[$i] . '.xml';
        $data = getXML($file);
        $title = stripslashes(htmlspecialchars_decode($data->title, ENT_QUOTES));
        $intro = stripslashes(htmlspecialchars_decode($data->intro, ENT_QUOTES));
        $parent = stripslashes(htmlspecialchars_decode($data->parent, ENT_QUOTES));
        $author_edit = stripslashes(htmlspecialchars_decode($data->author_edit, ENT_QUOTES));
        $date = stripslashes(htmlspecialchars_decode($data->pubDate, ENT_QUOTES));
        $url = stripslashes(htmlspecialchars_decode($data->url, ENT_QUOTES));
        $metad = stripslashes(htmlspecialchars_decode($data->metad, ENT_QUOTES));
        $imgb = imagenesHTML(html_entity_decode(strip_decode($intro)));
        ?>
    	
		
		
		<span class="blog_title"><a href="<?php 
        echo find_url($data->url, $data->parent);
        ?>
"><?php 
        echo $title;
        ?>
</a></span>
		<br /><span><i><?php 
        echo lngDate($date);
        ?>
</i> | <?php 
        echo $parent;
        ?>
</span>
		<div class="blog_item">
		<img src="<?php 
        echo $imgb[0];
        ?>
">
		
		<?php 
        $patron = "<img[^<>]*/>";
        echo eregi_replace($patron, "", $intro);
        ?>
		<div class="clear"></div>
		</div>
		
		
	
    <?php 
    }
    echo '<div class="pagination-links">';
    if ($page_ > 0) {
        echo '<a href="?page=' . $page_ . '"> Anterior</a> ';
    }
    for ($i = 1; $i <= $total_pages; $i++) {
        if ($page == $i) {
            echo '<span class="current">Pagina ' . $page . '</span> ';
        } else {
            echo ' <a href="?page=' . $i . '">' . $i . '</a>';
        }
    }
    $page++;
    if (++$page_ < $total_pages) {
        echo ' <a href="?page=' . $page . '"> Siguiente </a>';
    }
    echo "</div>";
}
/**
 * Get Page Field
 *
 * Retrieve and display the requested field from the given page. 
 * If the field is "content" it will call returnPageContent()
 *
 * @since 3.1
 * @param $page - slug of the page to retrieve content
 * @param $field - the Field to display
 * 
 */
function returnPageField($page, $field)
{
    global $pagesArray;
    if (!$pagesArray) {
        getPagesXmlValues();
    }
    if ($field == "content") {
        $ret = returnPageContent($page);
    } else {
        if (isset($pagesArray[(string) $page]) && array_key_exists($field, $pagesArray[(string) $page])) {
            $ret = strip_decode(@$pagesArray[(string) $page][(string) $field]);
        } else {
            $ret = returnPageContent($page, $field);
        }
    }
    return $ret;
}
Esempio n. 6
0
function set_blog_title()
{
    global $title, $blogSettings, $post;
    // Declare GLOBAL variables
    $slug = base64_encode(return_page_slug());
    // What page are we on?
    if ($slug == base64_encode($blogSettings["blogurl"])) {
        // If we're on the blog page...
        if (isset($_GET['post']) && !empty($post)) {
            // If viewing a post...
            $title = (string) $post->title;
            // Set title of post
        } else {
            if (isset($_GET['archive'])) {
                // If viewing an archive...
                // Set the archive title
                $title = (string) i18n_r(BLOGFILE . '/ARCHIVE_PRETITLE') . date('F Y', strtotime($_GET['archive']));
            } else {
                if (isset($_GET['category'])) {
                    // If viewing a category...
                    $title = (string) i18n_r(BLOGFILE . '/CATEGORY_PRETITLE') . $_GET['category'];
                    // Set category title
                }
            }
        }
    }
    $title = strip_tags(strip_decode($title));
    // Clean the title variable
}
Esempio n. 7
0
/**
 * Get Available Pages
 *
 * Lists all available pages for plugin/api use
 *
 * @since 2.0
 * @uses GSDATAPAGESPATH
 * @uses find_url
 * @uses getXML
 * @uses subval_sort
 *
 * @return array|string Type 'string' in this case will be XML 
 */
function get_available_pages()
{
    $menu_extract = '';
    $path = GSDATAPAGESPATH;
    $dir_handle = @opendir($path) or die("Unable to open {$path}");
    $filenames = array();
    while ($filename = readdir($dir_handle)) {
        $filenames[] = $filename;
    }
    closedir($dir_handle);
    $count = "0";
    $pagesArray = array();
    if (count($filenames) != 0) {
        foreach ($filenames as $file) {
            if ($file == "." || $file == ".." || is_dir($path . $file) || $file == ".htaccess") {
                // not a page data file
            } else {
                $data = getXML($path . $file);
                if ($data->private != 'Y') {
                    $pagesArray[$count]['menuStatus'] = $data->menuStatus;
                    $pagesArray[$count]['menuOrder'] = $data->menuOrder;
                    $pagesArray[$count]['menu'] = strip_decode($data->menu);
                    $pagesArray[$count]['parent'] = $data->parent;
                    $pagesArray[$count]['title'] = strip_decode($data->title);
                    $pagesArray[$count]['url'] = $data->url;
                    $pagesArray[$count]['private'] = $data->private;
                    $pagesArray[$count]['pubDate'] = $data->pubDate;
                    $count++;
                }
            }
        }
    }
    $pagesSorted = subval_sort($pagesArray, 'title');
    if (count($pagesSorted) != 0) {
        $count = 0;
        foreach ($pagesSorted as $page) {
            $text = (string) $page['menu'];
            $pri = (string) $page['menuOrder'];
            $parent = (string) $page['parent'];
            $title = (string) $page['title'];
            $slug = (string) $page['url'];
            $menuStatus = (string) $page['menuStatus'];
            $private = (string) $page['private'];
            $pubDate = (string) $page['pubDate'];
            $url = find_url($slug, $parent);
            $specific = array("slug" => $slug, "url" => $url, "parent_slug" => $parent, "title" => $title, "menu_priority" => $pri, "menu_text" => $text, "menu_status" => $menuStatus, "private" => $private, "pub_date" => $pubDate);
            $extract[] = $specific;
        }
        return $extract;
    }
}
Esempio n. 8
0
 /** 
  * Create Excerpt for post
  * 
  * @param $content string the content to be excerpted
  * @param $start int the starting character to create excerpt from
  * @param $maxchars int the amount of characters excerpt should be
  * @return string The created excerpt
  */
 public function create_excerpt($content, $start, $maxchars)
 {
     $maxchars = (int) $maxchars;
     $content = htmlspecialchars_decode(strip_tags(strip_decode($content)));
     $content = substr($content, $start, $maxchars);
     $pos = strrpos($content, " ");
     if ($pos > 0) {
         $content = substr($content, $start, $pos);
     }
     $content = str_replace(i18n_r(BLOGFILE . '/READ_FULL_ARTICLE'), "", $content);
     return $content;
 }
Esempio n. 9
0
function nm_show_post($slug, $showexcerpt = false, $filter = true, $single = false)
{
    global $nmoption, $nmdata;
    $file = NMPOSTPATH . $slug . '.xml';
    if (dirname(realpath($file)) == realpath(NMPOSTPATH)) {
        // no path traversal
        $post = @getXML($file);
    }
    if (!empty($post) && ($post->private != 'Y' || $single && function_exists('is_logged_in') && is_logged_in())) {
        $url = nm_get_url('post') . $slug;
        $title = stripslashes($post->title);
        $date = nm_get_date(i18n_r('news_manager/DATE_FORMAT'), strtotime($post->date));
        $content = strip_decode($post->content);
        $image = stripslashes($post->image);
        $tags = !empty($post->tags) ? explode(',', nm_lowercase_tags(strip_decode($post->tags))) : array();
        # save post data?
        $nmdata = $single ? compact('slug', 'url', 'title', 'content', 'image', 'tags') : array();
        if ($filter) {
            ob_start();
        }
        echo '  <', $nmoption['markuppost'], ' class="', $nmoption['classpost'], '">', PHP_EOL;
        foreach ($nmoption['fields'] as $field) {
            switch ($field) {
                case 'title':
                    echo '    <', $nmoption['markupposttitle'], ' class="', $nmoption['classposttitle'], '">';
                    if ($nmoption['titlelink']) {
                        $class = $nmoption['classposttitlelink'] ? ' class="' . $nmoption['classposttitlelink'] . '"' : '';
                        echo '<a', $class, ' href="', $url, '">', $title, '</a>';
                    } else {
                        echo $title;
                    }
                    echo '</', $nmoption['markupposttitle'], '>', PHP_EOL;
                    break;
                case 'date':
                    echo '    <', $nmoption['markuppostdate'], ' class="', $nmoption['classpostdate'], '">', i18n_r('news_manager/PUBLISHED'), ' ', $date, '</', $nmoption['markuppostdate'], '>', PHP_EOL;
                    break;
                case 'content':
                    echo '    <', $nmoption['markuppostcontent'], ' class="', $nmoption['classpostcontent'], '">';
                    if ($single) {
                        echo $content;
                    } else {
                        $slice = '';
                        $class = '';
                        $readmore = $nmoption['readmore'];
                        if ($readmore) {
                            $class = $nmoption['classreadmorelink'] ? ' class="' . $nmoption['classreadmorelink'] . '"' : '';
                        }
                        if ($nmoption['more']) {
                            $morepos = strpos($content, '<hr');
                            if ($morepos !== false) {
                                $slice = substr($content, 0, $morepos);
                                if ($readmore) {
                                    $slice .= '      <p class="' . $nmoption['classreadmore'] . '"><a' . $class . ' href="' . $url . '">' . i18n_r('news_manager/READ_MORE') . '</a></p>' . PHP_EOL;
                                }
                            }
                        }
                        if ($slice) {
                            echo $slice;
                        } else {
                            if ($showexcerpt) {
                                if (!$readmore) {
                                    echo nm_create_excerpt($content);
                                } elseif ($readmore === 'a') {
                                    echo nm_create_excerpt($content, $url, true);
                                } else {
                                    echo nm_create_excerpt($content, $url);
                                }
                            } else {
                                echo $content;
                                if ($readmore === 'a') {
                                    echo '      <p class="', $nmoption['classreadmore'], '"><a', $class, ' href="', $url, '">', i18n_r('news_manager/READ_MORE'), '</a></p>', PHP_EOL;
                                }
                            }
                        }
                    }
                    echo '    </', $nmoption['markuppostcontent'], '>', PHP_EOL;
                    break;
                case 'tags':
                    if ($tags) {
                        echo '    <', $nmoption['markupposttags'], ' class="', $nmoption['classposttags'], '"><b>', i18n_r('news_manager/TAGS'), ':</b> ';
                        $sep = '';
                        foreach ($tags as $tag) {
                            if (substr($tag, 0, 1) != '_') {
                                echo $sep, '<a href="', nm_get_url('tag') . rawurlencode($tag), '">', htmlspecialchars($tag), '</a>';
                                if ($sep == '') {
                                    $sep = $nmoption['tagseparator'];
                                }
                            }
                        }
                        echo '</', $nmoption['markupposttags'], '>', PHP_EOL;
                    }
                    break;
                case 'image':
                    $imageurl = $nmoption['showimages'] ? nm_get_image_url($image) : false;
                    if ($imageurl) {
                        $str = '';
                        if (isset($nmoption['imageclass'])) {
                            $str .= ' class="' . $nmoption['imageclass'] . '"';
                        }
                        if ($nmoption['imagesizeattr'] && $nmoption['imagewidth'] && $nmoption['imageheight']) {
                            $str .= ' width="' . $nmoption['imagewidth'] . '" height="' . $nmoption['imageheight'] . '"';
                        }
                        $str .= $nmoption['imagealt'] ? ' alt="' . htmlspecialchars($title, ENT_COMPAT) . '"' : ' alt=""';
                        $str .= $nmoption['imagetitle'] ? ' title="' . htmlspecialchars($title, ENT_COMPAT) . '"' : '';
                        $str = '<img src="' . htmlspecialchars($imageurl) . '"' . $str . ' />';
                        if ($nmoption['imagelink']) {
                            $str = '<a href="' . $url . '">' . $str . '</a>';
                        }
                        echo '    <', $nmoption['markuppostimage'], ' class="', $nmoption['classpostimage'], '">', $str, '</', $nmoption['markuppostimage'], '>', PHP_EOL;
                    }
                    break;
                case 'author':
                    if ($nmoption['showauthor']) {
                        $author = nm_get_author_name_html(stripslashes($post->author));
                        if (empty($author) && $nmoption['defaultauthor']) {
                            $author = $nmoption['defaultauthor'];
                        }
                        if (!empty($author)) {
                            echo '    <', $nmoption['markuppostauthor'], ' class="', $nmoption['classpostauthor'], '">', i18n_r('news_manager/AUTHOR'), ' <', $nmoption['markuppostauthorname'], '>', $author, '</', $nmoption['markuppostauthorname'], '></', $nmoption['markuppostauthor'], '>', PHP_EOL;
                        }
                    }
                    break;
            }
        }
        if (isset($nmoption['componentbottompost'])) {
            get_component($nmoption['componentbottompost']);
            echo PHP_EOL;
        }
        if ($single) {
            # show "go back" link?
            if ($nmoption['gobacklink']) {
                $goback = $nmoption['gobacklink'] === 'main' ? nm_get_url() : 'javascript:history.back()';
                $class = $nmoption['classgobacklink'] ? ' class="' . $nmoption['classgobacklink'] . '"' : '';
                echo '    <', $nmoption['markupgoback'], ' class="' . $nmoption['classgoback'] . '"><a', $class, ' href="' . $goback . '">';
                i18n('news_manager/GO_BACK');
                echo '</a></', $nmoption['markupgoback'], '>', PHP_EOL;
            }
        }
        echo '  </', $nmoption['markuppost'], '>', PHP_EOL;
        if (isset($nmoption['componentafterpost'])) {
            get_component($nmoption['componentafterpost']);
            echo PHP_EOL;
        }
        if ($filter) {
            echo nm_ob_get_content(true);
        }
        return true;
    } else {
        echo '<p>' . i18n_r('news_manager/NOT_EXIST') . '</p>', PHP_EOL;
        return false;
    }
}
Esempio n. 10
0
function i18n_gallery_theme_header()
{
    global $content;
    get_i18n_gallery_header_from_content(strip_decode($content));
}
/**
 * Return Page Field
 *
 * Retrieve the requested field from the given page cache, fallback to page file
 * If the field is "content" and not raw it will run it through content filter
 *
 * @since 3.1
 * @param $page  slug of the page to retrieve content
 * @param $field the Field to display
 * @param $raw   if true, prevent any processing of data, use with caution as result can vary if falls back to page file
 * @param $cache if false, bypass cache and get directly from page file
 * 
 */
function returnPageField($page, $field, $raw = false, $cache = true)
{
    $pagesArray = getPagesXmlValues();
    if ($cache && isset($pagesArray[(string) $page]) && isset($pagesArray[(string) $page][$field])) {
        $ret = $raw ? $pagesArray[(string) $page][(string) $field] : strip_decode($pagesArray[(string) $page][(string) $field]);
    } else {
        $ret = returnPageFieldFromFile($page, $field, $raw);
    }
    // @todo this needs to come out of there, its dumb, special handling for special fields needs to be external
    if ($field == "content" && !$raw) {
        $ret = filterPageContent($page, $ret);
    }
    return $ret;
}
Esempio n. 12
0
/** 
* Get Page/POST Title
* This function is a modified version of the core get_page_clean_title() function. It will function normally on all pages except individual blog posts, where the post title will be placed in instead of the page title.
* 
* @return void
*/
function get_blog_title($echo = true)
{
    global $title, $blogSettings, $post;
    $slug = base64_encode(return_page_slug());
    if ($slug == base64_encode($blogSettings["blogurl"])) {
        if (isset($_GET['post']) && !empty($post)) {
            $title = (string) $post->title;
        }
    }
    $myVar = strip_tags(strip_decode($title));
    if ($echo) {
        echo $myVar;
    } else {
        return $myVar;
    }
}
Esempio n. 13
0
/**
 * Return Page Field
 *
 * Retrieve the requested field from the given page cache, fallback to page file
 * If the field is "content" and not raw it will run it through content filter
 *
 * @since 3.1
 * @param $page  slug of the page to retrieve content
 * @param $field the Field to display
 * @param $raw   if true, prevent any processing of data, use with caution as result can vary if falls back to page file
 * @param $cache if false, bypass cache and get directly from page file
 * 
 */
function returnPageField($page, $field, $raw = false, $cache = true)
{
    $pagesArray = getPagesXmlValues();
    if ($cache && isset($pagesArray[(string) $page]) && isset($pagesArray[(string) $page][$field])) {
        $ret = $raw ? $pagesArray[(string) $page][(string) $field] : strip_decode($pagesArray[(string) $page][(string) $field]);
    } else {
        $ret = returnPageFieldFromFile($page, $field, $raw);
    }
    if ($field == "content" && !$raw) {
        $ret = filterPageContent($page, $ret);
    }
    return $ret;
}
Esempio n. 14
0
/**
 * Get Main Navigation
 *
 * This will return unordered list of main navigation
 * This function uses the menu opitions listed within the 'Edit Page' control panel screen
 *
 * @since 1.0
 * @uses GSDATAOTHERPATH
 * @uses getXML
 * @uses subval_sort
 * @uses find_url
 * @uses strip_quotes 
 * @uses exec_filter 
 *
 * @param string $currentpage This is the ID of the current page the visitor is on
 * @param string $classPrefix Prefix that gets added to the parent and slug classnames
 * @return string 
 */
function get_navigation($currentpage, $classPrefix = "")
{
    $menu = '';
    global $pagesArray;
    global $SITEURL;
    // Kevin F - Just initializing array and img tag outside the loops
    $imgExts = array('.png', '.jpg', '.gif');
    $imgTag = '';
    $pagesSorted = subval_sort($pagesArray, 'menuOrder');
    if (count($pagesSorted) != 0) {
        foreach ($pagesSorted as $page) {
            $sel = '';
            $classes = '';
            $url_nav = $page['url'];
            // Kevin F - Change the $icon variable to suit your directory needs
            foreach ($imgExts as $ext) {
                if (is_file(GSDATAUPLOADPATH . 'img/menu-icons/' . $page['url'] . $ext)) {
                    $icon = $SITEURL . 'data/uploads/img/menu-icons/' . $page['url'] . $ext;
                    $imgTag = '<img src="' . $icon . '" alt="' . $page['title'] . ' " width="65" height="65">';
                    break;
                    // File found! break out of loop...
                } else {
                    $imgTag = '';
                    // Add no img element as there is no image...
                }
            }
            if ($page['menuStatus'] == 'Y') {
                $parentClass = !empty($page['parent']) ? $classPrefix . $page['parent'] . " " : "";
                $classes = trim($parentClass . $classPrefix . $url_nav);
                if ("{$currentpage}" == "{$url_nav}") {
                    $classes .= " current active";
                }
                if ($page['menu'] == '') {
                    $page['menu'] = $page['title'];
                }
                if ($page['title'] == '') {
                    $page['title'] = $page['menu'];
                }
                // Kevin F - The menu variable below has been modified to cater for icons and alt name
                $menu .= '<li class="' . $classes . '"><a href="' . find_url($page['url'], $page['parent']) . '" title="' . encode_quotes(cl($page['title'])) . '">' . $imgTag . '<span class="link-title">' . strip_decode($page['menu']) . '</span></a></li>' . "\n";
            }
        }
    }
    echo exec_filter('menuitems', $menu);
}
Esempio n. 15
0
$setlang = isset($_GET["setlang"]);
$result = array();
if ($page == "" || $page == "init" || $setlang) {
    if (!$setlang) {
        $page = "index";
    }
    $result["langs"] = return_i18n_languages();
    $result["tabs"] = return_i18n_menu_data(return_page_slug(), 0, 0, I18N_SHOW_MENU);
    //echo $other_lang;
}
$content = "";
$title = "";
$url = $page;
if (isset($pagesArray[$page])) {
    $data_index = return_i18n_page_data($page);
    $content = strip_decode($data_index->content);
    $content = exec_filter('content', $content);
    $title = strip_decode($data_index->title);
    $url = strip_decode($data_index->url);
}
$page_content = array();
$children = return_i18n_menu_data($page, 1, 1, I18N_SHOW_MENU);
if (!is_null($children)) {
    $page_content["children"] = $children;
}
$page_content["title"] = $title;
$page_content["content"] = $content;
$result["url"] = $url;
$result["page"] = $page_content;
//$result["content"] = get_content($page);
echo json_encode($result);
Esempio n. 16
0
/**
 * Output a collection item
 *
 * This will output the item requested. 
 * items are parsed for PHP within them if not $raw
 * Will only return the first component matching $id
 *
 * @since 3.4
 *
 * @param string $id This is the ID of the component you want to display
 * @param bool $force Force return of inactive components
 * @param bool $raw do not process php
 */
function output_collection_item($id, $collection, $force = false, $raw = false)
{
    $item = get_collection_item($id, $collection);
    if (!$item) {
        return;
    }
    $disabled = (bool) (string) $item->disabled;
    if ($disabled && !$force) {
        return;
    }
    if (!$raw) {
        eval("?>" . strip_decode($item->value) . "<?php ");
    } else {
        echo strip_decode($item->value);
    }
}
Esempio n. 17
0
/**
 * Get Main Navigation
 *
 * This will return unordered list of main navigation
 * This function uses the menu opitions listed within the 'Edit Page' control panel screen
 *
 * @since 1.0
 * @uses GSDATAOTHERPATH
 * @uses getXML
 * @uses subval_sort
 * @uses find_url
 * @uses strip_quotes 
 * @uses exec_filter 
 *
 * @param string $currentpage This is the ID of the current page the visitor is on
 * @return string 
 */
function get_navigation($currentpage)
{
    $menu = '';
    global $pagesArray;
    $pagesSorted = subval_sort($pagesArray, 'menuOrder');
    if (count($pagesSorted) != 0) {
        foreach ($pagesSorted as $page) {
            $sel = '';
            $classes = '';
            $url_nav = $page['url'];
            if ($page['menuStatus'] == 'Y') {
                if ("{$currentpage}" == "{$url_nav}") {
                    $classes = "current active " . $page['parent'] . " " . $url_nav;
                } else {
                    $classes = trim($page['parent'] . " " . $url_nav);
                }
                if ($page['menu'] == '') {
                    $page['menu'] = $page['title'];
                }
                if ($page['title'] == '') {
                    $page['title'] = $page['menu'];
                }
                $menu .= '<li class="' . $classes . '"><a href="' . find_url($page['url'], $page['parent']) . '" title="' . encode_quotes(cl($page['title'])) . '">' . strip_decode($page['menu']) . '</a></li>' . "\n";
            }
        }
    }
    echo exec_filter('menuitems', $menu);
}
Esempio n. 18
0
/**
 * Get Main Navigation
 *
 * This will return unordered list of main navigation
 * This function uses the menu opitions listed within the 'Edit Page' control panel screen
 *
 * @since 1.0
 * @uses GSDATAOTHERPATH
 * @uses getXML
 * @uses subval_sort
 * @uses find_url
 * @uses strip_quotes 
 * @uses exec_filter 
 *
 * @param string $currentpage This is the ID of the current page the visitor is on
 * @return string 
 */
function get_navigation($currentpage)
{
    $menu = '';
    $path = GSDATAPAGESPATH;
    $dir_handle = opendir($path) or die("Unable to open {$path}");
    $filenames = array();
    while ($filename = readdir($dir_handle)) {
        $filenames[] = $filename;
    }
    $count = "0";
    $pagesArray = array();
    if (count($filenames) != 0) {
        foreach ($filenames as $file) {
            if ($file == "." || $file == ".." || is_dir($path . $file) || $file == ".htaccess") {
                // not a page data file
            } else {
                $data = getXML($path . $file);
                if ($data->private != 'Y') {
                    $pagesArray[$count]['menuStatus'] = $data->menuStatus;
                    $pagesArray[$count]['menuOrder'] = $data->menuOrder;
                    $pagesArray[$count]['menu'] = strip_decode($data->menu);
                    $pagesArray[$count]['url'] = $data->url;
                    $pagesArray[$count]['title'] = strip_decode($data->title);
                    $pagesArray[$count]['parent'] = $data->parent;
                    $count++;
                }
            }
        }
    }
    $pagesSorted = subval_sort($pagesArray, 'menuOrder');
    if (count($pagesSorted) != 0) {
        foreach ($pagesSorted as $page) {
            $sel = '';
            $classes = '';
            $url_nav = $page['url'];
            if ($page['menuStatus'] == 'Y') {
                if ("{$currentpage}" == "{$url_nav}") {
                    $classes = "current " . $page['parent'] . " " . $url_nav;
                } else {
                    $classes = trim($page['parent'] . " " . $url_nav);
                }
                if ($page['menu'] == '') {
                    $page['menu'] = $page['title'];
                }
                if ($page['title'] == '') {
                    $page['title'] = $page['menu'];
                }
                $menu .= '<li class="' . $classes . '"><a href="' . find_url($page['url'], $page['parent']) . '" title="' . strip_quotes($page['title']) . '">' . $page['menu'] . '</a></li>' . "\n";
            }
        }
    }
    closedir($dir_handle);
    echo exec_filter('menuitems', $menu);
}
Esempio n. 19
0
/**
 * Get Main Navigation
 *
 * This will return unordered list of main navigation
 * This function uses the menu opitions listed within the 'Edit Page' control panel screen
 *
 * @since 1.0
 * @uses GSDATAOTHERPATH
 * @uses getXML
 * @uses subval_sort
 * @uses find_url
 * @uses strip_quotes 
 * @uses exec_filter 
 *
 * @param string $currentpage This is the ID of the current page the visitor is on
 * @param string $classPrefix Prefix that gets added to the parent and slug classnames
 * @return string 
 */
function get_navigation($currentpage = "", $classPrefix = "")
{
    $menu = '';
    global $pagesArray;
    $pagesSorted = subval_sort($pagesArray, 'menuOrder');
    if (count($pagesSorted) != 0) {
        foreach ($pagesSorted as $page) {
            $sel = $classes = '';
            $url_nav = (string) $page['url'];
            if ($page['menuStatus'] == 'Y') {
                $parentClass = !empty($page['parent']) ? $classPrefix . $page['parent'] . " " : "";
                $classes = trim($parentClass . $classPrefix . $url_nav);
                if ((string) $currentpage == $url_nav) {
                    $classes .= " current active";
                }
                if ($page['menu'] == '') {
                    $page['menu'] = $page['title'];
                }
                if ($page['title'] == '') {
                    $page['title'] = $page['menu'];
                }
                $menu .= '<li class="' . $classes . '"><a href="' . find_url($page['url'], $page['parent']) . '" title="' . encode_quotes(cl($page['title'])) . '">' . strip_decode($page['menu']) . '</a></li>' . "\n";
            }
        }
    }
    echo exec_filter('menuitems', $menu);
    // @filter menuitems (str) menu items html in get_navigation
}
Esempio n. 20
0
    public function printAllItems($page)
    {
        global $SITEURL;
        $data = getXML(ITEMDATA . $page['name'], 'SimpleXMLElement', LIBXML_NOCDATA);
        // $url = ($PRETTYURLS == 1) ? $SITEURL . $data->url : $SITEURL . 'index.php?id=' . $data->url;
        // Extract and filter content
        $content = strip_decode($data->content);
        $content = htmlspecialchars_decode($content, ENT_QUOTES);
        $content = strip_tags($content);
        $content = str_replace("&nbsp;", " ", $content);
        $content = substr($content, 0, 220);
        $b_url = $data->slug;
        // $url = preg_match('/\?/', $b_url) ? '&' : '?';
        $url = str_replace(' ', '-', $b_url);
        $url = $SITEURL . ITEMPAGE . "/?item=" . $url;
        //generowanie linku do strony produktu
        // Print result
        if (file_exists(ITEMSFILE)) {
            $item_manager_file = getXML(ITEMSFILE);
        }
        if (isset($item_manager_file->item->resultspage)) {
            $file_results_page = eval("?>" . strip_decode($item_manager_file->item->resultspage) . "<?php ");
        } else {
            $file_results_page = '
				<style>
					.m_pic {
					width:160px;
					float:left;
					border:1px solid white;
					padding:1px;margin-top:0px;
				}
				.thatable tr td h2 {
					margin:5px;
					font-size:15px;
					margin-toP:6px;
					margin-top:0px;
					padding-top:0px;
				}
				.thetable {
					margin-bottom:30px;
				}
				.thetable td h2{
					font-size:17px;
				}
				</style>
				<table width="100%" class="thetable">
					<tr>
						<td class="resize_img" width="175" valign="top">
							<div><img src="<?php echo $SITEURL; ?>/data/uploads/items/<?php echo $data->image1; ?>" class="m_pic"/></div>
						</td>
						<td valign="top">
							<h2 style=""><?php echo $data->title; ?> - <span class="title_development"><?php echo $data->category; ?></span> - <a href="<?php echo $url; ?>" style="font-size:13px;">View Details</a></h2>
							<p style="margin:0px;margin-left:4px;text-align:left;">
							</p>
							<p style="margin:0px;margin-left:4px;text-align:left;">
							<?php echo $content; ?>.. <a href="<?php echo $url; ?>">Read more</a>
							</p>
						</td>
					</tr>
				</table>
			';
            $file_results_page = eval("?>" . strip_decode($file_results_page) . "<?php ");
        }
    }
function sc_get_component($page)
{
    $content = returnPageContent(return_page_slug(), 'content', false, true);
    $content = strip_decode($content);
    if (!preg_match('#\\[sc_form(.*)\\]#', $content)) {
        getPageContent($page);
    }
}
Esempio n. 22
0
function nm_custom_display_posts($templ = '', $tag = '', $type = '')
{
    global $NMRECENTPOSTS, $NMCUSTOMIMAGES, $NMCUSTOMOFFSET;
    if ($templ == '') {
        $templ = '<p><a href="{{ post_link }}">{{ post_title }}</a> {{ post_date }}</p>' . PHP_EOL;
    }
    foreach (array('post_link', 'post_slug', 'post_title', 'post_date', 'post_excerpt', 'post_content', 'post_number', 'post_image', 'post_image_url', 'post_author') as $token) {
        if (strpos($templ, '{{' . $token . '}}')) {
            $templ = str_replace('{{' . $token . '}}', '{{ ' . $token . ' }}', $templ);
        }
    }
    if ($type == 'future') {
        $posts = array_reverse(nm_get_posts(true));
        $allposts = array();
        $now = time();
        foreach ($posts as $post) {
            if ($post->private != 'Y' && strtotime($post->date) > $now) {
                $allposts[] = $post;
            }
        }
    } else {
        $allposts = nm_get_posts();
    }
    if (trim($tag) !== '') {
        $posts = array();
        foreach ($allposts as $post) {
            if (in_array($tag, explode(',', $post->tags))) {
                $posts[] = $post;
            }
        }
    } else {
        $posts = $allposts;
    }
    unset($allposts);
    if (!empty($posts)) {
        ob_start();
        // content filter
        if (strpos($templ, '{{ post_date }}') !== false) {
            global $NMCUSTOMDATE;
            $fmt = $NMCUSTOMDATE ? $NMCUSTOMDATE : i18n_r('news_manager/DATE_FORMAT');
        } else {
            $fmt = false;
        }
        $w = isset($NMCUSTOMIMAGES['width']) ? $NMCUSTOMIMAGES['width'] : 0;
        $h = isset($NMCUSTOMIMAGES['height']) ? $NMCUSTOMIMAGES['height'] : 0;
        $c = isset($NMCUSTOMIMAGES['crop']) ? $NMCUSTOMIMAGES['crop'] : 0;
        $d = isset($NMCUSTOMIMAGES['default']) ? $NMCUSTOMIMAGES['default'] : '';
        $count = 0;
        $offset = $NMCUSTOMOFFSET ? intval($NMCUSTOMOFFSET) : 0;
        $posts = array_slice($posts, $offset, $NMRECENTPOSTS, true);
        foreach ($posts as $post) {
            $str = $templ;
            $str = str_replace('{{ post_number }}', strval($count), $str);
            $str = str_replace('{{ post_slug }}', $post->slug, $str);
            $str = str_replace('{{ post_link }}', nm_get_url('post') . $post->slug, $str);
            $str = str_replace('{{ post_title }}', stripslashes($post->title), $str);
            if (strpos($str, '{{ post_image') !== false && function_exists('nm_get_image_url')) {
                $img = htmlspecialchars(nm_get_image_url((string) $post->image, $w, $h, $c, $d));
                $str = str_replace('{{ post_image_url }}', $img, $str);
                if (!empty($img)) {
                    $str = str_replace('{{ post_image }}', '<img src="' . $img . '" alt="" />', $str);
                } else {
                    $str = str_replace('{{ post_image }}', '', $str);
                }
            }
            if ($fmt) {
                $date = nm_get_date($fmt, strtotime($post->date));
                $str = str_replace('{{ post_date }}', $date, $str);
            }
            if (strpos($str, '{{ post_author }}') !== false) {
                if (isset($post->author)) {
                    $author = strval($post->author);
                    global $NMAUTHOR;
                    // NM Custom Authors (array)
                    if ($NMAUTHOR && isset($NMAUTHOR[$author])) {
                        $author = $NMAUTHOR[$author];
                    }
                } else {
                    if (function_exists('nm_get_option')) {
                        $author = nm_get_option('defaultauthor');
                        // NM 3.0+ custom setting
                        if (!$author) {
                            $author = '';
                        }
                    } else {
                        $author = '';
                    }
                }
                $str = str_replace('{{ post_author }}', $author, $str);
            }
            if (strpos($str, '{{ post_excerpt }}') !== false || strpos($str, '{{ post_content }}') !== false) {
                $postxml = getXML(NMPOSTPATH . $post->slug . '.xml');
                if (strpos($str, '{{ post_excerpt }}') !== false) {
                    if (function_exists('nm_make_excerpt1')) {
                        $excerpt = nm_make_excerpt(strip_decode($postxml->content));
                    } else {
                        // NM < 3.0 - remove <p>, </p>
                        $excerpt = substr(nm_create_excerpt(strip_decode($postxml->content)), 3, -4);
                    }
                    $str = str_replace('{{ post_excerpt }}', $excerpt, $str);
                } else {
                    $str = str_replace('{{ post_content }}', strip_decode($postxml->content), $str);
                }
            }
            echo $str;
            $count++;
        }
        $output = ob_get_contents();
        ob_end_clean();
        echo exec_filter('content', $output);
        // content filter
    }
}
Esempio n. 23
0
?>
:</td><td><?php 
echo $menuOrder;
?>
</td></tr>
		<tr><td class="title" ><?php 
i18n('ADD_TO_MENU');
?>
</td><td><?php 
echo $menuStatus;
?>
</td></tr>
		</table>
		
		<textarea id="codetext" wrap='off' style="background:#f4f4f4;padding:4px;width:635px;color:#444;border:1px solid #666;" readonly ><?php 
echo strip_decode($content);
?>
</textarea>

		</div>
		
		<?php 
if ($HTMLEDITOR != '') {
    if (defined('GSEDITORHEIGHT')) {
        $EDHEIGHT = GSEDITORHEIGHT . 'px';
    } else {
        $EDHEIGHT = '500px';
    }
    if (defined('GSEDITORLANG')) {
        $EDLANG = GSEDITORLANG;
    } else {
Esempio n. 24
0
/**
 * Get Page 
 * @param string $pageVar, Name of the page var to return
 * @param bool $echo Optional, default is true. False will 'return' value
 * @return string Echos or returns based on param $echo
 */
function get_page($pageVar, $echo = true, $clean = true)
{
    global $pageSet;
    if (isset($pageSet[$pageVar]) && !empty($pageSet[$pageVar])) {
        $myVar = strip_decode($pageSet[$pageVar]);
        if ($clean) {
            $myVar = strip_tags($myVar);
        }
    } else {
        $myVar = '';
    }
    if (!$echo) {
        return $myVar;
    }
    echo $myVar;
}
Esempio n. 25
0
/**
 * Return Page Field
 *
 * Retrieve the requested field from the given page. 
 * If the field is "content" it will call returnPageContent()
 *
 * @since 3.1
 * @param $page - slug of the page to retrieve content
 * @param $field - the Field to display
 * 
 */
function returnPageField($page, $field)
{
    $pagesArray = getPagesXmlValues();
    if ($field == "content") {
        $ret = returnPageContent($page);
    } else {
        if (array_key_exists($field, $pagesArray[(string) $page])) {
            $ret = strip_decode($pagesArray[(string) $page][(string) $field]);
        } else {
            $ret = returnPageContent($page, $field);
        }
    }
    return $ret;
}
Esempio n. 26
0
function bm_show_book($slug, $excerpt = false)
{
    $file = BMBOOKPATH . "{$slug}.xml";
    $book = @getXML($file);
    if (!empty($book) && $book->private != 'Y') {
        $url = bm_get_url('book') . $slug;
        $title = strip_tags(strip_decode($book->title));
        $date = bm_get_date(i18n_r('books_manager/DATE_FORMAT'), strtotime($book->date));
        $content = strip_decode($book->content);
        if ($excerpt) {
            $content = bm_create_excerpt($content);
        }
        # print book data
        ?>
    <div class="bm_book">
      <h3 class="bm_book_title">
        <a href="<?php 
        echo $url;
        ?>
"><?php 
        echo $title;
        ?>
</a>
      </h3>
      <!--<p class="bm_book_date"><?php 
        //echo i18n_r('news_manager/PUBLISHED') . " $date";
        ?>
</p>-->
      <p class="bm_book_date"><?php 
        echo 'books_manager' . " {$date}";
        ?>
</p>
      <div class="bm_book_content"><?php 
        echo $content;
        ?>
</div>
      <?php 
        # print tags, if any
        if (!empty($book->tags)) {
            // echo '<p class="bm_book_meta"><b>' . i18n_r('news_manager/TAGS') . ':</b>';
            echo '<p class="bm_book_meta"><b>' . 'books_manager' . ':</b>';
            $tags = explode(',', $book->tags);
            foreach ($tags as $tag) {
                $url = bm_get_url('tag') . $tag;
                echo " <a href=\"{$url}\">{$tag}</a>";
            }
            echo '</p>';
        }
        # show "go back" link, if required
        if (strstr($_SERVER['QUERY_STRING'], "book={$slug}")) {
            echo '<p class="bm_book_back"><a href="javascript:history.back()">&lt;&lt; ';
            //i18n('news_manager/GO_BACK');
            'books_manager';
            echo '</a></p>';
        }
        ?>
    </div>
    <?php 
    } else {
        //echo '<p>' . i18n_r('news_manager/NOT_EXIST') . '</p>';
        echo '<p>' . 'books_manager' . '</p>';
    }
}