'; for ($i = 5; $i <= 60; $i++) { $val = $i . 'px'; $selected = $val == $value ? ' selected' : ''; $opts .= ''; } if (!empty($id_target)) $onchange = 'onchange="jQuery(' . "'#" . $id_target . "').css('font-size'," . 'jQuery(this).val());"'; else $onchange = ''; return ''; } function sumakweb_get_radius_select($id_name,$value) { $opts = ''; for ($i = 1; $i <= 25; $i++) { $val = $i . 'px'; $selected = $val == $value ? ' selected' : ''; $opts .= ''; } return ''; } function sumakweb_get_text_align_select($id_name,$value) { $opts = ''; for ($i = 0; $i < 4; $i++) { switch ($i) { case 0: $val = 'left'; break; case 1: $val = 'right'; break; case 2: $val = 'center'; break; case 3: $val = 'justify'; break; } $selected = $val == $value ? ' selected' : ''; $opts .= ''; } return ''; } $arrOptions = get_option('sumakweb'); $sumakweb_has_data = !empty($arrOptions); $option_std = array(); foreach ($options as $option) { if (isset($option['std'])) $option_std[$option['id']] = $option['std']; } foreach ($options as $option) { if (($option['type'] == 'open') || ($option['type'] == 'close') || ($option['type'] == 'displayonly')) { // Nothing here, move on. } else { if (isset($arrOptions[$option['id']])) { if ($sumakweb_has_data) $real_value = $arrOptions[$option['id']]; else $real_value = $option_std[$option['id']]; //$option['std']; } else { //$real_value = $option['std']; $real_value = $option_std[$option['id']]; // New items. } } if (isset($option['class'])) $fields_html .= ''; switch ($option['type']) { case 'open': $tab_id = str_replace(' ', '-', strtolower($option['title'])); // Generate the id which will be used as the id of the section (for the tabs system purposes). $menubar_html .= '
  • '.$option['title'].'
  • '; // Add the new link in the menubar for this section. $fields_html .= '
    '; // Open the new section. break; case 'close': $fields_html .= '
    '; // Close the current section break; case 'displayonly': switch ($option['data'][0]) { case 'colors': $field_id = (isset($option['id']) ? ' id="' . $option['id'] . '"' : ''); $the_style = ''; $id_bg = $option['data'][1]; $id_fg = $option['data'][2]; if ($sumakweb_has_data && (isset($arrOptions[$id_bg]))) { $val_bg = $arrOptions[$id_bg]; $val_fg = $arrOptions[$id_fg]; } else { $val_bg = $option_std[$id_bg]; $val_fg = $option_std[$id_fg]; } if (!empty($val_bg)) $the_style .= 'background-color:' . $val_bg . ';'; if (!empty($val_fg)) $the_style .= 'color:' . $val_fg . ';'; if (isset($option['data'][3])) { $id_font = $option['data'][3]; $id_size = $option['data'][3] . '_size'; $id_bold = $option['data'][3] . '_bold'; $id_italic = $option['data'][3] . '_italic'; if ($sumakweb_has_data && (isset($arrOptions[$id_font]))) { $val_font = $arrOptions[$id_font ]; $val_size = $arrOptions[$id_size ]; $val_bold = $arrOptions[$id_bold ]; $val_italic = $arrOptions[$id_italic]; } else { $val_font = $option_std[$id_font ]; $val_size = $option_std[$id_size ]; $val_bold = $option_std[$id_bold ]; $val_italic = $option_std[$id_italic]; } if (!empty($val_font ) ) $the_style .= 'font-family:' . $val_font . ';'; if (!empty($val_size ) ) $the_style .= 'font-size:' . $val_size . ';'; if (!empty($val_bold ) && ($val_bold == 'on')) $the_style .= 'font-weight:bold;'; if (!empty($val_italic) && ($val_italic == 'on')) $the_style .= 'font-style:italic;'; } if (!empty($the_style)) $the_style = ' style="' . $the_style . '"'; $fields_html .= '
    ' . (isset($option['title']) ? '
    ' . $option['title'] . '
    ' : '') . '
    ' . '' . '
    ' . (isset($option['note' ]) ? '
    ' . $option['note' ] . '
    ' : '') . '
    '; break; case 'info': $fields_html .= '
    ' . (isset($option['title']) ? '
    ' . $option['title'] . '
    ' : '') . (isset($option['desc' ]) ? '
    ' . $option['desc' ] . '
    ' : '') . $option['data'][1] . '
    '; break; case 'delimiter': $fields_html .= '
    ' . ($option['data'][1] == 'top' ? '
    ' : '') . (isset($option['title']) ? '
    ' . $option['title'] . '
    ' : '') . (isset($option['desc' ]) ? '
    ' . $option['desc' ] . '
    ' : '') . ($option['data'][1] == 'bottom' ? '
    ' : '') . '
    '; break; case 'form': $fields_html .= '
    ' . (isset($option['title']) ? '
    ' . $option['title'] . '
    ' : '') . (isset($option['desc' ]) ? '
    ' . $option['desc' ] . '
    ' : '') . $option['data'][1] . '
    '; break; case 'webservice': if (isset($option['if_cbx']) && ($arrOptions[$option['if_cbx']] == 'on')) { if ((isset($option['data'][1])) && (!empty($option['data'][1]))) { $news = wp_remote_fopen($option['data'][1]); if (empty($news)) $fields_html .= '

    ' . __('Unavailable','sumakweb') . '

    '; else $fields_html .= '
    ' . $news . '
    '; } } else $fields_html .= '

    ' . __('Disabled','sumakweb') . '

    '; break; } break; // case 'displayonly': case 'text': $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= ''; if (isset($option['desc' ])) $fields_html .= '
    ' . $option['desc'] . '
    '; if (isset($option['note' ])) $fields_html .= '
    ' . $option['note'] . '
    '; $fields_html .= ''; $fields_html .= '
    '; break; case 'number': $fields_html .= '
    ' . '' . '  ' . (isset($option['desc']) ? '
    ' . $option['desc'] . '
    ' : '') . (isset($option['note']) ? '
    ' . $option['note'] . '
    ' : '') . '
    '; break; case 'checkbox': $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= ''; if (isset($option['note' ])) $fields_html .= '
    ' . $option['note' ] . '
    '; if ($real_value == 'on') $checked = 'checked'; else $checked = ''; $fields_html .= '

    ' . (isset($option['desc' ]) ? '  ' . $option['desc' ] . '' : '') . '

    ' . '
    '; break; case 'radio': $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= ''; if (isset($option['desc' ])) $fields_html .= '
    ' . $option['desc' ] . '
    '; if (isset($option['note' ])) $fields_html .= '
    ' . $option['note' ] . '
    '; foreach($option['data'] as $ix => $val){ if ($val == $real_value) $checked = 'checked'; else $checked = ''; $fields_html .= '

    ' . '  ' . $ix . '

    '; } $fields_html .= '
    '; break; case 'color': $fields_html .= '
    '; $fields_html .= '
    '; if (isset($option['desc'])) $fields_html .= '
    ' . $option['desc'] . '
    '; if (isset($option['note'])) $fields_html .= '
    ' . $option['note'] . '
    '; if ((isset($option['data'][0])) && (isset($option['data'][0]))) { $onchange = ' onblur="' . 'jQuery(' . "'" . '#' . $option['data'][0] . "'" . ').css(' . "'" . $option['data'][1] . "',jQuery(this).val());" . '"'; } else $onchange = ''; $fields_html .= '' . '  ' . '
    ' . '
    ' . '
    ' . '
    '; break; case 'image': $fields_html .= '
    '; $fields_html .= ''; if (isset($option['desc'])){ $fields_html .= '
    '; $fields_html .= $option['desc']; $fields_html .= '
    '; } if (isset($option['note'])) $fields_html .= '
    ' . $option['note'] . '
    '; if (!empty($real_value['url'])) { if (!empty($real_value['width']) && (!empty($real_value['height'])) && ($real_value['width'] == '16') && ($real_value['height'] == '16')) { $fields_html .= ''; } else { $style = 'background-image:url(' . get_template_directory_uri() . '/pix/transparency.jpg);background-repeat:repeat;'; $fields_html .= ''; } } if (!empty($real_value['width']) && (!empty($real_value['height']))) { $fields_html .= '

    ' . __('Size:','sumakweb') . ' ' . $real_value['width'] . 'x' . $real_value['height'] . '

    '; } if (!empty($real_value['file'])) { $fields_html .= ''; } $fields_html .= ''; $fields_html .= '
    '; break; case 'textarea': $style = ' style="width:100%;'; if (isset($option['data'][0])) { if ($option['data'][0] == 'small') $style .= 'height:4em;'; } $style .= '"'; $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= ''; if (isset($option['desc' ])) $fields_html .= '
    ' . $option['desc' ] . '
    '; if (isset($option['note' ])) $fields_html .= '
    ' . $option['note' ] . '
    '; $fields_html .= ''; $fields_html .= '
    '; break; case 'font': $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= '   '; if (isset($option['desc' ])) $fields_html .= '
    ' . $option['desc'] . '
    '; if (isset($option['note' ])) $fields_html .= '
    ' . $option['note'] . '
    '; $id_size = $option['id'] . '_size'; $id_bold = $option['id'] . '_bold'; $id_italic = $option['id'] . '_italic'; if ($sumakweb_has_data && (isset($arrOptions[$id_size]))) { $val_size = isset($arrOptions[$id_size ]) ? $arrOptions[$id_size ] : ''; $val_bold = isset($arrOptions[$id_bold ]) ? $arrOptions[$id_bold ] : ''; $val_italic = isset($arrOptions[$id_italic]) ? $arrOptions[$id_italic] : ''; } else { $val_size = $option_std[$id_size ]; $val_bold = $option_std[$id_bold ]; $val_italic = $option_std[$id_italic]; } $checked_bold = $val_bold == 'on' ? 'checked' : ''; $checked_italic = $val_italic == 'on' ? 'checked' : ''; if (isset($option['data'])) { $onchange_bold = ' onchange="sumakweb_checkbox_css(' . "'" . $id_bold . "','" . $option['data'] . "','font-weight','bold' ,'normal'" . ');"'; $onchange_italic = ' onchange="sumakweb_checkbox_css(' . "'" . $id_italic . "','" . $option['data'] . "','font-style' ,'italic','normal'" . ');"'; } else { $onchange_bold = ''; $onchange_italic = ''; } $fields_html .= sumakweb_get_font_select($id_size,$val_size,(isset($option['data']) ? $option['data'] : '')) . '' . ' ' . __('Bold','sumakweb') . '' . '' . ' ' . __('Italic','sumakweb') . '' . '' . '
    '; break; case 'radius': $fields_html .= '
    '; $fields_html .= sumakweb_get_radius_select($option['id'],$real_value); if (isset($option['title'])) $fields_html .= ' '; $fields_html .= '
    '; break; case 'text-align': $fields_html .= '
    '; if (isset($option['title'])) $fields_html .= ' '; $fields_html .= sumakweb_get_text_align_select($option['id'],$real_value); $fields_html .= '
    '; break; } if (isset($option['class'])) $fields_html .= '
    '; }