PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.9
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.9
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
← All changes | Inc/Classes/hooks.php +71 -69 4.2.232.0.9 View file →
@@ -1,97 +1,99 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 -use PXLBSAdminify\Inc\Utils;
6 -
7 5 // no direct access allowed
8 -if ( ! defined( 'ABSPATH' ) ) {
9 - exit;
10 -}
6 +if (!defined('ABSPATH')) exit;
11 7 /**
12 - * PXLBSAdminify
8 + * WPAdminify
13 9 *
14 10 * @author Jewel Theme <support@jeweltheme.com>
15 11 */
16 -class Hooks {
12 +class Hooks
13 +{
14 + public function __construct()
15 + {
16 + // https://wordpress.stackexchange.com/questions/25034/how-to-remove-screen-options-and-help-links-in-the-admin-area
17 + // https://wordpress.stackexchange.com/questions/73561/how-to-remove-all-widgets-from-dashboard
18 + // Hide Screen Options and Contextual Help
17 19
18 - public function __construct() {
19 - // https://wordpress.stackexchange.com/questions/25034/how-to-remove-screen-options-and-help-links-in-the-admin-area
20 - // https://wordpress.stackexchange.com/questions/73561/how-to-remove-all-widgets-from-dashboard
21 - // Hide Screen Options and Contextual Help
20 + // Add Featured Image or Post Thumbnail to RSS Feed
21 + add_filter('the_excerpt_rss', [$this, 'jltwp_adminify_rss_post_thumbnail']);
22 + add_filter('the_content_feed', [$this, 'jltwp_adminify_rss_post_thumbnail']);
22 23
23 - // Add Featured Image or Post Thumbnail to RSS Feed
24 - add_filter( 'the_excerpt_rss', [ $this, 'rss_post_thumbnail' ] );
25 - add_filter( 'the_content_feed', [ $this, 'rss_post_thumbnail' ] );
24 + //Add Categories to WordPress Pages, add tag and category support to pages
25 + add_action('init', [$this, 'jltwp_adminify_tags_categories_support_all']);
26 + add_action('pre_get_posts', [$this, 'jltwp_adminify_tags_categories_support_query']);
26 27
27 - // Add Categories to WordPress Pages, add tag and category support to pages
28 - add_action( 'init', [ $this, 'tags_categories_support_all' ] );
29 - add_action( 'pre_get_posts', [ $this, 'tags_categories_support_query' ] );
28 + // Remove WordPress Version Number
29 + add_filter('the_generator', [$this, 'jltwp_adminify_remove_version']);
30 30
31 - // Remove WordPress Version Number
32 - add_filter( 'the_generator', [ $this, 'remove_version' ] );
31 + //Remove Default Image Links in WordPress
32 + add_action('admin_init', [$this, 'jltwp_adminify_imagelink_setup'], 10);
33 33
34 - // Remove Default Image Links in WordPress
35 - add_action( 'admin_init', [ $this, 'imagelink_setup' ], 10 );
36 34
37 - // WP Adminify Custom Tweaks
38 - add_filter( 'manage_posts_columns', [ $this, 'columns_attachments' ], 1 );
39 - add_action( 'manage_posts_custom_column', [ $this, 'custom_columns_attachments' ], 1, 2 );
40 - }
41 35
36 + // WP Adminify Custom Tweaks
37 + add_filter('manage_posts_columns', [$this, 'jltwp_adminify_columns_attachments'], 1);
38 + add_action('manage_posts_custom_column', [$this, 'jltwp_adminify_custom_columns_attachments'], 1, 2);
39 + }
42 40
43 - function columns_attachments( $attachmentCount ) {
44 - $attachmentCount['wp_adminify_post_attachments'] = esc_html__( 'Attachment(s)', 'adminify' );
45 - return $attachmentCount;
46 - }
47 41
48 - function custom_columns_attachments( $adminify_col_name, $id ) {
49 - if ( $adminify_col_name === 'wp_adminify_post_attachments' ) {
50 - $attachments = get_children( [ 'post_parent' => $id ] );
51 - $adminifyAttachments = count( $attachments );
52 - if ( $adminifyAttachments != 0 ) {
53 - echo esc_html( Utils::kses_custom( $adminifyAttachments ) );
54 - }
55 - }
56 - }
42 + function jltwp_adminify_columns_attachments($attachmentCount)
43 + {
44 + $attachmentCount['wp_adminify_post_attachments'] = esc_html__('Attachment(s)', 'adminify');
45 + return $attachmentCount;
46 + }
57 47
48 + function jltwp_adminify_custom_columns_attachments($adminify_col_name, $id)
49 + {
50 + if ($adminify_col_name === 'wp_adminify_post_attachments') {
51 + $attachments = get_children(array('post_parent' => $id));
52 + $adminifyAttachments = count($attachments);
53 + if ($adminifyAttachments != 0) {
54 + echo $adminifyAttachments;
55 + }
56 + }
57 + }
58 58
59 - function rss_post_thumbnail( $content ) {
60 - global $post;
61 - if ( has_post_thumbnail( $post->ID ) ) {
62 - $content = '<p>' . get_the_post_thumbnail( $post->ID ) .
63 - '</p>' . get_the_content();
64 - }
65 - return $content;
66 - }
67 59
60 + function jltwp_adminify_rss_post_thumbnail($content)
61 + {
62 + global $post;
63 + if (has_post_thumbnail($post->ID)) {
64 + $content = '<p>' . get_the_post_thumbnail($post->ID) .
65 + '</p>' . get_the_content();
66 + }
67 + return $content;
68 + }
68 69
69 - function tags_categories_support_all() {
70 - register_taxonomy_for_object_type( 'post_tag', 'page' );
71 - register_taxonomy_for_object_type( 'category', 'page' );
72 - }
73 70
74 - // ensure all tags and categories are included in queries
75 - function tags_categories_support_query( $wp_query ) {
76 - if ( $wp_query->get( 'tag' ) ) {
77 - $wp_query->set( 'post_type', 'any' );
78 - }
79 - if ( $wp_query->get( 'category_name' ) ) {
80 - $wp_query->set( 'post_type', 'any' );
81 - }
82 - }
71 + function jltwp_adminify_tags_categories_support_all()
72 + {
73 + register_taxonomy_for_object_type('post_tag', 'page');
74 + register_taxonomy_for_object_type('category', 'page');
75 + }
83 76
77 + // ensure all tags and categories are included in queries
78 + function jltwp_adminify_tags_categories_support_query($wp_query)
79 + {
80 + if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
81 + if ($wp_query->get('category_name')) $wp_query->set('post_type', 'any');
82 + }
84 83
85 - function remove_version() {
86 - return '';
87 - }
88 84
85 + function jltwp_adminify_remove_version()
86 + {
87 + return '';
88 + }
89 89
90 - function imagelink_setup() {
91 - $image_set = get_option( 'image_default_link_type' );
92 90
93 - if ( $image_set !== 'none' ) {
94 - update_option( 'image_default_link_type', 'none' );
95 - }
96 - }
91 + function jltwp_adminify_imagelink_setup()
92 + {
93 + $image_set = get_option('image_default_link_type');
94 +
95 + if ($image_set !== 'none') {
96 + update_option('image_default_link_type', 'none');
97 + }
98 + }
97 99 }