Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Loader)
- *
- * @ Version : 2.0.0.3
- * @ Author : DeZender
- * @ Release on : 06.05.2013
- * @ Official site : http://DeZender.Net
- *
- */
- function of_head() {
- do_action("of_head");
- return null;
- }
- function of_style_path() {
- $style = $_REQUEST["style"];
- if ($style != "")
- {
- $style_path = $style;
- }
- else
- {
- $stylesheet = get_option("of_alt_stylesheet");
- $style_path = str_replace(".css", "", $stylesheet);
- }
- if ($style_path == "default")
- {
- echo "images";
- return null;
- }
- echo "styles/" . $style_path;
- return null;
- }
- function of_option_setup() {
- $of_array = array();
- add_option("of_options", $of_array);
- $template = get_option("of_template");
- $saved_options = get_option("of_options");
- foreach ($template as $option)
- {
- if (!($option["type"] != "heading"))
- {
- continue;
- }
- $id = $option["id"];
- $std = $option["std"];
- $db_option = 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"];
- update_option($c_id, $c_std);
- $of_array[$c_id] = $c_std;
- continue;
- }
- continue;
- }
- update_option($id, $std);
- $of_array[$id] = $std;
- continue;
- }
- $of_array[$id] = $db_option;
- continue;
- }
- update_option("of_options", $of_array);
- return null;
- }
- function fabrikapanel_admin_head() {
- echo " ";
- echo "<s";
- echo "cript type=\"text/javascript\">\r
- jQuery(function(){\r
- var message = '<p><a href=\"";
- echo admin_url("admin.php?page=fabrikapanel");
- echo "\">Yönetim panelinden</a> tema ayarlarınızı yapabilirsiniz.</p>';\r
- jQuery('.themes-php #message2').html(message);\r
- \r
- });\r
- </script>\r
- ";
- return null;
- }
- function fabrikapanel_add_admin() {
- global $query_string;
- $themename = get_option("of_themename");
- $shortname = get_option("of_shortname");
- if (isset($_REQUEST["page"]) && $_REQUEST["page"] == "fabrikapanel")
- {
- if (isset($_REQUEST["of_save"]) && "reset" == $_REQUEST["of_save"])
- {
- $options = get_option("of_template");
- of_reset_options($options, "fabrikapanel");
- header("Location: admin.php?page=fabrikapanel&reset=true");
- exit();
- }
- }
- $of_page = add_menu_page($themename, "TEMA AYARLARI", "edit_theme_options", "fabrikapanel", "fabrikapanel_options_page", get_bloginfo("template_url") . "/admin/images/panel.png");
- add_action('' . "admin_print_scripts-" . $of_page, "of_load_only");
- add_action('' . "admin_print_styles-" . $of_page, "of_style_only");
- return null;
- }
- function of_reset_options($options, $page = "") {
- global $wpdb;
- $query_inner = "";
- $count = 0;
- $excludes = array("blogname", "blogdescription");
- foreach ($options as $option)
- {
- if (!isset($option["id"]))
- {
- continue;
- }
- $count++;
- $option_id = $option["id"];
- $option_type = $option["type"];
- if (in_array($option_id, $excludes))
- {
- continue;
- }
- if (1 < $count)
- {
- $query_inner .= " OR ";
- }
- if ($option_type == "multicheck")
- {
- $multicount = 0;
- foreach ($option["options"] as $option_key => $option_option)
- {
- $multicount++;
- if (1 < $multicount)
- {
- $query_inner .= " OR ";
- }
- $query_inner .= "option_name = '" . $option_id . "_" . $option_key . "'";
- continue;
- }
- continue;
- }
- if (is_array($option_type))
- {
- $type_array_count = 0;
- foreach ($option_type as $inner_option)
- {
- $type_array_count++;
- $option_id = $inner_option["id"];
- if (1 < $type_array_count)
- {
- $query_inner .= " OR ";
- }
- $query_inner .= '' . "option_name = '" . $option_id . "'";
- continue;
- }
- continue;
- }
- $query_inner .= '' . "option_name = '" . $option_id . "'";
- continue;
- }
- if ($page == "fabrikapanel")
- {
- $query_inner .= " OR option_name = 'of_options'";
- }
- $query = '' . "DELETE FROM " . $wpdb->options . " WHERE " . $query_inner;
- $wpdb->query($query);
- return null;
- }
- function fabrikapanel_options_page() {
- $options = get_option("of_template");
- $themename = get_option("of_themename");
- echo "\r
- \r
- <div style=\"float:left; width:800px; height:150px; margin:20px 0px 20px 10px; padding:0px 0px 20px 0px; border-bottom: 1px solid #999;\">\r
- <iframe src=\"http://www.temafabrika.com/demo/bilgi.html\" width=\"800\" height=\"150\" frameborder=\"0\" scrolling=\"no\"></iframe>\r
- </div>\r
- \r
- <div class=\"clear\"></div>\r
- \r
- \r
- <div class=\"wrap\" id=\"of_container\">\r
- <div id=\"of-popup-save\" class=\"of-save-popup\">\r
- <div class";
- echo "=\"of-save-save\">Ayarlar Güncellendi</div>\r
- </div>\r
- <div id=\"of-popup-reset\" class=\"of-save-popup\">\r
- <div class=\"of-save-reset\">Ayarlar Sıfırlandı</div>\r
- </div>\r
- <form action=\"\" enctype=\"multipart/form-data\" id=\"ofform\">\r
- <div id=\"header\">\r
- <div class=\"logo\">\r
- <h2>";
- echo $themename;
- echo "</h2>\r
- </div>\r
- <div class=\"icon-option\"> </div>\r
- <div class=\"clear\"></div>\r
- </div>\r
- ";
- $return = fabrikapanel_machine($options);
- echo " <div id=\"main\">\r
- <div id=\"of-nav\">\r
- <ul>\r
- ";
- echo $return[1];
- echo " </ul>\r
- </div>\r
- <div id=\"content\"> ";
- echo $return[0];
- echo " </div>\r
- <div class=\"clear\"></div>\r
- </div>\r
- <div class=\"save_bar_top\">\r
- <img style=\"display:none\" src=\"";
- echo bloginfo("stylesheet_directory");
- echo "/admin/images/loading-bottom.gif\" class=\"ajax-loading-img ajax-loading-img-bottom\" alt=\"Working...\" />\r
- <input type=\"submit\" value=\"Ayarları Kaydet\" class=\"button-primary\" />\r
- </form>\r
- <form action=\"";
- echo esc_attr($_SERVER["REQUEST_URI"]);
- echo "\" method=\"post\" style=\"display:inline;\" id=\"ofform-reset\">\r
- ";
- echo "<s";
- echo "pan class=\"submit-footer-reset\">\r
- <input name=\"reset\" type=\"submit\" value=\"Ayarları Sıfırla\" class=\"button submit-button reset-button\" onclick=\"return confirm('Tüm ayarlar sıfırlansınmı?');\" />\r
- <input type=\"hidden\" name=\"of_save\" value=\"reset\" />\r
- </span>\r
- </form>\r
- </div>\r
- ";
- if (!empty($update_message))
- {
- echo $update_message;
- }
- echo "<div style=\"clear:both;\"></div>\r
- </div>\r
- \r
- <!--wrap-->\r
- ";
- return null;
- }
- function of_style_only() {
- wp_enqueue_style("admin-style", OF_DIRECTORY . "/admin/admin-style.css");
- wp_enqueue_style("color-picker", OF_DIRECTORY . "/admin/css/colorpicker.css");
- return null;
- }
- function of_load_only() {
- add_action("admin_head", "of_admin_head");
- wp_enqueue_script("jquery-ui-core");
- wp_register_script("jquery-input-mask", OF_DIRECTORY . "/admin/js/jquery.maskedinput-1.2.2.js", array("jquery"));
- wp_enqueue_script("jquery-input-mask");
- wp_enqueue_script("color-picker", OF_DIRECTORY . "/admin/js/colorpicker.js", array("jquery"));
- wp_enqueue_script("ajaxupload", OF_DIRECTORY . "/admin/js/ajaxupload.js", array("jquery"));
- return null;
- }
- function of_admin_head() {
- echo " \r
- ";
- echo "<s";
- echo "cript type=\"text/javascript\" language=\"javascript\">\r
- \r
- jQuery(document).ready(function(){\r
- \r
- // Race condition to make sure js files are loaded\r
- if (typeof AjaxUpload != 'function') { \r
- return ++counter < 6 && window.setTimeout(init, counter * 500);\r
- }\r
- \r
- //Color Picker\r
- ";
- $options = get_option("of_template");
- foreach ($options as $option)
- {
- if (!((($option["type"] == "color") && $option["type"] == "typography") && $option["type"] == "border"))
- {
- continue;
- }
- if (($option["type"] == "typography") && $option["type"] == "border")
- {
- $option_id = $option["id"];
- $temp_color = get_option($option_id);
- $option_id = $option["id"] . "_color";
- $color = $temp_color["color"];
- }
- else
- {
- $option_id = $option["id"];
- $color = get_option($option_id);
- }
- echo " jQuery('#";
- echo $option_id;
- echo "_picker').children('div').css('backgroundColor', '";
- echo $color;
- echo "'); \r
- jQuery('#";
- echo $option_id;
- echo "_picker').ColorPicker({\r
- color: '";
- echo $color;
- echo "',\r
- onShow: function (colpkr) {\r
- jQuery(colpkr).fadeIn(500);\r
- return false;\r
- },\r
- onHide: function (colpkr) {\r
- jQuery(colpkr).fadeOut(500);\r
- return false;\r
- },\r
- onChange: function (hsb, hex, rgb) {\r
- //jQuery(this).css('border','1px solid red');\r
- jQuery('#";
- echo $option_id;
- echo "_picker').children('div').css('backgroundColor', '#' + hex);\r
- jQuery('#";
- echo $option_id;
- echo "_picker').next('input').attr('value','#' + hex);\r
- \r
- }\r
- });\r
- ";
- continue;
- }
- echo " \r
- });\r
- \r
- </script>\r
- \r
- ";
- echo "<s";
- echo "cript type=\"text/javascript\">\r
- jQuery(document).ready(function(){\r
- \r
- var flip = 0;\r
- \r
- jQuery('#expand_options').click(function(){\r
- if(flip == 0){\r
- flip = 1;\r
- jQuery('#of_container #of-nav').hide();\r
- jQuery('#of_container #content').width(755);\r
- jQuery('#of_container .group').add('#of_container .group h2').show();\r
- \r
- jQuery(this).text('[-]');\r
- \r
- ";
- echo " } else {\r
- flip = 0;\r
- jQuery('#of_container #of-nav').show();\r
- jQuery('#of_container #content').width(595);\r
- jQuery('#of_container .group').add('#of_container .group h2').hide();\r
- jQuery('#of_container .group:first').show();\r
- jQuery('#of_container #of-nav li').removeClass('current');\r
- jQuery('#of_container #of-nav li:first').addClass('current');\r
- \r
- jQu";
- echo "ery(this).text('[+]');\r
- \r
- }\r
- \r
- });\r
- \r
- jQuery('.group').hide();\r
- jQuery('.group:first').fadeIn();\r
- \r
- jQuery('.group .collapsed').each(function(){\r
- jQuery(this).find('input:checked').parent().parent().parent().nextAll().each( \r
- function(){\r
- if (jQuery(this).hasClass('last')) {\r
- jQuery(this).removeClass('hidden');\r
- ";
- echo " return false;\r
- }\r
- jQuery(this).filter('.hidden').removeClass('hidden');\r
- });\r
- });\r
- \r
- jQuery('.group .collapsed input:checkbox').click(unhideHidden);\r
- \r
- function unhideHidden(){\r
- if (jQuery(this).attr('checked')) {\r
- jQuery(this).parent().parent().parent().nextAll().removeClass('hidden');\r
- ";
- echo " }\r
- else {\r
- jQuery(this).parent().parent().parent().nextAll().each( \r
- function(){\r
- if (jQuery(this).filter('.last').length) {\r
- jQuery(this).addClass('hidden');\r
- return false;\r
- }\r
- jQuery(this).addClass('hidden');\r
- });\r
- \r
- }\r
- }\r
- \r
- jQuery('.of-radio-img-img')";
- echo ".click(function(){\r
- jQuery(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');\r
- jQuery(this).addClass('of-radio-img-selected');\r
- \r
- });\r
- jQuery('.of-radio-img-label').hide();\r
- jQuery('.of-radio-img-img').show();\r
- jQuery('.of-radio-img-radio').hide();\r
- jQuery('#of-nav li:first').addClass('current');\r
- jQuery('#of-nav li a').cl";
- echo "ick(function(evt){\r
- \r
- jQuery('#of-nav li').removeClass('current');\r
- jQuery(this).parent().addClass('current');\r
- \r
- var clicked_group = jQuery(this).attr('href');\r
- \r
- jQuery('.group').hide();\r
- \r
- jQuery(clicked_group).fadeIn();\r
- \r
- evt.preventDefault();\r
- \r
- });\r
- \r
- if('";
- if (isset($_REQUEST["reset"]))
- {
- echo $_REQUEST["reset"];
- }
- else
- {
- echo "false";
- }
- echo "' == 'true'){\r
- \r
- var reset_popup = jQuery('#of-popup-reset');\r
- reset_popup.fadeIn();\r
- window.setTimeout(function(){\r
- reset_popup.fadeOut(); \r
- }, 2000);\r
- //alert(response);\r
- \r
- }\r
- \r
- //Update Message popup\r
- jQuery.fn.center = function () {\r
- this.animate({\"top\":( jQuery(window).height() - this.height() - 200 ) / 2+";
- echo "jQuery(window).scrollTop() + \"px\"},100);\r
- this.css(\"left\", 250 );\r
- return this;\r
- }\r
- \r
- \r
- jQuery('#of-popup-save').center();\r
- jQuery('#of-popup-reset').center();\r
- jQuery(window).scroll(function() { \r
- \r
- jQuery('#of-popup-save').center();\r
- jQuery('#of-popup-reset').center();\r
- \r
- });\r
- \r
- \r
- \r
- //AJAX Upload\r
- jQuery('.image_upload_button').each(functio";
- echo "n(){\r
- \r
- var clickedObject = jQuery(this);\r
- var clickedID = jQuery(this).attr('id'); \r
- new AjaxUpload(clickedID, {\r
- action: '";
- echo admin_url("admin-ajax.php");
- echo "',\r
- name: clickedID, // File upload name\r
- data: { // Additional data to send\r
- action: 'of_ajax_post_action',\r
- type: 'upload',\r
- data: clickedID },\r
- autoSubmit: true, // Submit file after selection\r
- responseType: false,\r
- onChange: function(file, extension){},\r
- onSubmit: function(file, extension){\r
- clickedObject.text('Yükleniyor...'); // ch";
- echo "ange button text, when user selects file \r
- this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button\r
- interval = window.setInterval(function(){\r
- var text = clickedObject.text();\r
- if (text.length < 13){ clickedObject.text(text + '.'); }\r
- else { clickedObject.text('Yükleniyor...'); } \r
- }, 200);\r
- },\r
- onCompl";
- echo "ete: function(file, response) {\r
- \r
- window.clearInterval(interval);\r
- clickedObject.text('Yeni Bir Dosya Seçin'); \r
- this.enable(); // enable upload button\r
- \r
- // If there was an error\r
- if(response.search('Hata') > -1){\r
- var buildReturn = '";
- echo "<s";
- echo "pan class=\"upload-error\">' + response + '</span>';\r
- jQuery(\".upload-error\").remove();\r
- clickedObject.parent().after(buildReturn);\r
- \r
- }\r
- else{\r
- var buildReturn = '<img class=\"hide of-option-image\" id=\"image_'+clickedID+'\" src=\"'+response+'\" alt=\"\" />';\r
- \r
- jQuery(\".upload-error\").remove();\r
- jQuery(\"#image_\" + clickedID).remove(); \r
- clickedObject.paren";
- echo "t().after(buildReturn);\r
- jQuery('img#image_'+clickedID).fadeIn();\r
- clickedObject.next('span').fadeIn();\r
- clickedObject.parent().prev('input').val(response);\r
- }\r
- }\r
- });\r
- \r
- });\r
- \r
- //AJAX Remove (clear option value)\r
- jQuery('.image_reset_button').click(function(){\r
- \r
- var clickedObject = jQuery(this);\r
- var clickedID = jQuery(this).attr('id')";
- echo ";\r
- var theID = jQuery(this).attr('title'); \r
- \r
- var ajax_url = '";
- echo admin_url("admin-ajax.php");
- echo "';\r
- \r
- var data = {\r
- action: 'of_ajax_post_action',\r
- type: 'image_reset',\r
- data: theID\r
- };\r
- \r
- jQuery.post(ajax_url, data, function(response) {\r
- var image_to_remove = jQuery('#image_' + theID);\r
- var button_to_hide = jQuery('#reset_' + theID);\r
- image_to_remove.fadeOut(500,function(){ jQuery(this).remove(); });\r
- button_to_hide.fadeOut()";
- echo ";\r
- clickedObject.parent().prev('input').val('');\r
- \r
- \r
- \r
- });\r
- \r
- return false; \r
- \r
- }); \r
- \r
- //Save everything else\r
- jQuery('#ofform').submit(function(){\r
- \r
- function newValues() {\r
- var serializedValues = jQuery(\"#ofform\").serialize();\r
- return serializedValues;\r
- }\r
- jQuery(\":checkbox, :radio\").click(newValues)";
- echo ";\r
- jQuery(\"select\").change(newValues);\r
- jQuery('.ajax-loading-img').fadeIn();\r
- var serializedReturn = newValues();\r
- \r
- var ajax_url = '";
- echo admin_url("admin-ajax.php");
- echo "';\r
- \r
- //var data = {data : serializedReturn};\r
- var data = {\r
- ";
- if (isset($_REQUEST["page"]) && $_REQUEST["page"] == "fabrikapanel")
- {
- echo " type: 'options',\r
- ";
- }
- echo "\r
- action: 'of_ajax_post_action',\r
- data: serializedReturn\r
- };\r
- \r
- jQuery.post(ajax_url, data, function(response) {\r
- var success = jQuery('#of-popup-save');\r
- var loading = jQuery('.ajax-loading-img');\r
- loading.fadeOut(); \r
- success.fadeIn();\r
- window.setTimeout(function(){\r
- success.fadeOut(); \r
- \r
- \r
- }, 2000);\r
- ";
- echo " });\r
- \r
- return false; \r
- \r
- }); \r
- \r
- });\r
- </script>\r
- ";
- return null;
- }
- function of_ajax_callback() {
- global $wpdb;
- $save_type = $_POST["type"];
- if ($save_type == "upload")
- {
- $clickedID = $_POST["data"];
- $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;
- update_option($clickedID, $uploaded_file["url"]);
- if (!empty($uploaded_file["error"]))
- {
- echo "Upload Error: " . $uploaded_file["error"];
- }
- else
- {
- echo $uploaded_file["url"];
- }
- }
- else
- {
- if ($save_type == "image_reset")
- {
- $id = $_POST["data"];
- global $wpdb;
- $query = '' . "DELETE FROM " . $wpdb->options . " WHERE option_name LIKE '" . $id . "'";
- $wpdb->query($query);
- }
- else
- {
- if (($save_type == "options") && $save_type == "framework")
- {
- $data = $_POST["data"];
- parse_str($data, $output);
- $options = get_option("of_template");
- foreach ($options as $option_array)
- {
- $id = $option_array["id"];
- $old_value = get_option($id);
- $new_value = "";
- if (isset($output[$id]))
- {
- $new_value = $output[$option_array["id"]];
- }
- if (!isset($option_array["id"]))
- {
- continue;
- }
- $type = $option_array["type"];
- if (is_array($type))
- {
- foreach ($type as $array)
- {
- if (!($array["type"] == "text"))
- {
- continue;
- }
- $id = $array["id"];
- $std = $array["std"];
- $new_value = $output[$id];
- if ($new_value == "")
- {
- $new_value = $std;
- }
- update_option($id, stripslashes($new_value));
- continue;
- }
- continue;
- }
- if ($new_value == "" && $type == "checkbox")
- {
- update_option($id, "false");
- continue;
- }
- if ($new_value == "true" && $type == "checkbox")
- {
- update_option($id, "true");
- continue;
- }
- if ($type == "multicheck")
- {
- $option_options = $option_array["options"];
- foreach ($option_options as $options_id => $options_value)
- {
- $multicheck_id = $id . "_" . $options_id;
- if (!isset($output[$multicheck_id]))
- {
- update_option($multicheck_id, "false");
- continue;
- }
- update_option($multicheck_id, "true");
- continue;
- }
- continue;
- }
- if ($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"];
- update_option($id, $typography_array);
- continue;
- }
- if ($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"];
- update_option($id, $border_array);
- continue;
- }
- if (!($type != "upload_min"))
- {
- continue;
- }
- update_option($id, stripslashes($new_value));
- continue;
- }
- }
- }
- }
- exit();
- return null;
- }
- function fabrikapanel_machine($options) {
- $counter = 0;
- $menu = "";
- $output = "";
- foreach ($options as $value)
- {
- $counter++;
- $val = "";
- if ($value["type"] != "heading")
- {
- $class = "";
- if (isset($value["class"]))
- {
- $class = $value["class"];
- }
- $output .= "<div class=\"section section-" . $value["type"] . " " . $class . "\">" . "\n";
- $output .= "<h3 class=\"heading\">" . $value["name"] . "</h3>" . "\n";
- $output .= "<div class=\"option\">" . "\n" . "<div class=\"controls\">" . "\n";
- }
- $select_value = "";
- switch ($value["type"])
- {
- case "text":
- {
- $val = $value["std"];
- $std = get_option($value["id"]);
- if ($std != "")
- {
- $val = $std;
- }
- $output .= "<input class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" type=\"" . $value["type"] . "\" value=\"" . $val . "\" />";
- break;
- }
- case "select":
- {
- $output .= "<select class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\">";
- $select_value = get_option($value["id"]);
- foreach ($value["options"] as $option)
- {
- $selected = "";
- if ($select_value != "")
- {
- if ($select_value == $option)
- {
- $selected = " selected=\"selected\"";
- }
- }
- else
- {
- if (isset($value["std"]))
- {
- if ($value["std"] == $option)
- {
- $selected = " selected=\"selected\"";
- }
- }
- }
- $output .= "<option" . $selected . ">";
- $output .= $option;
- $output .= "</option>";
- continue;
- }
- $output .= "</select>";
- break;
- }
- case "select2":
- {
- $output .= "<select class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\">";
- $select_value = get_option($value["id"]);
- foreach ($value["options"] as $option => $name)
- {
- $selected = "";
- if ($select_value != "")
- {
- if ($select_value == $option)
- {
- $selected = " selected=\"selected\"";
- }
- }
- else
- {
- if (isset($value["std"]))
- {
- if ($value["std"] == $option)
- {
- $selected = " selected=\"selected\"";
- }
- }
- }
- $output .= "<option" . $selected . " value=\"" . $option . "\">";
- $output .= $name;
- $output .= "</option>";
- continue;
- }
- $output .= "</select>";
- break;
- }
- case "textarea":
- {
- $cols = "8";
- $ta_value = "";
- if (isset($value["std"]))
- {
- $ta_value = $value["std"];
- if (isset($value["options"]))
- {
- $ta_options = $value["options"];
- if (isset($ta_options["cols"]))
- {
- $cols = $ta_options["cols"];
- }
- else
- {
- $cols = "8";
- }
- }
- }
- $std = get_option($value["id"]);
- if ($std != "")
- {
- $ta_value = stripslashes($std);
- }
- $output .= "<textarea class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" cols=\"" . $cols . "\" rows=\"8\">" . $ta_value . "</textarea>";
- break;
- }
- case "radio":
- {
- $select_value = get_option($value["id"]);
- foreach ($value["options"] as $key => $option)
- {
- $checked = "";
- if ($select_value != "")
- {
- if ($select_value == $key)
- {
- $checked = " checked";
- }
- }
- else
- {
- if ($value["std"] == $key)
- {
- $checked = " checked";
- }
- }
- $output .= "<input class=\"of-input of-radio\" type=\"radio\" name=\"" . $value["id"] . "\" value=\"" . $key . "\" " . $checked . " />" . $option . "<br />";
- continue;
- }
- break;
- }
- case "checkbox":
- {
- $std = $value["std"];
- $saved_std = get_option($value["id"]);
- $checked = "";
- if (!empty($saved_std))
- {
- if ($saved_std == "true")
- {
- $checked = "checked=\"checked\"";
- }
- else
- {
- $checked = "";
- }
- }
- else
- {
- if ($std == "true")
- {
- $checked = "checked=\"checked\"";
- }
- else
- {
- $checked = "";
- }
- }
- $output .= "<input type=\"checkbox\" class=\"checkbox of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" value=\"true\" " . $checked . " />";
- break;
- }
- case "multicheck":
- {
- $std = $value["std"];
- foreach ($value["options"] as $key => $option)
- {
- $of_key = $value["id"] . "_" . $key;
- $saved_std = get_option($of_key);
- if (!empty($saved_std))
- {
- if ($saved_std == "true")
- {
- $checked = "checked=\"checked\"";
- }
- else
- {
- $checked = "";
- }
- }
- else
- {
- if ($std == $key)
- {
- $checked = "checked=\"checked\"";
- }
- else
- {
- $checked = "";
- }
- }
- $output .= "<input type=\"checkbox\" class=\"checkbox of-input\" name=\"" . $of_key . "\" id=\"" . $of_key . "\" value=\"true\" " . $checked . " /><label for=\"" . $of_key . "\">" . $option . "</label><br />";
- continue;
- }
- break;
- }
- case "upload":
- {
- $output .= fabrikapanel_uploader_function($value["id"], $value["std"], null);
- break;
- }
- case "upload_min":
- {
- $output .= fabrikapanel_uploader_function($value["id"], $value["std"], "min");
- break;
- }
- case "color":
- {
- $val = $value["std"];
- $stored = get_option($value["id"]);
- if ($stored != "")
- {
- $val = $stored;
- }
- $output .= "<div id=\"" . $value["id"] . "_picker\" class=\"colorSelector\"><div></div></div>";
- $output .= "<input class=\"of-color\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" type=\"text\" value=\"" . $val . "\" />";
- break;
- }
- case "images":
- {
- $i = 0;
- $select_value = get_option($value["id"]);
- foreach ($value["options"] as $key => $option)
- {
- $i++;
- $checked = "";
- $selected = "";
- if ($select_value != "")
- {
- if ($select_value == $key)
- {
- $checked = " checked";
- $selected = "of-radio-img-selected";
- }
- }
- else
- {
- if ($value["std"] == $key)
- {
- $checked = " checked";
- $selected = "of-radio-img-selected";
- }
- else
- {
- if ($i == 1 && !isset($select_value))
- {
- $checked = " checked";
- $selected = "of-radio-img-selected";
- }
- else
- {
- if ($i == 1 && $value["std"] == "")
- {
- $checked = " checked";
- $selected = "of-radio-img-selected";
- }
- else
- {
- $checked = "";
- }
- }
- }
- }
- $output .= "<span>";
- $output .= "<input type=\"radio\" id=\"of-radio-img-" . $value["id"] . $i . "\" class=\"checkbox of-radio-img-radio\" value=\"" . $key . "\" name=\"" . $value["id"] . "\" " . $checked . " />";
- $output .= "<div class=\"of-radio-img-label\">" . $key . "</div>";
- $output .= "<img src=\"" . $option . "\" alt=\"\" class=\"of-radio-img-img " . $selected . "\" onClick=\"document.getElementById('of-radio-img-" . $value["id"] . $i . "').checked = true;\" />";
- $output .= "</span>";
- continue;
- }
- break;
- }
- case "info":
- {
- $default = $value["std"];
- $output .= $default;
- break;
- }
- case "heading":
- {
- if (2 <= $counter)
- {
- $output .= "</div>" . "\n";
- }
- $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value["name"]));
- $jquery_click_hook = "of-option-" . $jquery_click_hook;
- $menu .= "<li><a title=\"" . $value["name"] . "\" href=\"#" . $jquery_click_hook . "\">" . $value["name"] . "</a></li>";
- $output .= "<div class=\"group\" id=\"" . $jquery_click_hook . "\"><h2>" . $value["name"] . "</h2>" . "\n";
- }
- }
- if (is_array($value["type"]))
- {
- foreach ($value["type"] as $array)
- {
- $id = $array["id"];
- $std = $array["std"];
- $saved_std = get_option($id);
- if ($saved_std != $std)
- {
- $std = $saved_std;
- }
- $meta = $array["meta"];
- if (!($array["type"] == "text"))
- {
- continue;
- }
- $output .= "<input class=\"input-text-small of-input\" name=\"" . $id . "\" id=\"" . $id . "\" type=\"text\" value=\"" . $std . "\" />";
- $output .= "<span class=\"meta-two\">" . $meta . "</span>";
- continue;
- }
- }
- if (!($value["type"] != "heading"))
- {
- continue;
- }
- if ($value["type"] != "checkbox")
- {
- $output .= "<br/>";
- }
- if (!isset($value["desc"]))
- {
- $explain_value = "";
- }
- else
- {
- $explain_value = $value["desc"];
- }
- $output .= "</div><div class=\"explain\">" . $explain_value . "</div>" . "\n";
- $output .= "<div class=\"clear\"> </div></div></div>" . "\n";
- continue;
- }
- $output .= "</div>";
- return array($output, $menu);
- }
- .............................................................
- ..............................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement