Advertisement
Guest User

Untitled

a guest
Jun 27th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.37 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.3
  8. * @ Author : DeZender
  9. * @ Release on : 06.05.2013
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function of_head() {
  15.  
  16. do_action("of_head");
  17. return null;
  18. }
  19.  
  20. function of_style_path() {
  21.  
  22. $style = $_REQUEST["style"];
  23. if ($style != "")
  24. {
  25. $style_path = $style;
  26. }
  27. else
  28. {
  29. $stylesheet = get_option("of_alt_stylesheet");
  30. $style_path = str_replace(".css", "", $stylesheet);
  31. }
  32. if ($style_path == "default")
  33. {
  34. echo "images";
  35. return null;
  36. }
  37. echo "styles/" . $style_path;
  38. return null;
  39. }
  40.  
  41. function of_option_setup() {
  42.  
  43. $of_array = array();
  44. add_option("of_options", $of_array);
  45. $template = get_option("of_template");
  46. $saved_options = get_option("of_options");
  47. foreach ($template as $option)
  48. {
  49. if (!($option["type"] != "heading"))
  50. {
  51. continue;
  52. }
  53. $id = $option["id"];
  54. $std = $option["std"];
  55. $db_option = get_option($id);
  56. if (empty($db_option))
  57. {
  58. if (is_array($option["type"]))
  59. {
  60. foreach ($option["type"] as $child)
  61. {
  62. $c_id = $child["id"];
  63. $c_std = $child["std"];
  64. update_option($c_id, $c_std);
  65. $of_array[$c_id] = $c_std;
  66. continue;
  67. }
  68. continue;
  69. }
  70. update_option($id, $std);
  71. $of_array[$id] = $std;
  72. continue;
  73. }
  74. $of_array[$id] = $db_option;
  75. continue;
  76. }
  77. update_option("of_options", $of_array);
  78. return null;
  79. }
  80.  
  81. function fabrikapanel_admin_head() {
  82.  
  83. echo " ";
  84. echo "<s";
  85. echo "cript type=\"text/javascript\">\r
  86. jQuery(function(){\r
  87. var message = '<p><a href=\"";
  88. echo admin_url("admin.php?page=fabrikapanel");
  89. echo "\">Yönetim panelinden</a> tema ayarlarınızı yapabilirsiniz.</p>';\r
  90. jQuery('.themes-php #message2').html(message);\r
  91. \r
  92. });\r
  93. </script>\r
  94. ";
  95. return null;
  96. }
  97.  
  98. function fabrikapanel_add_admin() {
  99.  
  100. global $query_string;
  101. $themename = get_option("of_themename");
  102. $shortname = get_option("of_shortname");
  103. if (isset($_REQUEST["page"]) && $_REQUEST["page"] == "fabrikapanel")
  104. {
  105. if (isset($_REQUEST["of_save"]) && "reset" == $_REQUEST["of_save"])
  106. {
  107. $options = get_option("of_template");
  108. of_reset_options($options, "fabrikapanel");
  109. header("Location: admin.php?page=fabrikapanel&reset=true");
  110. exit();
  111. }
  112. }
  113. $of_page = add_menu_page($themename, "TEMA AYARLARI", "edit_theme_options", "fabrikapanel", "fabrikapanel_options_page", get_bloginfo("template_url") . "/admin/images/panel.png");
  114. add_action('' . "admin_print_scripts-" . $of_page, "of_load_only");
  115. add_action('' . "admin_print_styles-" . $of_page, "of_style_only");
  116. return null;
  117. }
  118.  
  119. function of_reset_options($options, $page = "") {
  120.  
  121. global $wpdb;
  122. $query_inner = "";
  123. $count = 0;
  124. $excludes = array("blogname", "blogdescription");
  125. foreach ($options as $option)
  126. {
  127. if (!isset($option["id"]))
  128. {
  129. continue;
  130. }
  131. $count++;
  132. $option_id = $option["id"];
  133. $option_type = $option["type"];
  134. if (in_array($option_id, $excludes))
  135. {
  136. continue;
  137. }
  138. if (1 < $count)
  139. {
  140. $query_inner .= " OR ";
  141. }
  142. if ($option_type == "multicheck")
  143. {
  144. $multicount = 0;
  145. foreach ($option["options"] as $option_key => $option_option)
  146. {
  147. $multicount++;
  148. if (1 < $multicount)
  149. {
  150. $query_inner .= " OR ";
  151. }
  152. $query_inner .= "option_name = '" . $option_id . "_" . $option_key . "'";
  153. continue;
  154. }
  155. continue;
  156. }
  157. if (is_array($option_type))
  158. {
  159. $type_array_count = 0;
  160. foreach ($option_type as $inner_option)
  161. {
  162. $type_array_count++;
  163. $option_id = $inner_option["id"];
  164. if (1 < $type_array_count)
  165. {
  166. $query_inner .= " OR ";
  167. }
  168. $query_inner .= '' . "option_name = '" . $option_id . "'";
  169. continue;
  170. }
  171. continue;
  172. }
  173. $query_inner .= '' . "option_name = '" . $option_id . "'";
  174. continue;
  175. }
  176. if ($page == "fabrikapanel")
  177. {
  178. $query_inner .= " OR option_name = 'of_options'";
  179. }
  180. $query = '' . "DELETE FROM " . $wpdb->options . " WHERE " . $query_inner;
  181. $wpdb->query($query);
  182. return null;
  183. }
  184.  
  185. function fabrikapanel_options_page() {
  186.  
  187. $options = get_option("of_template");
  188. $themename = get_option("of_themename");
  189. echo "\r
  190. \r
  191. <div style=\"float:left; width:800px; height:150px; margin:20px 0px 20px 10px; padding:0px 0px 20px 0px; border-bottom: 1px solid #999;\">\r
  192. <iframe src=\"http://www.temafabrika.com/demo/bilgi.html\" width=\"800\" height=\"150\" frameborder=\"0\" scrolling=\"no\"></iframe>\r
  193. </div>\r
  194. \r
  195. <div class=\"clear\"></div>\r
  196. \r
  197. \r
  198. <div class=\"wrap\" id=\"of_container\">\r
  199. <div id=\"of-popup-save\" class=\"of-save-popup\">\r
  200. <div class";
  201. echo "=\"of-save-save\">Ayarlar Güncellendi</div>\r
  202. </div>\r
  203. <div id=\"of-popup-reset\" class=\"of-save-popup\">\r
  204. <div class=\"of-save-reset\">Ayarlar Sıfırlandı</div>\r
  205. </div>\r
  206. <form action=\"\" enctype=\"multipart/form-data\" id=\"ofform\">\r
  207. <div id=\"header\">\r
  208. <div class=\"logo\">\r
  209. <h2>";
  210. echo $themename;
  211. echo "</h2>\r
  212. </div>\r
  213. <div class=\"icon-option\"> </div>\r
  214. <div class=\"clear\"></div>\r
  215. </div>\r
  216. ";
  217. $return = fabrikapanel_machine($options);
  218. echo " <div id=\"main\">\r
  219. <div id=\"of-nav\">\r
  220. <ul>\r
  221. ";
  222. echo $return[1];
  223. echo " </ul>\r
  224. </div>\r
  225. <div id=\"content\"> ";
  226. echo $return[0];
  227. echo " </div>\r
  228. <div class=\"clear\"></div>\r
  229. </div>\r
  230. <div class=\"save_bar_top\">\r
  231. <img style=\"display:none\" src=\"";
  232. echo bloginfo("stylesheet_directory");
  233. echo "/admin/images/loading-bottom.gif\" class=\"ajax-loading-img ajax-loading-img-bottom\" alt=\"Working...\" />\r
  234. <input type=\"submit\" value=\"Ayarları Kaydet\" class=\"button-primary\" />\r
  235. </form>\r
  236. <form action=\"";
  237. echo esc_attr($_SERVER["REQUEST_URI"]);
  238. echo "\" method=\"post\" style=\"display:inline;\" id=\"ofform-reset\">\r
  239. ";
  240. echo "<s";
  241. echo "pan class=\"submit-footer-reset\">\r
  242. <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
  243. <input type=\"hidden\" name=\"of_save\" value=\"reset\" />\r
  244. </span>\r
  245. </form>\r
  246. </div>\r
  247. ";
  248. if (!empty($update_message))
  249. {
  250. echo $update_message;
  251. }
  252. echo "<div style=\"clear:both;\"></div>\r
  253. </div>\r
  254. \r
  255. <!--wrap-->\r
  256. ";
  257. return null;
  258. }
  259.  
  260. function of_style_only() {
  261.  
  262. wp_enqueue_style("admin-style", OF_DIRECTORY . "/admin/admin-style.css");
  263. wp_enqueue_style("color-picker", OF_DIRECTORY . "/admin/css/colorpicker.css");
  264. return null;
  265. }
  266.  
  267. function of_load_only() {
  268.  
  269. add_action("admin_head", "of_admin_head");
  270. wp_enqueue_script("jquery-ui-core");
  271. wp_register_script("jquery-input-mask", OF_DIRECTORY . "/admin/js/jquery.maskedinput-1.2.2.js", array("jquery"));
  272. wp_enqueue_script("jquery-input-mask");
  273. wp_enqueue_script("color-picker", OF_DIRECTORY . "/admin/js/colorpicker.js", array("jquery"));
  274. wp_enqueue_script("ajaxupload", OF_DIRECTORY . "/admin/js/ajaxupload.js", array("jquery"));
  275. return null;
  276. }
  277.  
  278. function of_admin_head() {
  279.  
  280. echo " \r
  281. ";
  282. echo "<s";
  283. echo "cript type=\"text/javascript\" language=\"javascript\">\r
  284. \r
  285. jQuery(document).ready(function(){\r
  286. \r
  287. // Race condition to make sure js files are loaded\r
  288. if (typeof AjaxUpload != 'function') { \r
  289. return ++counter < 6 && window.setTimeout(init, counter * 500);\r
  290. }\r
  291. \r
  292. //Color Picker\r
  293. ";
  294. $options = get_option("of_template");
  295. foreach ($options as $option)
  296. {
  297. if (!((($option["type"] == "color") && $option["type"] == "typography") && $option["type"] == "border"))
  298. {
  299. continue;
  300. }
  301. if (($option["type"] == "typography") && $option["type"] == "border")
  302. {
  303. $option_id = $option["id"];
  304. $temp_color = get_option($option_id);
  305. $option_id = $option["id"] . "_color";
  306. $color = $temp_color["color"];
  307. }
  308. else
  309. {
  310. $option_id = $option["id"];
  311. $color = get_option($option_id);
  312. }
  313. echo " jQuery('#";
  314. echo $option_id;
  315. echo "_picker').children('div').css('backgroundColor', '";
  316. echo $color;
  317. echo "'); \r
  318. jQuery('#";
  319. echo $option_id;
  320. echo "_picker').ColorPicker({\r
  321. color: '";
  322. echo $color;
  323. echo "',\r
  324. onShow: function (colpkr) {\r
  325. jQuery(colpkr).fadeIn(500);\r
  326. return false;\r
  327. },\r
  328. onHide: function (colpkr) {\r
  329. jQuery(colpkr).fadeOut(500);\r
  330. return false;\r
  331. },\r
  332. onChange: function (hsb, hex, rgb) {\r
  333. //jQuery(this).css('border','1px solid red');\r
  334. jQuery('#";
  335. echo $option_id;
  336. echo "_picker').children('div').css('backgroundColor', '#' + hex);\r
  337. jQuery('#";
  338. echo $option_id;
  339. echo "_picker').next('input').attr('value','#' + hex);\r
  340. \r
  341. }\r
  342. });\r
  343. ";
  344. continue;
  345. }
  346. echo " \r
  347. });\r
  348. \r
  349. </script>\r
  350. \r
  351. ";
  352. echo "<s";
  353. echo "cript type=\"text/javascript\">\r
  354. jQuery(document).ready(function(){\r
  355. \r
  356. var flip = 0;\r
  357. \r
  358. jQuery('#expand_options').click(function(){\r
  359. if(flip == 0){\r
  360. flip = 1;\r
  361. jQuery('#of_container #of-nav').hide();\r
  362. jQuery('#of_container #content').width(755);\r
  363. jQuery('#of_container .group').add('#of_container .group h2').show();\r
  364. \r
  365. jQuery(this).text('[-]');\r
  366. \r
  367. ";
  368. echo " } else {\r
  369. flip = 0;\r
  370. jQuery('#of_container #of-nav').show();\r
  371. jQuery('#of_container #content').width(595);\r
  372. jQuery('#of_container .group').add('#of_container .group h2').hide();\r
  373. jQuery('#of_container .group:first').show();\r
  374. jQuery('#of_container #of-nav li').removeClass('current');\r
  375. jQuery('#of_container #of-nav li:first').addClass('current');\r
  376. \r
  377. jQu";
  378. echo "ery(this).text('[+]');\r
  379. \r
  380. }\r
  381. \r
  382. });\r
  383. \r
  384. jQuery('.group').hide();\r
  385. jQuery('.group:first').fadeIn();\r
  386. \r
  387. jQuery('.group .collapsed').each(function(){\r
  388. jQuery(this).find('input:checked').parent().parent().parent().nextAll().each( \r
  389. function(){\r
  390. if (jQuery(this).hasClass('last')) {\r
  391. jQuery(this).removeClass('hidden');\r
  392. ";
  393. echo " return false;\r
  394. }\r
  395. jQuery(this).filter('.hidden').removeClass('hidden');\r
  396. });\r
  397. });\r
  398. \r
  399. jQuery('.group .collapsed input:checkbox').click(unhideHidden);\r
  400. \r
  401. function unhideHidden(){\r
  402. if (jQuery(this).attr('checked')) {\r
  403. jQuery(this).parent().parent().parent().nextAll().removeClass('hidden');\r
  404. ";
  405. echo " }\r
  406. else {\r
  407. jQuery(this).parent().parent().parent().nextAll().each( \r
  408. function(){\r
  409. if (jQuery(this).filter('.last').length) {\r
  410. jQuery(this).addClass('hidden');\r
  411. return false;\r
  412. }\r
  413. jQuery(this).addClass('hidden');\r
  414. });\r
  415. \r
  416. }\r
  417. }\r
  418. \r
  419. jQuery('.of-radio-img-img')";
  420. echo ".click(function(){\r
  421. jQuery(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');\r
  422. jQuery(this).addClass('of-radio-img-selected');\r
  423. \r
  424. });\r
  425. jQuery('.of-radio-img-label').hide();\r
  426. jQuery('.of-radio-img-img').show();\r
  427. jQuery('.of-radio-img-radio').hide();\r
  428. jQuery('#of-nav li:first').addClass('current');\r
  429. jQuery('#of-nav li a').cl";
  430. echo "ick(function(evt){\r
  431. \r
  432. jQuery('#of-nav li').removeClass('current');\r
  433. jQuery(this).parent().addClass('current');\r
  434. \r
  435. var clicked_group = jQuery(this).attr('href');\r
  436. \r
  437. jQuery('.group').hide();\r
  438. \r
  439. jQuery(clicked_group).fadeIn();\r
  440. \r
  441. evt.preventDefault();\r
  442. \r
  443. });\r
  444. \r
  445. if('";
  446. if (isset($_REQUEST["reset"]))
  447. {
  448. echo $_REQUEST["reset"];
  449. }
  450. else
  451. {
  452. echo "false";
  453. }
  454. echo "' == 'true'){\r
  455. \r
  456. var reset_popup = jQuery('#of-popup-reset');\r
  457. reset_popup.fadeIn();\r
  458. window.setTimeout(function(){\r
  459. reset_popup.fadeOut(); \r
  460. }, 2000);\r
  461. //alert(response);\r
  462. \r
  463. }\r
  464. \r
  465. //Update Message popup\r
  466. jQuery.fn.center = function () {\r
  467. this.animate({\"top\":( jQuery(window).height() - this.height() - 200 ) / 2+";
  468. echo "jQuery(window).scrollTop() + \"px\"},100);\r
  469. this.css(\"left\", 250 );\r
  470. return this;\r
  471. }\r
  472. \r
  473. \r
  474. jQuery('#of-popup-save').center();\r
  475. jQuery('#of-popup-reset').center();\r
  476. jQuery(window).scroll(function() { \r
  477. \r
  478. jQuery('#of-popup-save').center();\r
  479. jQuery('#of-popup-reset').center();\r
  480. \r
  481. });\r
  482. \r
  483. \r
  484. \r
  485. //AJAX Upload\r
  486. jQuery('.image_upload_button').each(functio";
  487. echo "n(){\r
  488. \r
  489. var clickedObject = jQuery(this);\r
  490. var clickedID = jQuery(this).attr('id'); \r
  491. new AjaxUpload(clickedID, {\r
  492. action: '";
  493. echo admin_url("admin-ajax.php");
  494. echo "',\r
  495. name: clickedID, // File upload name\r
  496. data: { // Additional data to send\r
  497. action: 'of_ajax_post_action',\r
  498. type: 'upload',\r
  499. data: clickedID },\r
  500. autoSubmit: true, // Submit file after selection\r
  501. responseType: false,\r
  502. onChange: function(file, extension){},\r
  503. onSubmit: function(file, extension){\r
  504. clickedObject.text('Yükleniyor...'); // ch";
  505. echo "ange button text, when user selects file \r
  506. this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button\r
  507. interval = window.setInterval(function(){\r
  508. var text = clickedObject.text();\r
  509. if (text.length < 13){ clickedObject.text(text + '.'); }\r
  510. else { clickedObject.text('Yükleniyor...'); } \r
  511. }, 200);\r
  512. },\r
  513. onCompl";
  514. echo "ete: function(file, response) {\r
  515. \r
  516. window.clearInterval(interval);\r
  517. clickedObject.text('Yeni Bir Dosya Seçin'); \r
  518. this.enable(); // enable upload button\r
  519. \r
  520. // If there was an error\r
  521. if(response.search('Hata') > -1){\r
  522. var buildReturn = '";
  523. echo "<s";
  524. echo "pan class=\"upload-error\">' + response + '</span>';\r
  525. jQuery(\".upload-error\").remove();\r
  526. clickedObject.parent().after(buildReturn);\r
  527. \r
  528. }\r
  529. else{\r
  530. var buildReturn = '<img class=\"hide of-option-image\" id=\"image_'+clickedID+'\" src=\"'+response+'\" alt=\"\" />';\r
  531. \r
  532. jQuery(\".upload-error\").remove();\r
  533. jQuery(\"#image_\" + clickedID).remove(); \r
  534. clickedObject.paren";
  535. echo "t().after(buildReturn);\r
  536. jQuery('img#image_'+clickedID).fadeIn();\r
  537. clickedObject.next('span').fadeIn();\r
  538. clickedObject.parent().prev('input').val(response);\r
  539. }\r
  540. }\r
  541. });\r
  542. \r
  543. });\r
  544. \r
  545. //AJAX Remove (clear option value)\r
  546. jQuery('.image_reset_button').click(function(){\r
  547. \r
  548. var clickedObject = jQuery(this);\r
  549. var clickedID = jQuery(this).attr('id')";
  550. echo ";\r
  551. var theID = jQuery(this).attr('title'); \r
  552. \r
  553. var ajax_url = '";
  554. echo admin_url("admin-ajax.php");
  555. echo "';\r
  556. \r
  557. var data = {\r
  558. action: 'of_ajax_post_action',\r
  559. type: 'image_reset',\r
  560. data: theID\r
  561. };\r
  562. \r
  563. jQuery.post(ajax_url, data, function(response) {\r
  564. var image_to_remove = jQuery('#image_' + theID);\r
  565. var button_to_hide = jQuery('#reset_' + theID);\r
  566. image_to_remove.fadeOut(500,function(){ jQuery(this).remove(); });\r
  567. button_to_hide.fadeOut()";
  568. echo ";\r
  569. clickedObject.parent().prev('input').val('');\r
  570. \r
  571. \r
  572. \r
  573. });\r
  574. \r
  575. return false; \r
  576. \r
  577. }); \r
  578. \r
  579. //Save everything else\r
  580. jQuery('#ofform').submit(function(){\r
  581. \r
  582. function newValues() {\r
  583. var serializedValues = jQuery(\"#ofform\").serialize();\r
  584. return serializedValues;\r
  585. }\r
  586. jQuery(\":checkbox, :radio\").click(newValues)";
  587. echo ";\r
  588. jQuery(\"select\").change(newValues);\r
  589. jQuery('.ajax-loading-img').fadeIn();\r
  590. var serializedReturn = newValues();\r
  591. \r
  592. var ajax_url = '";
  593. echo admin_url("admin-ajax.php");
  594. echo "';\r
  595. \r
  596. //var data = {data : serializedReturn};\r
  597. var data = {\r
  598. ";
  599. if (isset($_REQUEST["page"]) && $_REQUEST["page"] == "fabrikapanel")
  600. {
  601. echo " type: 'options',\r
  602. ";
  603. }
  604. echo "\r
  605. action: 'of_ajax_post_action',\r
  606. data: serializedReturn\r
  607. };\r
  608. \r
  609. jQuery.post(ajax_url, data, function(response) {\r
  610. var success = jQuery('#of-popup-save');\r
  611. var loading = jQuery('.ajax-loading-img');\r
  612. loading.fadeOut(); \r
  613. success.fadeIn();\r
  614. window.setTimeout(function(){\r
  615. success.fadeOut(); \r
  616. \r
  617. \r
  618. }, 2000);\r
  619. ";
  620. echo " });\r
  621. \r
  622. return false; \r
  623. \r
  624. }); \r
  625. \r
  626. });\r
  627. </script>\r
  628. ";
  629. return null;
  630. }
  631.  
  632. function of_ajax_callback() {
  633.  
  634. global $wpdb;
  635. $save_type = $_POST["type"];
  636. if ($save_type == "upload")
  637. {
  638. $clickedID = $_POST["data"];
  639. $filename = $_FILES[$clickedID];
  640. $filename["name"] = preg_replace("/[^a-zA-Z0-9._\\-]/", "", $filename["name"]);
  641. $override["test_form"] = false;
  642. $override["action"] = "wp_handle_upload";
  643. $uploaded_file = wp_handle_upload($filename, $override);
  644. $upload_tracking[] = $clickedID;
  645. update_option($clickedID, $uploaded_file["url"]);
  646. if (!empty($uploaded_file["error"]))
  647. {
  648. echo "Upload Error: " . $uploaded_file["error"];
  649. }
  650. else
  651. {
  652. echo $uploaded_file["url"];
  653. }
  654. }
  655. else
  656. {
  657. if ($save_type == "image_reset")
  658. {
  659. $id = $_POST["data"];
  660. global $wpdb;
  661. $query = '' . "DELETE FROM " . $wpdb->options . " WHERE option_name LIKE '" . $id . "'";
  662. $wpdb->query($query);
  663. }
  664. else
  665. {
  666. if (($save_type == "options") && $save_type == "framework")
  667. {
  668. $data = $_POST["data"];
  669. parse_str($data, $output);
  670. $options = get_option("of_template");
  671. foreach ($options as $option_array)
  672. {
  673. $id = $option_array["id"];
  674. $old_value = get_option($id);
  675. $new_value = "";
  676. if (isset($output[$id]))
  677. {
  678. $new_value = $output[$option_array["id"]];
  679. }
  680. if (!isset($option_array["id"]))
  681. {
  682. continue;
  683. }
  684. $type = $option_array["type"];
  685. if (is_array($type))
  686. {
  687. foreach ($type as $array)
  688. {
  689. if (!($array["type"] == "text"))
  690. {
  691. continue;
  692. }
  693. $id = $array["id"];
  694. $std = $array["std"];
  695. $new_value = $output[$id];
  696. if ($new_value == "")
  697. {
  698. $new_value = $std;
  699. }
  700. update_option($id, stripslashes($new_value));
  701. continue;
  702. }
  703. continue;
  704. }
  705. if ($new_value == "" && $type == "checkbox")
  706. {
  707. update_option($id, "false");
  708. continue;
  709. }
  710. if ($new_value == "true" && $type == "checkbox")
  711. {
  712. update_option($id, "true");
  713. continue;
  714. }
  715. if ($type == "multicheck")
  716. {
  717. $option_options = $option_array["options"];
  718. foreach ($option_options as $options_id => $options_value)
  719. {
  720. $multicheck_id = $id . "_" . $options_id;
  721. if (!isset($output[$multicheck_id]))
  722. {
  723. update_option($multicheck_id, "false");
  724. continue;
  725. }
  726. update_option($multicheck_id, "true");
  727. continue;
  728. }
  729. continue;
  730. }
  731. if ($type == "typography")
  732. {
  733. $typography_array = array();
  734. $typography_array["size"] = $output[$option_array["id"] . "_size"];
  735. $typography_array["face"] = stripslashes($output[$option_array["id"] . "_face"]);
  736. $typography_array["style"] = $output[$option_array["id"] . "_style"];
  737. $typography_array["color"] = $output[$option_array["id"] . "_color"];
  738. update_option($id, $typography_array);
  739. continue;
  740. }
  741. if ($type == "border")
  742. {
  743. $border_array = array();
  744. $border_array["width"] = $output[$option_array["id"] . "_width"];
  745. $border_array["style"] = $output[$option_array["id"] . "_style"];
  746. $border_array["color"] = $output[$option_array["id"] . "_color"];
  747. update_option($id, $border_array);
  748. continue;
  749. }
  750. if (!($type != "upload_min"))
  751. {
  752. continue;
  753. }
  754. update_option($id, stripslashes($new_value));
  755. continue;
  756. }
  757. }
  758. }
  759. }
  760. exit();
  761. return null;
  762. }
  763.  
  764. function fabrikapanel_machine($options) {
  765.  
  766. $counter = 0;
  767. $menu = "";
  768. $output = "";
  769. foreach ($options as $value)
  770. {
  771. $counter++;
  772. $val = "";
  773. if ($value["type"] != "heading")
  774. {
  775. $class = "";
  776. if (isset($value["class"]))
  777. {
  778. $class = $value["class"];
  779. }
  780. $output .= "<div class=\"section section-" . $value["type"] . " " . $class . "\">" . "\n";
  781. $output .= "<h3 class=\"heading\">" . $value["name"] . "</h3>" . "\n";
  782. $output .= "<div class=\"option\">" . "\n" . "<div class=\"controls\">" . "\n";
  783. }
  784. $select_value = "";
  785. switch ($value["type"])
  786. {
  787. case "text":
  788. {
  789. $val = $value["std"];
  790. $std = get_option($value["id"]);
  791. if ($std != "")
  792. {
  793. $val = $std;
  794. }
  795. $output .= "<input class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" type=\"" . $value["type"] . "\" value=\"" . $val . "\" />";
  796. break;
  797. }
  798. case "select":
  799. {
  800. $output .= "<select class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\">";
  801. $select_value = get_option($value["id"]);
  802. foreach ($value["options"] as $option)
  803. {
  804. $selected = "";
  805. if ($select_value != "")
  806. {
  807. if ($select_value == $option)
  808. {
  809. $selected = " selected=\"selected\"";
  810. }
  811. }
  812. else
  813. {
  814. if (isset($value["std"]))
  815. {
  816. if ($value["std"] == $option)
  817. {
  818. $selected = " selected=\"selected\"";
  819. }
  820. }
  821. }
  822. $output .= "<option" . $selected . ">";
  823. $output .= $option;
  824. $output .= "</option>";
  825. continue;
  826. }
  827. $output .= "</select>";
  828. break;
  829. }
  830. case "select2":
  831. {
  832. $output .= "<select class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\">";
  833. $select_value = get_option($value["id"]);
  834. foreach ($value["options"] as $option => $name)
  835. {
  836. $selected = "";
  837. if ($select_value != "")
  838. {
  839. if ($select_value == $option)
  840. {
  841. $selected = " selected=\"selected\"";
  842. }
  843. }
  844. else
  845. {
  846. if (isset($value["std"]))
  847. {
  848. if ($value["std"] == $option)
  849. {
  850. $selected = " selected=\"selected\"";
  851. }
  852. }
  853. }
  854. $output .= "<option" . $selected . " value=\"" . $option . "\">";
  855. $output .= $name;
  856. $output .= "</option>";
  857. continue;
  858. }
  859. $output .= "</select>";
  860. break;
  861. }
  862. case "textarea":
  863. {
  864. $cols = "8";
  865. $ta_value = "";
  866. if (isset($value["std"]))
  867. {
  868. $ta_value = $value["std"];
  869. if (isset($value["options"]))
  870. {
  871. $ta_options = $value["options"];
  872. if (isset($ta_options["cols"]))
  873. {
  874. $cols = $ta_options["cols"];
  875. }
  876. else
  877. {
  878. $cols = "8";
  879. }
  880. }
  881. }
  882. $std = get_option($value["id"]);
  883. if ($std != "")
  884. {
  885. $ta_value = stripslashes($std);
  886. }
  887. $output .= "<textarea class=\"of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" cols=\"" . $cols . "\" rows=\"8\">" . $ta_value . "</textarea>";
  888. break;
  889. }
  890. case "radio":
  891. {
  892. $select_value = get_option($value["id"]);
  893. foreach ($value["options"] as $key => $option)
  894. {
  895. $checked = "";
  896. if ($select_value != "")
  897. {
  898. if ($select_value == $key)
  899. {
  900. $checked = " checked";
  901. }
  902. }
  903. else
  904. {
  905. if ($value["std"] == $key)
  906. {
  907. $checked = " checked";
  908. }
  909. }
  910. $output .= "<input class=\"of-input of-radio\" type=\"radio\" name=\"" . $value["id"] . "\" value=\"" . $key . "\" " . $checked . " />" . $option . "<br />";
  911. continue;
  912. }
  913. break;
  914. }
  915. case "checkbox":
  916. {
  917. $std = $value["std"];
  918. $saved_std = get_option($value["id"]);
  919. $checked = "";
  920. if (!empty($saved_std))
  921. {
  922. if ($saved_std == "true")
  923. {
  924. $checked = "checked=\"checked\"";
  925. }
  926. else
  927. {
  928. $checked = "";
  929. }
  930. }
  931. else
  932. {
  933. if ($std == "true")
  934. {
  935. $checked = "checked=\"checked\"";
  936. }
  937. else
  938. {
  939. $checked = "";
  940. }
  941. }
  942. $output .= "<input type=\"checkbox\" class=\"checkbox of-input\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" value=\"true\" " . $checked . " />";
  943. break;
  944. }
  945. case "multicheck":
  946. {
  947. $std = $value["std"];
  948. foreach ($value["options"] as $key => $option)
  949. {
  950. $of_key = $value["id"] . "_" . $key;
  951. $saved_std = get_option($of_key);
  952. if (!empty($saved_std))
  953. {
  954. if ($saved_std == "true")
  955. {
  956. $checked = "checked=\"checked\"";
  957. }
  958. else
  959. {
  960. $checked = "";
  961. }
  962. }
  963. else
  964. {
  965. if ($std == $key)
  966. {
  967. $checked = "checked=\"checked\"";
  968. }
  969. else
  970. {
  971. $checked = "";
  972. }
  973. }
  974. $output .= "<input type=\"checkbox\" class=\"checkbox of-input\" name=\"" . $of_key . "\" id=\"" . $of_key . "\" value=\"true\" " . $checked . " /><label for=\"" . $of_key . "\">" . $option . "</label><br />";
  975. continue;
  976. }
  977. break;
  978. }
  979. case "upload":
  980. {
  981. $output .= fabrikapanel_uploader_function($value["id"], $value["std"], null);
  982. break;
  983. }
  984. case "upload_min":
  985. {
  986. $output .= fabrikapanel_uploader_function($value["id"], $value["std"], "min");
  987. break;
  988. }
  989. case "color":
  990. {
  991. $val = $value["std"];
  992. $stored = get_option($value["id"]);
  993. if ($stored != "")
  994. {
  995. $val = $stored;
  996. }
  997. $output .= "<div id=\"" . $value["id"] . "_picker\" class=\"colorSelector\"><div></div></div>";
  998. $output .= "<input class=\"of-color\" name=\"" . $value["id"] . "\" id=\"" . $value["id"] . "\" type=\"text\" value=\"" . $val . "\" />";
  999. break;
  1000. }
  1001. case "images":
  1002. {
  1003. $i = 0;
  1004. $select_value = get_option($value["id"]);
  1005. foreach ($value["options"] as $key => $option)
  1006. {
  1007. $i++;
  1008. $checked = "";
  1009. $selected = "";
  1010. if ($select_value != "")
  1011. {
  1012. if ($select_value == $key)
  1013. {
  1014. $checked = " checked";
  1015. $selected = "of-radio-img-selected";
  1016. }
  1017. }
  1018. else
  1019. {
  1020. if ($value["std"] == $key)
  1021. {
  1022. $checked = " checked";
  1023. $selected = "of-radio-img-selected";
  1024. }
  1025. else
  1026. {
  1027. if ($i == 1 && !isset($select_value))
  1028. {
  1029. $checked = " checked";
  1030. $selected = "of-radio-img-selected";
  1031. }
  1032. else
  1033. {
  1034. if ($i == 1 && $value["std"] == "")
  1035. {
  1036. $checked = " checked";
  1037. $selected = "of-radio-img-selected";
  1038. }
  1039. else
  1040. {
  1041. $checked = "";
  1042. }
  1043. }
  1044. }
  1045. }
  1046. $output .= "<span>";
  1047. $output .= "<input type=\"radio\" id=\"of-radio-img-" . $value["id"] . $i . "\" class=\"checkbox of-radio-img-radio\" value=\"" . $key . "\" name=\"" . $value["id"] . "\" " . $checked . " />";
  1048. $output .= "<div class=\"of-radio-img-label\">" . $key . "</div>";
  1049. $output .= "<img src=\"" . $option . "\" alt=\"\" class=\"of-radio-img-img " . $selected . "\" onClick=\"document.getElementById('of-radio-img-" . $value["id"] . $i . "').checked = true;\" />";
  1050. $output .= "</span>";
  1051. continue;
  1052. }
  1053. break;
  1054. }
  1055. case "info":
  1056. {
  1057. $default = $value["std"];
  1058. $output .= $default;
  1059. break;
  1060. }
  1061. case "heading":
  1062. {
  1063. if (2 <= $counter)
  1064. {
  1065. $output .= "</div>" . "\n";
  1066. }
  1067. $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value["name"]));
  1068. $jquery_click_hook = "of-option-" . $jquery_click_hook;
  1069. $menu .= "<li><a title=\"" . $value["name"] . "\" href=\"#" . $jquery_click_hook . "\">" . $value["name"] . "</a></li>";
  1070. $output .= "<div class=\"group\" id=\"" . $jquery_click_hook . "\"><h2>" . $value["name"] . "</h2>" . "\n";
  1071. }
  1072. }
  1073. if (is_array($value["type"]))
  1074. {
  1075. foreach ($value["type"] as $array)
  1076. {
  1077. $id = $array["id"];
  1078. $std = $array["std"];
  1079. $saved_std = get_option($id);
  1080. if ($saved_std != $std)
  1081. {
  1082. $std = $saved_std;
  1083. }
  1084. $meta = $array["meta"];
  1085. if (!($array["type"] == "text"))
  1086. {
  1087. continue;
  1088. }
  1089. $output .= "<input class=\"input-text-small of-input\" name=\"" . $id . "\" id=\"" . $id . "\" type=\"text\" value=\"" . $std . "\" />";
  1090. $output .= "<span class=\"meta-two\">" . $meta . "</span>";
  1091. continue;
  1092. }
  1093. }
  1094. if (!($value["type"] != "heading"))
  1095. {
  1096. continue;
  1097. }
  1098. if ($value["type"] != "checkbox")
  1099. {
  1100. $output .= "<br/>";
  1101. }
  1102. if (!isset($value["desc"]))
  1103. {
  1104. $explain_value = "";
  1105. }
  1106. else
  1107. {
  1108. $explain_value = $value["desc"];
  1109. }
  1110. $output .= "</div><div class=\"explain\">" . $explain_value . "</div>" . "\n";
  1111. $output .= "<div class=\"clear\"> </div></div></div>" . "\n";
  1112. continue;
  1113. }
  1114. $output .= "</div>";
  1115. return array($output, $menu);
  1116. }
  1117. .............................................................
  1118. ..............................
  1119. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement