function synved_option_addon_installed($id, $name, $item = null) { $item = synved_option_item($id, $name); if ($item != null) { return synved_option_item_addon_is_installed($item); } return false; }
function synved_option_render_section($page, $section) { global $wp_settings_fields; if (!isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section])) { return; } $index = 0; foreach ((array) $wp_settings_fields[$page][$section] as $field) { $callback = $field['callback']; $args = $field['args']; $id = null; $name = null; $item = null; $class_list = array(); if ($callback == 'synved_option_call_array' && $args[0] == 'synved_option_setting_cb') { $extra_args = $args[1]; $id = $extra_args[0]; $name = $extra_args[1]; $item = $extra_args[2]; if ($item != null) { $type = synved_option_item_type($item); $style = synved_option_item_style($item); $class_list[] = 'synved-option-type-' . $type; if ($style != null) { foreach ($style as $style_name) { $class_list[] = 'synved-option-style-' . $style_name; // XXX exception if ($style_name == 'addon-important') { if ($type == 'addon') { if (synved_option_item_addon_is_installed($item)) { $class_list[] = 'synved-option-style-' . $style_name . '-installed'; } } } else { if ($style_name == 'group') { if ($index > 0) { $class_list[] = 'synved-option-style-' . $style_name . '-active'; } } } } } } } if ($class_list != null) { $class_list = ' class="' . implode(' ', $class_list) . '"'; } echo '<tr valign="top"' . $class_list . '>'; if (!empty($field['args']['label_for'])) { echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>'; } else { echo '<th scope="row">' . $field['title'] . '</th>'; } echo '<td>'; if ($item != null) { synved_option_render_item($id, $name, $item, true); } else { call_user_func($callback, $args); } echo '</td>'; echo '</tr>'; $index++; } }