/** * Load the plugin's Style Sheet and Javascript files * * @since 0.1 * * @param string Name of the page being loaded * * @return void */ public static function mla_admin_enqueue_scripts_action($page_hook) { global $wp_locale; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; if ('checked' != MLAOptions::mla_get_option(MLAOptions::MLA_SCREEN_DISPLAY_LIBRARY)) { wp_register_style(self::STYLESHEET_SLUG . '-nolibrary', MLA_PLUGIN_URL . 'css/mla-nolibrary.css', false, self::CURRENT_MLA_VERSION); wp_enqueue_style(self::STYLESHEET_SLUG . '-nolibrary'); } if ('edit-tags.php' == $page_hook) { wp_register_style(self::STYLESHEET_SLUG, MLA_PLUGIN_URL . 'css/mla-edit-tags-style.css', false, self::CURRENT_MLA_VERSION); wp_enqueue_style(self::STYLESHEET_SLUG); return; } if ('media_page_' . self::ADMIN_PAGE_SLUG != $page_hook) { return; } /* * Add the styles for variable-size icon and WP 4.3 primary column display */ add_action('admin_print_styles', 'MLA::mla_admin_print_styles_action'); if ($wp_locale->is_rtl()) { wp_register_style(self::STYLESHEET_SLUG, MLA_PLUGIN_URL . 'css/mla-style-rtl.css', false, self::CURRENT_MLA_VERSION); } else { wp_register_style(self::STYLESHEET_SLUG, MLA_PLUGIN_URL . 'css/mla-style.css', false, self::CURRENT_MLA_VERSION); } wp_enqueue_style(self::STYLESHEET_SLUG); wp_register_style(self::STYLESHEET_SLUG . '-set-parent', MLA_PLUGIN_URL . 'css/mla-style-set-parent.css', false, self::CURRENT_MLA_VERSION); wp_enqueue_style(self::STYLESHEET_SLUG . '-set-parent'); wp_enqueue_script(self::JAVASCRIPT_INLINE_EDIT_SLUG, MLA_PLUGIN_URL . "js/mla-inline-edit-scripts{$suffix}.js", array('wp-lists', 'suggest', 'jquery'), self::CURRENT_MLA_VERSION, false); wp_enqueue_script(self::JAVASCRIPT_INLINE_EDIT_SLUG . '-set-parent', MLA_PLUGIN_URL . "js/mla-set-parent-scripts{$suffix}.js", array('wp-lists', 'suggest', 'jquery', self::JAVASCRIPT_INLINE_EDIT_SLUG), self::CURRENT_MLA_VERSION, false); MLAModal::mla_add_terms_search_scripts(); $fields = array('post_title', 'post_name', 'post_excerpt', 'post_content', 'image_alt', 'post_parent', 'post_parent_title', 'menu_order', 'post_author'); $custom_fields = MLAOptions::mla_custom_field_support('quick_edit'); $custom_fields = array_merge($custom_fields, MLAOptions::mla_custom_field_support('bulk_edit')); foreach ($custom_fields as $slug => $details) { $fields[] = $slug; } $fields = apply_filters('mla_list_table_inline_fields', $fields); $script_variables = array('fields' => $fields, 'ajaxFailError' => __('An ajax.fail error has occurred. Please reload the page and try again.', 'media-library-assistant'), 'ajaxDoneError' => __('An ajax.done error has occurred. Please reload the page and try again.', 'media-library-assistant'), 'error' => __('Error while saving the changes.', 'media-library-assistant'), 'ntdelTitle' => __('Remove From Bulk Edit', 'media-library-assistant'), 'noTitle' => __('(no title)', 'media-library-assistant'), 'bulkTitle' => __('Bulk Edit items', 'media-library-assistant'), 'bulkWaiting' => __('Waiting', 'media-library-assistant'), 'bulkComplete' => __('Complete', 'media-library-assistant'), 'bulkUnchanged' => __('Unchanged', 'media-library-assistant'), 'bulkSuccess' => __('Succeeded', 'media-library-assistant'), 'bulkFailure' => __('Failed', 'media-library-assistant'), 'bulkCanceled' => __('CANCELED', 'media-library-assistant'), 'bulkChunkSize' => MLAOptions::mla_get_option(MLAOptions::MLA_BULK_CHUNK_SIZE), 'comma' => _x(',', 'tag_delimiter', 'media-library-assistant'), 'useSpinnerClass' => false, 'ajax_action' => self::JAVASCRIPT_INLINE_EDIT_SLUG, 'ajax_nonce' => wp_create_nonce(self::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME)); if (version_compare(get_bloginfo('version'), '4.2', '>=')) { $script_variables['useSpinnerClass'] = true; } wp_localize_script(self::JAVASCRIPT_INLINE_EDIT_SLUG, self::JAVASCRIPT_INLINE_EDIT_OBJECT, $script_variables); }
/** * Ensures that MLA media manager enhancements are present when required. * Declared public because it is a filter. * * @since 2.30 * * @param array associative array with setting => value pairs * @param object || NULL current post object, if available */ public static function mla_media_view_settings_filter($settings, $post) { if (class_exists('MLAModal')) { return $settings; } /* * Media Manager (Modal window) additions */ require_once MLA_PLUGIN_PATH . 'includes/class-mla-list-table.php'; require_once MLA_PLUGIN_PATH . 'includes/class-mla-view-list-table.php'; MLA_View_List_Table::mla_localize_default_columns_array(); require_once MLA_PLUGIN_PATH . 'includes/class-mla-media-modal.php'; MLAModal::initialize(); add_action('wp_enqueue_media', 'MLACore::mla_wp_enqueue_media_action', 10, 0); return MLAModal::mla_media_view_settings_filter($settings, $post); }
/** * Echo the hidden form for the "Search Terms" popup modal window * * @since 1.90 * * @return void Echos the HTML <form> markup for hidden form */ public static function mla_echo_terms_search_form() { echo MLAModal::mla_terms_search_form(); }
/** * Return terms in all languages when "Activate languages and translations for media" * is disabled * * @since 2.22 * * @param array ( 'class' => $class_array, 'value' => $value_array, 'text' => $text_array ) */ public static function mla_media_modal_terms_options($term_values) { global $polylang; static $in_process = false; // Avoid recursion loop if ($in_process) { return $term_values; } /* * Check Polylang Languages/Settings "Activate languages and translations for media" option */ if (isset($polylang->options['media_support']) && !$polylang->options['media_support']) { $in_process = true; $dropdown_options = array('pll_get_terms_not_translated' => true); $term_values = MLAModal::mla_terms_options(MLA_List_Table::mla_get_taxonomy_filter_dropdown(0, $dropdown_options)); $in_process = false; } /* * $class_array => HTML class attribute value for each option * $value_array => HTML value attribute value for each option * $text_array => HTML text content for each option */ return $term_values; }