Exemplo n.º 1
0
    function form($instance)
    {
        $defaults = $this->get_defaults();
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>
    <p>
        <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        echo __('Title', 'social-media-feather');
        ?>
:</label>
        <input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo $instance['title'];
        ?>
" />
    </p>
    <p>
        <label for="<?php 
        echo $this->get_field_id('icon_skin');
        ?>
"><?php 
        echo __('Icon Skin', 'social-media-feather');
        ?>
:</label>
        <?php 
        $params = array('tip' => '', 'output_name' => $this->get_field_name('icon_skin'), 'value' => $instance['icon_skin'], 'set_before' => array(array('default' => __('Use Default'))));
        $item = synved_option_item('synved_social', 'icon_skin');
        if ($item != null) {
            // XXX a bit unorthodox...
            if (is_object($item)) {
                $item = clone $item;
            }
            unset($item['render']);
            synved_option_render_item('synved_social', 'icon_skin', $item, true, $params, 'widget');
        }
        ?>
        <br/>
        <label for="<?php 
        echo $this->get_field_id('icon_size');
        ?>
"><?php 
        echo __('Icon Size', 'social-media-feather');
        ?>
:</label>
        <?php 
        $params = array('tip' => '', 'output_name' => $this->get_field_name('icon_size'), 'value' => $instance['icon_size'], 'set_before' => array(array('default' => __('Use Default'))));
        synved_option_render_item('synved_social', 'icon_size', null, true, $params, 'widget');
        ?>
        <br/>
        <label for="<?php 
        echo $this->get_field_id('icon_spacing');
        ?>
"><?php 
        echo __('Icon Spacing', 'social-media-feather');
        ?>
:</label>
        <input type="text" size="3" class="" id="<?php 
        echo $this->get_field_id('icon_spacing');
        ?>
" name="<?php 
        echo $this->get_field_name('icon_spacing');
        ?>
" value="<?php 
        echo $instance['icon_spacing'];
        ?>
" />
    </p>
<?php 
    }
Exemplo n.º 2
0
function synved_option_setting_cb($id, $name, $item)
{
    return synved_option_render_item($id, $name, $item, true);
}
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++;
    }
}