Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 14 commits
  • 37 files changed
  • 0 commit comments
  • 5 contributors
Commits on Apr 10, 2012
koopersmith Theme browsing UX improvements. see #20403.
* On manage/install themes pages, moved author under theme name.
* On manage themes page, moved version number to details.

git-svn-id: http://core.svn.wordpress.org/trunk@20414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
c2bc582
koopersmith Fix showing/hiding theme details and move code from theme-preview.js …
…to theme.js. see #20403.

git-svn-id: http://core.svn.wordpress.org/trunk@20415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
06e5671
bumpbot Compress scripts/styles: 3.4-beta1-20416.
git-svn-id: http://core.svn.wordpress.org/trunk@20416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
10336f6
azaozz Introduce wp_is_mobile() and use it instead of $is_iphone global, see…
… #20014

git-svn-id: http://core.svn.wordpress.org/trunk@20417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
3ef4fe6
bumpbot Compress scripts/styles: 3.4-beta1-20418.
git-svn-id: http://core.svn.wordpress.org/trunk@20418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
0496df9
koopersmith Replace all instances of thickbox theme preview with the theme custom…
…izer. fixes #20404.

* Use theme customizer in theme install/update screens.
* Separate the customize loader from the customizer. Use wp_customize_loader() to include the loader script and markup.
* Deprecated: wp-admin/js/theme-preview.js is now no longer used by core.

git-svn-id: http://core.svn.wordpress.org/trunk@20419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
dd0cd14
azaozz Move the wp_is_mobile() check after the admin bootstrap in media-new.…
…php, props SergeyBiryukov, see #20014

git-svn-id: http://core.svn.wordpress.org/trunk@20420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
3e862f7
bumpbot Compress scripts/styles: 3.4-beta1-20421.
git-svn-id: http://core.svn.wordpress.org/trunk@20421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
c1f88c9
azaozz Consistently remove links to media-new.php for mobile devices, props …
…SergeyBiryukov, see #20405

git-svn-id: http://core.svn.wordpress.org/trunk@20422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
bc73c6c
ryan Pass post_type to clean_post_cache() instead of attempting to fetch a…
… post object since the post may have been deleted.

Props leewillis77
see #19690


git-svn-id: http://core.svn.wordpress.org/trunk@20423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
69854cb
duck_ Don't override the $current_user global in get_currentuserinfo() on a…
…n XML-RPC request

if it's non-empty. Fixes capabilities checks for XML-RPC requests. See #20372.


