inkthemes_load_only

-----------------------------------------------------------------------------------.

Description

inkthemes_load_only(); 

Usage

  1. if ( !function_exists( 'inkthemes_load_only' ) ) { 
  2. require_once '/functions/admin-interface.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = inkthemes_load_only(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions/admin-interface.php  
  1. function inkthemes_load_only() { 
  2. add_action('admin_head', 'of_admin_head'); 
  3.  
  4. wp_enqueue_script('jquery-ui-core'); 
  5. wp_register_script('jquery-input-mask', get_template_directory_uri() . '/functions/js/jquery.maskedinput-1.2.2.js', array('jquery')); 
  6. wp_enqueue_script('jquery-input-mask'); 
  7.  
  8. function of_admin_head() { 
  9.  
  10. echo '<link rel="stylesheet" type="text/css" href="' . get_template_directory_uri() . '/functions/admin-style.css" media="screen" />'; 
  11.  
  12. // COLOR Picker  
  13. ?> 
  14. <link rel="stylesheet" media="screen" type="text/css" href="<?php echo get_template_directory_uri(); ?>/functions/css/colorpicker.css" /> 
  15. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/functions/js/colorpicker.js"></script> 
  16. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/functions/js/tiny_mce/tiny_mce.js"></script> 
  17. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/functions/js/tiny_mce_init.js"></script>  
  18. <script type="text/javascript" language="javascript"> 
  19. jQuery(document).ready(function() { 
  20. //Color Picker 
  21. <?php 
  22. $options = inkthemes_get_option('of_template'); 
  23. foreach ($options as $option) { 
  24. if ($option['type'] == 'color' OR $option['type'] == 'typography' OR $option['type'] == 'border') { 
  25. if ($option['type'] == 'typography' OR $option['type'] == 'border') { 
  26. $option_id = $option['id']; 
  27. $temp_color = inkthemes_get_option($option_id); 
  28. $option_id = $option['id'] . '_color'; 
  29. $color = $temp_color['color']; 
  30. } else { 
  31. $option_id = $option['id']; 
  32. $color = inkthemes_get_option($option_id); 
  33. ?> 
  34. jQuery('#<?php echo $option_id; ?>_picker').children('div').css('backgroundColor', '<?php echo $color; ?>'); 
  35. jQuery('#<?php echo $option_id; ?>_picker').ColorPicker({ 
  36. color: '<?php echo $color; ?>',  
  37. onShow: function (colpkr) { 
  38. jQuery(colpkr).fadeIn(500); 
  39. return false; 
  40. },  
  41. onHide: function (colpkr) { 
  42. jQuery(colpkr).fadeOut(500); 
  43. return false; 
  44. },  
  45. onChange: function (hsb, hex, rgb) { 
  46. //jQuery(this).css('border', '1px solid red'); 
  47. jQuery('#<?php echo $option_id; ?>_picker').children('div').css('backgroundColor', '#' + hex); 
  48. jQuery('#<?php echo $option_id; ?>_picker').next('input').attr('value', '#' + hex); 
  49. }); 
  50. <?php 
  51. ?> 
  52.  
  53. });</script> 
  54. <?php 
  55. //AJAX Upload 
  56. ?> 
  57. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/functions/js/ajaxupload.js"></script> 
  58. <script type="text/javascript"> 
  59. jQuery(document).ready(function() { 
  60.  
  61. var flip = 0; 
  62. jQuery('#expand_options').click(function() { 
  63. if (flip == 0) { 
  64. flip = 1; 
  65. jQuery('#of_container #of-nav').hide(); 
  66. jQuery('#of_container #content').width(755); 
  67. jQuery('#of_container .group').add('#of_container .group h2').show(); 
  68. jQuery(this).text('[-]'); 
  69. } else { 
  70. flip = 0; 
  71. jQuery('#of_container #of-nav').show(); 
  72. jQuery('#of_container #content').width(595); 
  73. jQuery('#of_container .group').add('#of_container .group h2').hide(); 
  74. jQuery('#of_container .group:first').show(); 
  75. jQuery('#of_container #of-nav li').removeClass('current'); 
  76. jQuery('#of_container #of-nav li:first').addClass('current'); 
  77. jQuery(this).text('[+]'); 
  78.  
  79. }); 
  80. jQuery('.group').hide(); 
  81. jQuery('.group:first').fadeIn(); 
  82. jQuery('.group .collapsed').each(function() { 
  83. jQuery(this).find('input:checked').parent().parent().parent().nextAll().each( 
  84. function() { 
  85. if (jQuery(this).hasClass('last')) { 
  86. jQuery(this).removeClass('hidden'); 
  87. return false; 
  88. jQuery(this).filter('.hidden').removeClass('hidden'); 
  89. }); 
  90. }); 
  91. jQuery('.group .collapsed input:checkbox').click(unhideHidden); 
  92. function unhideHidden() { 
  93. if (jQuery(this).attr('checked')) { 
  94. jQuery(this).parent().parent().parent().nextAll().removeClass('hidden'); 
  95. else { 
  96. jQuery(this).parent().parent().parent().nextAll().each( 
  97. function() { 
  98. if (jQuery(this).filter('.last').length) { 
  99. jQuery(this).addClass('hidden'); 
  100. return false; 
  101. jQuery(this).addClass('hidden'); 
  102. }); 
  103.  
  104. jQuery('.of-radio-img-img').click(function() { 
  105. jQuery(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected'); 
  106. jQuery(this).addClass('of-radio-img-selected'); 
  107. }); 
  108. jQuery('.of-radio-img-label').hide(); 
  109. jQuery('.of-radio-img-img').show(); 
  110. jQuery('.of-radio-img-radio').hide(); 
  111. jQuery('#of-nav li:first').addClass('current'); 
  112. jQuery('#of-nav li a').click(function(evt) { 
  113.  
  114. jQuery('#of-nav li').removeClass('current'); 
  115. jQuery(this).parent().addClass('current'); 
  116. var clicked_group = jQuery(this).attr('href'); 
  117. jQuery('.group').hide(); 
  118. jQuery(clicked_group).fadeIn(); 
  119. evt.preventDefault(); 
  120. }); 
  121. if ('<?php 
  122. if (isset($_REQUEST['reset'])) { 
  123. echo $_REQUEST['reset']; 
  124. } else { 
  125. echo 'false'; 
  126. ?>' == 'true') { 
  127.  
  128. var reset_popup = jQuery('#of-popup-reset'); 
  129. reset_popup.fadeIn(); 
  130. window.setTimeout(function() { 
  131. reset_popup.fadeOut(); 
  132. }, 2000); 
  133. //alert(response); 
  134.  
  135.  
  136. //Update Message popup 
  137. jQuery.fn.center = function () { 
  138. this.animate({"top":(jQuery(window).height() - this.height() - 200) / 2 + jQuery(window).scrollTop() + "px"}, 100); 
  139. this.css("left", 250); 
  140. return this; 
  141.  
  142.  
  143. jQuery('#of-popup-save').center(); 
  144. jQuery('#of-popup-reset').center(); 
  145. jQuery(window).scroll(function() { 
  146.  
  147. jQuery('#of-popup-save').center(); 
  148. jQuery('#of-popup-reset').center(); 
  149. }); 
  150. //AJAX Upload 
  151. jQuery('.image_upload_button').each(function() { 
  152.  
  153. var clickedObject = jQuery(this); 
  154. var clickedID = jQuery(this).attr('id'); 
  155. new AjaxUpload(clickedID, { 
  156. action: '<?php echo admin_url("admin-ajax.php"); ?>',  
  157. name: clickedID, // File upload name 
  158. data: { // Additional data to send 
  159. action: 'of_ajax_post_action',  
  160. type: 'upload',  
  161. data: clickedID },  
  162. autoSubmit: true, // Submit file after selection 
  163. responseType: false,  
  164. onChange: function(file, extension) {},  
  165. onSubmit: function(file, extension) { 
  166. clickedObject.text('Uploading'); // change button text, when user selects file  
  167. this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button 
  168. interval = window.setInterval(function() { 
  169. var text = clickedObject.text(); 
  170. if (text.length < 13) { clickedObject.text(text + '.'); } 
  171. else { clickedObject.text('Uploading'); } 
  172. }, 200); 
  173. },  
  174. onComplete: function(file, response) { 
  175.  
  176. window.clearInterval(interval); 
  177. clickedObject.text('Upload Image'); 
  178. this.enable(); // enable upload button 
  179.  
  180. // If there was an error 
  181. if (response.search('Upload Error') > - 1) { 
  182. var buildReturn = '<span class="upload-error">' + response + '</span>'; 
  183. jQuery(".upload-error").remove(); 
  184. clickedObject.parent().after(buildReturn); 
  185. else{ 
  186. var buildReturn = '<img class="hide of-option-image" id="image_' + clickedID + '" src="' + response + '" alt="" />'; 
  187. jQuery(".upload-error").remove(); 
  188. jQuery("#image_" + clickedID).remove(); 
  189. clickedObject.parent().after(buildReturn); 
  190. jQuery('img#image_' + clickedID).fadeIn(); 
  191. clickedObject.next('span').fadeIn(); 
  192. clickedObject.parent().prev('input').val(response); 
  193. }); 
  194. }); 
  195. //AJAX Remove (clear option value) 
  196. jQuery('.image_reset_button').click(function() { 
  197.  
  198. var clickedObject = jQuery(this); 
  199. var clickedID = jQuery(this).attr('id'); 
  200. var theID = jQuery(this).attr('title'); 
  201. var ajax_url = '<?php echo admin_url("admin-ajax.php"); ?>'; 
  202. var data = { 
  203. action: 'of_ajax_post_action',  
  204. type: 'image_reset',  
  205. data: theID 
  206. }; 
  207. jQuery.post(ajax_url, data, function(response) { 
  208. var image_to_remove = jQuery('#image_' + theID); 
  209. var button_to_hide = jQuery('#reset_' + theID); 
  210. image_to_remove.fadeOut(500, function() { jQuery(this).remove(); }); 
  211. button_to_hide.fadeOut(); 
  212. clickedObject.parent().prev('input').val(''); 
  213. }); 
  214. returnfalse; 
  215. }); 
  216. //Save everything else 
  217. jQuery('#ofform').submit(function() { 
  218.  
  219. function newValues() { 
  220. var serializedValues = jQuery("#ofform").serialize(); 
  221. return serializedValues; 
  222. jQuery(":checkbox, :radio").click(newValues); 
  223. jQuery("select").change(newValues); 
  224. jQuery('.ajax-loading-img').fadeIn(); 
  225. var serializedReturn = newValues(); 
  226. var ajax_url = '<?php echo admin_url("admin-ajax.php"); ?>'; 
  227. //var data = {data : serializedReturn}; 
  228. var data = { 
  229. <?php if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework') { ?> 
  230. type: 'options',  
  231. <?php } ?> 
  232. action: 'of_ajax_post_action',  
  233. data: serializedReturn 
  234. }; 
  235. jQuery.post(ajax_url, data, function(response) { 
  236. var success = jQuery('#of-popup-save'); 
  237. var loading = jQuery('.ajax-loading-img'); 
  238. loading.fadeOut(); 
  239. success.fadeIn(); 
  240. window.setTimeout(function() { 
  241. success.fadeOut(); 
  242. }, 2000); 
  243. }); 
  244. return false; 
  245. }); 
  246. }); 
  247.  
  248. </script> 
  249. <?php 
  250.