Ejemplo n.º 1
0
function modify_post_mime_types($post_mime_types)
{
    $post_mime_types['application/pdf'] = array(__('PDF', 'pdf'), __('Manage PDF', 'pdf'), __ngettext_noop('PDF (%s)', 'PDF (%s)', 'pdf'));
    $post_mime_types['application/msword'] = array(__('DOC', 'doc'), __('Manage DOC', 'doc'), __ngettext_noop('DOC (%s)', 'DOC (%s)', 'doc'));
    $post_mime_types['application/vnd.ms-excel'] = array(__('XLS', 'xls'), __('Manage XLS', 'xls'), __ngettext_noop('XLS (%s)', 'XLS (%s)', 'xls'));
    $post_mime_types['application/zip'] = array(__('Zip', 'zip'), __('Manage Zip', 'zip'), __ngettext_noop('Zip (%s)', 'Zip (%s)', 'zip'));
    return $post_mime_types;
}
Ejemplo n.º 2
0
<?php

/**
 * Test that all l10n functions are properly recognized.
 *
 * @package WP_L10n_Validator\Tests
 * @since 0.1.0
 */
__('test', 'wp-l10n-validator-tests');
_e('test', 'wp-l10n-validator-tests');
_c('test|context', 'wp-l10n-validator-tests');
_nc('test|context', 'single', 'plural', 'wp-l10n-validator-tests');
__ngettext('single', 'plural', 1, 'wp-l10n-validator-tests');
_n('single', 'plural', 1, 'wp-l10n-validator-tests');
__ngettext_noop('single', 'plural', 'wp-l10n-validator-tests');
_n_noop('single', 'plural', 'wp-l10n-validator-tests');
_x('test', 'context', 'wp-l10n-validator-tests');
_ex('test', 'context', 'wp-l10n-validator-tests');
_nx('singular', 'plural', 1, 'context', 'wp-l10n-validator-tests');
_nx_noop('single', 'plural', 'context', 'wp-l10n-validator-tests');
esc_attr__('test', 'wp-l10n-validator-tests');
esc_html__('test', 'wp-l10n-validator-tests');
esc_html_e('test', 'wp-l10n-validator-tests');
esc_attr_e('test', 'wp-l10n-validator-tests');
esc_attr_x('test', 'context', 'wp-l10n-validator-tests');
esc_html_x('test', 'context', 'wp-l10n-validator-tests');
Ejemplo n.º 3
0
            printf(__ngettext('%s comment marked as spam', '%s comments marked as spam', $spam), $spam);
            echo '<br />';
        }
        echo '</p></div>';
    }
}
?>

<form id="comments-form" action="" method="get">
<ul class="subsubsub">
<?php 
$status_links = array();
$num_comments = $post_id ? wp_count_comments($post_id) : wp_count_comments();
//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
$stati = array('all' => __ngettext_noop('All', 'All'), 'moderated' => __ngettext_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'), 'approved' => __ngettext_noop('Approved', 'Approved'), 'spam' => __ngettext_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)'));
$class = '' === $comment_status ? ' class="current"' : '';
// $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>';
$link = 'edit-comments.php';
if (!empty($comment_type) && 'all' != $comment_type) {
    $link = add_query_arg('comment_type', $comment_type, $link);
}
foreach ($stati as $status => $label) {
    $class = '';
    if (str_replace('all', '', $status) == $comment_status) {
        $class = ' class="current"';
    }
    if (!isset($num_comments->{$status})) {
        $num_comments->{$status} = 10;
    }
    if ('all' != $status) {
Ejemplo n.º 4
0
function wp_edit_attachments_query( $q = false ) {
	global $wpdb;
	if ( false === $q )
		$q = $_GET;
	$q['m']   = (int) $q['m'];
	$q['cat'] = (int) $q['cat'];
	$q['post_type'] = 'attachment';
	$q['post_status'] = 'any';
	$q['posts_per_page'] = 15;
	$post_mime_types = array(	//	array( adj, noun )
				'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
				'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
				'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
			);
	$post_mime_types = apply_filters('post_mime_types', $post_mime_types);

	$avail_post_mime_types = get_available_post_mime_types('attachment');

	if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
		unset($q['post_mime_type']);

	wp($q);

	return array($post_mime_types, $avail_post_mime_types);
}
Ejemplo n.º 5
0
function modify_post_mime_types($post_mime_types)
{
    $post_mime_types['application/pdf'] = array(__('Pdfs'), __('Manage Pdfs'), __ngettext_noop('Pdf (%s)', 'Pdfs (%s)'));
    return $post_mime_types;
}
Ejemplo n.º 6
0
$parent_file = 'upload.php';
if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
    $_GET['paged'] = 1;
}
if (isset($_GET['detached'])) {
    if (!empty($lost)) {
        $start = ($_GET['paged'] - 1) * 50;
        $page_links_total = ceil(count($lost) / 50);
        $lost = implode(',', $lost);
        $orphans = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND ID IN ({$lost}) LIMIT {$start}, 50");
    } else {
        $start = ($_GET['paged'] - 1) * 25;
        $orphans = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent < 1 LIMIT {$start}, 25");
        $page_links_total = ceil($wpdb->get_var("SELECT FOUND_ROWS()") / 25);
    }
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')), 'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')), 'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($_GET['post_mime_type']) && !array_intersect((array) $_GET['post_mime_type'], array_keys($post_mime_types))) {
        unset($_GET['post_mime_type']);
    }
} else {
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
}
wp_enqueue_script('media');
require_once 'admin-header.php';
?>

