Skip to content

Commit

Permalink
Merge pull request #4 from Automattic/2.7.1
Browse files Browse the repository at this point in the history
Merge the changes in 2.7.1 upstream to master.
  • Loading branch information
georgestephanis committed Dec 17, 2013
2 parents 2f6f4a4 + 643c84f commit 6094810
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 45 deletions.
47 changes: 3 additions & 44 deletions modules/holiday-snow.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,13 @@

class Jetpack_Holiday_Snow_Settings {
function __construct() {
add_filter( 'admin_init', array( $this , 'register_fields' ) );
add_action( 'admin_bar_menu', array( $this, 'admin_bar_reminder' ) );
}

function admin_bar_reminder( $wp_admin_bar ) {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}

if ( ! get_option( jetpack_holiday_snow_option_name() ) ) {
return;
}

$css = "
@-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
#wpadminbar .adminbar-holiday-snowflake * {
color: #fff;
}
.adminbar-holiday-snowflake .ab-item:hover span {
display: block;
-webkit-animation: spin 6s linear infinite;
animation: spin 6s linear infinite;
}";

$wp_admin_bar->add_node( array(
'id' => 'holiday-snow-reminder',
'title' => '<span>&#xFF0A;</span>',
'href' => admin_url( 'options-general.php#jetpack_holiday_snow_enabled' ),
'parent' => 'top-secondary',
'meta' => array(
'title' => __( 'Snow' , 'jetpack'),
'class' => 'adminbar-holiday-snowflake',
'html' => "<style>$css</style>",
),
) );
add_filter( 'admin_init' , array( &$this , 'register_fields' ) );
}

public function register_fields() {
register_setting( 'general', jetpack_holiday_snow_option_name(), 'esc_attr' );
add_settings_field( jetpack_holiday_snow_option_name(), '<label for="' . esc_attr( jetpack_holiday_snow_option_name() ) . '">' . __( 'Snow' , 'jetpack') . '</label>' , array( $this, 'blog_field_html' ) , 'general' );
add_action( 'update_option_' . jetpack_holiday_snow_option_name(), array( $this, 'holiday_snow_option_updated' ) );
add_settings_field( jetpack_holiday_snow_option_name(), '<label for="' . esc_attr( jetpack_holiday_snow_option_name() ) . '">' . __( 'Snow' , 'jetpack') . '</label>' , array( &$this, 'blog_field_html' ) , 'general' );
add_action( 'update_option_' . jetpack_holiday_snow_option_name(), array( &$this, 'holiday_snow_option_updated' ) );
}

public function blog_field_html() {
Expand Down
6 changes: 6 additions & 0 deletions modules/random-redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Deprecated. No longer needed.
*
* @package Jetpack
*/
6 changes: 6 additions & 0 deletions modules/social-links.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Deprecated. No longer needed.
*
* @package Jetpack
*/
47 changes: 46 additions & 1 deletion modules/theme-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ function jetpack_load_theme_tools() {
add_action( 'init', 'jetpack_load_theme_tools', 30 );

// Featured Content has an internal check for theme support in the constructor.
require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/featured-content.php' );
// This could already be defined by Twenty Fourteen if it's loaded first.
if ( ! class_exists( 'Featured_Content' ) ) {
require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/featured-content.php' );
}

/**
* INFINITE SCROLL
Expand Down Expand Up @@ -74,3 +77,45 @@ function jetpack_can_activate_infinite_scroll( $can_activate ) {
require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/testimonial.php' );
require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/nova.php' );

/**
* Load theme compat file if it exists.
*
* A theme could add its own compat files here if they like. For example:
*
* add_filter( 'jetpack_theme_compat_files', 'mytheme_jetpack_compat_file' );
* function mytheme_jetpack_compat_file( $files ) {
* $files['mytheme'] = locate_template( 'jetpack-compat.php' );
* return $files;
* }
*/
function jetpack_load_theme_compat() {
$found = 0;
$theme = wp_get_theme();
$to_check = array(
'stylesheet' => $theme->stylesheet,
'template' => $theme->template,
);

// Filter to let other plugins or themes add or remove compat files on their own if they like.
$compat_files = apply_filters( 'jetpack_theme_compat_files', array(
'twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php',
) );

foreach ( $compat_files as $theme_slug => $file ) {
// If we're expecting a compat file,
if ( in_array( $theme_slug, $compat_files ) ) {
// And the compat file that we're expecting is actually there,
if ( is_readable( $file ) ) {
// Use it!
require_once( $file );
$found++;
} else {
// Otherwise wtf^^?
return false;
}
}
}

return $found;
}
add_action( 'after_setup_theme', 'jetpack_load_theme_compat', -1 );
2 changes: 2 additions & 0 deletions modules/theme-tools/compat/twentyfourteen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php

6 changes: 6 additions & 0 deletions modules/tonesque.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Deprecated. No longer needed.
*
* @package Jetpack
*/

0 comments on commit 6094810

Please sign in to comment.