Exemplo n.º 1
0
    static function bizzthemes_editor()
    {
        $custom_editor = new bizz_custom_editor();
        ?>

<div id="bizz_options" class="wrap<?php 
        if (get_bloginfo('text_direction') == 'rtl') {
            echo ' rtl';
        }
        ?>
">
<?php 
        // options header
        bizzthemes_options_header($options_title = 'Custom Editor', $toggle = false);
        // filesystem: START
        // ---------------
        $url = wp_nonce_url('admin.php?page=bizz-editor');
        $form_fields = array('custom_file_submit');
        // this is a list of the form field contents I want passed along between page views
        $method = '';
        // Normally you leave this an empty string and it figures it out by itself, but you can override the filesystem method here
        if (false === ($creds = request_filesystem_credentials($url, $method, false, false, $form_fields))) {
            // if we get here, then we don't have credentials yet,
            // but have just produced a form for the user to fill in,
            // so stop processing for now
            return true;
            // stop the normal page form from displaying
        }
        // now we have some credentials, try to get the wp_filesystem running
        if (!WP_Filesystem($creds)) {
            // our credentials were no good, ask the user for them again
            request_filesystem_credentials($url, $method, true, false, $form_fields);
            return true;
        }
        // by this point, the $wp_filesystem global should be working, so let's use it to create a file
        global $wp_filesystem;
        // ---------------
        // filesystem: END
        // save
        if (isset($_GET['save']) && $_GET['save'] == 'true') {
            if (!current_user_can('edit_theme_options')) {
                wp_die(__('Easy there, homey. You don&#8217;t have admin privileges to access theme options.', 'bizzthemes'));
            }
            if (isset($_POST['custom_file_submit'])) {
                $contents = stripslashes($_POST['newcontent']);
                // Get new custom content
                $file = $_POST['file'];
                // Which file?
                $allowed_files = $custom_editor->get_custom_files();
                // Get list of allowed files
                if (!in_array($file, $allowed_files)) {
                    // Is the file allowed? If not, get outta here!
                    wp_die(__('You have attempted to modify an ineligible file. Only files within the BizzThemes <code>/custom</code> folder may be modified via this interface. Thank you.', 'bizzthemes'));
                }
                $file_path = BIZZ_LIB_CUSTOM . '/' . $file;
                if (!$wp_filesystem->put_contents($file_path, $contents)) {
                    return false;
                }
                $updated = '&updated=true';
                // Display updated message
            }
            if (isset($_POST['custom_file_jump'])) {
                $file = $_POST['custom_files'];
                $updated = '';
            }
        }
        if (file_exists(BIZZ_LIB_CUSTOM)) {
            // Determine which file we're editing. Default to something harmless, like custom.css.
            $file = isset($_GET['file']) ? $_GET['file'] : 'custom.css';
            $files = $custom_editor->get_custom_files();
            $extension = substr($file, strrpos($file, '.'));
            // Determine if the custom file exists and is writable. Otherwise, this page is useless.
            $error = $custom_editor->is_custom_writable($file, $files);
            if ($error) {
                echo $error;
            } else {
                // Get contents of custom.css
                if (filesize(BIZZ_LIB_CUSTOM . '/' . $file) > 0) {
                    $content = $wp_filesystem->get_contents(BIZZ_LIB_CUSTOM . '/' . $file);
                    $content = htmlspecialchars($content);
                } else {
                    $content = '';
                }
            }
            ?>

<div class="one_col">
	<h3><?php 
            printf(__('Currently editing: <code>%s</code>', 'bizzthemes'), "custom/{$file}");
            ?>
</h3>
	<p>
<?php 
            if ($extension == '.php') {
                echo "\t\t\t<div class=\"updated below-h2\"><p>" . __('<strong>Note:</strong> Make sure you have <acronym title="File Transfer Protocol">FTP</acronym> server access, before you start modifying <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> files. Bad code will make your site temporarily unusable.', 'bizzthemes') . "</p></div>\n";
            }
            if (isset($_GET['save'])) {
                echo "\t\t\t<div class=\"updated below-h2\"><p>" . __('File successfully updated.', 'bizzthemes') . "</p></div>\n";
            }
            ?>

	<h2 class="nav-tab-wrapper">
<?php 
            foreach ($files as $f) {
                // An option for each available file
                $selected = $f == $file ? ' nav-tab-active' : '';
                ?>

			<a class="nav-tab<?php 
                echo $selected;
                ?>
" href="<?php 
                echo admin_url("admin.php?page=bizz-editor&file={$f}");
                ?>
" title="Edit <?php 
                echo $f;
                ?>
"><?php 
                echo $f;
                ?>
</a>
<?php 
            }
            ?>

	</h2>
	</p>
		
	    <form class="file_editor" method="post" id="template" name="template" action="<?php 
            echo admin_url("admin.php?page=bizz-editor&file={$file}&save=true");
            ?>
">
			<input type="hidden" id="file" name="file" value="<?php 
            echo $file;
            ?>
" />
			<p><textarea id="newcontent" name="newcontent" rows="25" cols="50" class="large-text editor-area"><?php 
            echo $content;
            ?>
</textarea></p>
			<p>
				<input type="submit" class="button button-primary" id="custom_file_submit" name="custom_file_submit" value="<?php 
            _e('Save', 'bizzthemes');
            ?>
" />
			</p>
		</form>
		
</div>
<?php 
        } else {
            // echo '<div id="message" class="updated"><p>Rename your <code>custom-sample</code> folder to <code>custom</code>, otherwise theme will not work properly.</p></div>'."\n";
        }
        // options footer
        bizzthemes_options_footer();
        ?>

</div>
<?php 
    }
Exemplo n.º 2
0
/**
 * ADMIN OPTIONS
 *
 * output admin options
 * @since 7.0
 */
