mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-18 22:13:20 +09:00
Extract settings setup to new class
Generally extended by the helper class.
This commit is contained in:
@@ -32,6 +32,7 @@ if ( ! defined( 'DISPLAYFEATUREDIMAGEGENESIS_BASENAME' ) ) {
|
||||
function display_featured_image_genesis_require() {
|
||||
$files = array(
|
||||
'class-displayfeaturedimagegenesis',
|
||||
'class-displayfeaturedimagegenesis-getsetting',
|
||||
'class-displayfeaturedimagegenesis-helper',
|
||||
'class-displayfeaturedimagegenesis-admin',
|
||||
'class-displayfeaturedimagegenesis-author',
|
||||
|
||||
@@ -33,8 +33,7 @@ class Display_Featured_Image_Genesis_Customizer extends Display_Featured_Image_G
|
||||
*/
|
||||
public function customizer( $wp_customize ) {
|
||||
|
||||
$this->settings = new Display_Featured_Image_Genesis_Settings();
|
||||
$this->defaults = $this->settings->defaults();
|
||||
$this->defaults = $this->defaults();
|
||||
$setting = get_option( 'displayfeaturedimagegenesis', false );
|
||||
if ( ! $setting ) {
|
||||
add_option( 'displayfeaturedimagegenesis', $this->defaults );
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class DisplayFeaturedImageGenesisDoSetting
|
||||
* @package DisplayFeaturedImageGenesis
|
||||
* @copyright 2016 Robin Cornett
|
||||
*/
|
||||
class DisplayFeaturedImageGenesisGetSetting {
|
||||
|
||||
|
||||
public function defaults() {
|
||||
return apply_filters( 'displayfeaturedimagegenesis_defaults', array(
|
||||
'less_header' => 0,
|
||||
'default' => '',
|
||||
'exclude_front' => 0,
|
||||
'keep_titles' => 0,
|
||||
'move_excerpts' => 0,
|
||||
'is_paged' => 0,
|
||||
'feed_image' => 0,
|
||||
'thumbnails' => 0,
|
||||
'post_types' => array(),
|
||||
'skip' => array(),
|
||||
'fallback' => array(),
|
||||
'max_height' => '',
|
||||
'always_default' => 0,
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve plugin setting.
|
||||
* @return array All plugin settings.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public function get_display_setting() {
|
||||
$defaults = $this->defaults();
|
||||
$setting = get_option( 'displayfeaturedimagegenesis', $defaults );
|
||||
return wp_parse_args( $setting, $defaults );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
* @copyright 2014-2016 Robin Cornett Creative, LLC
|
||||
*/
|
||||
|
||||
class Display_Featured_Image_Genesis_Helper {
|
||||
class Display_Featured_Image_Genesis_Helper extends DisplayFeaturedImageGenesisGetSetting {
|
||||
|
||||
protected $setting;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
|
||||
|
||||
/**
|
||||
* Settings for options screen
|
||||
* @return settings for backstretch image options
|
||||
* @return array settings for backstretch image options
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -127,37 +127,6 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
|
||||
register_setting( 'displayfeaturedimagegenesis', 'displayfeaturedimagegenesis', array( $this, 'do_validation_things' ) );
|
||||
}
|
||||
|
||||
public function defaults() {
|
||||
return apply_filters( 'displayfeaturedimagegenesis_defaults', array(
|
||||
'less_header' => 0,
|
||||
'default' => '',
|
||||
'exclude_front' => 0,
|
||||
'keep_titles' => 0,
|
||||
'move_excerpts' => 0,
|
||||
'is_paged' => 0,
|
||||
'feed_image' => 0,
|
||||
'thumbnails' => 0,
|
||||
'post_types' => array(),
|
||||
'skip' => array(),
|
||||
'fallback' => array(),
|
||||
'max_height' => '',
|
||||
'always_default' => 0,
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve plugin setting.
|
||||
* @return array All plugin settings.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public function get_display_setting() {
|
||||
$defaults = $this->defaults();
|
||||
$setting = get_option( 'displayfeaturedimagegenesis', $defaults );
|
||||
return wp_parse_args( $setting, $defaults );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register plugin settings page sections
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user