Beispiel #1
0
            ?>
				<?php 
            echo $post->title == '' ? '&nbsp;' : Utils::htmlspecialchars($post->title);
            ?>
			<?php 
        }
        ?>
		</span>
		<span class="state pct10"><a href="<?php 
        URL::out('admin', array('page' => 'posts', 'type' => $post->content_type, 'status' => $post->status));
        ?>
" title="<?php 
        _e('Search for other %s items', array(MultiByte::ucfirst(Plugins::filter("post_status_display", $post->statusname))));
        ?>
"><?php 
        echo MultiByte::ucfirst(Plugins::filter("post_status_display", $post->statusname));
        ?>
</a></span>
		<span class="author pct20"><span class="dim"><?php 
        _e('by');
        ?>
</span> <a href="<?php 
        URL::out('admin', array('page' => 'posts', 'user_id' => $post->user_id, 'type' => $post->content_type, 'status' => 'any'));
        ?>
" title="<?php 
        _e('Search for other items by %s', array($post->author->displayname));
        ?>
"><?php 
        echo $post->author->displayname;
        ?>
</a></span>
Beispiel #2
0
	public function testUcfirst ( ) {
		
		$this->assertEquals( MultiByte::ucfirst( $this->test_strings['lowercase'] ), $this->test_strings['ucfirst'] );
		
		// perform a single test with an ascii string for code coverage
		$this->assertEquals( MultiByte::ucfirst( 'abcd', 'ascii' ), 'Abcd' );
		
	}
Beispiel #3
0
 public function test_ucfirst()
 {
     $this->assert_equal(MultiByte::ucfirst($this->test_strings['lowercase']), $this->test_strings['ucfirst']);
     $this->assert_equal(MultiByte::ucfirst('abcd'), 'Abcd');
 }
Beispiel #4
0
?>
<div class="item clear <?php echo $post->statusname; ?>" id="post_<?php echo $post->id; ?>">
	<div class="head clear">
		<?php if ( ACL::access_check( $post_permissions, 'delete' ) ) { ?>
		<span class="checkbox title pct5">
			<input type="checkbox" class="checkbox" name="checkbox_ids[<?php echo $post->id; ?>]" id="checkbox_ids[<?php echo $post->id; ?>]">
		</span>
		<?php } ?>
		<span class="checkbox title pct30">
			<?php if ( ACL::access_check( $post_permissions, 'edit' ) ) { ?>
				<a href="<?php echo URL::out('admin', 'page=publish&id=' . $post->id); ?>" class="title" title="<?php _e('Edit \'%s\'', array( Utils::htmlspecialchars( $post->title ) ) ) ?>"><?php echo ($post->title == '') ? '&nbsp;' : Utils::htmlspecialchars( $post->title ); ?></a>
			<?php } else { ?>
				<?php echo ($post->title == '') ? '&nbsp;' : Utils::htmlspecialchars( $post->title ); ?>
			<?php } ?>
		</span>
		<span class="state pct10"><a href="<?php URL::out('admin', array('page' => 'posts', 'type' => $post->content_type, 'status' => $post->status ) ); ?>" title="<?php _e('Search for other %s items', array( MultiByte::ucfirst( Plugins::filter( "post_status_display", $post->statusname ) ) ) ); ?>"><?php echo MultiByte::ucfirst( Plugins::filter( "post_status_display", $post->statusname ) ); ?></a></span>
		<span class="author pct20"><span class="dim"><?php _e('by'); ?></span> <a href="<?php URL::out('admin', array('page' => 'posts', 'user_id' => $post->user_id, 'type' => $post->content_type, 'status' => 'any') ); ?>" title="<?php _e('Search for other items by %s', array( $post->author->displayname ) ) ?>"><?php echo $post->author->displayname; ?></a></span>
		<span class="date pct15"><span class="dim"><?php _e('on'); ?></span> <a href="<?php URL::out('admin', array('page' => 'posts', 'type' => $post->content_type, 'year_month' => $post->pubdate->get('Y-m') ) ); ?>" title="<?php _e('Search for other items from %s', array( $post->pubdate->get( 'M, Y' ) ) ); ?>"><?php $post->pubdate->out( HabariDateTime::get_default_date_format() ); ?></a></span>
		<span class="time pct10"><span class="dim"><?php _e('at'); ?> <?php $post->pubdate->out( HabariDateTime::get_default_time_format()); ?></span></span>

		<ul class="dropbutton">
			<?php $actions = array(
				'edit' => array('url' => URL::get('admin', 'page=publish&id=' . $post->id), 'title' => sprintf( _t('Edit \'%s\''), $post->title ), 'label' => _t('Edit'), 'permission' => 'edit' ),
				'view' => array('url' => $post->permalink . '?preview=1', 'title' => sprintf( _t('View \'%s\''), $post->title ), 'label' => _t('View') ),
				'remove' => array('url' => 'javascript:itemManage.remove('. $post->id . ', \'post\');', 'title' => _t('Delete this item'), 'label' => _t('Delete'), 'permission' => 'delete' )
			);
			$actions = Plugins::filter('post_actions', $actions, $post);
			foreach( $actions as $action ) :
			?>
				<?php if ( !isset( $action['permission'] ) || ACL::access_check( $post_permissions, $action['permission'] ) ) { ?>
				<li><a href="<?php echo $action['url']; ?>" title="<?php echo $action['title']; ?>"><?php echo $action['label']; ?></a></li>
 /**
  * Handles the submission of the comment moderation form.
  * @todo Separate delete from "delete until purge"
  */
 public function post_comments()
 {
     // Get special search statuses
     $statuses = Comment::list_comment_statuses();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_status_display", $a));
     }, $statuses);
     $terms = array_map(function ($a) {
         return "status:{$a}";
     }, $statuses);
     $statuses = array_combine($terms, $labels);
     // Get special search types
     $types = Comment::list_comment_types();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_type_display", $a, "singular"));
     }, $types);
     $terms = array_map(function ($a) {
         return "type:{$a}";
     }, $types);
     $types = array_combine($terms, $labels);
     $this->theme->special_searches = array_merge($statuses, $types);
     $this->fetch_comments();
     $this->display('comments');
 }