function bizzthemes_options()
{
    global $options, $design, $frame;
    // declare options variables
    if ($_GET['page'] == 'bizzthemes') {
        $options = $options;
        $bizz_page = __('Framework Settings', 'bizzthemes');
    } elseif ($_GET['page'] == 'bizz-design') {
        $options = $design;
        $bizz_page = __('Design Options', 'bizzthemes');
    }
    // options header
    bizzthemes_options_header($bizz_page, $toggle = true);
    foreach ($options as $value) {
        if (isset($value['type'])) {
            switch ($value['type']) {
                case 'text':
                    option_wrapper_header($value);
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value" type="<?php 
                    echo $value['type'];
                    ?>
" value="<?php 
                    echo stripslashes(stripslashes($val));
                    ?>
" />
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'select':
                    option_wrapper_header($value);
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<select class="select_input" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value">
<?php 
                    if (isset($value['show_option_none']) && $value['show_option_none'] == true) {
                        echo "<option value=''>" . __('-- None --', 'bizzthemes') . "</option>\n";
                    }
                    foreach ($value['options'] as $option) {
                        if ($val == $option) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $option . "\">" . $option . "</option>\n";
                    }
                    ?>

					</select>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'select_by_id':
                    option_wrapper_header($value);
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<select class="select_input" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value">
<?php 
                    if ($value['show_option_none'] == true) {
                        echo "<option value=''>" . __('-- None --', 'bizzthemes') . "</option>\n";
                    } elseif ($value['show_option_all'] == true) {
                        echo "<option value=''>" . __('-- All --', 'bizzthemes') . "</option>\n";
                    }
                    foreach ($value['options'] as $key => $option) {
                        if ($val == $option) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $option . "\">" . $key . "</option>\n";
                    }
                    ?>

					</select>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'menu_select':
                    option_wrapper_header($value);
                    $nav_menus = wp_get_nav_menus();
                    $nav_menu_selected_id = $nav_menus[0]->term_id;
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<select class="select_input" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value">
<?php 
                    foreach ((array) $nav_menus as $key => $_nav_menu) {
                        $_nav_menu->truncated_name = trim(wp_html_excerpt($_nav_menu->name, 40));
                        if ($_nav_menu->truncated_name != $_nav_menu->name) {
                            $_nav_menu->truncated_name .= '&hellip;';
                        }
                        $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
                        if ($val == esc_attr($_nav_menu->term_id)) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        ?>

								<option value="<?php 
                        echo esc_attr($_nav_menu->term_id);
                        ?>
" <?php 
                        echo $selected;
                        ?>
>
									<?php 
                        echo esc_html($_nav_menu->truncated_name);
                        ?>

								</option>
<?php 
                    }
                    ?>

					</select>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'upload':
                    option_wrapper_header($value);
                    $id = $value['id'];
                    $std = $value['std']['value'];
                    $uploader = '';
                    $val = '';
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<div id="upload-wrap">
						<div class="upload_button" id="<?php 
                    echo $id;
                    ?>
"><?php 
                    _e('Choose File', 'bizzthemes');
                    ?>
</div>
						<input class="upload_text_input" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value" type="text" value="<?php 
                    echo $val;
                    ?>
" />
<?php 
                    if (!empty($val)) {
                        ?>

							<a class="img-preview" href="<?php 
                        echo $val;
                        ?>
">
							<img id="image_<?php 
                        echo $id;
                        ?>
" src="<?php 
                        echo $val;
                        ?>
" width="10" height="10" title="Image Preview" alt="Image Preview" />
							</a>
<?php 
                    }
                    ?>

						<div class="clear"><!----></div>
					</div>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'textarea':
                    option_wrapper_header($value);
                    if (isset($value['wysiwyg']) && $value['wysiwyg'] != '') {
                        $wysiwyg = $value['wysiwyg'];
                    } else {
                        $wysiwyg = $value['id'];
                    }
                    if (isset($value['cols']) && $value['cols'] != '') {
                        $cols = $value['cols'];
                    } else {
                        $cols = '50';
                    }
                    if (isset($value['rows']) && $value['rows'] != '') {
                        $rows = $value['rows'];
                    } else {
                        $rows = '8';
                    }
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<textarea name="<?php 
                    echo $value['id'];
                    ?>
[value]" class="<?php 
                    echo $wysiwyg;
                    ?>
" id="<?php 
                    echo $wysiwyg;
                    ?>
" cols="<?php 
                    echo $cols;
                    ?>
" rows="<?php 
                    echo $rows;
                    ?>
"><?php 
                    echo stripslashes($val);
                    ?>
</textarea>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "radio":
                    option_wrapper_header($value);
                    $std = $value['std']['value'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['value']) ? $GLOBALS['opt'][$value['id']]['value'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['value']) ? $GLOBALS['optd'][$value['id']]['value'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    $counting = 0;
                    foreach ($value['options'] as $key => $option) {
                        $counting++;
                        $checked = '';
                        if ($val == $key) {
                            $checked = ' checked';
                        } else {
                            $checked = '';
                        }
                        ?>

					<input class="input_checkbox" type="radio" name="<?php 
                        echo $value['id'];
                        ?>
[value]" id="<?php 
                        echo $value['id']['value'] . '_' . $counting;
                        ?>
" value="<?php 
                        echo $key;
                        ?>
" <?php 
                        echo $checked;
                        ?>
 />&nbsp;
					<label for="<?php 
                        echo $value['id']['value'] . '_' . $counting;
                        ?>
"><?php 
                        echo $option;
                        ?>
</label><br />
					<input class="text_input" name="<?php 
                        echo $value['id'];
                        ?>
[css]" id="<?php 
                        echo $value['id'];
                        ?>
_css" type="hidden" value="<?php 
                        echo stripslashes(stripslashes($value['std']['css']));
                        ?>
" />
<?php 
                    }
                    option_wrapper_footer($value);
                    break;
                case "checkbox":
                    option_wrapper_header($value);
                    if (isset($GLOBALS['opt'][$value['id']]['value']) && $GLOBALS['opt'][$value['id']]['value'] || isset($GLOBALS['optd'][$value['id']]['value']) && $GLOBALS['optd'][$value['id']]['value'] || isset($value['std']['value']) && $value['std']['value'] && isset($GLOBALS['opt'][$value['id']]['value'])) {
                        $val = 'true';
                    } else {
                        $val = '';
                    }
                    $checked = '';
                    $checked = $val == 'true' ? ' checked' : '';
                    $disabled = isset($value['disabled']) ? $value['disabled'] : '';
                    ?>

					<input <?php 
                    echo $disabled;
                    ?>
 class="input_checkbox" type="checkbox" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value" value="true" <?php 
                    echo $checked;
                    ?>
 />
					<label for="<?php 
                    echo $value['id'];
                    ?>
_value"><?php 
                    echo $value['label'];
                    ?>
</label><br />
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "checkbox2":
                    option_wrapper_header($value);
                    if (isset($GLOBALS['opt'][$value['id']]['value'])) {
                        $checked = "checked=\"checked\"";
                    } elseif (isset($GLOBALS['optd'][$value['id']]['value'])) {
                        $checked = "checked=\"checked\"";
                    } else {
                        $checked = "";
                    }
                    $disabled = isset($value['disabled']) ? $value['disabled'] : '';
                    ?>

					<input <?php 
                    echo $disabled;
                    ?>
 class="input_checkbox" type="checkbox" name="<?php 
                    echo $value['id'];
                    ?>
[value]" id="<?php 
                    echo $value['id'];
                    ?>
_value" value="true" <?php 
                    echo $checked;
                    ?>
 />&nbsp;
					<label for="<?php 
                    echo $value['id'];
                    ?>
_value"><?php 
                    echo $value['label'];
                    ?>
</label><br />
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "multisort":
                    $vid = $value['id']['value'];
                    if ($GLOBALS['opt'][$value['id']]['value'] != '') {
                        $array1 = $GLOBALS['opt'][$value['id']]['value'];
                        $array2 = $value['options'];
                        $sort_array1 = array_intersect_key($array1, $array2);
                        $sort_array2 = array_diff_key($array1, $array2);
                        $count_a1 = count($sort_array1);
                        // count same array keys
                        $count_a2 = count($array2);
                        // count std arrays
                        if ($count_a1 == $count_a2) {
                            $sort_array = $sort_array1;
                            $opto = 'false';
                        } else {
                            $sort_array = $array2;
                            $opto = 'true';
                        }
                    } else {
                        $sort_array = $value['options'];
                        $opto = 'true';
                    }
                    foreach ($sort_array as $key => $value) {
                        $pn_key = $vid . '_' . $key;
                        $chk_std = $value['show'];
                        $chk_sav = isset($GLOBALS['opt'][$vid . '_' . $key]) ? true : '';
                        $chk_sav2 = isset($GLOBALS['opt'][$vid . '_' . $key]) ? true : '';
                        $checked = '';
                        if (!empty($chk_sav)) {
                            if ($chk_sav == 'true') {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = '';
                            }
                        } elseif (!empty($chk_sav2)) {
                            if ($chk_sav == 'true') {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = '';
                            }
                        } elseif ($chk_std == 'true') {
                            $checked = "checked=\"checked\"";
                        } else {
                            $checked = '';
                        }
                        $opt_name = $value;
                        // get option full name
                        if ($opto == 'true') {
                            $opt_name = $value['name'];
                        } else {
                            $opt_name = $value;
                        }
                        // get option full name
                        ?>

					<div class="list_item">
					<input class="input_checkbox" type="checkbox" name="<?php 
                        echo $pn_key;
                        ?>
" id="<?php 
                        echo $pn_key;
                        ?>
" value="true" <?php 
                        echo $checked;
                        ?>
 />&nbsp;
					<label for="<?php 
                        echo $pn_key;
                        ?>
"><?php 
                        echo $opt_name;
                        ?>
&nbsp;&nbsp;<small style='color:#aaaaaa'>id=<?php 
                        echo $key;
                        ?>
</small></label><br />
					<input type="hidden" name="<?php 
                        echo $vid;
                        ?>
[<?php 
                        echo $key;
                        ?>
]" value="<?php 
                        echo $opt_name;
                        ?>
" />
					</div>
					<input class="text_input" name="<?php 
                        echo $value['id'];
                        ?>
[css]" id="<?php 
                        echo $value['id'];
                        ?>
_css" type="hidden" value="<?php 
                        echo stripslashes(stripslashes($value['std']['css']));
                        ?>
" />
<?php 
                    }
                    // end foreach
                    break;
                case "typography":
                    option_wrapper_header($value);
                    // font-family
                    $font_stacks = bizz_get_fonts();
                    $std = $value['std']['font-family'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['font-family']) ? $GLOBALS['opt'][$value['id']]['font-family'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['font-family']) ? $GLOBALS['optd'][$value['id']]['font-family'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q6" name="<?php 
                    echo $value['id'];
                    ?>
[font-family]" id="<?php 
                    echo $value['id'];
                    ?>
_font-family">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">Inherit</option>\n";
                    foreach ($font_stacks as $font_key => $font) {
                        if ($val == $font_key) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        $web_safe = $font['web_safe'] ? ' *' : '';
                        $goog_font = $font['google'] ? ' <small>G</small>' : '';
                        echo "<option " . $selected . " value=\"" . $font_key . "\">" . $font['name'] . $web_safe . '' . $goog_font . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // font-weight
                    $options_weight = array("normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900");
                    $std = $value['std']['font-weight'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['font-weight']) ? $GLOBALS['opt'][$value['id']]['font-weight'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['font-weight']) ? $GLOBALS['optd'][$value['id']]['font-weight'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q7" name="<?php 
                    echo $value['id'];
                    ?>
[font-weight]" id="<?php 
                    echo $value['id'];
                    ?>
_font-weight">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- weight --</option>\n";
                    foreach ($options_weight as $weight) {
                        if ($val == $weight) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $weight . "\">" . $weight . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // font-size
                    $std = $value['std']['font-size'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['font-size']) ? $GLOBALS['opt'][$value['id']]['font-size'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['font-size']) ? $GLOBALS['optd'][$value['id']]['font-size'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q3" name="<?php 
                    echo $value['id'];
                    ?>
[font-size]" id="<?php 
                    echo $value['id'];
                    ?>
_font-size">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- size --</option>\n";
                    for ($i = 7; $i < 71; $i++) {
                        $val == $i ? $selected = ' selected="selected"' : ($selected = '');
                        echo "<option{$selected} value=\"" . $i . "px\">" . $i . "px</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
				<span class="opt-spacing"><!----></span>
<?php 
                    // font-variant
                    $options_variant = array("normal", "small-caps");
                    $std = $value['std']['font-variant'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['font-variant']) ? $GLOBALS['opt'][$value['id']]['font-variant'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['font-variant']) ? $GLOBALS['optd'][$value['id']]['font-variant'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q2" name="<?php 
                    echo $value['id'];
                    ?>
[font-variant]" id="<?php 
                    echo $value['id'];
                    ?>
_font-variant">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- variant --</option>\n";
                    foreach ($options_variant as $variant) {
                        if ($val == $variant) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $variant . "\">" . $variant . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // font-style
                    $options_style = array("normal", "italic", "oblique");
                    $std = $value['std']['font-style'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['font-style']) ? $GLOBALS['opt'][$value['id']]['font-style'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['font-style']) ? $GLOBALS['optd'][$value['id']]['font-style'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q3" name="<?php 
                    echo $value['id'];
                    ?>
[font-style]" id="<?php 
                    echo $value['id'];
                    ?>
_font-style">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- style --</option>\n";
                    foreach ($options_style as $style) {
                        if ($val == $style) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $style . "\">" . $style . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // font-color
                    $std = $value['std']['color'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['color']) ? $GLOBALS['opt'][$value['id']]['color'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['color']) ? $GLOBALS['optd'][$value['id']]['color'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<input class="text_q color {hash:true,caps:false,required:false}" type="text" name="<?php 
                    echo $value['id'];
                    ?>
[color]" id="<?php 
                    echo $value['id'];
                    ?>
" value="<?php 
                    echo $val;
                    ?>
" />
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "border":
                    option_wrapper_header($value);
                    // border-color
                    $position = $value['std']['border-position'];
                    $std = $value['std']['border-color'];
                    $sav = isset($GLOBALS['opt'][$value['id']][$position . '-color']) ? $GLOBALS['opt'][$value['id']][$position . '-color'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']][$position . '-color']) ? $GLOBALS['optd'][$value['id']][$position . '-color'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<input class="text_q q8 color {hash:true,caps:false,required:false}" name="<?php 
                    echo $value['id'];
                    ?>
[<?php 
                    echo $position;
                    ?>
-color]" id="<?php 
                    echo $value['id'];
                    ?>
_color" type="text" value="<?php 
                    echo $val;
                    ?>
" />
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // border-width
                    $position = $value['std']['border-position'];
                    $std = $value['std']['border-width'];
                    $sav = isset($GLOBALS['opt'][$value['id']][$position . '-width']) ? $GLOBALS['opt'][$value['id']][$position . '-width'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']][$position . '-width']) ? $GLOBALS['optd'][$value['id']][$position . '-width'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q3" name="<?php 
                    echo $value['id'];
                    ?>
[<?php 
                    echo $position;
                    ?>
-width]" id="<?php 
                    echo $value['id'];
                    ?>
_border-width">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- width --</option>\n";
                    for ($i = 0; $i < 30; $i++) {
                        $val == $i && $val != '' ? $selected = ' selected="selected"' : ($selected = '');
                        echo "<option{$selected} value=\"" . $i . "px\">" . $i . "px</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // border-style
                    $position = $value['std']['border-position'];
                    $options_style = array("solid", "dashed", "dotted", "double", "groove", "ridge", "inset", "outset");
                    $std = $value['std']['border-style'];
                    $sav = isset($GLOBALS['opt'][$value['id']][$position . '-style']) ? $GLOBALS['opt'][$value['id']][$position . '-style'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']][$position . '-style']) ? $GLOBALS['optd'][$value['id']][$position . '-style'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q9" name="<?php 
                    echo $value['id'];
                    ?>
[<?php 
                    echo $position;
                    ?>
-style]" id="<?php 
                    echo $value['id'];
                    ?>
-style">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- style --</option>\n";
                    foreach ($options_style as $style) {
                        if ($val == $style) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $style . "\">" . $style . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "bgproperties":
                    option_wrapper_header($value);
                    // bg-image
                    $id = $value['id'];
                    $std = $value['std']['background-image'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['background-image']) ? $GLOBALS['opt'][$value['id']]['background-image'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['background-image']) ? $GLOBALS['optd'][$value['id']]['background-image'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

					<div id="upload-wrap">
						<div class="upload_button" id="<?php 
                    echo $id;
                    ?>
"><?php 
                    _e('Choose File', 'bizzthemes');
                    ?>
</div>
						<input class="upload_text_input" name="<?php 
                    echo $value['id'];
                    ?>
[background-image]" id="<?php 
                    echo $value['id'];
                    ?>
_value" type="text" value="<?php 
                    echo $val;
                    ?>
" />
						<?php 
                    if (!empty($val)) {
                        ?>

							<a class="img-preview" href="<?php 
                        echo $val;
                        ?>
">
							<img id="image_<?php 
                        echo $id;
                        ?>
" src="<?php 
                        echo $val;
                        ?>
" width="10" height="10" title="Image Preview" alt="Image Preview" />
							</a>
						<?php 
                    }
                    ?>

						<div class="clear"><!----></div>
					</div>
					<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
					
				<span class="opt-spacing"><!----></span>
<?php 
                    // bg-color
                    $std = $value['std']['background-color'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['background-color']) ? $GLOBALS['opt'][$value['id']]['background-color'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['background-color']) ? $GLOBALS['optd'][$value['id']]['background-color'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<input class="text_q q8 color {hash:true,caps:false,required:false}" type="text" name="<?php 
                    echo $value['id'];
                    ?>
[background-color]" id="<?php 
                    echo $value['id'];
                    ?>
" value="<?php 
                    echo $val;
                    ?>
" />
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // bg-repeat
                    $options_style = array("repeat", "repeat-x", "repeat-y", "no-repeat");
                    $std = $value['std']['background-repeat'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['background-repeat']) ? $GLOBALS['opt'][$value['id']]['repeat'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['background-repeat']) ? $GLOBALS['optd'][$value['id']]['background-repeat'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q3" name="<?php 
                    echo $value['id'];
                    ?>
[background-repeat]" id="<?php 
                    echo $value['id'];
                    ?>
_repeat">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- repeat --</option>\n";
                    foreach ($options_style as $repeat) {
                        if ($val == $repeat) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $repeat . "\">" . $repeat . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    // bg-position
                    $options_style = array("top left", "top center", "top right", "center left", "center center", "center right", "bottom left", "bottom center", "bottom right");
                    $std = $value['std']['background-position'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['background-position']) ? $GLOBALS['opt'][$value['id']]['background-position'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['background-position']) ? $GLOBALS['optd'][$value['id']]['background-position'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<select class="select_q q9" name="<?php 
                    echo $value['id'];
                    ?>
[background-position]" id="<?php 
                    echo $value['id'];
                    ?>
_position">
<?php 
                    $selected = !$std ? ' selected="selected"' : '';
                    echo "<option{$selected} value=\"\">-- position --</option>\n";
                    foreach ($options_style as $position) {
                        if ($val == $position) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo "<option " . $selected . " value=\"" . $position . "\">" . $position . "</option>\n";
                    }
                    ?>

				</select>
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "color":
                    option_wrapper_header($value);
                    $std = $value['std']['color'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['color']) ? $GLOBALS['opt'][$value['id']]['color'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['color']) ? $GLOBALS['optd'][$value['id']]['color'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<input class="text_q q8 color {hash:true,caps:false,required:false}" type="text" name="<?php 
                    echo $value['id'];
                    ?>
[color]" id="<?php 
                    echo $value['id'];
                    ?>
_color"  value="<?php 
                    echo $val;
                    ?>
" />
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case "background-color":
                    option_wrapper_header($value);
                    $std = $value['std']['background-color'];
                    $sav = isset($GLOBALS['opt'][$value['id']]['background-color']) ? $GLOBALS['opt'][$value['id']]['background-color'] : '';
                    $sav2 = isset($GLOBALS['optd'][$value['id']]['background-color']) ? $GLOBALS['optd'][$value['id']]['background-color'] : '';
                    if ($sav != "") {
                        $val = $sav;
                    } elseif ($sav2 != "") {
                        $val = $sav2;
                    } else {
                        $val = $std;
                    }
                    ?>

				<input class="text_q q8 color {hash:true,caps:false,required:false}" type="text" name="<?php 
                    echo $value['id'];
                    ?>
[background-color]" id="<?php 
                    echo $value['id'];
                    ?>
_background-color" value="<?php 
                    echo $val;
                    ?>
" />
				<input class="text_input" name="<?php 
                    echo $value['id'];
                    ?>
[css]" id="<?php 
                    echo $value['id'];
                    ?>
_css" type="hidden" value="<?php 
                    echo stripslashes(stripslashes($value['std']['css']));
                    ?>
" />
<?php 
                    option_wrapper_footer($value);
                    break;
                case 'help':
                    option_wrapper_header3($value);
                    echo '<div><!----></div>' . "\n";
                    option_wrapper_footer3($value);
                    break;
                case "heading":
                    echo '<div class="box-title">' . $value['name'] . '</div>' . "\n";
                    echo '<div class="fr submit submit-title">' . "\n";
                    echo '<input name="save" class="button" type="submit" value="' . __('Save changes', 'bizzthemes') . '" />' . "\n";
                    // echo '<input type="hidden" name="bizz_save" value="save" />'."\n";
                    echo '</div>' . "\n";
                    break;
                case "subheadingtop":
                    echo '<div class="feature-box">' . "\n";
                    echo '<div class="subheading">' . "\n";
                    if ($value['toggle'] != "") {
                        echo '<a class="toggle" href="" title="Show/hide additional information"><span class="pos">&nbsp;</span><span class="neg">&nbsp;</span>' . $value['name'] . '</a>';
                    }
                    echo '</div>' . "\n";
                    echo '<div class="options-box">' . "\n";
                    break;
                case "subheadingbottom":
                    echo '</div>' . "\n";
                    // end options-box
                    echo '</div>' . "\n";
                    // end feature-box
                    break;
                case "wraptop":
                    echo '<div class="table-row"><div class="text"><div class="wrap-dropdown">' . "\n";
                    break;
                case "wrapbottom":
                    echo '</div></div></div>' . "\n";
                    break;
                case "upc_top":
                    echo '<div class="table-row upc-top"><div class="text"><div class="upc-wrap">' . "\n";
                    break;
                case "upc_bottom":
                    echo '</div></div></div>' . "\n";
                    break;
                case "upc_addremove":
                    echo '<div class="addremove"><span class="add" title="Add new item">Add [&#43;]</span> <span class="remove" title="Remove this item">Remove [&#45;]</span></div>' . "\n";
                    break;
                case "sorttop":
                    echo '<div class="table-row"><div class="text"><div id="sortme" class="wrap-dropdown sortable">' . "\n";
                    break;
                case "sortbottom":
                    echo '</div></div></div>' . "\n";
                    break;
                case "maintabletop":
                    echo '<div class="maintable">' . "\n";
                    break;
                case "maintablebottom":
                    echo '</div>' . "\n";
                    break;
                case "maintablebreak":
                    echo '<div class="break"><!----></div>' . "\n";
                    break;
                default:
                    break;
            }
            #end switch
        }
    }
    #foreach
    // options footer
    bizzthemes_options_footer();
}
Exemplo n.º 3
0
function bizzthemes_framework_update_page()
{
    global $bizz_package, $themeid, $frameversion, $bloghomeurl;
    /* WP Filesystem
    	------------------------------------*/
    $method = get_filesystem_method();
    if (isset($_POST['password'])) {
        $cred = $_POST;
        $filesystem = WP_Filesystem($cred);
    } elseif (isset($_POST['bizz_ftp_cred'])) {
        $cred = unserialize(base64_decode($_POST['bizz_ftp_cred']));
        $filesystem = WP_Filesystem($cred);
    } else {
        $filesystem = WP_Filesystem();
    }
    /* URL redirect
    	------------------------------------*/
    $url = admin_url('admin.php?page=bizz-update');
    echo "\t<div class=\"wrap themes-page\">\n";
    // options header
    bizzthemes_options_header($options_title = 'Version Control', $toggle = false);
    if ($filesystem == false) {
        request_filesystem_credentials($url);
    } elseif ($bizz_package == 'ZnJlZQ==') {
        echo "\t\t<span style=\"display:none\">" . $method . "</span>\n";
        // CONNECTION ALERT
        echo "\t\t<h2>" . __('Updates Control Panel', 'bizzthemes') . "</h2>\n";
        echo "\t\t\t<div class=\"error below-h2\"><p>" . sprintf(__('To use automatic framework updating system, please <a href="%s/wp-admin/admin.php?page=bizz-license">Upgrade to Standard or Agency Theme Package</a>.'), site_url()) . "</p></div>\n";
        // options footer
        bizzthemes_options_footer();
    } elseif (is_child_theme()) {
        echo 'Your are using the child theme that needs to be manually maintained.';
    } else {
        echo "\t\t<span style=\"display:none\">" . $method . "</span>\n";
        echo "\t\t<form method=\"post\"  enctype=\"multipart/form-data\" id=\"bizzform\" action=\"\">\n";
        wp_nonce_field('update-options');
        // THEME UPDATES
        echo "\t\t<h2>" . __('Theme Update Control', 'bizzthemes') . "</h2>\n";
        if (function_exists('wp_get_theme')) {
            $this_theme_data = wp_get_theme();
            $this_theme_version = $this_theme_data->Version;
        } else {
            $this_theme_data = get_theme_data(TEMPLATEPATH . '/style.css');
            $this_theme_version = $this_theme_data['Version'];
        }
        $remote_changelog = 'http://demo.bizzthemes.com/' . strtolower($themeid) . '/wp-content/themes/' . strtolower($themeid) . '/lib_theme/changelog.txt';
        $remote_theme = 'http://bizzthemes.com/files/' . strtolower($themeid) . '.zip';
        $remote_theme_version = get_transient('remote_t_version_' . $themeid);
        echo "\t\t\t<ul class=\"file-download\">\n";
        echo "\t\t\t<li>Your theme version: <b>{$this_theme_version}</b></li>\n";
        echo "\t\t\t<li>Current theme version: <b>{$remote_theme_version}</b></li>\n";
        echo "\t\t\t</ul>\n";
        if ($remote_theme_version != 'Currently Unavailable') {
            echo "\t\t\t<ul class=\"file-download\">\n";
            echo "\t\t\t<li><a href=\"{$remote_changelog}\" class=\"button\">View Theme Changelog</a></li>\n";
            echo "\t\t\t</ul>\n";
        }
        $this_theme_version = trim(str_replace('.', '', $this_theme_version));
        $remote_theme_version = trim(str_replace('.', '', $remote_theme_version));
        if (strlen($this_theme_version) == 2) {
            $this_theme_version = $this_theme_version . '0';
        }
        if (strlen($remote_theme_version) == 2) {
            $remote_theme_version = $remote_theme_version . '0';
        }
        if ($this_theme_version < $remote_theme_version && $remote_theme_version != 'Currently Unavailable') {
            echo "\t\t\t<div class=\"error below-h2\"><p>" . __('Theme update is available.', 'bizzthemes') . "</p></div>\n";
            echo "\t\t\t<p>" . __('To update your theme go through following steps:', 'bizzthemes') . "</p>\n";
            echo "\t\t\t<ol class=\"file-download\">\n";
            echo "\t\t\t<li>" . __('Backup your old theme files and database (preferably via FTP).', 'bizzthemes') . "</li>\n";
            echo "\t\t\t<li>" . __('Make sure your definitely backup &#8217;custom&#8217; folder in root theme directory.', 'bizzthemes') . "</li>\n";
            echo "\t\t\t<li>" . __('Update all theme files by clicking the button bellow.', 'bizzthemes') . "</li>\n";
            echo "\t\t\t<li>" . __('That&#8217;s it!', 'bizzthemes') . "</li>\n";
            echo "\t\t\t</ol>\n";
            echo '<input type="submit" class="button" name=\\"bizz_update_theme\\" value="' . __('Update Theme', 'bizzthemes') . '" onclick="return confirm(\'' . __('Old theme files will be lost! Click OK to proceed.', 'bizzthemes') . '\');" />' . "\n";
            echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_theme\" value=\"upgrade\" />\n";
            echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_save\" value=\"save\" />\n";
            echo "\t\t\t<input type=\"hidden\" name=\"bizz_ftp_cred\" value=\"" . base64_encode(serialize($_POST)) . "\" />\n";
        } else {
            if ($remote_theme_version != 'Currently Unavailable') {
                echo "\t\t\t<div class=\"updated below-h2\"><p>" . __('You are using the latest theme version.', 'bizzthemes') . "</p></div>\n";
            }
            // FRAMEWORK UPDATES
            echo "\t\t<h2>" . __('Framework Update Control', 'bizzthemes') . "</h2>\n";
            $localversion = $frameversion;
            $remoteversion = get_transient('remote_f_version_' . $themeid);
            $fw_remote_changelog = 'http://www.bizzthemes.com/framework/changelog.txt';
            $fw_remote_frame = 'http://www.bizzthemes.com/framework/lib_frame.zip';
            echo "\t\t\t<ul class=\"file-download\">\n";
            echo "\t\t\t<li>Your frame version: <b>{$localversion}</b></li>\n";
            echo "\t\t\t<li>Current frame version: <b>{$remoteversion}</b></li>\n";
            echo "\t\t\t</ul>\n";
            echo "\t\t\t<ul class=\"file-download\">\n";
            echo "\t\t\t<li><a href=\"{$fw_remote_changelog}\" class=\"button\">View Framework Changelog</a></li>\n";
            echo "\t\t\t</ul>\n";
            $localversion = trim(str_replace('.', '', $localversion));
            $remoteversion = trim(str_replace('.', '', $remoteversion));
            if (strlen($localversion) == 2) {
                $localversion = $localversion . '0';
            }
            if (strlen($remoteversion) == 2) {
                $remoteversion = $remoteversion . '0';
            }
            if ($localversion == $remoteversion) {
                echo '<input class="button" type="submit" value="' . __('Re-install Frame', 'bizzthemes') . '" onclick="return confirm(\'' . __('Old theme files will be lost! Click OK to proceed.', 'bizzthemes') . '\');" />' . "\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_save\" value=\"save\" />\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_frame\" value=\"upgrade\" />\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_ftp_cred\" value=\"" . base64_encode(serialize($_POST)) . "\" />\n";
                echo "\t\t\t<a class=\"button\" href=\"{$fw_remote_frame}\">" . __('Download', 'bizzthemes') . "</a>\n";
                echo "\t\t\t<br/><br/>\n";
            }
            if ($localversion < $remoteversion) {
                echo "\t\t\t<div class=\"error below-h2\"><p>" . __('Framework update is available.', 'bizzthemes') . "</p></div>\n";
                echo "\t\t\t<p>" . __('To update your theme framework go through following steps:', 'bizzthemes') . "</p>\n";
                echo "\t\t\t<ol class=\"file-download\">\n";
                echo "\t\t\t<li>" . __('Backup your old theme files and database.', 'bizzthemes') . "</li>\n";
                echo "\t\t\t<li>" . __('Update all files in lib_frame folder with new ones by clicking the button bellow.', 'bizzthemes') . "</li>\n";
                echo "\t\t\t<li>" . __('That&#8217;s it!', 'bizzthemes') . "</li>\n";
                echo "\t\t\t</ol>\n";
                echo "\t\t\t<input class=\"button\" type=\"submit\" value=\"Update Framework\" />\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_save\" value=\"save\" />\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_frame\" value=\"upgrade\" />\n";
                echo "\t\t\t<input type=\"hidden\" name=\"bizz_ftp_cred\" value=\"" . base64_encode(serialize($_POST)) . "\" />\n";
            } else {
                echo "\t\t\t<div class=\"updated below-h2\"><p>" . __('You are using the latest framework version.', 'bizzthemes') . "</p></div>\n";
            }
        }
        echo "\t\t</form>\n";
    }
    // options footer
    bizzthemes_options_footer();
    echo "\t</div>\n";
}
Exemplo n.º 4
0
function bizzthemes_layout()
{
    global $wpdb, $wp_version, $wp_registered_widget_updates, $wp_registered_sidebars, $wp_registered_widgets, $bizz_package, $sidebars_widgets;
    // Permissions Check
    if (!current_user_can('edit_theme_options')) {
        wp_die(__('Cheatin&#8217; uh?', 'bizzthemes'));
    }
    // WordPress Administration Widgets API
    load_template(ABSPATH . 'wp-admin/includes/widgets.php');
    // These are the widgets grouped by sidebar
    /*
    $sidebars_widgets = wp_get_sidebars_widgets();
    if ( empty( $sidebars_widgets ) )
    	$sidebars_widgets = wp_get_widget_defaults();
    */
    // Show inactive widgets
    $user = get_current_user_id();
    $screenopt = get_user_meta($user, 'templates_screen_options', true);
    // Mobile
    if (wp_is_mobile()) {
        wp_enqueue_script('jquery-touch-punch');
    }
    // Do sidebar action
    do_action('sidebar_admin_setup');
    // options header
    bizzthemes_options_header($options_title = __('Template Builder', 'bizzthemes'), $toggle = false);
    if (isset($messages)) {
        foreach ($messages as $message) {
            echo $message . "\n";
        }
    }
    // register the inactive_widgets area as sidebar
    register_sidebar(array('name' => __('Inactive Widgets', 'bizzthemes'), 'id' => 'wp_inactive_widgets', 'class' => 'inactive-sidebar', 'description' => __('Drag widgets here to remove them from the sidebar but keep their settings.', 'bizzthemes'), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', 'grid' => ''));
    if (function_exists('retrieve_widgets')) {
        retrieve_widgets();
    }
    do_action('widgets_admin_page');
    ?>

	<div class="manage-templates manage-menus<?php 
    if (!isset($_REQUEST['tab'])) {
        echo ' disabled';
    }
    ?>
">
		<div class="label-templates"><?php 
    _e('Select a template to edit:', 'bizzthemes');
    ?>
</div>
		<div class="select-templates">
			<a href="#" class="dropdown-toggle menu-select">
				<span dir="ltr"><?php 
    echo bizz_tabs_active();
    ?>
</span>
				<span class="templates-toggle"></span>
			</a>
			<div class="dropdown-menu menu-tabs">
				<?php 
    bizz_tabs_list();
    ?>

			</div>
		</div>
		<a href="#" class="bizzhelp templates-help" onclick="return template_help_toggle();">?</a>
	</div>
	<div id="widget-frame" class="clearfix">
	<div class="widget-liquid-left<?php 
    if (!isset($_REQUEST['tab'])) {
        echo ' liquid-left-disabled';
    }
    ?>
">
	<div id="widgets-left">
		<div id="available-widgets" class="widgets-holder-wrap">
			<div class="sidebar-name">
			   <div class="sidebar-name-arrow"><br /></div>
			   <h3><?php 
    _e('Available Widgets', 'bizzthemes');
    ?>
 <span id="removing-widget"><?php 
    _e('Deactivate', 'bizzthemes');
    ?>
 <span></span></span></h3>
			</div>
			<div class="widget-holder">
				<p class="description">
					<?php 
    _e('Drag widgets from here to a template on the right to activate them. Drag widgets back here to deactivate them and delete their settings.', 'bizzthemes');
    ?>

				</p>
				<div id="widget-list">
					<?php 
    wp_list_widgets();
    ?>

				</div>
				<br class='clear' />
			</div>
		</div>
<?php 
    if (isset($screenopt['inactive_widgets'])) {
        foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) {
            if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) {
                $wrap_class = 'widgets-holder-wrap closed';
                if (!empty($registered_sidebar['class'])) {
                    $wrap_class .= ' sidebar-' . $registered_sidebar['class'];
                }
                ?>


				<div id="inactive-widgets" class="<?php 
                echo esc_attr($wrap_class);
                ?>
">
					<div class="sidebar-name">
						<div class="sidebar-name-arrow"><br /></div>
						<h3><?php 
                echo esc_html($registered_sidebar['name']);
                ?>

							<span class="spinner"></span>
						</h3>
					</div>
					<div class="widget-holder inactive">
						<?php 
                wp_list_widget_controls($sidebar);
                ?>

						<br class="clear" />
					</div>
				</div>
<?php 
            }
        }
    }
    ?>

	</div>
	</div>
	<div class="widget-liquid-right<?php 
    if (!isset($_REQUEST['tab'])) {
        echo ' liquid-right-disabled';
    }
    ?>
">
	<div id="widgets-right">
		<div id="post-body-content" class="meta-box-sortables">
			<div class="metabox-holder sortme<?php 
    if (!isset($_REQUEST['tab'])) {
        echo ' sortme-disabled';
    }
    ?>
">
<?php 
    // conditions and items (administration tabs)
    isset($_REQUEST['condition']) ? $bizz_condition = $_REQUEST['condition'] : ($bizz_condition = 'is_index');
    isset($_REQUEST['id']) ? $bizz_item = $_REQUEST['id'] : ($bizz_item = 'all');
    isset($_REQUEST['tab']) ? $bizz_tab = $_REQUEST['tab'] : ($bizz_tab = 'is_index');
    isset($_REQUEST['subtab']) ? $bizz_subtab = $_REQUEST['subtab'] : ($bizz_subtab = 'all');
    isset($_REQUEST['subtabsub']) ? $bizz_subtabsub = $_REQUEST['subtabsub'] : ($bizz_subtabsub = 'all');
    // define condition logic
    $condition_logic['bizz_tab'] = $bizz_tab;
    $condition_logic['bizz_subtab'] = $bizz_subtab;
    $condition_logic['bizz_subtabsub'] = $bizz_subtabsub;
    $condition_logic['bizz_condition'] = $bizz_condition;
    $condition_logic['bizz_item'] = $bizz_item;
    // bake condition and item
    echo "\t<input type=\"hidden\" class=\"cond_item\" name=\"empty\" value=\"empty\" />\n";
    echo "\t<input type=\"hidden\" class=\"cond_item\" name=\"condition\" value=\"{$bizz_condition}\" />\n";
    echo "\t<input type=\"hidden\" class=\"cond_item\" name=\"item\" value=\"{$bizz_item}\" />\n";
    echo "\t<input type=\"hidden\" class=\"cond_item\" name=\"empty\" value=\"empty\" />\n";
    echo "\t<input type=\"hidden\" class=\"empty_parent\" name=\"empty\" value=\"empty\" />\n";
    echo "\t<input type=\"hidden\" class=\"is_parent\" name=\"parent\" value=\"true\" />\n";
    echo "\t<input type=\"hidden\" class=\"not_parent\" name=\"parent\" value=\"false\" />\n";
    echo "\t<input type=\"hidden\" class=\"cond_item\" name=\"empty\" value=\"empty\" />\n";
    echo "\t<input type=\"hidden\" class=\"empty_parent\" name=\"empty\" value=\"empty\" />\n";
    echo "\t<input type=\"hidden\" class=\"is_enabled\" name=\"show\" value=\"true\" />\n";
    echo "\t<input type=\"hidden\" class=\"not_enabled\" name=\"show\" value=\"false\" />\n";
    $widget_logic = bizz_frame_widget_logic($condition_logic);
    #widget logic
    // print_r($widget_logic);
    // print_r('<br/><br/>');
    $grid_logic = bizz_frame_grid_logic($condition_logic);
    #grid logic
    // print_r($grid_logic);
    // print_r('<br/><br/>');
    $main_area_exists = array_key_exists("main_area", $grid_logic) ? true : false;
    #main area exists?
    // loop through registred grids
    $i = 0;
    foreach ($grid_logic as $container => $registered_container) {
        $closed = ' closed';
        if ($main_area_exists && $registered_container['id'] == 'main_area' && $registered_container['show'] == 'true') {
            $next = $i;
        } elseif ($main_area_exists && $registered_container['id'] == 'main_area' && $registered_container['show'] == 'false') {
            $next = $i + 1;
        } elseif (!$main_area_exists) {
            $next = 0;
        }
        // close
        if (isset($next) && $next == $i) {
            $closed = '';
        }
        // show
        if ($registered_container['show'] == 'true') {
            $box = ' enabled-box';
            $taction = __('Disable', 'bizzthemes');
            $show = 'true';
            # show grid
        } elseif (!isset($_REQUEST['tab'])) {
            $box = ' enabled-box';
            $taction = __('Disable', 'bizzthemes');
            $show = 'true';
            # show grid
        } else {
            $box = ' disabled-box closed';
            $taction = __('Enable', 'bizzthemes');
            $show = 'false';
            # hide grid
        }
        // hide enable/disable for first builder page
        if (!isset($_REQUEST['tab'])) {
            $taction = '';
        }
        ?>
													
				<div class="postbox container-area<?php 
        echo $box . $closed;
        ?>
">
					<div class="sidebar-name-arrow container-arrow" title="<?php 
        _e('Click to toggle', 'bizzthemes');
        ?>
"><br /></div>
					<h3 class="container-name">
						<span class="label"><?php 
        echo esc_html($registered_container['name']);
        ?>
</span>
						<span class="current"><?php 
        _e('disabled', 'bizzthemes');
        ?>
</span>
						<span class="spinner"></span>
						<span class="title-action"><a href="#"><?php 
        echo $taction;
        ?>
</a></span>
					</h3>
					<div class="widget-holder">
					<div class="row-fluid">
<?php 
        bizz_grid_tree($registered_container['grids']);
        ?>

					</div><!-- END .row-fluid -->
					</div><!-- END .widget-holder -->
					
					<input type="hidden" class="accepted" name="<?php 
        echo $registered_container['id'];
        ?>
[id]" value="<?php 
        echo $registered_container['id'];
        ?>
" />
					<input type="hidden" class="accepted" name="<?php 
        echo $registered_container['id'];
        ?>
[name]" value="<?php 
        echo $registered_container['name'];
        ?>
" />
					<input type="hidden" class="accepted" name="<?php 
        echo $registered_container['id'];
        ?>
[show]" value="<?php 
        echo $show;
        ?>
" />
					<input type="hidden" class="accepted" name="<?php 
        echo $registered_container['id'];
        ?>
[condition]" value="<?php 
        isset($_REQUEST['condition']) ? esc_attr_e($_REQUEST['condition']) : esc_attr_e('is_index');
        ?>
" />
					<input type="hidden" class="accepted" name="<?php 
        echo $registered_container['id'];
        ?>
[item]" value="<?php 
        isset($_REQUEST['id']) ? esc_attr_e($_REQUEST['id']) : esc_attr_e('all');
        ?>
" />
				
				</div><!-- END .container-area -->
<?php 
        $i++;
    }
    ?>

			</div><!-- /.metabox-holder -->
		</div><!-- /#post-body-content -->
	</div>
	</div>
	</div>
	<form action="" method="post"><?php 
    wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false);
    ?>
</form>
	<div class="clear"><!----></div>
	<?php 
    if (isset($_REQUEST['tab'])) {
        ?>

	<div id="bcollapse-menu" class="hide-if-no-js clearfix"><div id="bcollapse-button"><div></div></div><span><?php 
        esc_html_e('Collapse menu', 'bizzthemes');
        ?>
</span></div>
	<?php 
    }
    ?>

	<br />
<?php 
    // options footer
    bizzthemes_options_footer();
    do_action('sidebar_admin_page');
}
Exemplo n.º 5
0
function bizzthemes_license_page()
{
    $theme_api = bizzthemes_license_api();
    echo "\t<div class=\"wrap themes-page\">\n";
    // options header
    bizzthemes_options_header($options_title = 'License Control', $toggle = false);
    echo "\t<h2>" . __('License API Key', 'bizzthemes') . "</h2>\n";
    echo "\t\t<form method=\"post\"  enctype=\"multipart/form-data\" id=\"bizzform\" action=\"\">\n";
    wp_nonce_field('update-options');
    if (!isset($theme_api) || $theme_api['valid'] != 'true') {
        echo "\t\t\t<div class=\"error below-h2\"><p>" . __('Validate theme API key and open all of your themes potential.', 'bizzthemes') . "</p></div>\n";
        echo "\t\t\t<p><input id=\"key\" name=\"key\" type=\"text\" size=\"45\" maxlength=\"45\" value=\"\" /> (<a href=\"http://bizzthemes.com/pricing/\" id=\"license-what\">What is this?</a>)</p>\n";
        echo "\t\t\t<input class=\"button\" type=\"submit\" value=\"Validate API key\" />\n";
    } else {
        $key_val = isset($theme_api['api']) ? $theme_api['api'] : '';
        echo "\t\t\t<div class=\"updated below-h2\"><p>" . __('Your API key has been successfully validated.', 'bizzthemes') . "</p></div>\n";
        echo "\t\t\t<p><input id=\"key\" name=\"key\" type=\"text\" size=\"45\" maxlength=\"45\" value=\"{$key_val}\" /></p>\n";
        echo "\t\t\t<input class=\"button\" type=\"submit\" value=\"Update API key\" />\n";
    }
    echo "\t\t\t<input type=\"hidden\" name=\"bizz_update_save\" value=\"save\" />\n";
    echo "\t\t</form>\n";
    // options footer
    bizzthemes_options_footer();
    echo "\t</div>\n";
}