'text/css',
'codemirror' => array(
'lineWrapping' => true,
),
)
);
wp_localize_script( 'jquery', 'cm_settings', $cm_settings );
wp_enqueue_script( 'wp-theme-plugin-editor' );
wp_enqueue_style( 'wp-codemirror' );
}
/**
* Add inline style for wpLingua custom CSS
*/
$custom_css = get_option( 'wplng_custom_css' );
if ( ! empty( $custom_css )
&& is_string( $custom_css )
) {
$custom_css = wp_strip_all_tags( $custom_css );
// Prevent breaking out of the admin_url( 'admin-ajax.php' ),
'currentLanguage' => false,
'message' => array(
'exitPage' => esc_html__(
'You are about to leave the page without saving your changes. They will be lost if you continue. Would you like to leave the page anyway?',
'wplingua'
),
'exitEditorModal' => '',
'buttonSave' => '',
'buttonSaveInProgress' => '',
),
)
);
/**
* Enqueue wpLingua CSS styles
*/
wp_enqueue_style(
'wplingua-edit-translation',
plugins_url() . '/wplingua/assets/css/admin/edit-translation.css',
array(),
WPLNG_PLUGIN_VERSION
);
}
}
/**
* Register wpLingua assets on translations admin list
*
* @return void
*/
function wplng_translation_list_assets() {
global $post_type;
if ( 'wplng_translation' === $post_type ) {
/**
* Enqueue wpLingua CSS styles
*/
wp_enqueue_style(
'wplingua-list-translation',
plugins_url() . '/wplingua/assets/css/admin/list-translation.css',
array(),
WPLNG_PLUGIN_VERSION
);
}
}
/**
* Register wpLingua assets on slugs edit pages
*
* @return void
*/
function wplng_slug_edit_assets() {
global $post_type;
if ( 'wplng_slug' === $post_type ) {
/**
* Enqueue jQuery
*/
wp_enqueue_script( 'jquery' );
/**
* Enqueue wpLingua JS scripts
*/
wp_enqueue_script(
'wplingua-edit-slug',
plugins_url() . '/wplingua/assets/js/admin/edit-slug.js',
array( 'jquery' ),
WPLNG_PLUGIN_VERSION
);
/**
* Localize script
*/
wp_localize_script(
'wplingua-edit-slug',
'wplngI18nSlug',
array(
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'currentLanguage' => false,
'message' => array(
'exitPage' => esc_html__(
'You are about to leave the page without saving your changes. They will be lost if you continue. Would you like to leave the page anyway?',
'wplingua'
),
'exitEditorModal' => '',
'buttonSave' => '',
'buttonSaveInProgress' => '',
),
)
);
/**
* Enqueue wpLingua CSS styles
*/
wp_enqueue_style(
'wplingua-edit-slug',
plugins_url() . '/wplingua/assets/css/admin/edit-slug.css',
array(),
WPLNG_PLUGIN_VERSION
);
}
}
/**
* Register wpLingua assets on slugs admin list
*
* @return void
*/
function wplng_slug_list_assets() {
global $post_type;
if ( 'wplng_slug' === $post_type ) {
/**
* Enqueue wpLingua CSS styles
*/
wp_enqueue_style(
'wplingua-list-slug',
plugins_url() . '/wplingua/assets/css/admin/list-slug.css',
array(),
WPLNG_PLUGIN_VERSION
);
}
}
/**
* Print wpLingua head script (JSON with all languages informations)
*
* @return void
*/
function wplng_inline_script_languages() {
$languages = array();
$languages_allow = wplng_get_languages_allow();
if ( ! empty( $languages_allow ) && is_array( $languages_allow ) ) {
$language_website = wplng_get_language_website();
if ( ! in_array( $language_website, $languages_allow, true ) ) {
$languages_allow[] = $language_website;
}
$languages = $languages_allow;
} else {
$languages = wplng_get_languages_all();
}
?>