Beispiel #6
0
	public function testUcfirst ( ) {
		
		// test the native method
		$this->assertNotEquals( MultiByte::ucfirst( $this->test_strings['lowercase'] ), $this->test_strings['ucfirst'] );
		$this->assertEquals( MultiByte::ucfirst( 'abcd' ), 'Abcd' );
		
	}
Beispiel #7
0
 /**
  * Handles POST values from /manage/posts.
  * Used to control what content to show / manage.
  */
 public function post_posts()
 {
     $this->fetch_posts();
     // Get special search statuses
     $statuses = array_keys(Post::list_post_statuses());
     array_shift($statuses);
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("post_status_display", $a));
     }, $statuses);
     $terms = array_map(function ($a) {
         return "status:{$a}";
     }, $statuses);
     $statuses = array_combine($terms, $labels);
     // Get special search types
     $types = array_keys(Post::list_active_post_types());
     array_shift($types);
     $labels = array_map(function ($a) {
         return Plugins::filter("post_type_display", $a, "singular");
     }, $types);
     $terms = array_map(function ($a) {
         return "type:{$a}";
     }, $types);
     $types = array_combine($terms, $labels);
     $special_searches = array_merge($statuses, $types);
     // Add a filter to get the only the user's posts
     $special_searches["author:" . User::identify()->username] = _t('My Posts');
     $this->theme->admin_page = _t('Manage Posts');
     $this->theme->admin_title = _t('Manage Posts');
     $this->theme->special_searches = Plugins::filter('special_searches', $special_searches);
     $this->display('posts');
 }
	/**
	 * filter_dash_module_post_types
	 * Function used to set theme variables to the post types dashboard widget
	 * @param string $module_id
	 * @return string The contents of the module
	 */
	public function filter_dash_module_post_types_and_statuses( $module, $module_id, $theme )
	{
		$messages = array();
		$user = User::identify();

		$post_types = Post::list_active_post_types();
		array_shift( $post_types );
		$post_statuses = array_values( Post::list_post_statuses() );
		array_shift( $post_statuses );

		foreach( $post_types as $type => $type_id ) {
			$plural = Plugins::filter( 'post_type_display', $type, 'plural' );
			foreach( $post_statuses as $status => $status_id ) {
				$status_display = MultiByte::ucfirst( Plugins::filter( 'post_status_display', Post::status_name( $status_id ) ) );
				$site_count = Posts::get( array( 'content_type' => $type_id, 'count' => true, 'status' => $status_id ) );
				$user_count = Posts::get( array( 'content_type' => $type_id, 'count' => true, 'status' => $status_id, 'user_id' => $user->id ) );

				// @locale First variable is the post status, second is the post type
				$message['label'] = _t( '%1$s %2$s', array( $status_display, $plural ) );

				if( ! $site_count ) {
					$message['site_count'] = '';
				}
				else if( $user->cannot( 'post_unpublished' ) && Post::status_name( $status_id ) != 'published' ) {
					$message['site_count'] = '';
				}
				else {
					$message['site_count'] = $site_count;
				}
				$perms = array(
					'post_any' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
					'own_posts' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
					'post_' . $type => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
				);
				if ( $user->can_any( $perms ) && $message['site_count'] ) {
					$message['site_count'] = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'posts', 'type' => Post::type( $type ), 'status' => $status_id ) ) ) . '">' . Utils::htmlspecialchars( $message['site_count'] ) . '</a>';
				}

				if( ! $user_count ) {
					$message['user_count'] = '';
				}
				else {
					$message['user_count'] = $user_count;
				}
				// @locale First variable is the post status, second is the post type
				$perms = array(
					'own_posts' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
					'post_' . $type => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
				);
				if ( $user->can_any( $perms )  && $message['user_count'] ) {
					$message['user_count'] = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'posts', 'type' => Post::type( $type ), 'status' => $status_id, 'user_id' => $user->id ) ) ) . '">' . Utils::htmlspecialchars( $message['user_count'] ) . '</a>';
				}

				if( $message['site_count'] || $message['user_count'] ) {
					$messages[] = $message;
				}
			}
		}

		$theme->type_messages = $messages;

		$module['title'] = _t( 'Post Types and Statuses' );
		$module['content'] = $theme->fetch( 'dash_posttypes' );
		return $module;
	}
