Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ChangeOperation
  • Collection
  • FeedEditor
  • FeedEditorElement
  • ImageEditor
  • ImageEditorElement
  • Module
  • MultiEditorElement
  • NodeEditor
  • NodeEditorElement
  • PatronEditor
  • PatronEditorElement
  • PHPEditor
  • PHPEditorElement
  • RawEditor
  • RawEditorElement
  • RTEEditor
  • RTEEditorElement
  • SelectorElement
  • TabbableEditor
  • TabbableEditorElement
  • TabbableEditorRenderer
  • TabbableNewPaneOperation
  • TextEditor
  • TextEditorElement
  • TextmarkEditor
  • TextmarkEditorElement
  • WidgetsEditor
  • WidgetsEditorElement

Interfaces

  • Editor
  • EditorElement

Exceptions

  • EditorAlreadyInstantiated
  • EditorNotDefined
  1 <?php
  2 
  3 /*
  4  * This file is part of the Icybee package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace Icybee\Modules\Editor;
 13 
 14 /**
 15  * "Feed" editor.
 16  */
 17 class FeedEditor implements Editor
 18 {
 19     /**
 20      * Returns content as is.
 21      *
 22      * @see Icybee\Modules\Editor.Editor::serialize()
 23      */
 24     public function serialize($content)
 25     {
 26         return json_encode($content);
 27     }
 28 
 29     /**
 30      * Returns serialized content as is.
 31      *
 32      * @see Icybee\Modules\Editor.Editor::unserialize()
 33      */
 34     public function unserialize($serialized_content)
 35     {
 36         return json_decode($serialized_content, true);
 37     }
 38     /**
 39      * @return FeedEditorElement
 40      *
 41      * @see Icybee\Modules\Editor.Editor::from()
 42      */
 43     public function from(array $attributes)
 44     {
 45         return new FeedEditorElement($attributes);
 46     }
 47 
 48     /*
 49     static public function to_content($value, $content_id, $page_id)
 50     {
 51         global $core;
 52 
 53         $contents = parent::to_content($value, $content_id, $page_id);
 54 
 55         if (!$contents)
 56         {
 57             return;
 58         }
 59 
 60         // TODO-20101130: there is no cleanup for that, if the content is deleted, the view's target won't be removed
 61 
 62         $constructor = $contents['constructor'];
 63         $view_target_key = 'views.targets.' . strtr($constructor, '.', '_') . '/feed';
 64 
 65         $core->site->metas[$view_target_key] = $page_id;
 66 
 67         return json_encode($contents);
 68     }
 69     */
 70 
 71     // http://tools.ietf.org/html/rfc4287
 72 
 73     public function render($content)
 74     {
 75         global $core;
 76 
 77         $page = $core->request->context->page;
 78         $site = $page->site;
 79         $options = $content;
 80 
 81         $constructor = $options['constructor'];
 82         $limit = $options['limit'];
 83         $with_author = false;
 84 
 85         if (isset($options['settings']))
 86         {
 87             $options['settings']['is_with_author'];
 88         }
 89 
 90         $gmt_offset = $core->timezone;
 91 
 92         $fdate = $core->locale->calendar->date_formatter;
 93         $time_pattern = "y-MM-dd'T'HH:mm:ss";
 94 
 95         $host = preg_replace('#^www\.#', '', $_SERVER['SERVER_NAME']);
 96         $page_created_at = $fdate($page->created_at, 'y-MM-dd');
 97 
 98         $entries = $core->models[$constructor]->filter_by_constructor($constructor)->visible->order('date DESC')->limit($limit)->all;
 99 
100         ob_start();
101 
102 ?>
103 
104     <id>tag:<?= $host ?>,<?= $page_created_at ?>:<?= $page->slug ?></id>
105     <title><?= $page->title ?></title>
106     <link href="<?php echo $page->absolute_url ?>" rel="self" />
107     <link href="<?php echo $page->home->absolute_url ?>" />
108 
109     <author>
110         <name><?php $user = $page->user; echo ($user->firstname && $user->lastname) ? $user->firstname . ' ' . $user->lastname : $user->name ?></name>
111     </author>
112 
113     <updated><?php
114 
115     $updated = '';
116 
117     foreach ($entries as $entry)
118     {
119         if (strcmp($updated, $entry->updated_at) < 0)
120         {
121             $updated = $entry->updated_at;
122         }
123     }
124 
125     echo $fdate($updated, $time_pattern) . $gmt_offset ?></updated>
126 
127 <?php
128 
129         foreach ($entries as $entry)
130         {
131 ?>
132     <entry>
133         <title><?= \ICanBoogie\escape($entry->title) ?></title>
134         <link href="<?php echo $entry->absolute_url ?>" />
135         <id>tag:<?= $host ?>,<?php echo $fdate($entry->created_at, 'y-MM-dd') ?>:<?= $entry->slug ?></id>
136         <updated><?= $fdate($entry->updated_at, $time_pattern) . $gmt_offset ?></updated>
137         <published><?= $fdate($entry->date, $time_pattern) . $gmt_offset ?></published>
138         <?php if ($with_author): ?>
139         <author>
140             <name><?php
141 
142             $user = $entry->user;
143 
144             echo ($user->firstname && $user->lastname) ? $user->firstname . ' ' . $user->lastname : $entry->user->name ?></name>
145         </author>
146         <?php endif; ?>
147         <?php /*
148         <category term="<?php echo $entry->category ?>" /> */ ?>
149         <content type="html" xml:lang="<?php echo $entry->language ? $entry->language : $site->language  ?>"><![CDATA[<?php echo $entry ?>]]></content>
150     </entry>
151 <?php
152         }
153 
154         $rc = ob_get_clean();
155         $rc = preg_replace('#(href|src)="/#', '$1="http://' . $host .'/', $rc);
156 
157         header('Content-Type: application/atom+xml;charset=utf-8');
158         //header('Content-Type: text/plain');
159 
160         echo '<?xml version="1.0" encoding="utf-8"?>
161 <feed xmlns="http://www.w3.org/2005/Atom">' . $rc . '</feed>';
162 
163         exit;
164     }
165 }
166 
Autodoc API documentation generated by ApiGen 2.8.0