/**
  * Create sitemap
  */
 public static function create()
 {
     // Get pages list
     $pages_list = Pages::getPages();
     // Create sitemap content
     $map = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     $map .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     foreach ($pages_list as $page) {
         if ($page['parent'] != '') {
             $parent = $page['parent'] . '/';
             $priority = '0.5';
         } else {
             $parent = '';
             $priority = '1.0';
         }
         $map .= "\t" . '<url>' . "\n\t\t" . '<loc>' . Option::get('siteurl') . '/' . $parent . $page['slug'] . '</loc>' . "\n\t\t" . '<lastmod>' . date("Y-m-d", (int) $page['date']) . '</lastmod>' . "\n\t\t" . '<changefreq>weekly</changefreq>' . "\n\t\t" . '<priority>' . $priority . '</priority>' . "\n\t" . '</url>' . "\n";
     }
     // Get list of components
     $components = Sitemap::getComponents();
     // Add components to sitemap
     if (count($components) > 0) {
         foreach ($components as $component) {
             $map .= "\t" . '<url>' . "\n\t\t" . '<loc>' . Option::get('siteurl') . '/' . Text::lowercase($component) . '</loc>' . "\n\t\t" . '<lastmod>' . date("Y-m-d", time()) . '</lastmod>' . "\n\t\t" . '<changefreq>weekly</changefreq>' . "\n\t\t" . '<priority>1.0</priority>' . "\n\t" . '</url>' . "\n";
         }
     }
     // Close sitemap
     $map .= '</urlset>';
     // Save sitemap
     return File::setContent(ROOT . DS . 'sitemap.xml', $map);
 }
Esempio n. 2
0
 public function indexAction()
 {
     $p = new Pages();
     $this->view->pages = $p->getSchemas();
     $this->view->user_pages = $p->getPages($this->_application->user->id);
     // Prepare view
     $this->common();
     $this->view->headScript()->appendFile('js/storytlr/effects.js');
     $this->view->headScript()->appendFile('js/controllers/pages.js');
 }
Esempio n. 3
0
 public function indexAction()
 {
     $tab = (int) $this->getRequest()->getParam("tab");
     $user = Zend_Registry::get('user');
     $pages = new Pages(array(Pages::USER => $user->id));
     $tabs = $pages->getPages();
     if (count($tabs) > 0 && $tab < count($tabs)) {
         $page = $tabs[$tab];
         $this->_forward('index', $page['prefix'], 'pages', array('pid' => $page['id']));
     } else {
         $this->_forward('index', 'nopage', 'pages');
     }
 }
Esempio n. 4
0
function getContent()
{
    $index = getIndex();
    if (!$index) {
        $index = 'home';
    }
    if (!isPage($index)) {
        $index = '404';
    } else {
        if (!isAccess($index)) {
            $index = '403';
        }
    }
    $p = Pages::getPages($index)['link'];
    include "/pages/{$p}";
}
Esempio n. 5
0
 /**
  * @dataProvider pageNumbersProvider
  */
 public function testPageNumbers($pages, array $result)
 {
     $p = new Pages($pages);
     $this->assertEquals($result, $p->getPages());
 }
Esempio n. 6
0
<?php

/*тут знаходиться наше меню*/
?>
<div class="menu">
<ul>
    <?php 
