summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php')
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php100
1 files changed, 59 insertions, 41 deletions
diff --git a/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php b/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php
index 728a1548..75fe80b1 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php
+++ b/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo.php
@@ -23,7 +23,7 @@ class Site_Logo {
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
- self::$instance = new Site_Logo;
+ self::$instance = new Site_Logo();
self::$instance->register_hooks();
}
@@ -77,46 +77,61 @@ class Site_Logo {
*/
public function customize_register( $wp_customize ) {
// Include our custom control.
- require( dirname( __FILE__ ) . '/class-site-logo-control.php' );
-
- //Update the Customizer section title for discoverability.
- $wp_customize->get_section('title_tagline')->title = __( 'Site Title, Tagline, and Logo', 'jetpack' );
+ require dirname( __FILE__ ) . '/class-site-logo-control.php';
// Add a setting to hide header text if the theme isn't supporting the feature itself
if ( ! current_theme_supports( 'custom-header' ) ) {
- $wp_customize->add_setting( 'site_logo_header_text', array(
- 'default' => 1,
- 'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
- 'transport' => 'postMessage',
- ) );
-
- $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'site_logo_header_text', array(
- 'label' => __( 'Display Header Text', 'jetpack' ),
- 'section' => 'title_tagline',
- 'settings' => 'site_logo_header_text',
- 'type' => 'checkbox',
- ) ) );
+ $wp_customize->add_setting(
+ 'site_logo_header_text',
+ array(
+ 'default' => 1,
+ 'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
+ 'transport' => 'postMessage',
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Control(
+ $wp_customize,
+ 'site_logo_header_text',
+ array(
+ 'label' => __( 'Display Header Text', 'jetpack' ),
+ 'section' => 'title_tagline',
+ 'settings' => 'site_logo_header_text',
+ 'type' => 'checkbox',
+ )
+ )
+ );
}
// Add the setting for our logo value.
- $wp_customize->add_setting( 'site_logo', array(
- 'capability' => 'manage_options',
- 'default' => array(
- 'id' => 0,
- 'sizes' => array(),
- 'url' => false,
- ),
- 'sanitize_callback' => array( $this, 'sanitize_logo_setting' ),
- 'transport' => 'postMessage',
- 'type' => 'option',
- ) );
+ $wp_customize->add_setting(
+ 'site_logo',
+ array(
+ 'capability' => 'manage_options',
+ 'default' => array(
+ 'id' => 0,
+ 'sizes' => array(),
+ 'url' => false,
+ ),
+ 'sanitize_callback' => array( $this, 'sanitize_logo_setting' ),
+ 'transport' => 'postMessage',
+ 'type' => 'option',
+ )
+ );
// Add our image uploader.
- $wp_customize->add_control( new Site_Logo_Image_Control( $wp_customize, 'site_logo', array(
- 'label' => __( 'Logo', 'jetpack' ),
- 'section' => 'title_tagline',
- 'settings' => 'site_logo',
- ) ) );
+ $wp_customize->add_control(
+ new Site_Logo_Image_Control(
+ $wp_customize,
+ 'site_logo',
+ array(
+ 'label' => __( 'Logo', 'jetpack' ),
+ 'section' => 'title_tagline',
+ 'settings' => 'site_logo',
+ )
+ )
+ );
}
/**
@@ -148,9 +163,9 @@ class Site_Logo {
public function header_text_classes() {
$args = get_theme_support( 'site-logo' );
- if ( isset( $args[0][ 'header-text' ] ) ) {
+ if ( isset( $args[0]['header-text'] ) ) {
// Use any classes defined in add_theme_support().
- $classes = $args[0][ 'header-text' ];
+ $classes = $args[0]['header-text'];
} else {
// Otherwise, use these defaults, which will work with any Underscores-based theme.
$classes = array(
@@ -205,7 +220,7 @@ class Site_Logo {
* @return string Size specified in add_theme_support declaration, or 'thumbnail' default
*/
public function theme_size() {
- $args = get_theme_support( 'site-logo' );
+ $args = get_theme_support( 'site-logo' );
$valid_sizes = get_intermediate_image_sizes();
// Add 'full' to the list of accepted values.
@@ -288,11 +303,14 @@ class Site_Logo {
* @uses update_option()
*/
public function remove_site_logo() {
- update_option( 'site_logo', array(
- 'id' => (int) 0,
- 'sizes' => array(),
- 'url' => '',
- ) );
+ update_option(
+ 'site_logo',
+ array(
+ 'id' => (int) 0,
+ 'sizes' => array(),
+ 'url' => '',
+ )
+ );
}
/**