Esempio n. 1
0
 /**
  * Renders <tr> element with controls
  * id =>
  * label =>
  * label_class =>
  * <control> => details
  * style - default is label,controls view,
  *         alternative is one-column view
  */
 public static function table_tr($a)
 {
     $id = isset($a['id']) ? $a['id'] : '';
     $a = apply_filters('w3tc_ui_settings_item', $a);
     if (isset($a['style'])) {
         echo '<tr><th colspan="2"';
     } else {
         echo '<tr><th';
         if (isset($a['label_class'])) {
             echo ' class="' . $a['label_class'] . '"';
         }
         echo '>';
         if (isset($a['label'])) {
             Util_Ui::label($id, $a['label']);
         }
         echo "</th>\n<td>\n";
     }
     foreach ($a as $key => $e) {
         if ($key == 'checkbox') {
             Util_Ui::checkbox($id, isset($e['name']) ? $e['name'] : null, $e['value'], isset($e['disabled']) ? $e['disabled'] : false, isset($e['label']) ? $e['label'] : null);
         } elseif ($key == 'description') {
             echo '<br /><span class="description">' . $e . '</span>';
         } elseif ($key == 'hidden') {
             Util_Ui::hidden('', $e['name'], $e['value']);
         } elseif ($key == 'html') {
             echo $e;
         } elseif ($key == 'radiogroup') {
             Util_Ui::radiogroup($e['name'], $e['value'], $e['values']);
         } elseif ($key == 'selectbox') {
             Util_Ui::selectbox($id, $e['name'], $e['value'], $e['values'], isset($e['disabled']) ? $e['disabled'] : false, isset($e['optgroups']) ? $e['optgroups'] : null);
         } elseif ($key == 'textbox') {
             Util_Ui::textbox($id, $e['name'], $e['value'], isset($e['disabled']) ? $e['disabled'] : false, !empty($e['size']) ? $e['size'] : 20);
         } elseif ($key == 'textarea') {
             Util_Ui::textarea($id, $e['name'], $e['value'], isset($e['disabled']) ? $e['disabled'] : false);
         }
     }
     if (isset($a['style'])) {
         echo "</th>";
     } else {
         echo "</td>";
     }
     echo "</tr>\n";
 }