コード例 #1
0
function weaverx_form_widget_area($value, $submit = false)
{
    /* build the rows for area settings
    	 * Defined Areas:
    	 *  'container' => '0', 'header' => '0', 'header_html' => '0', 'header_sb' => '0',
    		'infobar' => '5px', 'content' => 'T:4px, B:8px', 'post' => '0', 'footer' => '0',
    		'footer_sb' => '0', 'footer_html' => '0', 'widget' => '0', 'primary' => '0',
    		'secondary' => '0', 'extra' => '0', 'top' => '0', 'bottom' => '0', 'wrapper' => '0'
    	 */
    // defaults - these are determined by the =Padding section of style-weaverx.css
    $default_tb = array('infobar' => '5px', 'content' => 'T:4px, B:8px', 'footer' => '8px', 'footer_sb' => '8px', 'primary' => '8px', 'secondary' => '8px', 'extra' => '8px', 'top' => '8px', 'bottom' => '8px');
    $default_lr = array('infobar' => '5px', 'content' => '2%', 'post' => '0', 'footer' => '8px', 'footer_sb' => '8px', 'primary' => '8px', 'secondary' => '8px', 'extra' => '8px', 'top' => '8px', 'bottom' => '8px');
    $default_margins = array('infobar' => '5px', 'content' => 'T:0, B:0', 'footer' => 'T:0, B:0', 'footer_sb' => 'T:0, B:10', 'primary' => 'T:0, B:10', 'widget' => '0, Auto - First: T:0, Last: B:0', 'secondary' => 'T:0, B:10', 'extra' => 'T:0, B:10', 'top' => 'T:10, B:10', 'bottom' => 'T:10, B:10', 'wrapper' => 'T:0, B:0', 'post' => 'T:0, B:15');
    $id = $value['id'];
    $def_tb = '0';
    $def_lr = '0';
    $def_marg = '0';
    if (isset($default_tb[$id])) {
        $def_tb = $default_tb[$id];
    }
    if (isset($default_lr[$id])) {
        $def_lr = $default_lr[$id];
    }
    if (isset($default_margins[$id])) {
        $def_marg = $default_margins[$id];
    }
    $use_percent = array('content', 'post');
    //echo '<table><tr><td>';
    $name = $value['name'];
    $lr_type = in_array($id, $use_percent) ? 'text_lr_percent' : 'text_lr';
    $opts = array(array('name' => $name, 'id' => '-welcome-widgets-menus', 'type' => 'header_area', 'info' => $value['info']), array('name' => $name, 'id' => $id, 'type' => 'titles_area', 'info' => $name), array('name' => '<span class="i-left dashicons dashicons-align-none"></span>' . __('Padding', 'weaver-xtreme'), 'id' => $id . '_padding', 'type' => 'text_tb', 'info' => '<em>' . $name . '</em>' . __(': Top/Bottom Inner padding [Default: ', 'weaver-xtreme') . $def_tb . ']'), array('name' => '', 'id' => $id . '_padding', 'type' => $lr_type, 'info' => '<em>' . $name . '</em>' . __(': Left/Right Inner padding [Default: ', 'weaver-xtreme') . $def_lr . ']'), array('name' => '<span class="i-left dashicons dashicons-align-none"></span>' . __('Top/Bottom Margins', 'weaver-xtreme'), 'id' => $id . '_margin', 'type' => 'text_tb', 'info' => '<em>' . $name . '</em>' . __(': Top/Bottom margins. <em>Side margins auto-generated.</em> [Default: ', 'weaver-xtreme') . $def_marg . ']'));
    weaverx_form_show_options($opts, false, false);
    $no_lr_margins = array('primary', 'secondary', 'content', 'post', 'widget');
    $no_widgets = array('widget', 'content', 'post', 'wrapper', 'container', 'header', 'header_html', 'footer_html', 'footer', 'infobar');
    $no_hide = array('wrapper', 'container', 'content', 'widget', 'post');
    $default_auto = array('top', 'bottom', 'footer_sb', 'header_sb');
    if (in_array($id, $no_lr_margins)) {
        if ($id != 'widget') {
            weaverx_form_checkbox(array('name' => '<span class="i-left dashicons dashicons-align-none"></span>' . __('Add Side Margin(s)', 'weaver-xtreme'), 'id' => $id . '_smartmargin', 'type' => '', 'info' => '<em>' . $name . '</em>' . __(': Automatically add left/right "smart" margins for separation of areas (sidebar/content).', 'weaver-xtreme')));
        }
        weaverx_form_note(array('name' => '<strong>' . __('Width', 'weaver-xtreme') . '</strong>', 'info' => __('The width of this area is automatically determined by the enclosing area', 'weaver-xtreme')));
    } else {
        if ($id != 'wrapper') {
            if (in_array($id, $default_auto)) {
                weaverx_form_val(array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span> ' . __('Width', 'weaver-xtreme'), 'id' => $id . '_width_int', 'type' => '', 'info' => '<em>' . $name . '</em>' . __(': Width of Area in % of enclosing area on desktop and small tablet. Hint: use with Center align. Use 0 to force auto width. (Default if blank: auto)', 'weaver-xtreme'), 'value' => array()), '%');
            } else {
                weaverx_form_val(array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span> ' . __('Width', 'weaver-xtreme'), 'id' => $id . '_width_int', 'type' => '', 'info' => '<em>' . $name . '</em>' . __(': Width of Area in % of enclosing area on desktop and small tablet. Hint: use with Center align. Use 0 to force auto width. (Default if blank: 100%)', 'weaver-xtreme'), 'value' => array()), '%');
            }
            weaverx_form_align(array('name' => '<span class="i-left dashicons dashicons-editor-alignleft"></span><small>' . __('Align Area', 'weaver-xtreme') . '</small>', 'id' => $id . '_align', 'type' => '', 'info' => '<em>' . $name . '</em>' . __(': How to align this area (Default: Left Align)', 'weaver-xtreme')));
            if ($id == 'header_html' || $id == 'footer_html') {
                weaverx_form_checkbox(array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Center Content', 'weaver-xtreme') . '</small>', 'id' => $id . '_center_content', 'type' => '', 'info' => '<em>' . $name . '</em>' . __(': Center Content within HTML Area content within the area.', 'weaver-xtreme')));
            }
        }
    }
    if ($id == 'wrapper') {
        // setting #wrapper sets theme width.
        $info = __('<em>Change Theme Width.</em> Standard width is 1100px. Use the options on the "Full Width" tab for full width designs, but leave this value set. Widths less than 768px may give unexpected results on mobile devices. Weaver Xtreme can not create a fixed-width site.', 'weaver-xtreme');
        weaverx_form_val(array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span><em style="color:red;">' . __('Theme Width', 'weaver-xtreme') . '</em>', 'id' => 'theme_width_int', 'type' => '', 'info' => $info, 'value' => array()), 'px');
    }
    if (in_array($id, array('container', 'header', 'footer'))) {
        $opts_max = array(array('name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Max Width', 'weaver-xtreme') . '</small>', 'id' => $id . '_max_width_int', 'type' => '+val_px', 'info' => '<em>' . $name . '</em>' . __(': Set Max Width of Area for Desktop View. Advanced Option. (&starf;Plus)', 'weaver-xtreme'), 'value' => array()));
        weaverx_form_show_options($opts_max, false, false);
    }
    if (!in_array($id, $no_widgets)) {
        $opts02 = array(array('name' => '<span class="i-left" style="font-size:120%;">&nbsp;&#9783;</span>' . __('Columns', 'weaver-xtreme'), 'id' => $id . '_cols_int', 'type' => 'val_num', 'info' => '<em>' . $name . '</em>' . __(': Equal width columns of widgets (Default: 1; max: 8)', 'weaver-xtreme')), array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('No Smart Widget Margins', 'weaver-xtreme') . '</small>', 'id' => $id . '_no_widget_margins', 'type' => 'checkbox', 'info' => '<em>' . $name . '</em>' . __(': Do not use "smart margins" between widgets on rows.', 'weaver-xtreme')), array('name' => '<span class="i-left" style="font-size:140%;">&nbsp;=</span><small>' . __('Equal Height Widget Rows', 'weaver-xtreme') . '</small>', 'id' => $id . '_eq_widgets', 'type' => '+checkbox', 'info' => '<em>' . $name . '</em>' . __(': Make widgets equal height rows if &gt; 1 column (&starf;Plus)', 'weaver-xtreme')));
        weaverx_form_show_options($opts02, false, false);
        $custom_widths = array('header_sb', 'footer_sb', 'primary', 'secondary', 'top', 'bottom');
        if (in_array($id, $custom_widths)) {
            /* if ( $id == 'header_sb' || $id == 'footer_sb' ) { */
            ?>
	<tr><th scope="row" align="right"><span class="i-left" style="font-size:120%;">&nbsp;&#9783;</span><small><?php 
            _e('Custom Widget Widths:', 'weaver-xtreme');
            ?>
</small></th><td colspan="2" style="padding-left:20px;">
		<small><?php 
            _e('You can optionally specify widget widths, including for specific devices. Please read the help entry!', 'weaver-xtreme');
            ?>
		<?php 
            weaverx_help_link('help.html#CustomWidgetWidth', __('Help on Custom Widget Widths', 'weaver-xtreme'));
            ?>
		<?php 
            _e('(&starf;Plus) (&diams;)', 'weaver-xtreme');
            ?>
</small></td>
	</tr>
		 <?php 
            $opts2 = array(array('name' => '<span class="i-left dashicons dashicons-desktop"></span><small>' . __('Desktop', 'weaver-xtreme') . '</small>', 'id' => '_' . $id . '_lw_cols_list', 'type' => '+textarea', 'placeholder' => __('25,25,50; 60,40; - for example', 'weaver-xtreme'), 'info' => __('List of widths separated by comma. Use semi-colon (;) for end of each row.  (&starf;Plus) (&diams;)', 'weaver-xtreme')), array('name' => '<span class="i-left dashicons dashicons-tablet"></span><small>' . __('Small Tablet', 'weaver-xtreme') . '</small>', 'id' => '_' . $id . '_mw_cols_list', 'type' => '+textarea', 'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme')), array('name' => '<span class="i-left dashicons dashicons-smartphone"></span><small>' . __('Phone', 'weaver-xtreme') . '</small>', 'id' => '_' . $id . '_sw_cols_list', 'type' => '+textarea', 'info' => __('List of widget widths. (&starf;Plus) (&diams;)', 'weaver-xtreme')));
            weaverx_form_show_options($opts2, false, false);
        }
    }
    $opts3 = array(array('name' => '<span class="i-left" style="font-size:200%;margin-left:4px;">&#x25a1;</span><small>' . __('Add Border', 'weaver-xtreme') . '</small>', 'id' => $id . '_border', 'type' => 'checkbox', 'info' => '<em>' . $name . '</em>' . __(': Add the "standard" border (as set on Custom tab)', 'weaver-xtreme')), array('name' => '<span class="i-left dashicons dashicons-admin-page"></span><small>' . __('Shadow', 'weaver-xtreme') . '</small>', 'id' => $id . '_shadow', 'type' => 'shadows', 'info' => '<em>' . $name . '</em>' . __(': Wrap Area with Shadow.', 'weaver-xtreme')), array('name' => '<span class="i-left dashicons dashicons-marker"></span><small>' . __('Rounded Corners', 'weaver-xtreme') . '</small>', 'id' => $id . '_rounded', 'type' => 'rounded', 'info' => '<em>' . $name . '</em>' . __(': Rounded corners. Needs bg color or borders to show. <em>You might need to set overlapping corners for parent/child areas also!</em>', 'weaver-xtreme')));
    weaverx_form_show_options($opts3, false, false);
    if (!in_array($id, $no_hide)) {
        weaverx_form_select_hide(array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Area', 'weaver-xtreme') . '</small>', 'id' => $id . '_hide', 'info' => '<em>' . $name . '</em>' . __(': Hide area on different display devices', 'weaver-xtreme'), 'value' => ''));
    }
    // class names
    $opts4 = array(array('name' => '<span class="i-left">{ }</span> <small>' . __('Add Classes', 'weaver-xtreme') . '</small>', 'id' => $id . '_add_class', 'type' => '+widetext', 'info' => '<em>' . $name . '</em>' . __(': Space separated class names to add to this area (<em>Advanced option</em>) (&starf;Plus)', 'weaver-xtreme')));
    weaverx_form_show_options($opts4, false, false);
    if ($submit) {
        weaverx_form_submit('');
    }
    //echo '</td></tr></table>';
}
コード例 #2
0
function weaverx_form_show_options($weaverx_olist, $begin_table = true, $end_table = true)
{
    /* output a list of options - this really does the layout for the options defined in an array */
    if ($begin_table) {
        ?>
<div>
<table class="optiontable" style="margin-top:6px;">
<?php 
    }
    foreach ($weaverx_olist as $value) {
        $value['type'] = weaverx_fix_type($value['type']);
        switch ($value['type']) {
            case 'align':
                weaverx_form_align($value);
                break;
            case 'break':
                weaverx_form_break($value);
                break;
            case 'checkbox':
                weaverx_form_checkbox($value);
                break;
            case 'ctext':
                weaverx_form_ctext($value);
                break;
            case 'color':
                weaverx_form_color($value);
                break;
            case 'custom_css':
                weaverx_custom_css($value);
                break;
            case 'endheader':
                echo '<!-- end header -->';
                break;
            case 'fi_align':
                weaverx_form_fi_align($value);
                break;
            case 'fi_location':
                weaverx_from_fi_location($value);
                break;
            case 'fi_location_post':
                weaverx_from_fi_location($value, true);
                break;
            case 'fixedtop':
                weaverx_form_fixedtop($value);
                break;
            case 'header':
                weaverx_form_header($value);
                break;
            case 'header_area':
                weaverx_form_header_area($value);
                break;
            case 'header0':
                weaverx_form_header($value, true);
                break;
            case 'inactive':
                weaverx_form_inactive($value);
                break;
            case 'link':
                weaverx_form_link($value);
                break;
            case 'menu_opts':
                weaverx_form_menu_opts($value, false);
                break;
            case 'menu_opts_submit':
                weaverx_form_menu_opts($value, true);
                break;
            case 'note':
                weaverx_form_note($value);
                break;
            case 'radio':
                weaverx_form_radio($value);
                break;
            case 'rounded':
                weaverx_form_rounded($value);
                break;
            case 'select_hide':
                weaverx_form_select_hide($value);
                break;
            case 'select_id':
                weaverx_form_select_id($value);
                break;
            case 'select_layout':
                weaverx_form_select_layout($value);
                break;
            case 'shadows':
                weaverx_form_shadows($value);
                break;
            case 'subheader':
                weaverx_form_subheader($value);
                break;
            case 'subheader_alt':
                weaverx_form_subheader_alt($value);
                break;
            case 'submit':
                weaverx_form_submit($value);
                break;
            case 'text':
            case 'widetext':
                weaverx_form_text($value);
                break;
            case 'text_xy':
                weaverx_form_text_xy($value);
                break;
            case 'text_xy_em':
                weaverx_form_text_xy($value, 'X', 'Y', 'em');
                break;
            case 'text_xy_percent':
                weaverx_form_text_xy($value, 'X', 'Y', '%');
                break;
            case 'text_tb':
                weaverx_form_text_xy($value, 'T', 'B');
                break;
            case 'text_lr':
                weaverx_form_text_xy($value, 'L', 'R');
                break;
            case 'text_lr_em':
                weaverx_form_text_xy($value, 'L', 'R', 'em');
                break;
            case 'text_lr_percent':
                weaverx_form_text_xy($value, 'L', 'R', '%');
                break;
            case 'textarea':
                weaverx_form_textarea($value);
                break;
            case 'titles':
                weaverx_form_text_props($value, 'titles');
                break;
            case 'titles_area':
                weaverx_form_text_props($value, 'area');
                break;
            case 'titles_content':
                weaverx_form_text_props($value, 'content');
                break;
            case 'titles_menu':
                weaverx_form_text_props($value, 'menu');
                break;
            case 'titles_text':
                weaverx_form_text_props($value, 'text');
                break;
            case 'val_num':
                weaverx_form_val($value, '');
                break;
            case 'val_percent':
                weaverx_form_val($value, '%');
                break;
            case 'val_px':
                weaverx_form_val($value, 'px');
                break;
            case 'val_em':
                weaverx_form_val($value, 'em');
                break;
            case 'widget_area':
                weaverx_form_widget_area($value, false);
                break;
            case 'widget_area_submit':
                weaverx_form_widget_area($value, true);
                break;
            default:
                weaverx_form_subheader_alt($value);
                break;
        }
    }
    if ($end_table) {
        ?>
</table></div> <!-- close previous tab div -->
	<br />
<?php 
    }
}