foreach (Pages::getPages() as $key => $p) {
    ?>
        <?php 
    if ($p['menu']) {
        ?>
            <li><a href="/<?php 
        echo $key;
        ?>
"><?php 
        echo $p['label'];
        ?>
</a></li>
        <?php 
    }
    ?>
    <?php 
}
?>
</ul>
</div>
Esempio n. 7
0
             echo json_encode($result, true);
         } else {
             // get all info
             $result = array('title' => $title, 'date' => $date, 'slug' => $slug, 'url' => $url, 'tag' => $tag, 'thumbnail' => $thumbnail, 'template' => $template, 'keywords' => $keywords, 'description' => $description, 'summary' => $summary, 'content' => $content);
             // encode to jso
             echo json_encode($result, true);
         }
     } else {
         // no name get error
         echo json_encode(array('404' => 'Not Found'), true);
     }
     break;
 case 'pages':
     //api?type=pages&name=test get all of test folder
     if (Request::get('name')) {
         $pages = @Pages::getPages(Request::get('name'));
         if ($pages != null) {
             $result = '';
             if (Request::get('filter')) {
                 switch (Request::get('filter')) {
                     // get titles
                     // api?type=pages&name=test&filter=title
                     case 'title':
                         foreach ($pages as $page) {
                             $title = isset($page['title']) ? $page['title'] : '';
                             $result .= json_encode(array('title' => $title), true) . ',';
                         }
                         break;
                         // get dates
                         // api?type=pages&name=test&filter=date
                     // get dates
Esempio n. 8
0
 protected function common()
 {
     // Set the timezone to the user timezone
     $timezone = $this->_properties->getProperty('timezone');
     date_default_timezone_set($timezone);
     // Assgin a different layout if embedded
     if ($this->_embed) {
         if ($this->_embed == 'page') {
             $this->_helper->layout->setlayout('embed_page');
         } else {
             $this->_helper->layout->disableLayout();
         }
     }
     // Fetch the user configured widgets
     if (!$this->_embed) {
         $w = new Widgets();
         $this->view->widgets = $w->getWidgets($this->_user->id);
     }
     // User provided footer (e.g. tracker)
     $user_footer = $this->_properties->getProperty('footer');
     $this->view->user_footer = $user_footer;
     // Javascript
     $this->view->headScript()->appendFile('js/prototype/prototype.js');
     $this->view->headScript()->appendFile('js/scriptaculous/builder.js');
     $this->view->headScript()->appendFile('js/scriptaculous/builder.js');
     $this->view->headScript()->appendFile('js/scriptaculous/effects.js');
     $this->view->headScript()->appendFile('js/scriptaculous/dragdrop.js');
     $this->view->headScript()->appendFile('js/scriptaculous/controls.js');
     $this->view->headScript()->appendFile('js/scriptaculous/slider.js');
     $this->view->headScript()->appendFile('js/scriptaculous/sound.js');
     $this->view->headScript()->appendFile('js/storytlr/validateForm.js');
     $this->view->headScript()->appendFile('js/storytlr/common.js');
     $this->view->headScript()->appendFile('js/controllers/adminbar.js');
     $this->view->headScript()->appendFile('js/accordion/accordion.js');
     // Meta
     $this->view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
     // CSS
     $this->view->headLink()->appendStylesheet('style/toolbar.css');
     $this->view->headLink()->appendStylesheet('themes/' . $this->_properties->getProperty('theme') . '/style.css');
     // Colors
     $colors = $this->_properties->getProperties(array("color_title", "color_subtitle", "color_sidebar_border", "color_background", "color_link", "color_sidebar_text", "color_sidebar_header"));
     $this->view->colors = $colors;
     // Error and status messages
     $this->view->status_messages = $this->getStatusMessages();
     $this->view->error_messages = $this->getErrorMessages();
     // User details
     $this->view->username = $this->_user->username;
     $this->view->user_id = $this->_user->id;
     $this->view->admin = $this->_admin;
     // Theme
     $themes = Themes::getAvailableThemes();
     $theme = $this->_properties->getProperty('theme');
     $this->view->theme = $theme;
     $this->view->theme_data = $themes[$theme];
     // Pages
     $pages = new Pages();
     $this->view->pages = $pages->getPages();
     // Page layout
     $this->view->background_image = $this->_properties->getProperty('background_image');
     $this->view->header_image = $this->_properties->getProperty('header_image');
     $this->view->has_colors = $this->_properties->getProperty('has_colors');
     $this->view->css_enabled = $this->_properties->getProperty('css_enabled');
     $this->view->css_content = $this->_properties->getProperty('css_content');
     $this->view->title = $this->_properties->getProperty('title');
     $this->view->subtitle = $this->_properties->getProperty('subtitle');
     $this->view->disqus = $this->_properties->getProperty('disqus');
     $this->view->googlefc = $this->_properties->getProperty('googlefc');
     $this->view->footer = $this->_properties->getProperty('footer');
 }