$value_mix_string) { $_array_temp = explode(':', $value_mix_string , 2); if(!empty($_array_temp)) { $_name = (isset($_array_temp[0])) ? $_array_temp[0] : ''; $_value = (isset($_array_temp[1])) ? $_array_temp[1] : ''; if($_name !== '') { $_value_array[$_name] = $_value; } } } } $current_input_name_val = (isset($_value_array['input_share'])) ? urldecode( $_value_array['input_share'] ): ''; $current_input_label_val = (isset($_value_array['profile_link'])) ? urldecode( $_value_array['profile_link'] ) : ''; $current_input_type_val = (isset($_value_array['input_type'])) ? $_value_array['input_type'] : ''; $current_network_name_label_val= (isset($_value_array['network_name'])) ? $_value_array['network_name'] : ''; $accordion_label = ($current_input_type_val != '') ? $current_input_type_val : ''; $is_hidden = $is_profile = $is_share = $need_placeholder = false; $order = (isset($_value_array['order'])) ? $_value_array['order'] : '0'; $bw_type = isset( $_value_array['smile_adv_share_opt'] ) ? $_value_array['smile_adv_share_opt'] : 0 ; $bw_switch_checked = ($bw_type) ? 'checked="checked"' : ''; $output .= '
'; $output .= '
'.$accordion_label.'
'; $output .= '
'; //first selct box for network $output .= ''; //add network name field $output .= ''; //second selct box for action $output .= ''; $profile_style_for_options = ($is_profile) ? 'style="display:block"' : 'style="display:none"'; //profile_link $output .= ''; //switch for share $output .= ''; //share url $output .= ''; $shares = $data_count = ''; $output .= ''; $output .= '
'; $output .= '
'; return $output; } function social_media_settings_field($name, $settings, $value) { $input_share = $name; $type = isset($settings['type']) ? $settings['type'] : ''; $class = isset($settings['class']) ? $settings['class'] : ''; $uniq = uniqid(); $output = '
'; $output .= ''; $output .= '
'; $boxes = explode(';', $value); if(!empty($boxes)) { foreach ($boxes as $key => $box_value) { $output .= render_multi_social_media($uniq, $box_value); } } $output .= '
'; $output .= '
Add New Network
'; $output .= '
'; return $output; } add_action( 'wp_ajax_repeat_social_media', 'repeat_social_media_callback' ); //add_action( 'wp_ajax_repeat_social_media_count', 'repeat_social_media_callback_count' ); function repeat_social_media_callback() { $uniq = $_POST['id']; if($uniq === '') { $response['type'] = 'error'; $response['message'] = 'No wrapper ID found'; echo json_encode($response); die(); } $value = ''; $output = render_multi_social_media($uniq, $value); $response['type'] = 'success'; $response['message'] = $output; echo json_encode($response); die(); } // function to convert dropdown string to array function sc_dropdown_string_to_array($string) { $lines = explode(PHP_EOL, $string); $array = array(); foreach ($lines as $key => $line) { $line = trim($line); if($line === '') continue; $temp = array(); $line_to_array = explode('+', $line); $label = (isset($line_to_array[0])) ? ucfirst($line_to_array[0]) : ucfirst($line); $value = (isset($line_to_array[1])) ? $line_to_array[1] : $line; $temp['label'] = trim($label); $temp['value'] = trim($value); array_push($array, $temp); } return $array; }