Ejemplo n.º 1
0
"<?php 
            echo in_array($opt_key, (array) $value) ? ' selected' : '';
            ?>
><?php 
            echo \Habari\Utils::htmlspecialchars($opt_val);
            ?>
</option>
				<?php 
        }
        ?>
			</optgroup>
		<?php 
    } else {
        ?>
			<option value="<?php 
        echo $opts_key;
        ?>
"<?php 
        echo in_array($opts_key, (array) $value) ? ' selected' : '';
        ?>
><?php 
        echo \Habari\Utils::htmlspecialchars($opts_val);
        ?>
</option>
		<?php 
    }
    ?>
	<?php 
}
?>
</select>
Ejemplo n.º 2
0
 /**
  * Output a post collection based on the provided parameters.
  *
  * @param array $params An array of parameters as passed to Posts::get() to retrieve posts.
  */
 public function get_collection($params = array())
 {
     // Store handler vars since we'll be using them a lot.
     $handler_vars = Controller::get_handler_vars();
     // Retrieve the current matched rule and store its name and argument values.
     $rr = URL::get_matched_rule();
     $rr_name = $rr->name;
     $rr_args = $rr->named_arg_values;
     // Assign alternate links based on the matched rule.
     $alternate_rules = array('atom_feed_tag' => 'display_entries_by_tag', 'atom_feed' => 'display_home', 'atom_entry' => 'display_entry', 'atom_feed_entry_comments' => 'display_entry', 'atom_feed_page_comments' => 'display_entry', 'atom_feed_comments' => 'display_home');
     $alternate_rules = Plugins::filter('atom_get_collection_alternate_rules', $alternate_rules);
     $alternate = URL::get($alternate_rules[$rr_name], $handler_vars, false);
     // Assign self link based on the matched rule.
     $self = URL::get($rr_name, $rr_args, false);
     // Get posts to put in the feed
     $page = isset($rr_args['page']) ? $rr_args['page'] : 1;
     if ($page > 1) {
         $params['page'] = $page;
     }
     if (!isset($params['content_type'])) {
         $params['content_type'] = Post::type('entry');
     }
     $params['content_type'] = Plugins::filter('atom_get_collection_content_type', $params['content_type']);
     $params['status'] = $this->is_auth() ? 'any' : Post::status('published');
     $params['orderby'] = 'updated DESC';
     $params['limit'] = Options::get('atom_entries');
     $params = array_merge($params, $rr_args);
     if (array_key_exists('tag', $params)) {
         $id = urlencode($params['tag']);
         $tags = explode(' ', $params['tag']);
         foreach ($tags as $tag) {
             if ($tag[0] == '-') {
                 $tag = substr($tag, 1);
                 $params['vocabulary'][Tags::vocabulary()->name . ':not:term'][] = Utils::slugify($tag);
             } else {
                 $params['vocabulary'][Tags::vocabulary()->name . ':all:term'][] = Utils::slugify($tag);
             }
         }
         unset($params['tag']);
     } else {
         $id = 'atom';
     }
     $posts = Posts::get($params);
     if (count($posts)) {
         $updated = $posts[0]->updated;
     } else {
         $updated = null;
         header('HTTP/1.1 404 Not Found', true, 404);
         die('Posts could not be found');
     }
     $xml = $this->create_atom_wrapper($alternate, $self, $id, $updated);
     $xml = $this->add_pagination_links($xml, $posts->count_all());
     $xml = $this->add_posts($xml, $posts);
     Plugins::act('atom_get_collection', $xml, $params, $handler_vars);
     $xml = $xml->asXML();
     ob_clean();
     header('Content-Type: application/atom+xml');
     print $this->tidy_xml($xml);
 }
Ejemplo n.º 3
0
<form <?php 
echo $_attributes;
?>
>
	<?php 
echo \Habari\Utils::setup_wsse();
?>
	<input type="hidden" name="_form_id" value="<?php 
echo $_control_id;
?>
">
	<?php 
echo $content;
?>
</form>