git-svn-id: http://core.svn.wordpress.org/trunk@20424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
98a1dd5
ryan Use wp_safe_redirect(). No need to allow offsite redirects.
git-svn-id: http://core.svn.wordpress.org/trunk@20425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
e4d2362
koopersmith Larger screenshots in theme list tables. see #20403, #19816.
git-svn-id: http://core.svn.wordpress.org/trunk@20426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
87ec5e7
bumpbot Compress scripts/styles: 3.4-beta1-20427.
git-svn-id: http://core.svn.wordpress.org/trunk@20427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
b216ff5
View
9 wp-admin/admin-header.php
@@ -11,7 +11,7 @@
require_once( './admin.php' );
// In case admin-header.php is included in a function.
-global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version, $is_iphone,
+global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
$current_site, $update_title, $total_update_count, $parent_file;
// Catch plugins that include admin-header.php before admin.php completes.
@@ -87,9 +87,10 @@
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
-if ( $is_iphone ) { ?>
-<style type="text/css">.row-actions{visibility:visible;}</style>
-<?php } ?>
+if ( wp_is_mobile() )
+ $admin_body_class .= ' mobile';
+
+?>
</head>
<body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
<script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
View
2 wp-admin/css/wp-admin.css
1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
22 wp-admin/css/wp-admin.dev.css
@@ -4286,12 +4286,12 @@ h3.available-themes {
overflow: hidden;
padding: 20px;
vertical-align: top;
- width: 240px;
+ width: 300px;
}
.available-theme a.screenshot {
- width: 240px;
- height: 180px;
+ width: 300px;
+ height: 225px;
display: block;
border-width: 1px;
border-style: solid;
@@ -4300,11 +4300,19 @@ h3.available-themes {
}
.available-theme img {
- width: 240px;
+ width: 300px;
}
.available-theme h3 {
- margin: 15px 0 5px;
+ margin: 15px 0 0;
+}
+
+.available-theme .theme-author {
+ line-height: 18px;
+}
+
+.available-theme .action-links {
+ margin-top: 10px;
}
#current-theme {
@@ -5315,6 +5323,10 @@ p.pagenav {
padding: 2px 0 0;
}
+.mobile .row-actions {
+ visibility: visible;
+}
+
tr:hover .row-actions,
div.comment-item:hover .row-actions {
visibility: visible;
View
2 wp-admin/includes/class-wp-posts-list-table.php
@@ -360,7 +360,7 @@ function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
if ( $page->post_parent == $page->ID ) {
$page->post_parent = 0;
$wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
- clean_page_cache( $page->ID );
+ clean_post_cache( $page->ID, $page->post_type );
}
if ( 0 == $page->post_parent )
View
6 wp-admin/includes/class-wp-theme-install-list-table.php
@@ -197,10 +197,8 @@ function single_row( $theme ) {
<img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
</a>
- <h3><?php
- /* translators: 1: theme name, 2: author name */
- printf( __( '%1$s <span>by %2$s</span>' ), $name, $author );
- ?></h3>
+ <h3><?php echo $name; ?></h3>
+ <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
<?php
$this->install_theme_info( $theme );
View
50 wp-admin/includes/class-wp-themes-list-table.php
@@ -116,17 +116,17 @@ function get_columns() {
function display_rows() {
$themes = $this->items;
- foreach ( $themes as $theme ) {
- echo '<div class="available-theme">';
+ foreach ( $themes as $theme ):
+ ?><div class="available-theme"><?php
- $template = $theme->get_template();
+ $template = $theme->get_template();
$stylesheet = $theme->get_stylesheet();
-
- $title = $theme->display('Name');
- $version = $theme->display('Version');
- $author = $theme->display('Author');
+ $title = $theme->display('Name');
+ $version = $theme->display('Version');
+ $author = $theme->display('Author');
$activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $template );
+
$preview_link = esc_url( add_query_arg(
array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ),
home_url( '/' ) ) );
@@ -154,28 +154,32 @@ function display_rows() {
<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
<?php endif; ?>
</a>
- <h3><?php
- /* translators: 1: theme title, 2: theme version, 3: theme author */
- printf( __( '%1$s %2$s by %3$s' ), $title, $version, $author ) ; ?></h3>
+ <h3><?php echo $title; ?></h3>
+ <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
+ <div class="action-links">
+ <?php echo $actions; ?>
+ <span class="separator hide-if-no-js">| </span><a href="#" class="theme-detail hide-if-no-js" tabindex='4'><?php _e('Details') ?></a>
+ </div>
- <span class='action-links'><?php echo $actions ?></span>
- <span class="separator hide-if-no-js">| </span><a href="#" class="theme-detail hide-if-no-js" tabindex='4'><?php _e('Details') ?></a>
<div class="themedetaildiv hide-if-js">
- <p><?php echo $theme->display('Description'); ?></p>
- <?php if ( current_user_can( 'edit_themes' ) && $theme->parent() ) :
- /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?>
- <p><?php printf( __( 'The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.' ),
- $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ), $title, $theme->parent()->display('Name') ); ?></p>
- <?php else :
- /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir */ ?>
- <p><?php printf( __( 'All of this theme&#8217;s files are located in <code>%2$s</code>.' ),
- $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ) ); ?></p>
- <?php endif; ?>
+ <p><strong><?php _e('Version: '); ?></strong><?php echo $version; ?></p>
+ <p><?php echo $theme->display('Description'); ?></p>
+ <?php if ( current_user_can( 'edit_themes' ) && $theme->parent() ) :
+ /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?>
+ <p><?php printf( __( 'The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.' ),
+ $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ), $title, $theme->parent()->display('Name') ); ?></p>
+ <?php else :
+ /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir */ ?>
+ <p><?php printf( __( 'All of this theme&#8217;s files are located in <code>%2$s</code>.' ),
+ $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ) ); ?></p>
+ <?php endif; ?>
</div>
+
<?php theme_update_available( $theme ); ?>
+
</div>
<?php
- }
+ endforeach;
}
function search_theme( $theme ) {
View
64 wp-admin/includes/class-wp-upgrader.php
@@ -711,7 +711,7 @@ function check_parent_theme_filter($install_result, $hook_extra, $child_result)
$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version);
$this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version);
-
+
add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme.
// Install the parent theme
@@ -735,7 +735,7 @@ function check_parent_theme_filter($install_result, $hook_extra, $child_result)
return $install_result;
}
-
+
function hide_activate_preview_actions($actions) {
unset($actions['activate'], $actions['preview']);
return $actions;
@@ -1494,19 +1494,33 @@ function after() {
return;
$theme_info = $this->upgrader->theme_info();
- if ( empty($theme_info) )
+ if ( empty( $theme_info ) )
return;
- $name = $theme_info->display('Name');
+
+ $name = $theme_info->display('Name');
$stylesheet = $this->upgrader->result['destination_name'];
- $template = $theme_info->get_template();
+ $template = $theme_info->get_template();
- $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
- $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
+ $preview_link = add_query_arg( array(
+ 'preview' => 1,
+ 'template' => $template,
+ 'stylesheet' => $stylesheet,
+ ), trailingslashit( get_home_url() ) );
- $install_actions = array(
- 'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
- 'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>'
- );
+ $customize_attributes = 'title="' . esc_attr( sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) ) . '"
+ . data-customize-template="' . esc_attr( $template ) . '" data-customize-stylesheet="' . esc_attr( $stylesheet ) . '"';
+
+ $activate_link = add_query_arg( array(
+ 'action' => 'activate',
+ 'template' => $template,
+ 'stylesheet' => $stylesheet,
+ ), admin_url('themes.php') );
+ $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template );
+
+ $install_actions = array();
+ $install_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-js" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
+ $install_actions['preview'] .= '<a href="#" class="hide-if-no-js load-customize" ' . $customize_attributes . '>' . __('Customize') . '</a>';
+ $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . $template, 'enable-theme_' . $template ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
@@ -1550,17 +1564,31 @@ function after() {
$update_actions = array();
if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
- $name = $theme_info->display('Name');
+ $name = $theme_info->display('Name');
$stylesheet = $this->upgrader->result['destination_name'];
- $template = $theme_info->get_template();
+ $template = $theme_info->get_template();
+
+ $preview_link = add_query_arg( array(
+ 'preview' => 1,
+ 'template' => $template,
+ 'stylesheet' => $stylesheet,
+ ), trailingslashit( get_home_url() ) );
+
+ $customize_attributes = 'title="' . esc_attr( sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) ) . '"
+ . data-customize-template="' . esc_attr( $template ) . '" data-customize-stylesheet="' . esc_attr( $stylesheet ) . '"';
- $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
- $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
+ $activate_link = add_query_arg( array(
+ 'action' => 'activate',
+ 'template' => $template,
+ 'stylesheet' => $stylesheet,
+ ), admin_url('themes.php') );
+ $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template );
- $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
- $update_actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
+ $update_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-js" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
+ $update_actions['preview'] .= '<a href="#" class="hide-if-no-js load-customize" ' . $customize_attributes . '>' . __('Customize') . '</a>';
+ $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
- if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() )
+ if ( ( ! $this->result || is_wp_error( $this->result ) ) || $stylesheet == get_stylesheet() )
unset($update_actions['preview'], $update_actions['activate']);
}
View
16 wp-admin/includes/media.php
@@ -62,10 +62,10 @@ function update_gallery_tab($tabs) {
* @since 2.5.0
*/
function the_media_upload_tabs() {
- global $redir_tab, $is_iphone;
+ global $redir_tab;
$tabs = media_upload_tabs();
- if ( $is_iphone ) {
+ if ( wp_is_mobile() ) {
unset($tabs['type']);
$default = 'type_url';
} else {
@@ -528,8 +528,6 @@ function media_upload_form_handler() {
* @return unknown
*/
function wp_media_upload_handler() {
- global $is_iphone;
-
$errors = array();
$id = 0;
@@ -600,7 +598,7 @@ function wp_media_upload_handler() {
return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
}
- if ( $is_iphone )
+ if ( wp_is_mobile() )
return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
else
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
@@ -1306,9 +1304,9 @@ function media_upload_header() {
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
- global $type, $tab, $pagenow, $is_IE, $is_opera, $is_iphone;
+ global $type, $tab, $pagenow, $is_IE, $is_opera;
- if ( $is_iphone )
+ if ( wp_is_mobile() )
return;
$upload_action_url = admin_url('async-upload.php');
@@ -1440,9 +1438,7 @@ function media_upload_form( $errors = null ) {
* @param unknown_type $id
*/
function media_upload_type_form($type = 'file', $errors = null, $id = null) {
- global $is_iphone;
-
- if ( $is_iphone )
+ if ( wp_is_mobile() )
return;
media_upload_header();
View
7 wp-admin/includes/misc.php
@@ -583,9 +583,10 @@ function admin_color_scheme_picker() {
}
function _ipad_meta() {
- if ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false ) { ?>
- <meta name="viewport" id="ipad-viewportmeta" content="width=device-width, initial-scale=1">
- <?php
+ if ( wp_is_mobile() ) {
+ ?>
+ <meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1">
+ <?php
}
}
add_action('admin_head', '_ipad_meta');
View
2 wp-admin/js/postbox.dev.js
@@ -1,4 +1,4 @@
-var postboxes, is_iPad = navigator.userAgent.match(/iPad/);
+var postboxes;
(function($) {
postboxes = {
View
2 wp-admin/js/postbox.js
@@ -1 +1 @@
-var postboxes,is_iPad=navigator.userAgent.match(/iPad/);(function(a){postboxes={add_postbox_toggles:function(d,c){var b=this;b.init(d,c);a(".postbox h3, .postbox .handlediv").bind("click.postboxes",function(){var e=a(this).parent(".postbox"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");if(d!="press-this"){b.save_state(d)}if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){b.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){b.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").bind("click.postboxes",function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").bind("click.postboxes",function(){var e=a(this).val();if(a(this).prop("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){b.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){b.pbhide(e)}}b.save_state(d);b._mark_area()});a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(a(this).val(),10);if(e){b._pb_edit(e);b.save_order(d)}})},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c)},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}postboxes._mark_area()}});if(navigator.userAgent.match(/mobile/i)){a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()});this._pb_change()}this._mark_area()},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_mark_area:function(){var c=a("div.postbox:visible").length,b=a("#post-body #side-sortables");a("#dashboard-widgets .meta-box-sortables:visible").each(function(f,e){var d=a(this);if(c==1||d.children(".postbox:visible").length){d.removeClass("empty-container")}else{d.addClass("empty-container")}});if(b.length){if(b.children(".postbox:visible").length){b.removeClass("empty-container")}else{if(a("#postbox-container-1").css("width")=="280px"){b.addClass("empty-container")}}}},_pb_edit:function(c){var b=a(".metabox-holder").get(0);b.className=b.className.replace(/columns-\d+/,"columns-"+c)},_pb_change:function(){switch(window.orientation){case 90:case -90:this._pb_edit(2);break;case 0:case 180:if(a("#poststuff").length){this._pb_edit(1)}else{this._pb_edit(2)}break}},pbshow:false,pbhide:false}}(jQuery));
+var postboxes;(function(a){postboxes={add_postbox_toggles:function(d,c){var b=this;b.init(d,c);a(".postbox h3, .postbox .handlediv").bind("click.postboxes",function(){var e=a(this).parent(".postbox"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");if(d!="press-this"){b.save_state(d)}if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){b.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){b.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").bind("click.postboxes",function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").bind("click.postboxes",function(){var e=a(this).val();if(a(this).prop("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){b.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){b.pbhide(e)}}b.save_state(d);b._mark_area()});a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(a(this).val(),10);if(e){b._pb_edit(e);b.save_order(d)}})},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c)},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}postboxes._mark_area()}});if(navigator.userAgent.match(/mobile/i)){a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()});this._pb_change()}this._mark_area()},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_mark_area:function(){var c=a("div.postbox:visible").length,b=a("#post-body #side-sortables");a("#dashboard-widgets .meta-box-sortables:visible").each(function(f,e){var d=a(this);if(c==1||d.children(".postbox:visible").length){d.removeClass("empty-container")}else{d.addClass("empty-container")}});if(b.length){if(b.children(".postbox:visible").length){b.removeClass("empty-container")}else{if(a("#postbox-container-1").css("width")=="280px"){b.addClass("empty-container")}}}},_pb_edit:function(c){var b=a(".metabox-holder").get(0);b.className=b.className.replace(/columns-\d+/,"columns-"+c)},_pb_change:function(){switch(window.orientation){case 90:case -90:this._pb_edit(2);break;case 0:case 180:if(a("#poststuff").length){this._pb_edit(1)}else{this._pb_edit(2)}break}},pbshow:false,pbhide:false}}(jQuery));
View
7 wp-admin/js/theme-preview.dev.js
@@ -53,11 +53,4 @@ jQuery(document).ready(function($) {
return false;
} );
-
- // Theme details
- $('#availablethemes').on('click', 'a.theme-detail', function (event) {
- $(this).siblings('.themedetaildiv').toggle();
- return false;
- });
-
});
View
2 wp-admin/js/theme-preview.js
@@ -1 +1 @@
-var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){tb_click.call(this);var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e='&nbsp; <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e='&nbsp; <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false});a("#availablethemes").on("click","a.theme-detail",function(b){a(this).siblings(".themedetaildiv").toggle();return false})});
+var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){tb_click.call(this);var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e='&nbsp; <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e='&nbsp; <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false})});
View
14 wp-admin/js/theme.dev.js
@@ -1,4 +1,16 @@
-/*
+/**
+ * Theme Browsing
+ *
+ * Controls visibility of theme details on manage and install themes pages.
+ */
+jQuery( function($) {
+ $('#availablethemes').on( 'click', '.theme-detail', function (event) {
+ $(this).parent().siblings('.themedetaildiv').toggle();
+ event.preventDefault();
+ });
+});
+
+/**
* Theme Install
*
* Displays theme previews on theme install pages.
View
2 wp-admin/js/theme.js
@@ -1 +1 @@
-jQuery(function(c){var e=c("#theme-installer"),d=e.find(".install-theme-info"),b=e.find(".wp-full-overlay-main"),a=c(document.body);e.on("click",".close-full-overlay",function(f){e.fadeOut(200,function(){b.empty();a.removeClass("theme-installer-active full-overlay-active")});f.preventDefault()});e.on("click",".collapse-sidebar",function(f){e.toggleClass("collapsed");f.preventDefault()});c("#availablethemes").on("click",".installable-theme",function(f){var g;d.html(c(this).find(".install-theme-info").html());g=d.find(".theme-preview-url").val();b.html('<iframe src="'+g+'" />');e.fadeIn(200,function(){a.addClass("theme-installer-active full-overlay-active")});f.preventDefault()})});var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filter-box :checkbox").unbind("click").click(function(){var e=a("#filter-box :checked").length,f=a("#filter-click").text();if(f.indexOf("(")!=-1){f=f.substr(0,f.indexOf("("))}if(e==0){a("#filter-click").text(f)}else{a("#filter-click").text(f+" ("+e+")")}})}var c={init:d};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});var ThemeScroller;(function(a){ThemeScroller={querying:false,scrollPollingDelay:500,failedRetryDelay:4000,outListBottomThreshold:300,init:function(){var b=this;if(typeof ajaxurl==="undefined"||typeof list_args==="undefined"||typeof theme_list_args==="undefined"){a(".pagination-links").show();return}this.nonce=a("#_ajax_fetch_list_nonce").val();this.nextPage=(theme_list_args.paged+1);this.$outList=a("#availablethemes");this.$spinner=a("div.tablenav.bottom").children("img.ajax-loading");this.$window=a(window);this.$document=a(document);if(theme_list_args.total_pages>=this.nextPage){this.pollInterval=setInterval(function(){return b.poll()},this.scrollPollingDelay)}},poll:function(){var b=this.$document.scrollTop()+this.$window.innerHeight();if(this.querying||(b<this.$outList.height()-this.outListBottomThreshold)){return}this.ajax()},process:function(b){if(b===undefined){clearInterval(this.pollInterval);return}if(this.nextPage>theme_list_args.total_pages){clearInterval(this.pollInterval)}if(this.nextPage<=(theme_list_args.total_pages+1)){this.$outList.append(b.rows)}},ajax:function(){var b=this;this.querying=true;var c={action:"fetch-list",paged:this.nextPage,s:theme_list_args.search,tab:theme_list_args.tab,type:theme_list_args.type,_ajax_fetch_list_nonce:this.nonce,"features[]":theme_list_args.features,list_args:list_args};this.$spinner.css("visibility","visible");a.getJSON(ajaxurl,c).done(function(d){b.nextPage++;b.process(d);b.$spinner.css("visibility","hidden");b.querying=false}).fail(function(){b.$spinner.css("visibility","hidden");b.querying=false;setTimeout(function(){b.ajax()},b.failedRetryDelay)})}};a(document).ready(function(b){ThemeScroller.init()})})(jQuery);
+jQuery(function(a){a("#availablethemes").on("click",".theme-detail",function(b){a(this).parent().siblings(".themedetaildiv").toggle();b.preventDefault()})});jQuery(function(c){var e=c("#theme-installer"),d=e.find(".install-theme-info"),b=e.find(".wp-full-overlay-main"),a=c(document.body);e.on("click",".close-full-overlay",function(f){e.fadeOut(200,function(){b.empty();a.removeClass("theme-installer-active full-overlay-active")});f.preventDefault()});e.on("click",".collapse-sidebar",function(f){e.toggleClass("collapsed");f.preventDefault()});c("#availablethemes").on("click",".installable-theme",function(f){var g;d.html(c(this).find(".install-theme-info").html());g=d.find(".theme-preview-url").val();b.html('<iframe src="'+g+'" />');e.fadeIn(200,function(){a.addClass("theme-installer-active full-overlay-active")});f.preventDefault()})});var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filter-box :checkbox").unbind("click").click(function(){var e=a("#filter-box :checked").length,f=a("#filter-click").text();if(f.indexOf("(")!=-1){f=f.substr(0,f.indexOf("("))}if(e==0){a("#filter-click").text(f)}else{a("#filter-click").text(f+" ("+e+")")}})}var c={init:d};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});var ThemeScroller;(function(a){ThemeScroller={querying:false,scrollPollingDelay:500,failedRetryDelay:4000,outListBottomThreshold:300,init:function(){var b=this;if(typeof ajaxurl==="undefined"||typeof list_args==="undefined"||typeof theme_list_args==="undefined"){a(".pagination-links").show();return}this.nonce=a("#_ajax_fetch_list_nonce").val();this.nextPage=(theme_list_args.paged+1);this.$outList=a("#availablethemes");this.$spinner=a("div.tablenav.bottom").children("img.ajax-loading");this.$window=a(window);this.$document=a(document);if(theme_list_args.total_pages>=this.nextPage){this.pollInterval=setInterval(function(){return b.poll()},this.scrollPollingDelay)}},poll:function(){var b=this.$document.scrollTop()+this.$window.innerHeight();if(this.querying||(b<this.$outList.height()-this.outListBottomThreshold)){return}this.ajax()},process:function(b){if(b===undefined){clearInterval(this.pollInterval);return}if(this.nextPage>theme_list_args.total_pages){clearInterval(this.pollInterval)}if(this.nextPage<=(theme_list_args.total_pages+1)){this.$outList.append(b.rows)}},ajax:function(){var b=this;this.querying=true;var c={action:"fetch-list",paged:this.nextPage,s:theme_list_args.search,tab:theme_list_args.tab,type:theme_list_args.type,_ajax_fetch_list_nonce:this.nonce,"features[]":theme_list_args.features,list_args:list_args};this.$spinner.css("visibility","visible");a.getJSON(ajaxurl,c).done(function(d){b.nextPage++;b.process(d);b.$spinner.css("visibility","hidden");b.querying=false}).fail(function(){b.$spinner.css("visibility","hidden");b.querying=false;setTimeout(function(){b.ajax()},b.failedRetryDelay)})}};a(document).ready(function(b){ThemeScroller.init()})})(jQuery);
View
9 wp-admin/media-new.php
@@ -6,12 +6,11 @@
* @subpackage Administration
*/
-global $is_iphone;
-
-if ( $is_iphone ) // cannot upload files from iPhone/iPad
- return;
-
$_GET['inline'] = 'true';
/** Administration bootstrap */
require_once('./admin.php');
+
+if ( wp_is_mobile() ) // cannot upload files from mobile devices
+ return;
+
require_once('./media-upload.php');
View
2 wp-admin/media.php
@@ -106,7 +106,7 @@
<h2>
<?php
echo esc_html( $title );
-if ( current_user_can( 'upload_files' ) ) { ?>
+if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() ) { ?>
<a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a>
<?php } ?>
</h2>
View
2 wp-admin/menu.php
@@ -56,7 +56,7 @@
$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' );
$submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
/* translators: add new file */
- if ( !$is_iphone )
+ if ( ! wp_is_mobile() )
$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
View
3 wp-admin/theme-install.php
@@ -30,9 +30,6 @@
$submenu_file = 'themes.php';
wp_enqueue_script( 'theme-install' );
-
-add_thickbox();
-wp_enqueue_script( 'theme-preview' );
wp_enqueue_script( 'theme' );
$body_id = $tab;
View
3 wp-admin/themes.php
@@ -66,9 +66,8 @@
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
-add_thickbox();
-wp_enqueue_script( 'theme-preview' );
wp_enqueue_script( 'theme' );
+wp_customize_loader();
endif;
View
13 wp-admin/update.php
@@ -152,8 +152,8 @@
check_admin_referer('upgrade-theme_' . $theme);
- add_thickbox();
- wp_enqueue_script('theme-preview');
+ wp_customize_loader();
+
$title = __('Update Theme');
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
@@ -204,8 +204,8 @@
if ( is_wp_error($api) )
wp_die($api);
- add_thickbox();
- wp_enqueue_script('theme-preview');
+ wp_customize_loader();
+
$title = __('Install Themes');
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
@@ -230,11 +230,12 @@
$file_upload = new File_Upload_Upgrader('themezip', 'package');
+ wp_customize_loader();
+
$title = __('Upload Theme');
$parent_file = 'themes.php';
$submenu_file = 'theme-install.php';
- add_thickbox();
- wp_enqueue_script('theme-preview');
+
require_once(ABSPATH . 'wp-admin/admin-header.php');
$title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
View
7 wp-admin/upload.php
@@ -176,7 +176,12 @@
<div class="wrap">
<?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php
+<h2>
+<?php
+echo esc_html( $title );
+if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() ) { ?>
+ <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
+}
if ( ! empty( $_REQUEST['s'] ) )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
</h2>
View
2 wp-comments-post.php
@@ -95,5 +95,5 @@
$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
$location = apply_filters('comment_post_redirect', $location, $comment);
-wp_redirect($location);
+wp_safe_redirect( $location );
exit;
View
2 wp-includes/admin-bar.php
@@ -489,7 +489,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
unset( $cpts['post'] );
}
- if ( current_user_can( 'upload_files' ) )
+ if ( current_user_can( 'upload_files' ) && ! wp_is_mobile() )
$actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' );
if ( current_user_can( 'manage_links' ) )
View
4 wp-includes/class-wp-admin-bar.php
@@ -321,7 +321,7 @@ public function render() {
}
final protected function _render( $root ) {
- global $is_IE, $is_iphone;
+ global $is_IE;
// Add browser classes.
// We have to do this here since admin bar shows on the front end.
@@ -333,7 +333,7 @@ public function render() {
$class .= ' ie8';
elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) )
$class .= ' ie9';
- } elseif ( $is_iphone ) {
+ } elseif ( wp_is_mobile() ) {
$class .= ' mobile';
}
View
21 wp-includes/class-wp-customize.php
@@ -29,7 +29,6 @@ public function __construct() {
add_action( 'setup_theme', array( $this, 'setup_theme' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
- add_action( 'admin_footer', array( $this, 'admin_footer' ) );
add_action( 'customize_previewing', array( $this, 'customize_previewing' ) );
add_action( 'customize_register', array( $this, 'register_controls' ) );
@@ -275,8 +274,6 @@ public function admin_init() {
if ( isset( $_REQUEST['save_customize_controls'] ) )
$this->save();
- wp_enqueue_script( 'customize-loader' );
-
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
return;
@@ -295,24 +292,6 @@ public function admin_init() {
}
/**
- * Print the customize template.
- *
- * @since 3.4.0
- */
- public function admin_footer() {
- ?>
- <div id="customize-container" class="wp-full-overlay">
- <input type="hidden" class="admin-url" value="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" />
- <a href="#" class="close-full-overlay"><?php printf( __( '&larr; Return to %s' ), get_admin_page_title() ); ?></a>
- <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
- <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
- <span class="collapse-sidebar-arrow"></span>
- </a>
- </div>
- <?php
- }
-
- /**
* Switch the theme and trigger the save action of each setting.
*
* @since 3.4.0
View
5 wp-includes/comment.php
@@ -1583,10 +1583,7 @@ function wp_update_comment_count_now($post_id) {
$new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
$wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
- if ( 'page' == $post->post_type )
- clean_page_cache( $post_id );
- else
- clean_post_cache( $post_id );
+ clean_post_cache( $post_id, $post->post_type );
do_action('wp_update_comment_count', $post_id, $new, $old);
do_action('edit_post', $post_id, $post);
View
37 wp-includes/deprecated.php
@@ -3116,4 +3116,39 @@ function get_theme_data( $theme_file ) {
);
return $theme_data;
-}
+}
+
+/**
+ * Alias of update_post_cache().
+ *
+ * @see update_post_cache() Posts and pages are the same, alias is intentional
+ *
+ * @since 1.5.1
+ * @deprecated 3.4.0
+ *
+ * @param array $pages list of page objects
+ */
+function update_page_cache( &$pages ) {
+ _deprecated_function( __FUNCTION__, 3.4, 'update_post_cache()' );
+
+ update_post_cache( $pages );
+}
+
+/**
+ * Will clean the page in the cache.
+ *
+ * Clean (read: delete) page from cache that matches $id. Will also clean cache
+ * associated with 'all_page_ids' and 'get_pages'.
+ *
+ * @since 2.0.0
+ * @deprecated 3.4.0
+ *
+ * @uses do_action() Will call the 'clean_page_cache' hook action.
+ *
+ * @param int $id Page ID to clean
+ */
+function clean_page_cache( $id ) {
+ _deprecated_function( __FUNCTION__, 3.4, 'clean_post_cache()' );
+
+ clean_post_cache( $id, 'page' );
+}
View
6 wp-includes/general-template.php
@@ -1746,14 +1746,14 @@ function rich_edit_exists() {
* @return bool
*/
function user_can_richedit() {
- global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_iphone, $is_IE;
+ global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE;
if ( !isset($wp_rich_edit) ) {
$wp_rich_edit = false;
if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users
if ( $is_safari ) {
- if ( $is_iphone || false !== strpos( $_SERVER['HTTP_USER_AGENT'], '; Silk/' ) )
+ if ( wp_is_mobile() || false !== strpos( $_SERVER['HTTP_USER_AGENT'], '; Silk/' ) )
$wp_rich_edit = ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
else
$wp_rich_edit = true;
@@ -2108,7 +2108,7 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
* Enqueues the default ThickBox js and css.
*
* If any of the settings need to be changed, this can be done with another js
- * file similar to media-upload.js and theme-preview.js. That file should
+ * file similar to media-upload.js. That file should
* require array('thickbox') to ensure it is loaded after.
*
* @since 2.5.0
View
2 wp-includes/js/customize-loader.dev.js
@@ -41,7 +41,7 @@ if ( typeof wp === 'undefined' )
$( function() {
Loader.initialize();
- $('#current-theme, #availablethemes').on( 'click', '.load-customize', function( event ) {
+ $('#wpbody').on( 'click', '.load-customize', function( event ) {
var load = $(this);
event.preventDefault();
View
2 wp-includes/js/customize-loader.js
@@ -1 +1 @@
-if(typeof wp==="undefined"){var wp={}}(function(a,b){var c={initialize:function(){this.body=b(document.body);this.element=b("#customize-container");this.base=b(".admin-url",this.element).val();this.element.on("click",".close-full-overlay",function(){c.close();return false});this.element.on("click",".collapse-sidebar",function(){c.element.toggleClass("collapsed");return false})},open:function(d){d.customize="on";this.iframe=b("<iframe />",{src:this.base+"?"+jQuery.param(d)}).appendTo(this.element);this.element.fadeIn(200,function(){c.body.addClass("customize-active full-overlay-active")})},close:function(){this.element.fadeOut(200,function(){c.iframe.remove();c.iframe=null;c.body.removeClass("customize-active full-overlay-active")})}};b(function(){c.initialize();b("#current-theme, #availablethemes").on("click",".load-customize",function(d){var e=b(this);d.preventDefault();c.open({template:e.data("customizeTemplate"),stylesheet:e.data("customizeStylesheet")})})});a.CustomizeLoader=c})(wp,jQuery);
+if(typeof wp==="undefined"){var wp={}}(function(a,b){var c={initialize:function(){this.body=b(document.body);this.element=b("#customize-container");this.base=b(".admin-url",this.element).val();this.element.on("click",".close-full-overlay",function(){c.close();return false});this.element.on("click",".collapse-sidebar",function(){c.element.toggleClass("collapsed");return false})},open:function(d){d.customize="on";this.iframe=b("<iframe />",{src:this.base+"?"+jQuery.param(d)}).appendTo(this.element);this.element.fadeIn(200,function(){c.body.addClass("customize-active full-overlay-active")})},close:function(){this.element.fadeOut(200,function(){c.iframe.remove();c.iframe=null;c.body.removeClass("customize-active full-overlay-active")})}};b(function(){c.initialize();b("#wpbody").on("click",".load-customize",function(d){var e=b(this);d.preventDefault();c.open({template:e.data("customizeTemplate"),stylesheet:e.data("customizeStylesheet")})})});a.CustomizeLoader=c})(wp,jQuery);
View
10 wp-includes/pluggable.php
@@ -74,11 +74,6 @@ function wp_get_current_user() {
function get_currentuserinfo() {
global $current_user;
- if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
- wp_set_current_user( 0 );
- return false;
- }
-
if ( ! empty( $current_user ) ) {
if ( $current_user instanceof WP_User )
return;
@@ -97,6 +92,11 @@ function get_currentuserinfo() {
return false;
}
+ if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
+ wp_set_current_user( 0 );
+ return false;
+ }
+
if ( ! $user = wp_validate_auth_cookie() ) {
if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) || !$user = wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' ) ) {
wp_set_current_user( 0 );
View
103 wp-includes/post.php
@@ -1359,12 +1359,9 @@ function set_post_type( $post_id = 0, $post_type = 'post' ) {
global $wpdb;
$post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db');
- $return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) );
+ $return = $wpdb->update( $wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) );
- if ( 'page' == $post_type )
- clean_page_cache($post_id);
- else
- clean_post_cache($post_id);
+ clean_post_cache( $post_id, $post_type );
return $return;
}
@@ -2056,15 +2053,11 @@ function wp_delete_post( $postid = 0, $force_delete = false ) {
$wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
do_action( 'deleted_post', $postid );
- if ( 'page' == $post->post_type ) {
- clean_page_cache($postid);
- } else {
- clean_post_cache($postid);
- }
+ clean_post_cache( $postid, $post->post_type );
if ( is_post_type_hierarchical( $post->post_type ) ) {
foreach ( (array) $children as $child )
- clean_post_cache( $child->ID );
+ clean_post_cache( $child->ID, $child->post_type );
}
wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
@@ -2643,10 +2636,7 @@ function wp_insert_post($postarr, $wp_error = false) {
$current_guid = get_post_field( 'guid', $post_ID );
- if ( 'page' == $data['post_type'] )
- clean_page_cache($post_ID);
- else
- clean_post_cache($post_ID);
+ clean_post_cache( $post_ID, $data['post_type'] );
// Set GUID
if ( !$update && '' == $current_guid )
@@ -3535,7 +3525,7 @@ function &get_pages($args = '') {
}
// Update cache.
- update_page_cache($pages);
+ update_post_cache( $pages );
if ( $child_of || $hierarchical )
$pages = & get_page_children($child_of, $pages);
@@ -3751,7 +3741,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
if ( $file )
update_attached_file( $post_ID, $file );
- clean_post_cache($post_ID);
+ clean_post_cache( $post_ID, $post_type );
if ( ! empty( $context ) )
add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
@@ -3864,7 +3854,7 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
if ( ! empty($file) )
@ unlink($file);
- clean_post_cache($post_id);
+ clean_post_cache( $post_id, $post->post_type );
return $post;
}
@@ -4314,20 +4304,18 @@ function _get_last_post_time( $timezone, $field ) {
/**
* Updates posts in cache.
*
- * @usedby update_page_cache() Aliased by this function.
- *
* @package WordPress
* @subpackage Cache
* @since 1.5.1
*
* @param array $posts Array of post objects
*/
-function update_post_cache(&$posts) {
- if ( !$posts )
+function update_post_cache( &$posts ) {
+ if ( ! $posts )
return;
foreach ( $posts as $post )
- wp_cache_add($post->ID, $post, 'posts');
+ wp_cache_add( $post->ID, $post, 'posts' );
}
/**
@@ -4348,11 +4336,12 @@ function update_post_cache(&$posts) {
* @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
*
* @param int $id The Post ID in the cache to clean
+ * @param string $post_type The post_type of the post. Defaults to "post"
*/
-function clean_post_cache($id) {
+function clean_post_cache($id, $post_type = 'post') {
global $_wp_suspend_cache_invalidation, $wpdb;
- if ( !empty($_wp_suspend_cache_invalidation) )
+ if ( ! empty( $_wp_suspend_cache_invalidation ) )
return;
$id = (int) $id;
@@ -4360,23 +4349,27 @@ function clean_post_cache($id) {
if ( 0 === $id )
return;
- $post = get_post( $id );
-
wp_cache_delete($id, 'posts');
wp_cache_delete($id, 'post_meta');
- clean_object_term_cache( $id, $post->post_type );
+ clean_object_term_cache( $id, $post_type );
wp_cache_delete( 'wp_get_archives', 'general' );
- do_action('clean_post_cache', $id);
+ do_action( 'clean_post_cache', $id, $post_type );
+
+ if ( 'page' == $post_type ) {
+ wp_cache_delete( 'all_page_ids', 'posts' );
+ wp_cache_delete( 'get_pages', 'posts' );
+ do_action( 'clean_page_cache', $id );
+ }
- if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) {
+ if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) {
foreach ( $children as $cid ) {
// Loop detection
- if ( $cid == $id )
+ if ( $cid->ID == $id )
continue;
- clean_post_cache( $cid );
+ clean_post_cache( $cid->ID, $cid->post_type );
}
}
@@ -4385,44 +4378,6 @@ function clean_post_cache($id) {
}
/**
- * Alias of update_post_cache().
- *
- * @see update_post_cache() Posts and pages are the same, alias is intentional
- *
- * @package WordPress
- * @subpackage Cache
- * @since 1.5.1
- *
- * @param array $pages list of page objects
- */
-function update_page_cache(&$pages) {
- update_post_cache($pages);
-}
-
-/**
- * Will clean the page in the cache.
- *
- * Clean (read: delete) page from cache that matches $id. Will also clean cache
- * associated with 'all_page_ids' and 'get_pages'.
- *
- * @package WordPress
- * @subpackage Cache
- * @since 2.0.0
- *
- * @uses do_action() Will call the 'clean_page_cache' hook action.
- *
- * @param int $id Page ID to clean
- */
-function clean_page_cache($id) {
- clean_post_cache($id);
-
- wp_cache_delete( 'all_page_ids', 'posts' );
- wp_cache_delete( 'get_pages', 'posts' );
-
- do_action('clean_page_cache', $id);
-}
-
-/**
* Call major cache updating functions for list of Post objects.
*
* @package WordPress
@@ -4629,11 +4584,7 @@ function _publish_post_hook($post_id) {
* @param object $post Object type containing the post information
*/
function _save_post_hook($post_id, $post) {
- if ( $post->post_type == 'page' ) {
- clean_page_cache($post_id);
- } else {
- clean_post_cache($post_id);
- }
+ clean_post_cache($post_id, $post->post_type);
}
/**
@@ -5361,4 +5312,4 @@ function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache
update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
}
-}
+}
View
3 wp-includes/script-loader.php
@@ -364,8 +364,9 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
- $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox' ), false, 1 );
+ $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 );
+ // @todo: Core no longer uses theme-preview.js. Remove?
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
View
42 wp-includes/theme.php
@@ -1563,9 +1563,16 @@ function check_theme_switched() {
}
}
-function wp_customize_load() {
+/**
+ * Includes and instantiates the WP_Customize class.
+ *
+ * Fires when ?customize=on.
+ *
+ * @since 3.4.0
+ */
+function _wp_customize_include() {
// Load on themes.php or ?customize=on
- if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) && 'themes.php' != $GLOBALS['pagenow'] )
+ if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) )
return;
require( ABSPATH . WPINC . '/class-wp-customize.php' );
@@ -1573,4 +1580,33 @@ function wp_customize_load() {
// @todo Dependency injection instead
$GLOBALS['customize'] = new WP_Customize;
}
-add_action( 'plugins_loaded', 'wp_customize_load' );
+add_action( 'plugins_loaded', '_wp_customize_include' );
+
+/**
+ * Includes the loading scripts for the theme customizer and
+ * adds the action to print the customize container template.
+ *
+ * @since 3.4.0
+ */
+function wp_customize_loader() {
+ wp_enqueue_script( 'customize-loader' );
+ add_action( 'admin_footer', '_wp_customize_loader_template' );
+}
+
+/**
+ * Print the customize container template.
+ *
+ * @since 3.4.0
+ */
+function _wp_customize_loader_template() {
+ ?>
+ <div id="customize-container" class="wp-full-overlay">
+ <input type="hidden" class="admin-url" value="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" />
+ <a href="#" class="close-full-overlay"><?php printf( __( '&larr; Return to %s' ), get_admin_page_title() ); ?></a>
+ <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
+ <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
+ <span class="collapse-sidebar-arrow"></span>
+ </a>
+ </div>
+ <?php
+}
View
25 wp-includes/vars.php
@@ -97,3 +97,28 @@
* @global bool $is_iis7
*/
$is_iis7 = $is_IIS && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false);
+
+/**
+ * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
+ *
+ * @return bool true|false
+ */
+function wp_is_mobile() {
+ static $is_mobile;
+
+ if ( isset($is_mobile) )
+ return $is_mobile;
+
+ if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
+ $is_mobile = false;
+ } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
+ || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
+ || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
+ || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false ) {
+ $is_mobile = true;
+ } else {
+ $is_mobile = false;
+ }
+
+ return $is_mobile;
+}
View
71 wp-login.php
@@ -39,7 +39,7 @@
* @param WP_Error $wp_error Optional. WordPress Error Object
*/
function login_header($title = 'Log In', $message = '', $wp_error = '') {
- global $error, $is_iphone, $interim_login, $current_site;
+ global $error, $interim_login, $current_site;
// Don't index any of these forms
add_action( 'login_head', 'wp_no_robots' );
@@ -54,25 +54,26 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
add_action( 'login_head', 'wp_shake_js', 12 );
- ?>
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
-<head>
+ ?><!DOCTYPE html>
+ <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+ <head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
-<?php
+ <?php
+
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors-fresh', true );
- if ( $is_iphone ) { ?>
- <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
- <style type="text/css" media="screen">
- .login form, .login .message, #login_error { margin-left: 0px; }
- .login #nav, .login #backtoblog { margin-left: 8px; }
- .login h1 a { width: auto; }
- #login { padding: 20px 0; }
- </style>
-<?php
+ if ( wp_is_mobile() ) {
+ ?>
+ <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
+ <style type="text/css" media="screen">
+ .login form, .login .message, #login_error { margin-left: 0px; }
+ .login #nav, .login #backtoblog { margin-left: 8px; }
+ .login h1 a { width: auto; }
+ #login { padding: 20px 0; }
+ </style>
+ <?php
}
do_action( 'login_enqueue_scripts' );
@@ -88,16 +89,19 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
-?>
-</head>
-<body class="login">
+
+ ?>
+ </head>
+ <body class="login">
<div id="login">
<h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
-<?php
+ <?php
+
unset( $login_header_url, $login_header_title );
$message = apply_filters('login_message', $message);
- if ( !empty( $message ) ) echo $message . "\n";
+ if ( !empty( $message ) )
+ echo $message . "\n";
// In case a plugin uses $error rather than the $wp_errors object
if ( !empty( $error ) ) {
@@ -134,23 +138,22 @@ function login_footer($input_id = '') {
<p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '&larr; Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
</div>
-<?php if ( !empty($input_id) ) : ?>
-<script type="text/javascript">
-try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
-if(typeof wpOnload=='function')wpOnload();
-</script>
-<?php endif; ?>
-
-<?php do_action('login_footer'); ?>
-<div class="clear"></div>
-</body>
-</html>
-<?php
+ <?php if ( !empty($input_id) ) : ?>
+ <script type="text/javascript">
+ try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
+ if(typeof wpOnload=='function')wpOnload();
+ </script>
+ <?php endif; ?>
+
+ <?php do_action('login_footer'); ?>
+ <div class="clear"></div>
+ </body>
+ </html>
+ <?php
}
function wp_shake_js() {
- global $is_iphone;
- if ( $is_iphone )
+ if ( wp_is_mobile() )
return;
?>
<script type="text/javascript">

No commit comments for this range

Something went wrong with that request. Please try again.