<?php 
if (isset($_GET['posted']) && (int) $_GET['posted']) {
    $_GET['message'] = '1';
Ejemplo n.º 7
0
    if (strpos($sendback, 'page.php') !== false) {
        $sendback = admin_url('page-new.php');
    } elseif (strpos($sendback, 'attachments.php') !== false) {
        $sendback = admin_url('attachments.php');
    }
    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    wp_redirect($sendback);
    exit;
} elseif (!empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    exit;
}
$title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script('admin-forms');
$post_stati = array('publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')), 'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')), 'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')), 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')), 'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)')));
$post_status_label = __('Manage Pages');
$post_status_q = '';
if (isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys($post_stati))) {
    $post_status_label = $post_stati[$_GET['post_status']][1];
    $post_status_q = '&post_status=' . $_GET['post_status'];
    $post_status_q .= '&perm=readable';
}
$query_str = "post_type=page&orderby=menu_order title&what_to_show=posts{$post_status_q}&posts_per_page=-1&posts_per_archive_page=-1&order=asc";
$query_str = apply_filters('manage_pages_query', $query_str);
wp($query_str);
if (is_singular()) {
    wp_enqueue_script('admin-comments');
}
require_once 'admin-header.php';
?>
	exit();
} elseif ( !empty($_GET['_wp_http_referer']) ) {
	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
	 exit;
}

$title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script('admin-forms');

$post_stati  = array(	//	array( adj, noun )
		'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')),
		'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
		'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
		'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
		'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)'))
	);

$post_status_label = __('Manage Pages');
$post_status_q = '';
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
	$post_status_label = $post_stati[$_GET['post_status']][1];
	$post_status_q = '&post_status=' . $_GET['post_status'];
	$post_status_q .= '&perm=readable';
}

$query_str = "post_type=page&orderby=menu_order title&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc";

$query_str = apply_filters('manage_pages_query', $query_str);
wp($query_str);
Ejemplo n.º 9
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = 'any';
    $q['posts_per_page'] = 15;
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
	}
}
?>

<form id="comments-form" action="" method="get">
<ul class="subsubsub">
<?php
$status_links = array();
$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
$stati = array(
		'all' => __ngettext_noop('All', 'All'), // singular not used
		'moderated' => __ngettext_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
		'approved' => __ngettext_noop('Approved', 'Approved'), // singular not used
		'spam' => __ngettext_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
	);
$class = ( '' === $comment_status ) ? ' class="current"' : '';
// $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>';
$link = 'edit-comments.php';
if ( !empty($comment_type) && 'all' != $comment_type )
	$link = add_query_arg( 'comment_type', $comment_type, $link );
foreach ( $stati as $status => $label ) {
	$class = '';

	if ( str_replace( 'all', '', $status ) == $comment_status )
		$class = ' class="current"';
	if ( !isset( $num_comments->$status ) )
		$num_comments->$status = 10;
	if ( 'all' != $status )
		$link = add_query_arg( 'comment_status', $status, $link );
Ejemplo n.º 11
0
	function edit_data_query( $q = false ) {
		if ( false === $q ) {
			$q = $_GET;
		}
		
		// Date
		$q['m']   = (int) $q['m'];
		
		// Category
		$q['cat'] = (int) $q['cat'];
		
		// Quantity
		$q['posts_per_page'] = (int) $q['posts_per_page'];
		if ( $q['posts_per_page'] == 0 ) {
			$q['posts_per_page'] = 15;
		}		
		
		// Content type
		if ( $q['post_type'] == 'page' ) {
			$q['post_type'] = 'page';
		} else {
			$q['post_type'] = 'post';
		}
		
		// Post status
		$post_stati = array(	//	array( adj, noun )
			'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
			'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
			'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
			'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
			'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')),
		);
	
		$post_stati = apply_filters('post_stati', $post_stati);	
		$avail_post_stati = get_available_post_statuses('post');
	
		$post_status_q = '';
		if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
			$post_status_q = '&post_status=' . $q['post_status'];
			$post_status_q .= '&perm=readable';
		}
	
		if ( 'pending' === $q['post_status'] ) {
			$order = 'ASC';
			$orderby = 'modified';
		} elseif ( 'draft' === $q['post_status'] ) {
			$order = 'DESC';
			$orderby = 'modified';
		} else {
			$order = 'DESC';
			$orderby = 'date';
		}
	
		wp("post_type={$q['post_type']}&what_to_show=posts$post_status_q&posts_per_page={$q['posts_per_page']}&order=$order&orderby=$orderby");
	
		return array($post_stati, $avail_post_stati);
	}
Ejemplo n.º 12
0
	function modify_post_mime_types($post_mime_types) {
		if ( function_exists( '_n_noop' ) ) :
			$post_mime_types['application/x-shockwave-flash'] = array(__('Flash', 'swfobj'), __('Manage Flash', 'swfobj'), _n_noop('Flash (%s)', 'Flash (%s)', 'swfobj'));
		else :
			$post_mime_types['application/x-shockwave-flash'] = array(__('Flash', 'swfobj'), __('Manage Flash', 'swfobj'), __ngettext_noop('Flash (%s)', 'Flash (%s)', 'swfobj'));
		endif;
		return $post_mime_types;
	}