function enqueue_salsapress() { //Enqueing external scripts and styles wp_enqueue_script('SalsaPress', SALSAPRESS_BASE . 'utils/SalsaPress.js', array('jquery'), '1.0', true); wp_localize_script('SalsaPress', 'objectL10n', array('seem_to_be_missing' => __('Seem to be missing', 'salsapress'), 'click_to_try_again' => __('Click to try again', 'salsapress'), 'saving_wait_one_sec' => __('Saving... wait one sec', 'salsapress'), 'click_to_go_again' => __('Click to go again', 'salsapress'), 'please_enter_valid_email_address' => __('Please enter a valid email address.', 'salsapress'), 'try_again' => __('Try again, had a missfire there...', 'salsapress'), 'success' => __('Success!', 'salsapress'))); localize_scripts(); }
function add_salsapress_tinymce_plugin($plugin_array) { $plugin_array['salsa'] = SALSAPRESS_BASE . 'admin/editor_plugin.js'; wp_enqueue_script('SalsaPress', SALSAPRESS_BASE . 'admin/salsapress_admin.js', array('jquery'), '1.0', true); localize_scripts(); return $plugin_array; }
function salsapress_form_button_iframe() { wp_enqueue_script('SalsaPress', SALSAPRESS_BASE . 'utils/SalsaPress.js', array('jquery'), '1.0', true); wp_enqueue_style('SalsaPress_Admin', SALSAPRESS_BASE . 'admin/salsapress_admin.css', '', '0.5', 'all'); wp_enqueue_script('SalsaPress_Admin', SALSAPRESS_BASE . 'admin/salsapress_admin.js', array('jquery'), '1.0', true); localize_scripts(); remove_action('admin_enqueue_scripts', 'wp_auth_check_load'); wp_iframe('salsapress_form_button_iframe_content'); exit; }
function salsapress_options_menu_init() { register_setting('salsapress', 'salsapress_options', 'salsapress_validate_fix'); add_settings_field('salsapress_salsa_activate', __('Connect with Salsa?', 'salsapress'), 'salsapress_salsa_activate', __FILE__, 'salsapress_salsa_credentials'); add_settings_field('salsapress_salsa_username', __('Salsa Login (email)', 'salsapress'), 'salsapress_salsa_username', __FILE__, 'salsapress_salsa_credentials'); add_settings_field('salsapress_salsa_pass', __('Salsa Password', 'salsapress'), 'salsapress_salsa_pass', __FILE__, 'salsapress_salsa_credentials'); add_settings_field('salsapress_salsa_base_url', __('Salsa Base URL (salsa.democracyinaction.org, org2.democracyinaction.org, salsa.wiredforchange.com, etc)', 'salsapress'), 'salsapress_salsa_base_url', __FILE__, 'salsapress_salsa_credentials'); \add_settings_section('salsapress_salsa_credentials', __('Salsa Credentials', 'salsapress'), 'salsapress_salsa_credentials', __FILE__); if (SALSAPRESS_ACTIVE) { add_settings_field('salsapress_salsa_status', __('Salsa Status', 'salsapress'), 'salsapress_salsa_status', __FILE__, 'salsapress_salsa_credentials'); add_settings_field('salsapress_salsa_chapter_filter', __('Chapter Filter (Only show data from a single chapter)', 'salsapress'), 'salsapress_salsa_chapter_filter', __FILE__, 'salsapress_salsa_filters'); add_settings_field('salsapress_salsa_chapter_base', __('Base Chapter KEY', 'salsapress'), 'salsapress_salsa_chapter_base', __FILE__, 'salsapress_salsa_filters'); add_settings_field('salsapress_salsa_org_base', __('Base Organization KEY', 'salsapress'), 'salsapress_salsa_org_base', __FILE__, 'salsapress_salsa_filters'); add_settings_section('salsapress_salsa_filters', __('Salsa Settings', 'salsapress'), 'salsapress_salsa_filters', __FILE__); add_settings_field('salsapress_stop_cache', __('<strong>NEVER</strong> Cache SalsaPress', 'salsapress'), 'salsapress_cache', __FILE__, 'salsapress_cache_section'); add_settings_field('salsapress_cache_reset', __('Reset Current Cache', 'salsapress'), 'salsapress_cache_reset', __FILE__, 'salsapress_cache_section'); add_settings_section('salsapress_cache_section', __('SalsaPress Caching', "salsapress"), 'salsapress_cache_section', __FILE__); } wp_enqueue_script('SalsaPress', SALSAPRESS_BASE . 'admin/salsapress_admin.js', array('jquery'), '0.5', true); wp_localize_script('SalsaPress', 'objectL10n', array('hold_tight_ok' => __('Grabbing a preview, holdtightok?', 'salsapress'), 'success' => __('Success!', 'salsapress'))); wp_enqueue_style('SalsaPress', SALSAPRESS_BASE . 'admin/salsapress_admin.css', '', '0.5', 'all'); localize_scripts(); }