Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../inc
File: template-functions.php
/**
[500] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[501] Fix | Delete
*
[502] Fix | Delete
* @param array $attributes
[503] Fix | Delete
* @param bool $checked
[504] Fix | Delete
* @param bool $disabled
[505] Fix | Delete
*
[506] Fix | Delete
* @return string
[507] Fix | Delete
*/
[508] Fix | Delete
//$field_prefix = 'wpml_cf_translation_preferences_option_ignore_'
[509] Fix | Delete
function wpml_input_field_helper( $attributes = array(), $checked = false, $disabled = false ) {
[510] Fix | Delete
if ( $disabled ) {
[511] Fix | Delete
$attributes[ 'readonly' ] = 'readonly';
[512] Fix | Delete
$attributes[ 'disabled' ] = 'disabled';
[513] Fix | Delete
}
[514] Fix | Delete
if ( $checked && array_key_exists( 'type', $attributes ) && in_array( $attributes[ 'type' ], array( 'checkbox', 'radio' ) ) ) {
[515] Fix | Delete
$attributes[ 'checked' ] = 'checked';
[516] Fix | Delete
}
[517] Fix | Delete
$html_attributes = array();
[518] Fix | Delete
if ( is_array( $attributes ) ) {
[519] Fix | Delete
foreach ( $attributes as $attribute => $attribute_value ) {
[520] Fix | Delete
if ( $attribute != 'custom' ) {
[521] Fix | Delete
$html_attributes[ ] = strip_tags( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
[522] Fix | Delete
} else {
[523] Fix | Delete
$html_attributes[ ] = esc_attr( $attribute_value );
[524] Fix | Delete
}
[525] Fix | Delete
}
[526] Fix | Delete
}
[527] Fix | Delete
$output = '<!-- OK! -->';
[528] Fix | Delete
$output .= '<input';
[529] Fix | Delete
if ( $html_attributes ) {
[530] Fix | Delete
$output .= ' ' . join( ' ', $html_attributes );
[531] Fix | Delete
}
[532] Fix | Delete
$output .= '>';
[533] Fix | Delete
[534] Fix | Delete
return $output;
[535] Fix | Delete
}
[536] Fix | Delete
[537] Fix | Delete
/**
[538] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[539] Fix | Delete
*
[540] Fix | Delete
* @param $attributes
[541] Fix | Delete
* @param $caption
[542] Fix | Delete
*
[543] Fix | Delete
* @return string
[544] Fix | Delete
*/
[545] Fix | Delete
function wpml_label_helper( $attributes, $caption ) {
[546] Fix | Delete
$html_attributes = array();
[547] Fix | Delete
if ( is_array( $attributes ) ) {
[548] Fix | Delete
foreach ( $attributes as $attribute => $attribute_value ) {
[549] Fix | Delete
if ( $attribute != 'custom' ) {
[550] Fix | Delete
$html_attributes[ ] = strip_tags( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
[551] Fix | Delete
} else {
[552] Fix | Delete
$html_attributes[ ] = esc_attr( $attribute_value );
[553] Fix | Delete
}
[554] Fix | Delete
}
[555] Fix | Delete
}
[556] Fix | Delete
[557] Fix | Delete
$output = '<!-- OK! -->';
[558] Fix | Delete
$output .= '<label';
[559] Fix | Delete
if ( $html_attributes ) {
[560] Fix | Delete
$output .= ' ' . join( ' ', $html_attributes );
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
$output .= '>' . $caption . '</label>';
[564] Fix | Delete
[565] Fix | Delete
return $output;
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
/**
[569] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[570] Fix | Delete
*
[571] Fix | Delete
* @param $args
[572] Fix | Delete
* @param $id_prefix
[573] Fix | Delete
* @param $value
[574] Fix | Delete
* @param $caption
[575] Fix | Delete
*
[576] Fix | Delete
* @return string
[577] Fix | Delete
*/
[578] Fix | Delete
function wpml_translation_preference_input_helper( $args, $id_prefix, $value, $caption ) {
[579] Fix | Delete
$output = '';
[580] Fix | Delete
[581] Fix | Delete
$input_attributes = $args[ 'input_attributes' ];
[582] Fix | Delete
$label_attributes = $args[ 'label_attributes' ];
[583] Fix | Delete
$id = $args[ 'id' ];
[584] Fix | Delete
$action = $args[ 'action' ];
[585] Fix | Delete
[586] Fix | Delete
$input_attributes[ 'id' ] = $id_prefix . $id;
[587] Fix | Delete
$input_attributes[ 'value' ] = $value;
[588] Fix | Delete
$label_attributes[ 'for' ] = $input_attributes[ 'id' ];
[589] Fix | Delete
[590] Fix | Delete
$output .= wpml_input_field_helper( $input_attributes, ( $value == $action ), $args[ 'disabled' ] );
[591] Fix | Delete
$output .= wpml_label_helper( $label_attributes, $caption );
[592] Fix | Delete
[593] Fix | Delete
return $output;
[594] Fix | Delete
}
[595] Fix | Delete
[596] Fix | Delete
/**
[597] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[598] Fix | Delete
*
[599] Fix | Delete
* @param $id
[600] Fix | Delete
* @param bool $custom_field
[601] Fix | Delete
* @param string $class
[602] Fix | Delete
* @param bool $ajax
[603] Fix | Delete
* @param string $default_value
[604] Fix | Delete
* @param bool $fieldset
[605] Fix | Delete
* @param bool $suppress_error
[606] Fix | Delete
*
[607] Fix | Delete
* @return string
[608] Fix | Delete
*/
[609] Fix | Delete
function wpml_cf_translation_preferences( $id, $custom_field = false, $class = 'wpml', $ajax = false, $default_value = 'ignore', $fieldset = false, $suppress_error = false ) {
[610] Fix | Delete
global $iclTranslationManagement;
[611] Fix | Delete
[612] Fix | Delete
$output = '';
[613] Fix | Delete
[614] Fix | Delete
if ( isset( $iclTranslationManagement ) ) {
[615] Fix | Delete
$section = 'custom_fields';
[616] Fix | Delete
$config_section = $iclTranslationManagement->get_translation_setting_name( $section );
[617] Fix | Delete
$readonly_config_section = $iclTranslationManagement->get_readonly_translation_setting_name( $section );
[618] Fix | Delete
[619] Fix | Delete
if ( $custom_field ) {
[620] Fix | Delete
$custom_field = @strval( $custom_field );
[621] Fix | Delete
}
[622] Fix | Delete
$class = @strval( $class );
[623] Fix | Delete
if ( $fieldset ) {
[624] Fix | Delete
$output .= '
[625] Fix | Delete
<fieldset id="wpml_cf_translation_preferences_fieldset_' . $id . '" class="wpml_cf_translation_preferences_fieldset ' . $class . '-form-fieldset form-fieldset fieldset">' . '<legend>' . __( 'Translation preferences', 'sitepress' ) . '</legend>';
[626] Fix | Delete
}
[627] Fix | Delete
$actions = array( 'ignore' => 0, 'copy' => 1, 'translate' => 2, 'copy-once' => 3 );
[628] Fix | Delete
$action = isset( $actions[ @strval( $default_value ) ] ) ? $actions[ @strval( $default_value ) ] : 0;
[629] Fix | Delete
$disabled = false;
[630] Fix | Delete
if ( $custom_field ) {
[631] Fix | Delete
if ( defined( 'WPML_TM_VERSION' ) && ! empty( $iclTranslationManagement ) ) {
[632] Fix | Delete
$custom_fields_settings = $iclTranslationManagement->settings[ $config_section ];
[633] Fix | Delete
if ( isset( $custom_fields_settings[ $custom_field ] ) ) {
[634] Fix | Delete
$action = intval( $custom_fields_settings[ $custom_field ] );
[635] Fix | Delete
}
[636] Fix | Delete
$custom_fields_readonly_settings = $iclTranslationManagement->settings[ $readonly_config_section ];
[637] Fix | Delete
$custom_fields_readonly_settings = isset( $custom_fields_readonly_settings ) ? $custom_fields_readonly_settings : array();
[638] Fix | Delete
$xml_override = in_array( $custom_field, $custom_fields_readonly_settings );
[639] Fix | Delete
$disabled = $xml_override;
[640] Fix | Delete
if ( $xml_override ) {
[641] Fix | Delete
$output .=
[642] Fix | Delete
'<div style="color:Red;font-style:italic;margin: 10px 0 0 0;">'
[643] Fix | Delete
. __( 'The translation preference for this field are being controlled by a language configuration XML file. If you want to control it manually, remove the entry from the configuration file.', 'sitepress' )
[644] Fix | Delete
. '</div>';
[645] Fix | Delete
}
[646] Fix | Delete
} else if ( ! $suppress_error ) {
[647] Fix | Delete
$output .= '<span style="color:#FF0000;">' . __( "To synchronize values for translations, you need to enable WPML's Translation Management module.", 'sitepress' ) . '</span>';
[648] Fix | Delete
$disabled = true;
[649] Fix | Delete
}
[650] Fix | Delete
} else if ( ! $suppress_error ) {
[651] Fix | Delete
$output .= '<span style="color:#FF0000;">' . __( 'Error: Something is wrong with field value. Translation preferences can not be set.', 'sitepress' ) . '</span>';
[652] Fix | Delete
$disabled = true;
[653] Fix | Delete
}
[654] Fix | Delete
//$disabled = !empty($disabled) ? ' readonly="readonly" disabled="disabled"' : '';
[655] Fix | Delete
$output .= '<div class="description ' . $class . '-form-description ' . $class . '-form-description-fieldset description-fieldset">' . __( 'Choose what to do when translating content with this field:', 'sitepress' ) . '</div>';
[656] Fix | Delete
[657] Fix | Delete
$input_attributes = array(
[658] Fix | Delete
'name' => 'wpml_cf_translation_preferences[' . $id . ']',
[659] Fix | Delete
'class' => $class . '-form-radio form-radio radio',
[660] Fix | Delete
'type' => 'radio',
[661] Fix | Delete
);
[662] Fix | Delete
$label_attributes = array(
[663] Fix | Delete
'class' => $class . '-form-label ' . $class . '-form-radio-label',
[664] Fix | Delete
);
[665] Fix | Delete
[666] Fix | Delete
$args = array(
[667] Fix | Delete
'input_attributes' => $input_attributes,
[668] Fix | Delete
'label_attributes' => $label_attributes,
[669] Fix | Delete
'disabled' => $disabled,
[670] Fix | Delete
'id' => $id,
[671] Fix | Delete
'action' => $action
[672] Fix | Delete
);
[673] Fix | Delete
[674] Fix | Delete
$output .= '<ul><li>';
[675] Fix | Delete
$output .= wpml_translation_preference_input_helper( $args, 'wpml_cf_translation_preferences_option_ignore_', WPML_IGNORE_CUSTOM_FIELD, __( "Don't translate", 'sitepress' ) );
[676] Fix | Delete
$output .= '</li><li>';
[677] Fix | Delete
$output .= wpml_translation_preference_input_helper( $args, 'wpml_cf_translation_preferences_option_copy_', WPML_COPY_CUSTOM_FIELD, __( "Copy from original to translation", 'sitepress' ) );
[678] Fix | Delete
$output .= '</li><li>';
[679] Fix | Delete
$output .= wpml_translation_preference_input_helper( $args, 'wpml_cf_translation_preferences_option_copy_once_', WPML_COPY_ONCE_CUSTOM_FIELD, __( "Copy once", 'sitepress' ) );
[680] Fix | Delete
$output .= '</li><li>';
[681] Fix | Delete
$output .= wpml_translation_preference_input_helper( $args, 'wpml_cf_translation_preferences_option_translate_', WPML_TRANSLATE_CUSTOM_FIELD, __( "Translate", 'sitepress' ) );
[682] Fix | Delete
$output .= '</li></ul>';
[683] Fix | Delete
[684] Fix | Delete
if ( $custom_field && $ajax ) {
[685] Fix | Delete
$output .= '
[686] Fix | Delete
<div style=";margin: 5px 0 5px 0;" id="wpml_cf_translation_preferences_ajax_response_' . $id . '"></div>
[687] Fix | Delete
<input type="button" onclick="icl_cf_translation_preferences_submit(\'' . $id . '\', jQuery(this));" style="margin-top:5px;" class="button-secondary" value="' . __( 'Apply' ) . '" name="wpml_cf_translation_preferences_submit_' . $id . '" />
[688] Fix | Delete
<input type="hidden" name="wpml_cf_translation_preferences_data_' . $id . '" value="custom_field=' . $custom_field . '&amp;_icl_nonce=' . wp_create_nonce( 'wpml_cf_translation_preferences_nonce' ) . '" />';
[689] Fix | Delete
}
[690] Fix | Delete
if ( $fieldset ) {
[691] Fix | Delete
$output .= '
[692] Fix | Delete
</fieldset>
[693] Fix | Delete
';
[694] Fix | Delete
}
[695] Fix | Delete
}
[696] Fix | Delete
[697] Fix | Delete
return $output;
[698] Fix | Delete
}
[699] Fix | Delete
[700] Fix | Delete
/**
[701] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[702] Fix | Delete
* wpml_get_copied_fields_for_post_edit
[703] Fix | Delete
* return a list of fields that are marked for copying and the
[704] Fix | Delete
* original post id that the fields should be copied from
[705] Fix | Delete
* This should be used to populate any custom field controls when
[706] Fix | Delete
* a new translation is selected and the field is marked as "copy" (sync)
[707] Fix | Delete
*
[708] Fix | Delete
* @param array $fields
[709] Fix | Delete
*
[710] Fix | Delete
* @return array
[711] Fix | Delete
*/
[712] Fix | Delete
function wpml_get_copied_fields_for_post_edit( $fields = array() ) {
[713] Fix | Delete
global $sitepress, $wpdb, $sitepress_settings, $pagenow;
[714] Fix | Delete
[715] Fix | Delete
$copied_cf = array( 'fields' => array() );
[716] Fix | Delete
$translations = null;
[717] Fix | Delete
[718] Fix | Delete
if ( defined( 'WPML_TM_VERSION' ) ) {
[719] Fix | Delete
[720] Fix | Delete
if ( ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
[721] Fix | Delete
if ( isset( $_GET[ 'trid' ] ) ) {
[722] Fix | Delete
$post_type = isset( $_GET[ 'post_type' ] ) ? $_GET[ 'post_type' ] : 'post';
[723] Fix | Delete
[724] Fix | Delete
$translations = $sitepress->get_element_translations( $_GET[ 'trid' ], 'post_' . $post_type );
[725] Fix | Delete
[726] Fix | Delete
$source_lang = isset( $_GET[ 'source_lang' ] ) ? $_GET[ 'source_lang' ] : $sitepress->get_default_language();
[727] Fix | Delete
$lang_details = $sitepress->get_language_details( $source_lang );
[728] Fix | Delete
} else if ( $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT ) ) {
[729] Fix | Delete
$post_type = $wpdb->get_var( $wpdb->prepare( "SELECT post_type FROM {$wpdb->posts} WHERE ID = %d", $post_id ) );
[730] Fix | Delete
$trid = $sitepress->get_element_trid( $post_id, 'post_' . $post_type );
[731] Fix | Delete
$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE source_language_code IS NULL AND trid=%d", $trid ) );
[732] Fix | Delete
if ( $original_id != $post_id ) {
[733] Fix | Delete
// Only return information if this is not the source language post.
[734] Fix | Delete
$translations = $sitepress->get_element_translations( $trid, 'post_' . $post_type );
[735] Fix | Delete
$source_lang = $wpdb->get_var( $wpdb->prepare( "SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE source_language_code IS NULL AND trid=%d", $trid ) );
[736] Fix | Delete
$lang_details = $sitepress->get_language_details( $source_lang );
[737] Fix | Delete
}
[738] Fix | Delete
}
[739] Fix | Delete
[740] Fix | Delete
if ( $translations && isset( $source_lang ) ) {
[741] Fix | Delete
$original_custom = get_post_custom( $translations[ $source_lang ]->element_id );
[742] Fix | Delete
[743] Fix | Delete
$copied_cf[ '_wpml_original_post_id' ] = $translations[ $source_lang ]->element_id;
[744] Fix | Delete
$ccf_note = '<img src="' . ICL_PLUGIN_URL . '/res/img/alert.png" alt="Notice" width="16" height="16" style="margin-right:8px" />';
[745] Fix | Delete
$copied_cf[ 'copy_message' ] = $ccf_note . sprintf( __( 'WPML will copy this field from %s when you save this post.', 'sitepress' ), $lang_details[ 'display_name' ] );
[746] Fix | Delete
[747] Fix | Delete
foreach ( (array) $sitepress_settings[ 'translation-management' ][ 'custom_fields_translation' ] as $key => $sync_opt ) {
[748] Fix | Delete
/*
[749] Fix | Delete
* Added parameter $fields so except checking if field exist in DB,
[750] Fix | Delete
* it can be checked if set in pre-defined fields.
[751] Fix | Delete
* Noticed when testing checkbox field that does not save
[752] Fix | Delete
* value to DB if not checked (omitted from list of copied fields).
[753] Fix | Delete
* https://icanlocalize.basecamphq.com/projects/2461186-wpml/todo_items/169933388/comments
[754] Fix | Delete
*/
[755] Fix | Delete
if ( $sync_opt == 1
[756] Fix | Delete
&& ( isset( $original_custom[ $key ] ) || in_array( $key, $fields ) )
[757] Fix | Delete
) {
[758] Fix | Delete
$copied_cf[ 'fields' ][ ] = $key;
[759] Fix | Delete
}
[760] Fix | Delete
}
[761] Fix | Delete
}
[762] Fix | Delete
}
[763] Fix | Delete
}
[764] Fix | Delete
[765] Fix | Delete
return $copied_cf;
[766] Fix | Delete
}
[767] Fix | Delete
[768] Fix | Delete
/**
[769] Fix | Delete
* Retrieve language information of a post by its ID
[770] Fix | Delete
* The language information includes
[771] Fix | Delete
* the post locale,
[772] Fix | Delete
* the language text direction (True for RTL, False for LTR),
[773] Fix | Delete
* the post language translated name and native name and
[774] Fix | Delete
* whether the current language is different to the post language (True/False)
[775] Fix | Delete
*
[776] Fix | Delete
* @param mixed $empty_value
[777] Fix | Delete
*
[778] Fix | Delete
* @see \wpml_get_active_languages_filter
[779] Fix | Delete
*
[780] Fix | Delete
* @param int $post_id Optional The post id to retrieve information of (post, page, attachment, custom) Defaults to current post ID.
[781] Fix | Delete
*
[782] Fix | Delete
* @return array|WP_Error
[783] Fix | Delete
* @use \SitePress::api_hooks
[784] Fix | Delete
*/
[785] Fix | Delete
function wpml_get_language_information( $empty_value = null, $post_id = null ) {
[786] Fix | Delete
global $sitepress;
[787] Fix | Delete
[788] Fix | Delete
if ( is_null( $post_id ) ) {
[789] Fix | Delete
$post_id = get_the_ID();
[790] Fix | Delete
}
[791] Fix | Delete
if ( empty( $post_id ) ) {
[792] Fix | Delete
return new WP_Error( 'missing_id', __( 'Missing post ID', 'sitepress' ) );
[793] Fix | Delete
}
[794] Fix | Delete
[795] Fix | Delete
$post = get_post( $post_id );
[796] Fix | Delete
if ( empty( $post ) ) {
[797] Fix | Delete
// translators: Post id.
[798] Fix | Delete
return new WP_Error( 'missing_post', sprintf( __( 'No such post for ID = %d', 'sitepress' ), $post_id ) );
[799] Fix | Delete
}
[800] Fix | Delete
[801] Fix | Delete
$language = $sitepress->get_language_for_element( $post_id, 'post_' . $post->post_type );
[802] Fix | Delete
$language_information = $sitepress->get_language_details( $language );
[803] Fix | Delete
[804] Fix | Delete
$current_language = $sitepress->get_current_language();
[805] Fix | Delete
$info = [
[806] Fix | Delete
'language_code' => $language,
[807] Fix | Delete
'locale' => $sitepress->get_locale( $language ),
[808] Fix | Delete
'text_direction' => $sitepress->is_rtl( $language ),
[809] Fix | Delete
'display_name' => $sitepress->get_display_language_name( $language, $current_language ),
[810] Fix | Delete
'native_name' => isset( $language_information['display_name'] ) ? $language_information['display_name'] : '',
[811] Fix | Delete
'different_language' => $language !== $current_language,
[812] Fix | Delete
];
[813] Fix | Delete
[814] Fix | Delete
return $info;
[815] Fix | Delete
}
[816] Fix | Delete
[817] Fix | Delete
/** This action is documented in */
[818] Fix | Delete
add_filter( 'wpcf_meta_box_post_type', 'wpml_wpcf_meta_box_order_defaults' );
[819] Fix | Delete
[820] Fix | Delete
/**
[821] Fix | Delete
* Add metabox definition to edit post type in Types
[822] Fix | Delete
* @since x.x.x
[823] Fix | Delete
*
[824] Fix | Delete
* @param array $boxes Meta boxes in Types.
[825] Fix | Delete
*
[826] Fix | Delete
* @return array Meta boxes in Types.
[827] Fix | Delete
*/
[828] Fix | Delete
function wpml_wpcf_meta_box_order_defaults( $boxes ) {
[829] Fix | Delete
$boxes['wpml'] = array(
[830] Fix | Delete
'callback' => 'wpml_custom_post_translation_options',
[831] Fix | Delete
'title' => __( 'Translation', 'sitepress' ),
[832] Fix | Delete
'default' => 'normal',
[833] Fix | Delete
'priority' => 'low',
[834] Fix | Delete
);
[835] Fix | Delete
[836] Fix | Delete
return $boxes;
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
/**
[840] Fix | Delete
* @todo: [WPML 3.3] refactor in 3.3
[841] Fix | Delete
*
[842] Fix | Delete
* @param $type_id
[843] Fix | Delete
*
[844] Fix | Delete
* @return string
[845] Fix | Delete
*/
[846] Fix | Delete
function wpml_custom_post_translation_options() {
[847] Fix | Delete
global $sitepress;
[848] Fix | Delete
$type_id = isset( $_GET['wpcf-post-type'] ) ? $_GET['wpcf-post-type'] : '';
[849] Fix | Delete
[850] Fix | Delete
$out = '';
[851] Fix | Delete
[852] Fix | Delete
$type = get_post_type_object( $type_id );
[853] Fix | Delete
[854] Fix | Delete
$translated = $sitepress->is_translated_post_type( $type_id );
[855] Fix | Delete
[856] Fix | Delete
$link = WPML_Admin_URL::multilingual_setup( 7 );
[857] Fix | Delete
$link2 = WPML_Admin_URL::multilingual_setup( 4 );
[858] Fix | Delete
[859] Fix | Delete
if ( $translated ) {
[860] Fix | Delete
[861] Fix | Delete
$out .= sprintf( __( '%s is translated via WPML. %sClick here to change translation options.%s', 'sitepress' ), '<strong>' . $type->labels->singular_name . '</strong>', '<a href="' . $link . '">', '</a>' );
[862] Fix | Delete
[863] Fix | Delete
if ( $type->rewrite['enabled'] && class_exists( 'WPML_ST_Post_Slug_Translation_Settings' ) ) {
[864] Fix | Delete
[865] Fix | Delete
$settings = new WPML_ST_Post_Slug_Translation_Settings( $sitepress );
[866] Fix | Delete
[867] Fix | Delete
if ( $settings->is_enabled() ) {
[868] Fix | Delete
if ( ! $settings->is_translated( $type_id ) ) {
[869] Fix | Delete
$out .= '<ul><li>' . __( 'Slugs are currently not translated.', 'sitepress' ) . '<li></ul>';
[870] Fix | Delete
} else {
[871] Fix | Delete
$out .= '<ul><li>' . __( 'Slugs are currently translated. Click the link above to edit the translations.', 'sitepress' ) . '<li></ul>';
[872] Fix | Delete
}
[873] Fix | Delete
} else {
[874] Fix | Delete
$out .= '<ul><li>' . sprintf( __( 'Slug translation is currently disabled in WPML. %sClick here to enable.%s', 'sitepress' ), '<a href="' . $link2 . '">', '</a>' ) . '</li></ul>';
[875] Fix | Delete
}
[876] Fix | Delete
}
[877] Fix | Delete
} else {
[878] Fix | Delete
[879] Fix | Delete
$out .= sprintf( __( '%s is not translated. %sClick here to make this post type translatable.%s', 'sitepress' ), '<strong>' . $type->labels->singular_name . '</strong>', '<a href="' . $link . '">', '</a>' );
[880] Fix | Delete
}
[881] Fix | Delete
[882] Fix | Delete
return $out;
[883] Fix | Delete
}
[884] Fix | Delete
[885] Fix | Delete
/**
[886] Fix | Delete
* @since unknown
[887] Fix | Delete
* @deprecated 3.2 use 'wpml_add_language_selector' filter instead
[888] Fix | Delete
*/
[889] Fix | Delete
function icl_language_selector() {
[890] Fix | Delete
ob_start();
[891] Fix | Delete
do_action( 'wpml_add_language_selector' );
[892] Fix | Delete
$output = ob_get_contents();
[893] Fix | Delete
ob_end_clean();
[894] Fix | Delete
return $output;
[895] Fix | Delete
}
[896] Fix | Delete
[897] Fix | Delete
/**
[898] Fix | Delete
* Display the drop down language selector
[899] Fix | Delete
* @since 3.2
[900] Fix | Delete
* Will use the language selector settings from "Language switcher as shortcode or action"
[901] Fix | Delete
* @use \SitePress::api_hooks
[902] Fix | Delete
* example: do_action( 'wpml_add_language_selector' );
[903] Fix | Delete
*/
[904] Fix | Delete
function wpml_add_language_selector_action() {
[905] Fix | Delete
do_action( 'wpml_add_language_selector' );
[906] Fix | Delete
}
[907] Fix | Delete
[908] Fix | Delete
/**
[909] Fix | Delete
* @since unknown
[910] Fix | Delete
* @deprecated 3.2 use 'wpml_footer_language_selector' filter instead
[911] Fix | Delete
*/
[912] Fix | Delete
function icl_language_selector_footer() {
[913] Fix | Delete
ob_start();
[914] Fix | Delete
do_action( 'wpml_footer_language_selector' );
[915] Fix | Delete
$output = ob_get_contents();
[916] Fix | Delete
ob_end_clean();
[917] Fix | Delete
return $output;
[918] Fix | Delete
}
[919] Fix | Delete
[920] Fix | Delete
/**
[921] Fix | Delete
* Display the footer language selector
[922] Fix | Delete
* @since 3.2
[923] Fix | Delete
* Will use the language selector include configuration from the WPML -> Language admin screen
[924] Fix | Delete
* @use \SitePress::api_hooks
[925] Fix | Delete
* example: do_action('wpml_footer_language_selector');
[926] Fix | Delete
*/
[927] Fix | Delete
function wpml_footer_language_selector_action() {
[928] Fix | Delete
do_action( 'wpml_footer_language_selector' );
[929] Fix | Delete
}
[930] Fix | Delete
[931] Fix | Delete
/**
[932] Fix | Delete
* Returns an HTML hidden input field with name="lang" and value of current language
[933] Fix | Delete
* This is for theme authors, to make their themes compatible with WPML when using the search form.
[934] Fix | Delete
* In order to make the search form work properly, they should use standard WordPress template tag get_search_form()
[935] Fix | Delete
* In this case WPML will handle the the rest.
[936] Fix | Delete
* If for some reasons the template function can't be used and form is created differently,
[937] Fix | Delete
* authors must the following code between inside the form
[938] Fix | Delete
* <?php
[939] Fix | Delete
* if (function_exists('wpml_the_language_input_field')) {
[940] Fix | Delete
* wpml_the_language_input_field();
[941] Fix | Delete
* }
[942] Fix | Delete
* @global SitePress $sitepress
[943] Fix | Delete
* @return string|null HTML input field or null
[944] Fix | Delete
* @since 3.2
[945] Fix | Delete
* @deprecated 3.2 use 'wpml_add_language_form_field' action instead
[946] Fix | Delete
*/
[947] Fix | Delete
function wpml_get_language_input_field() {
[948] Fix | Delete
global $sitepress;
[949] Fix | Delete
if ( isset( $sitepress ) ) {
[950] Fix | Delete
return "<input type='hidden' name='lang' value='" . esc_attr( $sitepress->get_current_language() ) . "' />";
[951] Fix | Delete
}
[952] Fix | Delete
[953] Fix | Delete
return null;
[954] Fix | Delete
}
[955] Fix | Delete
[956] Fix | Delete
/**
[957] Fix | Delete
* Echoes the value returned by \wpml_get_language_input_field
[958] Fix | Delete
* @since 3.1.7.3
[959] Fix | Delete
* @deprecated 3.2 use 'wpml_add_language_form_field' filter instead
[960] Fix | Delete
*/
[961] Fix | Delete
function wpml_the_language_input_field() {
[962] Fix | Delete
echo wpml_get_language_input_field();
[963] Fix | Delete
}
[964] Fix | Delete
[965] Fix | Delete
/**
[966] Fix | Delete
* @since 3.2
[967] Fix | Delete
* Returns an HTML hidden input field with name="lang" and as value the current language
[968] Fix | Delete
* In order to add a search form to your theme you would normally use the standard WordPress template tag: <code>get_search_form()</code>
[969] Fix | Delete
* If you are making use of the default WordPress search form, you do not need to edit anything. WPML will handle the rest.
[970] Fix | Delete
* However, there may be times when <code>get_search_form()</code> can't be used.
[971] Fix | Delete
* If you are creating a custom search form and you need to make it WPML compatible then this action hook is what you need.
[972] Fix | Delete
* Add the action hook inside the form:
[973] Fix | Delete
* <?php
[974] Fix | Delete
* do_action('wpml_add_language_form_field');
[975] Fix | Delete
* ?>
[976] Fix | Delete
* @global SitePress $sitepress
[977] Fix | Delete
* @return string|null HTML input field or null
[978] Fix | Delete
* @use \SitePress::api_hooks
[979] Fix | Delete
*/
[980] Fix | Delete
function wpml_add_language_form_field_action() {
[981] Fix | Delete
echo wpml_get_language_form_field();
[982] Fix | Delete
}
[983] Fix | Delete
[984] Fix | Delete
function wpml_language_form_field_shortcode() {
[985] Fix | Delete
return wpml_get_language_form_field();
[986] Fix | Delete
}
[987] Fix | Delete
[988] Fix | Delete
function wpml_get_language_form_field() {
[989] Fix | Delete
$language_form_field = '';
[990] Fix | Delete
global $sitepress;
[991] Fix | Delete
if ( isset( $sitepress ) ) {
[992] Fix | Delete
$current_language = $sitepress->get_current_language();
[993] Fix | Delete
$language_form_field = "<input type='hidden' name='lang' value='" . esc_attr( $current_language ) . "' />";
[994] Fix | Delete
$language_form_field = apply_filters( 'wpml_language_form_input_field', $language_form_field, $current_language );
[995] Fix | Delete
}
[996] Fix | Delete
[997] Fix | Delete
return $language_form_field;
[998] Fix | Delete
}
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function