function icl_st_render_option_writes($option_name, $option_value, $option_key = '') { $has_translations = ''; if (is_array($option_value) || is_object($option_value)) { echo '<h4><a class="icl_stow_toggler" href="#">+ ' . $option_name . '</a></h4>'; echo '<ul class="icl_st_option_writes" style="display: none">'; foreach ($option_value as $key => $value) { echo '<li>'; $this->icl_st_render_option_writes($key, $value, $option_key . '[' . $option_name . ']'); echo '</li>'; } echo '</ul>'; } elseif (is_string($option_value) || is_numeric($option_value)) { $context = $this->get_context($option_key, $option_name); if (icl_st_is_registered_string($context, $option_key . $option_name)) { $checked = ' checked="checked"'; if (icl_st_string_has_translations($context, $option_key . $option_name)) { $has_translations = ' class="icl_st_has_translations"'; } else { $has_translations = ''; } } else { $checked = ''; } if (is_numeric($option_value)) { $class = 'icl_st_numeric'; } else { $class = 'icl_st_string'; } global $iclTranslationManagement; $int = preg_match_all('#\\[([^\\]]+)\\]#', $option_key . '[' . $option_name . ']', $matches); $_v = $iclTranslationManagement->admin_texts_to_translate; if ($int) { foreach ($matches[1] as $m) { if (isset($_v[$m])) { $_v = $_v[$m]; } else { $_v = 0; break; } } } if ($_v) { $disabled = ' disabled="disabled"'; $has_translations = ''; // remove "has_translation" class because we can't uncheck it anyway. } else { $disabled = ''; } echo '<div class="icl_st_admin_string ' . $class . '">'; echo '<input' . $disabled . ' type="hidden" name="icl_admin_options' . $option_key . '[' . $option_name . ']" value="" />'; echo '<input' . $disabled . $has_translations . ' type="checkbox" name="icl_admin_options' . $option_key . '[' . $option_name . ']" value="' . htmlspecialchars($option_value) . '" ' . $checked . ' />'; echo '<input type="text" readonly="readonly" value="' . $option_name . '" size="32" />'; echo '<input type="text" value="' . htmlspecialchars($option_value) . '" readonly="readonly" size="48" />'; //echo '<br /><input type="text" size="100" value="icl_admin_options'.$option_key.'['.$option_name.']" />'; echo '</div><br clear="all" />'; } }
function icl_st_render_option_writes($option_name, $option_value, $option_key = '') { $sub_key = $option_key . '[' . $option_name . ']'; if (is_array($option_value) || is_object($option_value)) { $output = '<h4><a class="icl_stow_toggler" href="#">+ ' . $option_name . '</a></h4><ul class="icl_st_option_writes" style="display: none">'; foreach ($option_value as $key => $value) { $output .= '<li>' . $this->icl_st_render_option_writes($key, $value, $sub_key) . '</li>'; } $output .= '</ul>'; } elseif (is_string($option_value) || is_numeric($option_value)) { $fixed = $this->is_sub_key_fixed($sub_key); $string_name = $option_key . $option_name; $context = $this->get_context($option_key, $option_name); $checked = icl_st_is_registered_string($context, $string_name) ? ' checked="checked"' : ''; $has_translations = !$fixed && $checked === '' && icl_st_string_has_translations($context, $string_name) ? ' class="icl_st_has_translations" ' : ''; $input_val = ' value="' . htmlspecialchars($option_value) . '" '; $option_key_name = ' name="icl_admin_options' . $sub_key . ' '; $input_open = '<input' . ($fixed ? ' disabled="disabled"' : ''); $read_only_input_open = '<input type="text" readonly="readonly"'; $output = '<div class="icl_st_admin_string icl_st_' . (is_numeric($option_value) ? 'numeric' : 'string') . '">' . $input_open . ' type="hidden" ' . $option_key_name . ' value="" />' . $input_open . $has_translations . ' type="checkbox" ' . $option_key_name . $input_val . $checked . ' />' . $read_only_input_open . ' value="' . $option_name . '" size="32" />' . $read_only_input_open . $input_val . ' size="48" /></div><br clear="all" />'; } return isset($output) ? $output : ''; }
function icl_st_render_option_writes($option_name, $option_value, $option_key = '') { $output = ''; $has_translations = ''; if (icl_st_is_registered_string('admin_texts_theme_' . get_option('template'), $option_key . $option_name)) { $checked = ' checked="checked"'; if (icl_st_string_has_translations('admin_texts_theme_' . get_option('template'), $option_key . $option_name)) { $has_translations = ' class="icl_st_has_translations"'; } else { $has_translations = ''; } } else { $checked = ''; } if (is_numeric($option_value)) { $class = 'icl_st_numeric'; } else { $class = 'icl_st_string'; } global $iclTranslationManagement; $int = preg_match_all('#\\[([^\\]]+)\\]#', $option_key . '[' . $option_name . ']', $matches); $_v = $iclTranslationManagement->admin_texts_to_translate; if ($int) { foreach ($matches[1] as $m) { if (isset($_v[$m])) { $_v = $_v[$m]; } else { $_v = 0; break; } } } if ($_v) { $disabled = ' disabled="disabled"'; } else { $disabled = ''; } $output .= '<div class="icl_st_admin_string ' . $class . '">'; $output .= '<input' . $disabled . ' type="hidden" name="icl_admin_options' . $option_key . '[' . $option_name . ']" value="" />'; $output .= '<input' . $disabled . $has_translations . ' type="checkbox" name="icl_admin_options' . $option_key . '[' . $option_name . ']" value="' . esc_attr($option_value) . '" ' . $checked . ' />'; $output .= '<input type="text" readonly="readonly" value="' . $option_name . '" size="32" />'; $output .= '<input type="text" value="' . esc_attr($option_value) . '" readonly="readonly" size="48" />'; $output .= '</div><br clear="all" />'; return $output; }