Ejemplo n.º 1
0
 public function testRenderWithLink()
 {
     $cite = Cite::create()->appendText('Some ')->appendText(Anchor::create()->withHRef('http://foo.com')->appendText('link'))->appendText('.');
     $expected = '<cite>' . 'Some <a href="http://foo.com">link</a>.' . '</cite>';
     $rendered = $cite->render();
     $this->assertEquals($expected, $rendered);
 }
Ejemplo n.º 2
0
 public function index($data)
 {
     $data->active_class = Anchor::format('%c');
     $data->active_short_class = Anchor::format('%C');
     $data->active_method = Anchor::format('%m');
     $data->active_short_method = Anchor::format('%M');
     $data->active_full_path = Anchor::format('%p');
     $data->active_class_path = Anchor::format('%P');
 }
Ejemplo n.º 3
0
        break;
    default:
        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
}
/*
 * Set autoload directories to include your app models and libraries
 */
Autoloader::directory(array(APP . 'models', APP . 'libraries'));
/**
 * Helpers
 */
require APP . 'helpers' . EXT;
/**
 * Anchor setup
 */
Anchor::setup();
/**
 * Import defined routes
 */
if (is_admin()) {
    require APP . 'routes/admin' . EXT;
    require APP . 'routes/categories' . EXT;
    require APP . 'routes/comments' . EXT;
    require APP . 'routes/fields' . EXT;
    require APP . 'routes/menu' . EXT;
    require APP . 'routes/metadata' . EXT;
    require APP . 'routes/pages' . EXT;
    require APP . 'routes/plugins' . EXT;
    require APP . 'routes/posts' . EXT;
    require APP . 'routes/dossier' . EXT;
    require APP . 'routes/publications' . EXT;
Ejemplo n.º 4
0
 /**
  * Configures underscore as the word delimiter
  *
  * @return void
  */
 public static function setLegacyWordDelimiter()
 {
     self::$word_delimiter = '_';
 }
Ejemplo n.º 5
0
 /**
  * get the path bar for this anchor
  *
  * This function is used to build a path bar relative to the anchor.
  * For example, if you are displaying an article related to a category,
  * the path bar has to mention the category. You can use following code
  * to do that:
  * [php]
  * $anchor = Anchors::get($article['anchor']);
  * $context['path_bar'] = array_merge($context['path_bar'], $anchor->get_path_bar());
  * [/php]
  *
  * @return an array of $url => $label, or NULL on error
  *
  * @see shared/anchor.php
  */
 function get_path_bar()
 {
     // no item bound
     if (!isset($this->item['id'])) {
         return NULL;
     }
     // standard path
     $path = Anchor::get_path_bar();
     // add categories root
     if (!$this->item['anchor']) {
         $path = array_merge(array('categories/' => i18n::s('Categories')), $path);
     }
     return $path;
 }
Ejemplo n.º 6
0
    echo file_get_contents(PATH . 'system/admin/theme/error_config.php');
    exit(1);
}
// Register the default timezone for the application.
date_default_timezone_set(Config::get('application.timezone'));
// set locale
if (setlocale(LC_ALL, Config::get('application.language') . '.utf8') === false) {
    Log::warning('setlocate failed, please check your system has ' . Config::get('application.language') . ' installed.');
}
// Register the PHP exception handler.
set_exception_handler(array('Error', 'exception'));
// Register the PHP error handler.
set_error_handler(array('Error', 'native'));
// Register the shutdown handler.
register_shutdown_function(array('Error', 'shutdown'));
/**
	Start session handler
*/
Session::start();
/**
	Handle routing
*/
Anchor::run();
/**
	Close and end session
*/
Session::end();
/**
	Output awesomeness!
*/
Response::send();
Ejemplo n.º 7
0
 public function render()
 {
     if ($this->_if) {
         return parent::render();
     }
 }
