Example #1
0
 function businesspro_options()
 {
     // VARIABLES
     $themename = wp_get_theme(get_stylesheet_directory_uri());
     $themename = $themename['Name'];
     $shortname = "of";
     // Populate OptionsFramework option in array for use in theme
     global $businesspro_options;
     $businesspro_options = businesspro_get_option('businesspro_options');
     //Front page on/off
     $file_rename = array("on" => "On", "off" => "Off");
     // Background Defaults
     $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
     // Pull all the categories into an array
     $options_categories = array();
     $options_categories_obj = get_categories();
     foreach ($options_categories_obj as $category) {
         $options_categories[$category->cat_ID] = $category->cat_name;
     }
     // Populate OptionsFramework option in array for use in theme
     $testimonial = array("on" => "On", "off" => "Off");
     $home_page_blog = array("on" => "On", "off" => "Off");
     $sign_up_section = array("on" => "On", "off" => "Off");
     // Pull all the pages into an array
     $options_pages = array();
     $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
     $options_pages[''] = 'Select a page:';
     foreach ($options_pages_obj as $page) {
         $options_pages[$page->ID] = $page->post_title;
     }
     // If using image radio buttons, define a directory path
     $imagepath = get_stylesheet_directory_uri() . '/images/';
     /* ---------------------------------------------------------------------------- */
     /* General Setting */
     /* ---------------------------------------------------------------------------- */
     $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 221px Wide by 84px Height.", "id" => "businesspro_logo", "type" => "upload"), array("name" => "Home Page Top Right Cell Info", "desc" => "Enter your text for home page top right cell info.", "id" => "businesspro_topright_cell", "std" => "", "type" => "textarea"), array("name" => "Home Page Top Right Contact Info", "desc" => "Enter your text for home page top right contact info.", "id" => "businesspro_topright_text", "std" => "", "type" => "textarea"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "businesspro_favicon", "type" => "upload"), array("name" => "Home Top Feature", "type" => "heading"), array("name" => "Home Top Feature Image", "desc" => "Choose your image for first slider. Optimal size is 950px wide and 390px height.", "id" => "businesspro_slideimage1", "std" => "", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter your text heading for first slider.", "id" => "businesspro_sliderheading1", "std" => "", "type" => "textarea"), array("name" => "Home Top Feature Link URL", "desc" => "Enter your link url for first Slider section.", "id" => "businesspro_Sliderlink1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Enter your text description for first slider.", "id" => "businesspro_sliderdes1", "std" => "", "type" => "textarea"), array("name" => "Home Top Feature Image1", "desc" => "Choose your image for second slider. Optimal size is 950px wide and 390px height.", "id" => "businesspro_slideimage2", "std" => "", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter your text heading for second slider.", "id" => "businesspro_sliderheading2", "std" => "", "type" => "textarea"), array("name" => "Home Top Feature Link URL", "desc" => "Enter your link url for second slider section.", "id" => "businesspro_Sliderlink2", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Enter your text description for second slider.", "id" => "businesspro_sliderdes2", "std" => "", "type" => "textarea"), array("name" => "Home Top Feature Image2", "desc" => "Choose your image for third slider. Optimal size is 950px wide and 390px height.", "id" => "businesspro_slideimage3", "std" => "", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter your text heading for third slider.", "id" => "businesspro_sliderheading3", "std" => "", "type" => "textarea"), array("name" => "Home Top Feature Link URL", "desc" => "Enter your link url for third Slider section.", "id" => "businesspro_Sliderlink3", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Enter your text description for third slider.", "id" => "businesspro_sliderdes3", "std" => "", "type" => "textarea"), array("name" => "Homepage Settings", "type" => "heading"), array("name" => "Home Page Heading", "desc" => "Enter your heading text for home page", "id" => "businesspro_mainheading", "std" => "", "type" => "textarea"), array("name" => "Home Page Feature Content", "type" => "saperate", "class" => "saperator"), array("name" => "First Feature Heading", "desc" => "Enter your heading for first Feature area", "id" => "businesspro_headline1", "std" => "", "type" => "textarea"), array("name" => "First Feature Image", "desc" => "Choose image for your first Feature area. Optimal size 158px x 165px", "id" => "businesspro_wimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Content", "desc" => "Enter your content for first Feature area", "id" => "businesspro_feature1", "std" => "", "type" => "textarea"), array("name" => "First Feature Link", "desc" => "Enter your link for first Feature area", "id" => "businesspro_link1", "std" => "", "type" => "text"), array("name" => "Second Feature Heading", "desc" => "Enter your heading for second Feature area", "id" => "businesspro_headline2", "std" => "", "type" => "textarea"), array("name" => "Second Feature Image", "desc" => "Choose image for your second Feature area. Optimal size 158px x 165px", "id" => "businesspro_fimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Content", "desc" => "Enter your content for second feature area", "id" => "businesspro_feature2", "std" => "", "type" => "textarea"), array("name" => "Second Feature Link", "desc" => "Enter your link for second Feature area", "id" => "businesspro_link2", "std" => "", "type" => "text"), array("name" => "Third Feature Heading", "desc" => "Enter your heading for third Feature area", "id" => "businesspro_headline3", "std" => "", "type" => "textarea"), array("name" => "Third Feature Image", "desc" => "Choose image for your thrid Feature. Optimal size 158px x 165px", "id" => "businesspro_fimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Content", "desc" => "Enter your content for third Feature area", "id" => "businesspro_feature3", "std" => "", "type" => "textarea"), array("name" => "Third Feature Link", "desc" => "Enter your link for third feature area", "id" => "businesspro_link3", "std" => "", "type" => "text"), array("name" => "Social Logos", "type" => "heading"), array("name" => "Facebook URL", "desc" => "Enter your Facebook URL if you have one", "id" => "businesspro_facebook", "std" => "#", "type" => "text"), array("name" => "Twitter URL", "desc" => "Enter your Twitter URL if you have one", "id" => "businesspro_twitter", "std" => "#", "type" => "text"), array("name" => "LinkedIn URL", "desc" => "Enter your LinkedIn URL if you have one", "id" => "businesspro_linked", "std" => "#", "type" => "text"), array("name" => "RSS Feed URL", "desc" => "Enter your RSS Feed URL if you have one", "id" => "businesspro_rss", "std" => "#", "type" => "text"), array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some Custom CSS to your theme by adding it to this block.", "id" => "businesspro_customcss", "std" => "", "type" => "textarea"));
     businesspro_update_option('of_template', $options);
     businesspro_update_option('of_themename', $themename);
     businesspro_update_option('of_shortname', $shortname);
 }