Beispiel #9
0
                $u_title = _t('%1$s update: %3$s', array(MultiByte::ucfirst($u['severity']), $u['date'], Utils::htmlspecialchars($u['text'])));
            }
            if (!empty($u['url'])) {
                $u_string = sprintf('<a href="%1$s" title="%2$s" class="%3$s">%4$s</a>', $u['url'], $u_title, $u['severity'], $u['version']);
            } else {
                $u_string = sprintf('<span title="%1$s" class="%2$s">%3$s</span>', $u_title, $u['severity'], $u['version']);
            }
            // add it to the array of updates available for this plugin
            $u_strings[$u['version']] = $u_string;
        }
        $u_strings = Format::and_list($u_strings);
        ?>
								
									<li class="update">
										<?php 
        echo _t('%1$s <a href="%2$s">%3$s</a> has the following updates available: %4$s', array(MultiByte::ucfirst($beacon['type']), $beacon['url'], $beacon['name'], $u_strings));
        ?>
									</li>
								
								<?php 
    }
    ?>
						
					</ul>
					
				<?php 
}
?>

</div>
Beispiel #10
0
 /**
  * Handles the submission of the comment moderation form.
  * @todo Separate delete from "delete until purge"
  */
 public function post_comments()
 {
     // Get special search statuses
     $statuses = Comment::list_comment_statuses();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_status_display", $a));
     }, $statuses);
     $terms = array_map(function ($a) {
         return "status:{$a}";
     }, $statuses);
     $statuses = array_combine($terms, $labels);
     // Get special search types
     $types = Comment::list_comment_types();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_type_display", $a, "singular"));
     }, $types);
     $terms = array_map(function ($a) {
         return "type:{$a}";
     }, $types);
     $types = array_combine($terms, $labels);
     $this->theme->special_searches = array_merge($statuses, $types);
     $this->fetch_comments();
     // Create the form for the search and manage dropbutton. I bet we can save some code when combining this with the other manage pages.
     $form = new FormUI('manage');
     //$search = FormControlFacet::create('search');
     //$form->append($search);
     $aggregate = FormControlAggregate::create('selected_items')->set_selector('.comment_checkbox')->label('None Selected');
     $form->append($aggregate);
     $page_actions = FormControlDropbutton::create('page_actions');
     $page_actions->append(FormControlSubmit::create('delete')->set_caption(_t('Delete Selected'))->set_properties(array('onclick' => 'itemManage.update(\'delete\');return false;', 'title' => _t('Delete Selected'))));
     Plugins::act('comments_manage_actions', $page_actions);
     $form->append($page_actions);
     Stack::add('admin_header_javascript', 'manage-js');
     $this->theme->form = $form;
     $this->display('comments');
 }