Ejemplo n.º 8
0
 /**
  * provide a custom label
  *
  * @param string the target label (e.g., 'edit_title', 'item_name', 'item_names')
  * @param string the module that is invoking the anchor (e.g., 'comments')
  * @param string an optional title, if any
  * @return string the foreseen label
  */
 function get_label($id, $variant, $title = '')
 {
     global $context;
     throw new exception('function get_label() in sections/section.php has been obsoleted');
     // sanity check
     if (!isset($this->item['id'])) {
         return FALSE;
     }
     // a default title
     if (!$title) {
         $title = $this->get_title();
     }
     // strings for comments
     if ($variant == 'comments') {
         switch ($id) {
             // title for these
             case 'title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Replies');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Notes');
                 }
                 return i18n::s('Comments');
                 // many comments
             // many comments
             case 'list_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Replies');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Notes');
                 }
                 return i18n::s('Comments');
                 // command to delete a comment
             // command to delete a comment
             case 'delete_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Yes, I want to delete this reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Yes, I want to delete this note');
                 }
                 return i18n::s('Yes, I want to delete this comment');
                 // page title to delete a comment
             // page title to delete a comment
             case 'delete_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Delete a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Delete a note');
                 }
                 return i18n::s('Delete a comment');
                 // command to edit content
             // command to edit content
             case 'edit_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Edit the new reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Edit the new note');
                 }
                 return i18n::s('Edit the new comment');
                 // command to promote a comment
             // command to promote a comment
             case 'promote_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Yes, I want to turn this reply to an article');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Yes, I want to turn this note to an article');
                 }
                 return i18n::s('Yes, I want to turn this comment to an article');
                 // page title to promote a comment
             // page title to promote a comment
             case 'promote_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Promote a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Promote a note');
                 }
                 return i18n::s('Promote a comment');
                 // command to view the thread
             // command to view the thread
             case 'thread_command':
                 return i18n::s('View the page');
                 // page title to modify a comment
             // page title to modify a comment
             case 'edit_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Update a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Update a note');
                 }
                 return i18n::s('Edit a comment');
                 // page title to list comments
             // page title to list comments
             case 'list_title':
                 if ($this->has_layout('jive')) {
                     return sprintf(i18n::s('Replies: %s'), $title);
                 }
                 if ($this->has_layout('manual')) {
                     return sprintf(i18n::s('Notes: %s'), $title);
                 }
                 return sprintf(i18n::s('Discuss: %s'), $title);
                 // command to create a comment
             // command to create a comment
             case 'new_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Reply to this post');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Annotate this page');
                 }
                 return i18n::s('Post a comment');
                 // page title to create a comment
             // page title to create a comment
             case 'new_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Reply to this post');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Annotate this page');
                 }
                 return i18n::s('Post a comment');
                 // command to view content
             // command to view content
             case 'view_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('View the reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('View the note');
                 }
                 return i18n::s('View this comment');
                 // page title to view a comment
             // page title to view a comment
             case 'view_title':
                 if ($this->has_layout('jive')) {
                     return sprintf(i18n::s('Reply: %s'), $title);
                 }
                 if ($this->has_layout('manual')) {
                     return sprintf(i18n::s('Note: %s'), $title);
                 }
                 return $title;
         }
     }
     // fall-back on default behavior
     return parent::get_label($variant, $id, $title);
 }
Ejemplo n.º 9
0
	function toString(){
		$parrafo = new XMLNode("p");
		foreach($this->inputs as $inp){
			$parrafo->AddNode(new TextNode($inp->inputText."<br/>"));
			$input = new Input($inp->inputName);
			$parrafo->AddNode($input);
			$parrafo->AddNode(new TextNode("<br/>"));
		}
		$anchor = new Anchor($this->submitText);
		$go = new Go($this->goTo);
		foreach($this->inputs as $inp){
			$pf_ser = new PostField($inp->postName,"$(".$inp->inputName.")");
			$go->AddComponent($pf_ser);
		}
		foreach($this->vars as $var){
			$pf_ser = new PostField($var->postName,$var->value);
			$go->AddComponent($pf_ser);
		}
		$anchor->AddComponent($go);
		$parrafo->AddNode($anchor);
		return $parrafo->toString();
	}
Ejemplo n.º 10
0
 /**
  * Get the HTML of the breadcrumbs itself
  * @return string
  */
 private function getBreadcrumbsHtml()
 {
     $html = '';
     $index = 1;
     $numBreadcrumbs = count($this->breadcrumbs);
     foreach ($this->breadcrumbs as $label => $url) {
         $anchor = new Anchor($label, $url);
         if ($index == 1) {
             $anchor->appendToClass(self::STYLE_CLASS_FIRST);
         }
         if ($index == $numBreadcrumbs) {
             $anchor->appendToClass(self::STYLE_CLASS_LAST);
         }
         $html .= ($html ? $this->separator : '') . $anchor->getHtml();
         $index++;
     }
     return $html;
 }