mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-17 13:33:32 +09:00
Fix dependencies
This commit is contained in:
@@ -48,27 +48,14 @@ function display_featured_image_genesis_require() {
|
||||
display_featured_image_genesis_require();
|
||||
|
||||
// Instantiate dependent classes
|
||||
$displayfeaturedimagegenesis_admin = new Display_Featured_Image_Genesis_Admin();
|
||||
$displayfeaturedimagegenesis_author = new Display_Featured_Image_Genesis_Author();
|
||||
$displayfeaturedimagegenesis_common = new Display_Featured_Image_Genesis_Common();
|
||||
$displayfeaturedimagegenesis_description = new Display_Featured_Image_Genesis_Description();
|
||||
|
||||
// Classes with dependencies
|
||||
$displayfeaturedimagegenesis_admin = new Display_Featured_Image_Genesis_Admin(
|
||||
$displayfeaturedimagegenesis_common
|
||||
);
|
||||
$displayfeaturedimagegenesis_output = new Display_Featured_Image_Genesis_Output(
|
||||
$displayfeaturedimagegenesis_common,
|
||||
$displayfeaturedimagegenesis_description
|
||||
);
|
||||
$displayfeaturedimagegenesis_output = new Display_Featured_Image_Genesis_Output();
|
||||
$displayfeaturedimagegenesis_rss = new Display_Featured_Image_Genesis_RSS();
|
||||
$displayfeaturedimagegenesis_settings = new Display_Featured_Image_Genesis_Settings(
|
||||
$displayfeaturedimagegenesis_common
|
||||
);
|
||||
$displayfeaturedimagegenesis_author = new Display_Featured_Image_Genesis_Author(
|
||||
$displayfeaturedimagegenesis_settings
|
||||
);
|
||||
$displayfeaturedimagegenesis_taxonomies = new Display_Featured_Image_Genesis_Taxonomies(
|
||||
$displayfeaturedimagegenesis_settings
|
||||
);
|
||||
$displayfeaturedimagegenesis_settings = new Display_Featured_Image_Genesis_Settings();
|
||||
$displayfeaturedimagegenesis_taxonomies = new Display_Featured_Image_Genesis_Taxonomies();
|
||||
|
||||
$displayfeaturedimage = new Display_Featured_Image_Genesis(
|
||||
$displayfeaturedimagegenesis_admin,
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
|
||||
class Display_Featured_Image_Genesis_Admin {
|
||||
|
||||
public function __construct( $common ) {
|
||||
$this->common = $common;
|
||||
}
|
||||
protected $common;
|
||||
|
||||
public function set_up_columns() {
|
||||
$this->common = new Display_Featured_Image_Genesis_Common( $common = '' );
|
||||
$this->set_up_taxonomy_columns();
|
||||
$this->set_up_post_type_columns();
|
||||
|
||||
|
||||
@@ -5,19 +5,31 @@ class Display_Featured_Image_Genesis_Author {
|
||||
protected $settings;
|
||||
protected $name;
|
||||
|
||||
public function __construct( $settings ) {
|
||||
$this->settings = $settings;
|
||||
$this->name = 'displayfeaturedimagegenesis';
|
||||
/**
|
||||
* Set new profile field for authors
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public function set_author_meta() {
|
||||
|
||||
$this->settings = new Display_Featured_Image_Genesis_Settings( $common = '' );
|
||||
$this->name = 'displayfeaturedimagegenesis';
|
||||
// current user
|
||||
add_action( 'profile_personal_options', array( $this, 'do_author_fields' ) );
|
||||
add_action( 'personal_options_update', array( $this, 'save_profile_fields' ) );
|
||||
// not current user
|
||||
add_action( 'edit_user_profile', array( $this, 'do_author_fields' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'save_profile_fields' ) );
|
||||
}
|
||||
|
||||
function do_author_fields( $user ) {
|
||||
|
||||
$id = get_the_author_meta( $this->name, $user->ID );
|
||||
$id = get_the_author_meta( $this->name, $user->ID );
|
||||
|
||||
echo '<table class="form-table">';
|
||||
|
||||
echo '<tr class="user-featured-image-wrap">';
|
||||
echo '<th scope="row"><label for="' . $this->name . '">Featured Image</label></th>';
|
||||
echo '<th scope="row"><label for="' . esc_attr( $this->name ) . '">Featured Image</label></th>';
|
||||
|
||||
echo '<td>';
|
||||
if ( $id ) {
|
||||
|
||||
@@ -14,12 +14,6 @@ class Display_Featured_Image_Genesis_Output {
|
||||
protected $displaysetting;
|
||||
protected $item;
|
||||
|
||||
public function __construct( $common, $description ) {
|
||||
$this->common = $common;
|
||||
$this->description = $description;
|
||||
$this->displaysetting = get_option( 'displayfeaturedimagegenesis' );
|
||||
}
|
||||
|
||||
/**
|
||||
* set parameters for scripts, etc. to run.
|
||||
*
|
||||
@@ -27,7 +21,11 @@ class Display_Featured_Image_Genesis_Output {
|
||||
*/
|
||||
public function manage_output() {
|
||||
|
||||
$this->item = Display_Featured_Image_Genesis_Common::get_image_variables();
|
||||
$this->common = new Display_Featured_Image_Genesis_Common();
|
||||
$this->description = new Display_Featured_Image_Genesis_Description();
|
||||
$this->displaysetting = get_option( 'displayfeaturedimagegenesis' );
|
||||
$this->item = Display_Featured_Image_Genesis_Common::get_image_variables();
|
||||
|
||||
$skip = $this->displaysetting['exclude_front'];
|
||||
$post_types = array( 'attachment', 'revision', 'nav_menu_item' );
|
||||
$skipped_types = apply_filters( 'display_featured_image_genesis_skipped_posttypes', $post_types );
|
||||
|
||||
@@ -19,10 +19,6 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
protected $post_types;
|
||||
protected $fields;
|
||||
|
||||
public function __construct( $common ) {
|
||||
$this->common = $common;
|
||||
}
|
||||
|
||||
/**
|
||||
* add a submenu page under Appearance
|
||||
* @return submenu Display Featured image settings page
|
||||
@@ -30,7 +26,8 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
*/
|
||||
public function do_submenu_page() {
|
||||
|
||||
$this->page = 'displayfeaturedimagegenesis';
|
||||
$this->page = 'displayfeaturedimagegenesis';
|
||||
$this->common = new Display_Featured_Image_Genesis_Common();
|
||||
|
||||
add_theme_page(
|
||||
__( 'Display Featured Image for Genesis', 'display-featured-image-genesis' ),
|
||||
|
||||
@@ -11,8 +11,26 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
||||
|
||||
protected $settings;
|
||||
|
||||
public function __construct( $settings ) {
|
||||
$this->settings = $settings;
|
||||
/**
|
||||
* set up all actions for adding featured images to taxonomies
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function set_taxonomy_meta() {
|
||||
|
||||
$this->settings = new Display_Featured_Image_Genesis_Settings();
|
||||
|
||||
$args = array(
|
||||
'public' => true,
|
||||
);
|
||||
$output = 'names';
|
||||
$taxonomies = get_taxonomies( $args, $output );
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
add_action( "{$taxonomy}_add_form_fields", array( $this, 'add_taxonomy_meta_fields' ), 5, 2 );
|
||||
add_action( "{$taxonomy}_edit_form_fields", array( $this, 'edit_taxonomy_meta_fields' ), 5, 2 );
|
||||
add_action( "edited_{$taxonomy}", array( $this->settings, 'save_taxonomy_custom_meta' ), 10, 2 );
|
||||
add_action( "create_{$taxonomy}", array( $this->settings, 'save_taxonomy_custom_meta' ), 10, 2 );
|
||||
add_action( 'load-edit-tags.php', array( $this, 'help' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,8 +37,8 @@ class Display_Featured_Image_Genesis {
|
||||
|
||||
add_action( 'init', array( $this, 'add_plugin_supports' ) );
|
||||
add_action( 'admin_init', array( $this, 'check_settings' ) );
|
||||
add_action( 'admin_init', array( $this, 'set_taxonomy_meta' ) );
|
||||
add_action( 'admin_init', array( $this, 'set_author_meta' ) );
|
||||
add_action( 'admin_init', array( $this->taxonomies, 'set_taxonomy_meta' ) );
|
||||
add_action( 'admin_init', array( $this->author, 'set_author_meta' ) );
|
||||
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
||||
add_action( 'admin_init', array( $this->admin, 'set_up_columns' ) );
|
||||
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
||||
@@ -148,39 +148,6 @@ class Display_Featured_Image_Genesis {
|
||||
return update_option( $setting, wp_parse_args( $new, get_option( $setting ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* set up all actions for adding featured images to taxonomies
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function set_taxonomy_meta() {
|
||||
$args = array(
|
||||
'public' => true,
|
||||
);
|
||||
$output = 'names';
|
||||
$taxonomies = get_taxonomies( $args, $output );
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
add_action( "{$taxonomy}_add_form_fields", array( $this->taxonomies, 'add_taxonomy_meta_fields' ), 5, 2 );
|
||||
add_action( "{$taxonomy}_edit_form_fields", array( $this->taxonomies, 'edit_taxonomy_meta_fields' ), 5, 2 );
|
||||
add_action( "edited_{$taxonomy}", array( $this->settings, 'save_taxonomy_custom_meta' ), 10, 2 );
|
||||
add_action( "create_{$taxonomy}", array( $this->settings, 'save_taxonomy_custom_meta' ), 10, 2 );
|
||||
add_action( 'load-edit-tags.php', array( $this->taxonomies, 'help' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new profile field for authors
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public function set_author_meta() {
|
||||
// current user
|
||||
add_action( 'profile_personal_options', array( $this->author, 'do_author_fields' ) );
|
||||
add_action( 'personal_options_update', array( $this->author, 'save_profile_fields' ) );
|
||||
// not current user
|
||||
add_action( 'edit_user_profile', array( $this->author, 'do_author_fields' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this->author, 'save_profile_fields' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up text domain for translations
|
||||
*
|
||||
@@ -252,4 +219,15 @@ class Display_Featured_Image_Genesis {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add link to plugin settings page in plugin table
|
||||
* @param $links link to settings page
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public function add_settings_link( $links ) {
|
||||
$links[] = sprintf( '<a href="%s">%s</a>', esc_url( admin_url( 'themes.php?page=displayfeaturedimagegenesis' ) ), esc_attr__( 'Settings', 'display-featured-image-genesis' ) );
|
||||
return $links;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user