Example #2
0
function of_option_setup()
{
    //Update EMPTY options
    $of_array = array();
    add_option('of_options', $of_array);
    $template = businesspro_get_option('of_template');
    $saved_options = businesspro_get_option('of_options');
    $std = '';
    foreach ($template as $option) {
        if ($option['type'] != 'heading') {
            if (isset($option['id'])) {
                $id = $option['id'];
            }
            if (isset($option['std'])) {
                $std = $option['std'];
            }
            $db_option = businesspro_get_option($id);
            if (empty($db_option)) {
                if (is_array($option['type'])) {
                    foreach ($option['type'] as $child) {
                        $c_id = $child['id'];
                        $c_std = $child['std'];
                        businesspro_update_option($c_id, $c_std);
                        $of_array[$c_id] = $c_std;
                    }
                } else {
                    businesspro_update_option($id, $std);
                    $of_array[$id] = $std;
                }
            } else {
                //So just store the old values over again.
                $of_array[$id] = $db_option;
            }
        }
    }
    businesspro_update_option('of_options', $of_array);
}
Example #3
0
function businesspro_ajax_callback()
{
    global $wpdb;
    // this is how you get access to the database
    $save_type = $_POST['type'];
    //Uploads
    if ($save_type == 'upload') {
        $clickedID = $_POST['data'];
        // Acts as the name
        $filename = $_FILES[$clickedID];
        $filename['name'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', $filename['name']);
        $override['test_form'] = false;
        $override['action'] = 'wp_handle_upload';
        $uploaded_file = wp_handle_upload($filename, $override);
        $upload_tracking[] = $clickedID;
        businesspro_update_option($clickedID, $uploaded_file['url']);
        if (!empty($uploaded_file['error'])) {
            echo 'Upload Error: ' . $uploaded_file['error'];
        } else {
            echo $uploaded_file['url'];
        }
        // Is the Response
    } elseif ($save_type == 'image_reset') {
        $id = $_POST['data'];
        // Acts as the name
        businesspro_delete_option($id);
    } elseif ($save_type == 'options' or $save_type == 'framework') {
        $data = $_POST['data'];
        parse_str($data, $output);
        //print_r($output);
        //Pull options
        $options = businesspro_get_option('of_template');
        foreach ($options as $option_array) {
            $id = $option_array['id'];
            $old_value = businesspro_get_option($id);
            $new_value = '';
            if (isset($output[$id])) {
                $new_value = $output[$option_array['id']];
            }
            if (isset($option_array['id'])) {
                // Non - Headings...
                $type = $option_array['type'];
                if (is_array($type)) {
                    foreach ($type as $array) {
                        if ($array['type'] == 'text') {
                            $id = $array['id'];
                            $std = $array['std'];
                            $new_value = $output[$id];
                            if ($new_value == '') {
                                $new_value = $std;
                            }
                            businesspro_update_option($id, stripslashes($new_value));
                        }
                    }
                } elseif ($new_value == '' && $type == 'checkbox') {
                    // Checkbox Save
                    businesspro_update_option($id, 'false');
                } elseif ($new_value == 'true' && $type == 'checkbox') {
                    // Checkbox Save
                    businesspro_update_option($id, 'true');
                } elseif ($type == 'multicheck') {
                    // Multi Check Save
                    $option_options = $option_array['options'];
                    foreach ($option_options as $options_id => $options_value) {
                        $multicheck_id = $id . "_" . $options_id;
                        if (!isset($output[$multicheck_id])) {
                            businesspro_update_option($multicheck_id, 'false');
                        } else {
                            businesspro_update_option($multicheck_id, 'true');
                        }
                    }
                } elseif ($type == 'typography') {
                    $typography_array = array();
                    $typography_array['size'] = $output[$option_array['id'] . '_size'];
                    $typography_array['face'] = stripslashes($output[$option_array['id'] . '_face']);
                    $typography_array['style'] = $output[$option_array['id'] . '_style'];
                    $typography_array['color'] = $output[$option_array['id'] . '_color'];
                    businesspro_update_option($id, $typography_array);
                } elseif ($type == 'border') {
                    $border_array = array();
                    $border_array['width'] = $output[$option_array['id'] . '_width'];
                    $border_array['style'] = $output[$option_array['id'] . '_style'];
                    $border_array['color'] = $output[$option_array['id'] . '_color'];
                    businesspro_update_option($id, $border_array);
                } elseif ($type != 'upload_min') {
                    businesspro_update_option($id, stripslashes($new_value));
                }
            }
        }
    }
    die;
}