| @@ -49,13 +49,37 @@ | ||
| 49 | 49 | echo '<div class="wrap"><div id="wpupg-admin-manage">Loading...</div></div>'; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | + * Check compatibility with other plugins. | |
| 54 | + * | |
| 55 | + * @since 3.0.0 | |
| 56 | + */ | |
| 57 | + public static function do_not_load_here() { | |
| 58 | + $screen = get_current_screen(); | |
| 59 | + if ( 'toplevel_page_et_bloom_options' === $screen->id | |
| 60 | + || 'et_theme_builder' === substr( $screen->id, -16 ) | |
| 61 | + || 'bulletproof-security' === substr( $screen->id, 0, 20 ) | |
| 62 | + || 'hustle' === $screen->parent_base | |
| 63 | + || 'admin_page_newsletter' === substr( $screen->id, 0, 21 ) | |
| 64 | + || 'bookly-menu' === $screen->parent_base | |
| 65 | + || 'WishListMember' === $screen->parent_base ) { | |
| 66 | + return true; | |
| 67 | + } | |
| 68 | + | |
| 69 | + return false; | |
| 70 | + } | |
| 71 | + | |
| 72 | + /** | |
| 53 | 73 | * Add modal template to edit screen. |
| 54 | 74 | * |
| 55 | 75 | * @since 3.0.0 |
| 56 | 76 | */ |
| 57 | 77 | public static function add_modal_content() { |
| 78 | + if ( self::do_not_load_here() ) { | |
| 79 | + return; | |
| 80 | + } | |
| 81 | + | |
| 58 | 82 | echo '<div id="wpupg-admin-modal"></div>'; |
| 59 | 83 | echo '<div id="wpupg-admin-modal-tinymce-placeholder" style="display: none">'; |
| 60 | 84 | wp_editor( '', 'wpupg-admin-modal-tinymce' ); |
| 61 | 85 | echo '</div>'; |
| @@ -66,8 +90,12 @@ | ||
| 66 | 90 | * |
| 67 | 91 | * @since 3.0.0 |
| 68 | 92 | */ |
| 69 | 93 | public static function enqueue() { |
| 94 | + if ( self::do_not_load_here() ) { | |
| 95 | + return; | |
| 96 | + } | |
| 97 | + | |
| 70 | 98 | // Enqueue public assets as well for preview. |
| 71 | 99 | WPUPG_Assets::enqueue(); |
| 72 | 100 | WPUPG_Assets::load(); |
| 73 | 101 | |
| @@ -81,8 +109,9 @@ | ||
| 81 | 109 | 'taxonomies' => self::get_taxonomies(), |
| 82 | 110 | 'authors' => self::get_authors(), |
| 83 | 111 | 'filters' => WPUPG_Filter::get_defaults(), |
| 84 | 112 | 'templates' => self::get_templates(), |
| 113 | + 'multilingual' => WPUPG_Multilingual::get(), | |
| 85 | 114 | ) ); |
| 86 | 115 | } |
| 87 | 116 | |
| 88 | 117 | /** |
| @@ -163,13 +192,19 @@ | ||
| 163 | 192 | private static function get_authors() { |
| 164 | 193 | $authors = array(); |
| 165 | 194 | |
| 166 | 195 | $args = array( |
| 167 | - 'who' => 'authors', | |
| 168 | 196 | 'fields' => array( |
| 169 | 197 | 'ID', 'display_name' |
| 170 | 198 | ) |
| 171 | 199 | ); |
| 200 | + | |
| 201 | + // Prevent deprecation warning. | |
| 202 | + if ( version_compare( $GLOBALS['wp_version'], '5.9', '<' ) ) { | |
| 203 | + $args['who'] = 'authors'; | |
| 204 | + } else { | |
| 205 | + $args['capability'] = ['edit_posts']; | |
| 206 | + } | |
| 172 | 207 | |
| 173 | 208 | $users = get_users( $args ); |
| 174 | 209 | foreach ( $users as $user ) { |
| 175 | 210 | $authors[] = array( |