Advertisement
Guest User

Untitled

a guest
Nov 11th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.46 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * The function within this file are theme specific:
  5. * they are used only by this theme and not by the Avia Framework in general
  6. */
  7.  
  8.  
  9.  
  10. /* wrap embeds into a proportion containing div */
  11. if(!function_exists('avia_iframe_proportion_wrap'))
  12. {
  13. add_filter( 'embed_oembed_html', 'avia_iframe_proportion_wrap', 10, 4 );
  14.  
  15. function avia_iframe_proportion_wrap ( $html, $url, $attr, $post_ID )
  16. {
  17. if(strpos($html, '<iframe') !== false)
  18. {
  19. $html = "<div class='avia-iframe-wrap'>{$html}</div>";
  20. }
  21. return $html;
  22. }
  23. }
  24.  
  25. add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
  26. function avia_add_heading_font($fonts)
  27. {
  28. $fonts['Alef'] = 'Alef:400,700';
  29. return $fonts;
  30. }
  31.  
  32. add_filter( 'avf_google_content_font', 'avia_add_content_font');
  33. function avia_add_content_font($fonts)
  34. {
  35. $fonts['Alef'] = 'Alef:400,700';
  36. return $fonts;
  37. }
  38.  
  39. /* GOOGLE AUTHOR */
  40. if(!function_exists('avia_google_author_image'))
  41. {
  42. function avia_google_author_image()
  43. {
  44. $icons = avia_get_option('social_icons');
  45. if(is_array($icons) && !empty($icons))
  46. {
  47. foreach($icons as $icon) if($icon['social_icon'] == 'gplus') $url = $icon['social_icon_link'];
  48. }
  49.  
  50. if(!empty($url))
  51. {
  52. //add author url as described here: http://yoast.com/push-rel-author-head/
  53. echo '<link rel="author" href="'.$url.'"/>';
  54. }
  55.  
  56. }
  57. }
  58.  
  59. add_action( 'wp_head', 'avia_google_author_image' );
  60.  
  61.  
  62.  
  63.  
  64. /* AJAX SEARCH */
  65. if(!function_exists('avia_append_search_nav'))
  66. {
  67. //first append search item to main menu
  68. add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 10, 2 );
  69. add_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 10, 2 );
  70.  
  71. function avia_append_search_nav ( $items, $args )
  72. {
  73. if(avia_get_option('header_searchicon','header_searchicon') != "header_searchicon") return $items;
  74. if(avia_get_option('header_position', 'header_top') != "header_top") return $items;
  75.  
  76. if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
  77. {
  78. global $avia_config;
  79. ob_start();
  80. get_search_form();
  81. $form = htmlspecialchars(ob_get_clean()) ;
  82.  
  83. $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown">
  84. <a href="?s=" rel="nofollow" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'><span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span></a>
  85. </li>';
  86. }
  87. return $items;
  88. }
  89. }
  90.  
  91.  
  92.  
  93.  
  94. if(!function_exists('avia_ajax_search'))
  95. {
  96. //now hook into wordpress ajax function to catch any ajax requests
  97. add_action( 'wp_ajax_avia_ajax_search', 'avia_ajax_search' );
  98. add_action( 'wp_ajax_nopriv_avia_ajax_search', 'avia_ajax_search' );
  99.  
  100. function avia_ajax_search()
  101. {
  102. global $avia_config;
  103.  
  104. unset($_REQUEST['action']);
  105. if(empty($_REQUEST['s'])) $_REQUEST['s'] = array_shift(array_values($_REQUEST));
  106. if(empty($_REQUEST['s'])) die();
  107.  
  108.  
  109. $defaults = array('numberposts' => 5, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false);
  110. $_REQUEST['s'] = apply_filters( 'get_search_query', $_REQUEST['s']);
  111.  
  112. $search_parameters = array_merge($defaults, $_REQUEST);
  113. $search_query = apply_filters('avf_ajax_search_query', http_build_query($search_parameters));
  114. $query_function = apply_filters('avf_ajax_search_function', 'get_posts', $search_query, $search_parameters, $defaults);
  115. $posts = (($query_function == 'get_posts') || !function_exists($query_function)) ? get_posts($search_query) : $query_function($search_query, $search_parameters, $defaults);
  116.  
  117. $search_messages = array(
  118. 'no_criteria_matched' => __("Sorry, no posts matched your criteria", 'avia_framework'),
  119. 'another_search_term' => __("Please try another search term", 'avia_framework'),
  120. 'time_format' => get_option('date_format'),
  121. 'all_results_query' => http_build_query($_REQUEST),
  122. 'all_results_link' => home_url('?' . http_build_query($_REQUEST)),
  123. 'view_all_results' => __('View all results','avia_framework')
  124. );
  125.  
  126. $search_messages = apply_filters('avf_ajax_search_messages', $search_messages, $search_query);
  127.  
  128. if(empty($posts))
  129. {
  130. $output = "<span class='ajax_search_entry ajax_not_found'>";
  131. $output .= "<span class='ajax_search_image ".av_icon_string('info')."'>";
  132. $output .= "</span>";
  133. $output .= "<span class='ajax_search_content'>";
  134. $output .= " <span class='ajax_search_title'>";
  135. $output .= $search_messages['no_criteria_matched'];
  136. $output .= " </span>";
  137. $output .= " <span class='ajax_search_excerpt'>";
  138. $output .= $search_messages['another_search_term'];
  139. $output .= " </span>";
  140. $output .= "</span>";
  141. $output .= "</span>";
  142. echo $output;
  143. die();
  144. }
  145.  
  146. //if we got posts resort them by post type
  147. $output = "";
  148. $sorted = array();
  149. $post_type_obj = array();
  150. foreach($posts as $post)
  151. {
  152. $sorted[$post->post_type][] = $post;
  153. if(empty($post_type_obj[$post->post_type]))
  154. {
  155. $post_type_obj[$post->post_type] = get_post_type_object($post->post_type);
  156. }
  157. }
  158.  
  159.  
  160.  
  161. //now we got everything we need to preapre the output
  162. foreach($sorted as $key => $post_type)
  163. {
  164. if(isset($post_type_obj[$key]->labels->name))
  165. {
  166. $label = apply_filters('avf_ajax_search_label_names', $post_type_obj[$key]->labels->name);
  167. $output .= "<h4>".$label."</h4>";
  168. }
  169. else
  170. {
  171. $output .= "<hr />";
  172. }
  173.  
  174. foreach($post_type as $post)
  175. {
  176. $image = get_the_post_thumbnail( $post->ID, 'thumbnail' );
  177.  
  178. $extra_class = $image ? "with_image" : "";
  179. $post_type = $image ? "" : get_post_format($post->ID) != "" ? get_post_format($post->ID) : "standard";
  180. $iconfont = $image ? "" : av_icon_string($post_type);
  181. $excerpt = "";
  182.  
  183. if(!empty($post->post_excerpt))
  184. {
  185. $excerpt = apply_filters( 'avf_ajax_search_excerpt', avia_backend_truncate($post->post_excerpt,70," ","...", true, '', true) );
  186. }
  187. else
  188. {
  189. $excerpt = get_the_time($search_messages['time_format'], $post->ID);
  190. }
  191.  
  192. $link = apply_filters('av_custom_url', get_permalink($post->ID), $post);
  193.  
  194. $output .= "<a class ='ajax_search_entry {$extra_class}' href='".$link."'>";
  195. $output .= "<span class='ajax_search_image' {$iconfont}>";
  196. $output .= $image;
  197. $output .= "</span>";
  198. $output .= "<span class='ajax_search_content'>";
  199. $output .= " <span class='ajax_search_title'>";
  200. $output .= get_the_title($post->ID);
  201. $output .= " </span>";
  202. $output .= " <span class='ajax_search_excerpt'>";
  203. $output .= $excerpt;
  204. $output .= " </span>";
  205. $output .= "</span>";
  206. $output .= "</a>";
  207. }
  208. }
  209.  
  210. $output .= "<a class='ajax_search_entry ajax_search_entry_view_all' href='".$search_messages['all_results_link']."'>".$search_messages['view_all_results']."</a>";
  211.  
  212. echo $output;
  213. die();
  214. }
  215. }
  216.  
  217.  
  218. if(!function_exists('avia_social_widget_icon'))
  219. {
  220. /*modify twitter social count widget and add social icons as iconfont*/
  221. add_filter('avf_social_widget', 'avia_social_widget_icon',2,2);
  222.  
  223. function avia_social_widget_icon($content, $icon)
  224. {
  225. global $avia_config;
  226.  
  227. $content = "<span class='social_widget_icon' ".av_icon_string($icon)."></span>".$content;
  228. return $content;
  229. }
  230. }
  231.  
  232.  
  233.  
  234.  
  235.  
  236. //call functions for the theme
  237. add_filter('the_content_more_link', 'avia_remove_more_jump_link');
  238. add_post_type_support('page', 'excerpt');
  239.  
  240.  
  241.  
  242.  
  243. //allow additional file type uploads
  244. if(!function_exists('avia_upload_mimes'))
  245. {
  246. add_filter('upload_mimes','avia_upload_mimes');
  247. function avia_upload_mimes($mimes){ return array_merge($mimes, array ('mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'txt' => 'text/plain')); }
  248. }
  249.  
  250.  
  251.  
  252.  
  253. //change default thumbnail size and fullwidth size on theme activation
  254. if(!function_exists('avia_set_thumb_size'))
  255. {
  256. add_action('avia_backend_theme_activation', 'avia_set_thumb_size');
  257. function avia_set_thumb_size()
  258. {
  259. update_option( 'thumbnail_size_h', 80 ); update_option( 'thumbnail_size_w', 80 );
  260. update_option( 'large_size_w', 1030 ); update_option( 'large_size_h', 1030 );
  261. }
  262. }
  263.  
  264.  
  265.  
  266.  
  267. //add support for post thumbnails
  268. add_theme_support( 'post-thumbnails' );
  269.  
  270.  
  271.  
  272.  
  273. //advanced title + breadcrumb function
  274. if(!function_exists('avia_title'))
  275. {
  276. function avia_title($args = false, $id = false)
  277. {
  278. global $avia_config;
  279.  
  280. if(!$id) $id = avia_get_the_id();
  281.  
  282. $header_settings = avia_header_setting();
  283. if($header_settings['header_title_bar'] == 'hidden_title_bar') return "";
  284.  
  285. $defaults = array(
  286.  
  287. 'title' => get_the_title($id),
  288. 'subtitle' => "", //avia_post_meta($id, 'subtitle'),
  289. 'link' => get_permalink($id),
  290. 'html' => "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>",
  291. 'class' => 'stretch_full container_wrap alternate_color '.avia_is_dark_bg('alternate_color', true),
  292. 'breadcrumb' => true,
  293. 'additions' => "",
  294. 'heading' => 'h1' //headings are set based on this article: http://yoast.com/blog-headings-structure/
  295. );
  296.  
  297. if ( is_tax() || is_category() || is_tag() )
  298. {
  299. global $wp_query;
  300.  
  301. $term = $wp_query->get_queried_object();
  302. $defaults['link'] = get_term_link( $term );
  303. }
  304. else if(is_archive())
  305. {
  306. $defaults['link'] = "";
  307. }
  308.  
  309. //disable breadcrumb if requested
  310. if($header_settings['header_title_bar'] == 'title_bar') $defaults['breadcrumb'] = false;
  311.  
  312. // Parse incomming $args into an array and merge it with $defaults
  313. $args = wp_parse_args( $args, $defaults );
  314. $args = apply_filters('avf_title_args', $args, $id);
  315.  
  316. // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
  317. extract( $args, EXTR_SKIP );
  318.  
  319. if(empty($title)) $class .= " empty_title ";
  320. $markup = avia_markup_helper(array('context' => 'avia_title','echo'=>false));
  321. if(!empty($link)) $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".esc_attr( $title )."' $markup>".$title."</a>";
  322. if(!empty($subtitle)) $additions .= "<div class='title_meta meta-color'>".wpautop($subtitle)."</div>";
  323. if($breadcrumb) $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
  324.  
  325.  
  326. $html = str_replace('{class}', $class, $html);
  327. $html = str_replace('{title}', $title, $html);
  328. $html = str_replace('{additions}', $additions, $html);
  329. $html = str_replace('{heading}', $heading, $html);
  330.  
  331.  
  332.  
  333. if(!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview())
  334. {
  335. $avia_config['small_title'] = $title;
  336. }
  337. else
  338. {
  339. return $html;
  340. }
  341. }
  342. }
  343.  
  344.  
  345.  
  346. if(!function_exists('avia_post_nav'))
  347. {
  348. function avia_post_nav($same_category = false, $taxonomy = 'category')
  349. {
  350. global $wp_version;
  351. $settings = array();
  352. $settings['same_category'] = $same_category;
  353. $settings['excluded_terms'] = '';
  354. $settings['wpversion'] = $wp_version;
  355.  
  356. //dont display if a fullscreen slider is available since they overlap
  357. if((class_exists('avia_sc_layerslider') && !empty(avia_sc_layerslider::$slide_count)) ||
  358. class_exists('avia_sc_slider_full') && !empty(avia_sc_slider_full::$slide_count) ) $settings['is_fullwidth'] = true;
  359.  
  360. $settings['type'] = get_post_type();
  361. $settings['taxonomy'] = ($settings['type'] == 'portfolio') ? 'portfolio_entries' : $taxonomy;
  362.  
  363. if(!is_singular() || is_post_type_hierarchical($settings['type'])) $settings['is_hierarchical'] = true;
  364. if($settings['type'] === 'topic' || $settings['type'] === 'reply') $settings['is_bbpress'] = true;
  365.  
  366. $settings = apply_filters('avia_post_nav_settings', $settings);
  367. if(!empty($settings['is_bbpress']) || !empty($settings['is_hierarchical']) || !empty($settings['is_fullwidth'])) return;
  368.  
  369. if(version_compare($settings['wpversion'], '3.8', '>=' ))
  370. {
  371. $entries['prev'] = get_previous_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
  372. $entries['next'] = get_next_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
  373. }
  374. else
  375. {
  376. $entries['prev'] = get_previous_post($settings['same_category']);
  377. $entries['next'] = get_next_post($settings['same_category']);
  378. }
  379.  
  380. $entries = apply_filters('avia_post_nav_entries', $entries, $settings);
  381. $output = "";
  382.  
  383.  
  384. foreach ($entries as $key => $entry)
  385. {
  386. if(empty($entry)) continue;
  387. $the_title = isset($entry->av_custom_title) ? $entry->av_custom_title : avia_backend_truncate(get_the_title($entry->ID),75," ");
  388. $link = isset($entry->av_custom_link) ? $entry->av_custom_link : get_permalink($entry->ID);
  389. $image = isset($entry->av_custom_image) ? $entry->av_custom_image : get_the_post_thumbnail($entry->ID, 'thumbnail');
  390.  
  391. $tc1 = $tc2 = "";
  392. $class = $image ? "with-image" : "without-image";
  393.  
  394. $output .= "<a class='avia-post-nav avia-post-{$key} {$class}' href='{$link}' >";
  395. $output .= " <span class='label iconfont' ".av_icon_string($key)."></span>";
  396. $output .= " <span class='entry-info-wrap'>";
  397. $output .= " <span class='entry-info'>";
  398. $tc1 = " <span class='entry-title'>{$the_title}</span>";
  399. if($image) $tc2 = " <span class='entry-image'>{$image}</span>";
  400. $output .= $key == 'prev' ? $tc1.$tc2 : $tc2.$tc1;
  401. $output .= " </span>";
  402. $output .= " </span>";
  403. $output .= "</a>";
  404. }
  405. return $output;
  406. }
  407. }
  408.  
  409.  
  410.  
  411. if(!function_exists('avia_legacy_websave_fonts'))
  412. {
  413. add_filter('avia_style_filter', 'avia_legacy_websave_fonts');
  414.  
  415. function avia_legacy_websave_fonts($styles)
  416. {
  417. global $avia_config;
  418.  
  419. $os_info = avia_get_browser(false);
  420. $activate = false;
  421.  
  422. if('windows' == $os_info['platform'] && avia_get_option('websave_windows') == 'active')
  423. {
  424. if($os_info['shortname'] == 'MSIE' && $os_info['mainversion'] < 9) $activate = true;
  425. if($os_info['shortname'] == 'Firefox' && $os_info['mainversion'] < 8) $activate = true;
  426. if($os_info['shortname'] == 'Opera' && $os_info['mainversion'] < 11) $activate = true;
  427.  
  428. if($activate == true)
  429. {
  430. foreach ($styles as $key => $style)
  431. {
  432. if($style['key'] == 'google_webfont')
  433. {
  434. if (strpos($style['value'], '-websave') !== false)
  435. {
  436. $websave = explode(',',$style['value']);
  437. $websave = strtolower(" ".$websave[0]);
  438. $websave = str_replace('"','',$websave);
  439. $websave = str_replace("'",'',$websave);
  440. $websave = str_replace("-websave",'',$websave);
  441.  
  442. $avia_config['font_stack'] .= $websave.'-websave';
  443. }
  444.  
  445. unset($styles[$key]);
  446. }
  447. }
  448.  
  449. if(empty($avia_config['font_stack'])) $avia_config['font_stack'] = 'arial-websave';
  450. }
  451. }
  452.  
  453. return $styles;
  454. }
  455. }
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462. //wrap ampersands into special calss to apply special styling
  463.  
  464. if(!function_exists('avia_ampersand'))
  465. {
  466. add_filter('avia_ampersand','avia_ampersand');
  467.  
  468. function avia_ampersand($content)
  469. {
  470. //ampersands
  471. $content = str_replace(" &amp; "," <span class='special_amp'>&amp;</span> ",$content);
  472. $content = str_replace(" &#038; "," <span class='special_amp'>&amp;</span> ",$content);
  473.  
  474.  
  475. // quotes
  476. $content = str_replace("“","<span class='special_amp'>“</span>",$content); // left double quotation mark “
  477. $content = str_replace("”","<span class='special_amp'>”</span>",$content); // right double quotation mark ”
  478. $content = str_replace("„","<span class='special_amp'>„</span>",$content); // double low-9 quotation mark „
  479.  
  480.  
  481. $content = str_replace("&#8220;","<span class='special_amp'>&#8220;</span>",$content); // left double quotation mark “
  482. $content = str_replace("&#8221;","<span class='special_amp'>&#8221;</span>",$content); // right double quotation mark ”
  483. $content = str_replace("&#8222;","<span class='special_amp'>&#8222;</span>",$content); // double low-9 quotation mark „
  484.  
  485. return $content;
  486. }
  487. }
  488.  
  489.  
  490.  
  491.  
  492.  
  493. // checks if a background color of a specific region is dark or light and returns a class name
  494. if(!function_exists('avia_is_dark_bg'))
  495. {
  496. function avia_is_dark_bg($region, $return_only = false)
  497. {
  498. global $avia_config;
  499.  
  500. $return = "";
  501. $color = $avia_config['backend_colors']['color_set'][$region]['bg'];
  502.  
  503. $is_dark = avia_backend_calc_preceived_brightness($color, 70);
  504.  
  505. $return = $is_dark ? "dark_bg_color" : "light_bg_color";
  506. if($return_only)
  507. {
  508. return $return;
  509. }
  510. else
  511. {
  512. echo $return;
  513. }
  514. }
  515. }
  516.  
  517.  
  518.  
  519.  
  520. //set post excerpt to be visible on theme acivation in user backend
  521. if(!function_exists('avia_show_menu_description'))
  522. {
  523.  
  524. //add_action('avia_backend_theme_activation', 'avia_show_menu_description');
  525. function avia_show_menu_description()
  526. {
  527. global $current_user;
  528. get_currentuserinfo();
  529. $old_meta_data = $meta_data = get_user_meta($current_user->ID, 'metaboxhidden_page', true);
  530.  
  531. if(is_array($meta_data) && isset($meta_data[0]))
  532. {
  533. $key = array_search('postexcerpt', $meta_data);
  534.  
  535. if($key !== false)
  536. {
  537. unset($meta_data[$key]);
  538. update_user_meta( $current_user->ID, 'metaboxhidden_page', $meta_data, $old_meta_data );
  539. }
  540. }
  541. else
  542. {
  543. update_user_meta( $current_user->ID, 'metaboxhidden_page', array('postcustom', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv', 'revisionsdiv') );
  544. }
  545. }
  546. }
  547.  
  548.  
  549.  
  550.  
  551. /*
  552. * make google analytics code work, even if the user only enters the UA id. if the new async tracking code is entered add it to the header, else to the footer
  553. */
  554.  
  555. if(!function_exists('avia_get_tracking_code'))
  556. {
  557. add_action('init', 'avia_get_tracking_code');
  558.  
  559. function avia_get_tracking_code()
  560. {
  561. global $avia_config;
  562.  
  563. $avia_config['analytics_code'] = avia_option('analytics', false, false, true);
  564. if(empty($avia_config['analytics_code'])) return;
  565.  
  566. if(strpos($avia_config['analytics_code'],'UA-') === 0) // if we only get passed the UA-id create the script for the user (async tracking code)
  567. {
  568.  
  569. $avia_config['analytics_code'] = "
  570.  
  571. <script type='text/javascript'>
  572. var _gaq = _gaq || []; _gaq.push(['_setAccount', '".$avia_config['analytics_code']."']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();
  573. </script>
  574.  
  575. ";
  576. }
  577.  
  578. add_action('wp_footer', 'avia_print_tracking_code');
  579. }
  580.  
  581. function avia_print_tracking_code()
  582. {
  583. global $avia_config;
  584.  
  585. if(!empty($avia_config['analytics_code']))
  586. {
  587. echo $avia_config['analytics_code'];
  588. }
  589. }
  590.  
  591. }
  592.  
  593.  
  594. /*
  595. function that checks which header style we are using. In general the whole site has the same header active, based on the option in theme options->header
  596. however, for the theme demo we need to showcase all headers, thats why we can simply add a custom field key to overwrite the default heading
  597. */
  598.  
  599. if(!function_exists('avia_header_setting'))
  600. {
  601. function avia_header_setting($single_val = false)
  602. {
  603. global $avia_config;
  604. if(isset($avia_config['header_settings']) && $single_val && isset($avia_config['header_settings'][$single_val])) return $avia_config['header_settings'][$single_val];
  605. if(isset($avia_config['header_settings']) && !$single_val) return $avia_config['header_settings']; //return cached header setting if available
  606.  
  607. $defaults = array( 'header_position' => 'header_top',
  608. 'header_layout'=>'logo_left menu_right',
  609. 'header_size'=>'slim',
  610. 'header_custom_size'=>'',
  611. 'header_sticky'=>'header_sticky',
  612. 'header_shrinking'=>'header_shrinking',
  613. 'header_title_bar'=>'',
  614. 'header_social'=>'',
  615. 'header_secondary_menu'=>'',
  616. 'header_stretch'=>'',
  617. 'header_custom_size'=>'',
  618. 'header_phone_active'=>'',
  619. 'header_replacement_logo'=>'',
  620. 'header_replacement_menu'=>'',
  621. 'header_mobile_behavior' => '',
  622. 'header_mobile_activation' => 'mobile_menu_phone',
  623. 'phone'=>'',
  624. 'sidebarmenu_sticky' => 'conditional_sticky',
  625. 'layout_align_content' => 'content_align_center',
  626. 'sidebarmenu_widgets' => '',
  627. 'sidebarmenu_social' => 'disabled'
  628. );
  629.  
  630. $settings = avia_get_option();
  631.  
  632. //overwrite with custom fields if they are set
  633. $post_id = avia_get_the_id();
  634. if($post_id && is_singular())
  635. {
  636. $custom_fields = get_post_custom($post_id);
  637.  
  638. foreach($defaults as $key =>$default)
  639. {
  640. if(!empty($custom_fields[$key]) && !empty($custom_fields[$key][0]) )
  641. {
  642. $settings[$key] = $custom_fields[$key][0];
  643. }
  644. }
  645.  
  646. //check if header transparency is set to true
  647. $transparency = post_password_required() ? false : get_post_meta($post_id, 'header_transparency', true);
  648. }
  649.  
  650. $header = shortcode_atts($defaults, $settings);
  651. $header['header_scroll_offset'] = avia_get_header_scroll_offset($header);
  652.  
  653. if($header['header_position'] != "header_top") return avia_header_setting_sidebar($header, $single_val);
  654.  
  655. //set header transparency
  656. $header['header_transparency'] = "";
  657. if(!empty($transparency)) $header['header_transparency'] = 'header_transparency';
  658. if(!empty($transparency) && strpos($transparency, 'glass')) $header['header_transparency'] .= ' header_glassy';
  659. if(!empty($transparency) && strpos($transparency, 'hidden')) $header['disabled'] = true;
  660. if(!empty($transparency) && strpos($transparency, 'scrolldown'))
  661. {
  662. $header['header_transparency'] .= ' header_scrolldown';
  663. $header['header_sticky'] = 'header_sticky';
  664. }
  665.  
  666.  
  667. //deactivate title bar if header is transparent
  668. if(!empty($transparency)) $header['header_title_bar'] = 'hidden_title_bar';
  669.  
  670. //sticky and shrinking are tied together
  671. if($header['header_sticky'] == 'disabled') { $header['header_shrinking'] = 'disabled'; $header['header_scroll_offset'] = 0; }
  672.  
  673. //if the custom height is less than 70 shrinking doesnt really work
  674. if($header['header_size'] == 'custom' && (int) $header['header_custom_size'] < 65) $header['header_shrinking'] = 'disabled';
  675.  
  676. //create a header class so we can style properly
  677. $header_class_var = array('header_position', 'header_layout', 'header_size', 'header_sticky', 'header_shrinking', 'header_stretch', 'header_mobile_activation', 'header_transparency' );
  678. $header['header_class'] = "";
  679.  
  680. foreach($header_class_var as $class_name)
  681. {
  682. if(!empty($header[$class_name]))
  683. {
  684. if($header[$class_name] == "disabled") $header[$class_name] = $class_name."_disabled";
  685. $header['header_class'] .= " av_".str_replace(' ',' av_',$header[$class_name]);
  686. }
  687. }
  688.  
  689. //set manual flag if we should display the top bar
  690. $header['header_topbar'] = false;
  691. if(strpos($header['header_social'], 'extra_header_active') !== false || strpos($header['header_secondary_menu'], 'extra_header_active') !== false || !empty($header['header_phone_active'])){ $header['header_topbar'] = 'header_topbar_active'; }
  692.  
  693. //set manual flag if the menu is at the bottom
  694. $header['bottom_menu'] = false;
  695. if(strpos($header['header_layout'],'bottom_nav_header') !== false) $header['bottom_menu'] = 'header_bottom_menu_active';
  696.  
  697.  
  698.  
  699. //header class that tells us to use the alternate logo
  700. if(!empty($header['header_replacement_logo']))
  701. {
  702. $header['header_class'] .= " av_alternate_logo_active";
  703. if(is_numeric($header['header_replacement_logo']))
  704. {
  705. $header['header_replacement_logo'] = wp_get_attachment_image_src($header['header_replacement_logo'], 'full');
  706. $header['header_replacement_logo'] = $header['header_replacement_logo'][0];
  707. }
  708.  
  709. }
  710.  
  711. $header = apply_filters('avf_header_setting_filter', $header);
  712.  
  713. //make settings available globaly
  714. $avia_config['header_settings'] = $header;
  715.  
  716. if(!empty($single_val) && isset($header[$single_val])) return $header[$single_val];
  717.  
  718. return $header;
  719. }
  720. }
  721.  
  722. if(!function_exists('avia_header_setting_sidebar'))
  723. {
  724. function avia_header_setting_sidebar($header, $single_val = false)
  725. {
  726. $overwrite = array( 'header_layout'=>'logo_left menu_right',
  727. 'header_size'=>'slim',
  728. 'header_custom_size'=>'',
  729. 'header_sticky'=>'disabled',
  730. 'header_shrinking'=>'disabled',
  731. 'header_title_bar'=>'hidden_title_bar',
  732. 'header_social'=>'',
  733. 'header_secondary_menu'=>'',
  734. 'header_stretch'=>'',
  735. 'header_custom_size'=>'',
  736. 'header_phone_active'=>'disabled',
  737. 'header_replacement_logo'=>'',
  738. 'header_replacement_menu'=>'',
  739. 'header_mobile_behavior' => '',
  740. 'header_mobile_activation' => 'mobile_menu_phone',
  741. 'phone'=>'',
  742. 'header_topbar'=> false,
  743. 'bottom_menu'=> false
  744. );
  745.  
  746. $header = array_merge($header, $overwrite);
  747.  
  748. if( strpos($header['header_position'] , 'left') === false ) $header['sidebarmenu_sticky'] = "never_sticky";
  749.  
  750. $header['header_class'] = " av_".str_replace(' ',' av_',$header['header_position']." ".$header['sidebarmenu_sticky']);
  751.  
  752. $header = apply_filters('avf_header_setting_filter', $header);
  753.  
  754. //make settings available globaly
  755. $avia_config['header_settings'] = $header;
  756.  
  757. if(!empty($single_val) && isset($header[$single_val])) return $header[$single_val];
  758.  
  759. return $header;
  760. }
  761. }
  762.  
  763.  
  764. if(!function_exists('avia_get_header_scroll_offset'))
  765. {
  766. function avia_get_header_scroll_offset($header = array())
  767. {
  768. //#main data attribute used to calculate scroll offset
  769.  
  770. if(empty($header))
  771. {
  772. $header['header_position'] = avia_get_option('header_position','header_top');
  773. $header['header_size'] = avia_get_option('header_size');
  774. $header['header_custom_size'] = avia_get_option('header_custom_size');
  775. }
  776.  
  777. switch($header['header_size'])
  778. {
  779. case 'large': $header['header_scroll_offset'] = 116; break;
  780. case 'custom': $header['header_scroll_offset'] = $header['header_custom_size']; break;
  781. default : $header['header_scroll_offset'] = 88; break;
  782. }
  783.  
  784. if($header['header_position'] != 'header_top') $header['header_scroll_offset'] = 0;
  785.  
  786. return $header['header_scroll_offset'];
  787. }
  788. }
  789.  
  790. if(!function_exists('avia_header_class_string'))
  791. {
  792. function avia_header_class_string($necessary = array() , $prefix = "html_"){
  793.  
  794. if(empty($necessary)) $necessary = array( 'header_position',
  795. 'header_layout',
  796. 'header_size',
  797. 'header_sticky',
  798. 'header_shrinking',
  799. 'header_topbar',
  800. 'header_transparency',
  801. 'header_mobile_activation',
  802. 'header_mobile_behavior',
  803. 'layout_align_content'
  804. );
  805.  
  806. $settings = avia_header_setting();
  807. $class = array();
  808. $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
  809.  
  810. foreach($necessary as $class_name)
  811. {
  812. if(!empty($settings[$class_name]))
  813. {
  814. $result = array_filter(explode(' ', $settings[$class_name]));
  815. $class = array_merge($class, $result);
  816. }
  817. }
  818.  
  819. if($post_id) $class[] = "entry_id_".$post_id;
  820.  
  821. if(!empty($class))
  822. {
  823. $class = array_unique($class);
  824. $class = " ".$prefix.implode(" ".$prefix, $class);
  825. }
  826.  
  827.  
  828. return $class;
  829. }
  830. }
  831.  
  832.  
  833.  
  834. if(!function_exists('avia_blog_class_string'))
  835. {
  836. function avia_blog_class_string($necessary = array() , $prefix = "av-"){
  837.  
  838. if(empty($necessary)) $necessary = array( 'blog-meta-author',
  839. 'blog-meta-comments',
  840. 'blog-meta-category',
  841. 'blog-meta-date',
  842. 'blog-meta-html-info',
  843. 'blog-meta-tag',
  844. );
  845. $class = array();
  846. $settings = avia_get_option();
  847.  
  848. foreach($necessary as $class_name)
  849. {
  850. if(isset($settings[$class_name]) && $settings[$class_name] == "disabled") $class[] = $class_name."-disabled";
  851. }
  852.  
  853. if(empty($class)) $class = "";
  854. if(!empty($class))
  855. {
  856. $class = array_unique($class);
  857. if(!empty($class[0]))
  858. {
  859. $class = " ".$prefix.implode(" ".$prefix, $class);
  860. }
  861. else
  862. {
  863. $class = "";
  864. }
  865. }
  866.  
  867.  
  868. return $class;
  869. }
  870. }
  871.  
  872.  
  873.  
  874. if(!function_exists('avia_header_html_custom_height'))
  875. {
  876. function avia_header_html_custom_height()
  877. {
  878. $settings = avia_header_setting();
  879.  
  880. if($settings['header_size'] == "custom")
  881. {
  882. $size = $settings['header_custom_size'];
  883. $bottom_bar = $settings['bottom_menu'] == true ? 36 : 0;
  884. $top_bar = $settings['header_topbar'] == true ? 30 : 0;
  885.  
  886. $html = "";
  887. $html .= "\n<style type='text/css' media='screen'>\n";
  888. $html .= " #header_main .container, .main_menu ul:first-child > li a{ height:{$size}px; line-height: {$size}px; }\n";
  889. $html .= " .html_header_top.html_header_sticky #top #wrap_all #main{ padding-top:".((int)$size + $bottom_bar + $top_bar)."px; } \n";
  890. $html .= "</style>\n";
  891. echo $html;
  892. }
  893.  
  894. }
  895.  
  896. add_action('wp_head', 'avia_header_html_custom_height');
  897.  
  898. }
  899.  
  900.  
  901. /*
  902. * Display sidebar widgets in the main navigation area when it is set as sidebar instead of top
  903. */
  904. if(!function_exists('avia_sidebar_menu_additions'))
  905. {
  906. function avia_sidebar_menu_additions()
  907. {
  908. $settings = avia_header_setting();
  909. $output = "";
  910.  
  911. if($settings['header_position'] != "header_top")
  912. {
  913. /*add social icons*/
  914. if($settings['sidebarmenu_social'] != "disabled")
  915. {
  916. $social_args = array('outside'=>'ul', 'inside'=>'li', 'append' => '');
  917. $social = avia_social_media_icons($social_args, false);
  918. if($social) $output .= "<div class='av-sidebar-social-container'>".$social."</div>";
  919. }
  920.  
  921.  
  922. /*add widgets*/
  923. if(!empty( $settings['sidebarmenu_widgets']))
  924. {
  925. if('av-auto-widget-logic' == $settings['sidebarmenu_widgets'])
  926. {
  927.  
  928. }
  929. else if( is_dynamic_sidebar( $settings['sidebarmenu_widgets'] ) )
  930. {
  931. ob_start();
  932. dynamic_sidebar( $settings['sidebarmenu_widgets'] );
  933. $output .= ob_get_clean();
  934. $output = "<aside class='avia-custom-sidebar-widget-area sidebar sidebar_right'>".$output."</aside>";
  935. }
  936. }
  937. }
  938.  
  939. echo $output;
  940.  
  941. }
  942.  
  943. add_action('ava_after_main_menu', 'avia_sidebar_menu_additions');
  944.  
  945. }
  946.  
  947.  
  948.  
  949.  
  950.  
  951. /*
  952. * Display a subnavigation for pages that is automatically generated, so the users doesnt need to work with widgets
  953. */
  954. if(!function_exists('avia_sidebar_menu'))
  955. {
  956. function avia_sidebar_menu($echo = true)
  957. {
  958. $sidebar_menu = "";
  959.  
  960. $subNav = avia_get_option('page_nesting_nav');
  961.  
  962.  
  963. $the_id = @get_the_ID();
  964. $args = array();
  965. global $post;
  966.  
  967. if($subNav && $subNav != 'disabled' && !empty($the_id) && is_page())
  968. {
  969. $subNav = false;
  970. $parent = $post->ID;
  971. $sidebar_menu = "";
  972.  
  973. if (!empty($post->post_parent))
  974. {
  975. if(isset($post->ancestors)) $ancestors = $post->ancestors;
  976. if(!isset($ancestors)) $ancestors = get_post_ancestors($post->ID);
  977. $root = count($ancestors)-1;
  978. $parent = $ancestors[$root];
  979. }
  980.  
  981. $args = array('title_li'=>'', 'child_of'=>$parent, 'echo'=>0, 'sort_column'=>'menu_order, post_title');
  982.  
  983. //enables user to change query args
  984. $args = apply_filters('avia_sidebar_menu_args', $args, $post);
  985.  
  986. //hide or show child pages in menu - if the class is set to 'widget_nav_hide_child' the child pages will be hidden
  987. $display_child_pages = apply_filters('avia_sidebar_menu_display_child', 'widget_nav_hide_child', $args, $post);
  988.  
  989. $children = wp_list_pages($args);
  990.  
  991. if ($children)
  992. {
  993. $default_sidebar = false;
  994. $sidebar_menu .= "<nav class='widget widget_nav_menu $display_child_pages'><ul class='nested_nav'>";
  995. $sidebar_menu .= $children;
  996. $sidebar_menu .= "</ul></nav>";
  997. }
  998. }
  999.  
  1000. $sidebar_menu = apply_filters('avf_sidebar_menu_filter', $sidebar_menu, $args, $post);
  1001.  
  1002. if($echo == true) { echo $sidebar_menu; } else { return $sidebar_menu; }
  1003. }
  1004. }
  1005.  
  1006.  
  1007. /*
  1008. function that checks if updates for the theme are available - disabled for the moment because we use the new updater
  1009.  
  1010. if(!function_exists('avia_check_updates') && class_exists('avia_update_notifier'))
  1011. {
  1012. function avia_check_updates()
  1013. {
  1014. if(class_exists('avia_update_notifier'))
  1015. {
  1016. $avia_update_notifier = new avia_update_notifier('http://www.kriesi.at/themes/wp-content/uploads/avia_xml/'.THEMENAME.'-Updates.xml');
  1017. }
  1018. }
  1019.  
  1020. add_action('admin_menu', 'avia_check_updates', 1, 1);
  1021. }
  1022. */
  1023.  
  1024. /*
  1025. show tag archive page for post type - without this code you'll get 404 errors: http://wordpress.org/support/topic/custom-post-type-tagscategories-archive-page
  1026. */
  1027. if(!function_exists('avia_fix_tag_archive_page'))
  1028. {
  1029. function avia_fix_tag_archive_page($query)
  1030. {
  1031. $post_types = get_post_types();
  1032.  
  1033. if ( is_category() || is_tag())
  1034. {
  1035. if(!is_admin() && $query->is_main_query() )
  1036. {
  1037. $post_type = get_query_var(get_post_type());
  1038.  
  1039. if ($post_type) {
  1040. $post_type = $post_type;
  1041. } else {
  1042. $post_type = $post_types;
  1043. }
  1044. $query->set('post_type', $post_type);
  1045. }
  1046. }
  1047.  
  1048.  
  1049. return $query;
  1050. }
  1051. add_filter('pre_get_posts', 'avia_fix_tag_archive_page');
  1052. }
  1053.  
  1054.  
  1055.  
  1056. /*
  1057. * add html5.js script to head section - required for IE compatibility
  1058. */
  1059. if(!function_exists('avia_print_html5_js_script'))
  1060. {
  1061. add_action('wp_head', 'avia_print_html5_js_script');
  1062.  
  1063. function avia_print_html5_js_script()
  1064. {
  1065. $template_url = get_template_directory_uri();
  1066. $output = '';
  1067.  
  1068. $output .= '<!--[if lt IE 9]>';
  1069. $output .= '<script src="'.$template_url.'/js/html5shiv.js"></script>';
  1070. $output .= '<![endif]-->';
  1071. echo $output;
  1072. }
  1073. }
  1074.  
  1075.  
  1076. if(!function_exists('avia_add_compat_header'))
  1077. {
  1078. add_filter('wp_headers', 'avia_add_compat_header');
  1079. function avia_add_compat_header($headers)
  1080. {
  1081. if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
  1082. {
  1083. $headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
  1084. }
  1085. return $headers;
  1086. }
  1087. }
  1088.  
  1089.  
  1090. /*
  1091. Add a checkbox to the featured image metabox
  1092. */
  1093. if(!function_exists('avia_theme_featured_image_meta'))
  1094. {
  1095. add_filter( 'admin_post_thumbnail_html', 'avia_theme_featured_image_meta');
  1096.  
  1097. function avia_theme_featured_image_meta( $content )
  1098. {
  1099. global $post, $post_type;
  1100.  
  1101. if($post_type == "post")
  1102. {
  1103. $text = __( "Don't display image on single post", 'avia_framework' );
  1104. $id = '_avia_hide_featured_image';
  1105. $value = esc_attr( get_post_meta( $post->ID, $id, true ) );
  1106. $selected = !empty($value) ? "checked='checked'" : "";
  1107.  
  1108. $label = '<label for="' . $id . '" class="selectit"><input '.$selected.' name="' . $id . '" type="checkbox" id="' . $id . '" value="1" > ' . $text .'</label>';
  1109. return $content .= $label;
  1110. }
  1111.  
  1112. return $content;
  1113. }
  1114. }
  1115.  
  1116. /*
  1117. Make sure the checkbox above is saved properly
  1118. */
  1119. if(!function_exists('avia_add_feature_image_checkbox'))
  1120. {
  1121. add_filter( 'avf_builder_elements', 'avia_add_feature_image_checkbox');
  1122.  
  1123. function avia_add_feature_image_checkbox($elements)
  1124. {
  1125. $elements[] = array(
  1126. "slug" => "layout",
  1127. "id" => "_avia_hide_featured_image",
  1128. "type" => "fake",
  1129. );
  1130.  
  1131. return $elements;
  1132. }
  1133. }
  1134.  
  1135.  
  1136.  
  1137.  
  1138. if(!function_exists('avia_menu_button_style'))
  1139. {
  1140. add_action('wp_nav_menu_item_custom_fields', 'avia_menu_button_style', 10, 4);
  1141.  
  1142. function avia_menu_button_style($output, $item, $depth, $args)
  1143. {
  1144. $item_id = $item->ID;
  1145. $key = "style";
  1146. $name = "menu-item-avia-".$key; //name prefix must be the same for all items
  1147. $value = get_post_meta( $item->ID, '_'.$name, true);
  1148. ?>
  1149.  
  1150. <!-- *************** start conditional logic input fields *************** -->
  1151. <p class="field-avia-link-style description description-wide avia_mega_menu avia_mega_menu_d0">
  1152. <label for="<?php echo $key; ?>">
  1153. <?php _e( 'Menu Style' ); ?><br />
  1154. <select id="<?php echo $name . "-". $item_id;?>" class="widefat edit-menu-item-target" name="<?php echo $name . "[". $item_id ."]";?>">
  1155. <option value="" <?php selected( $value, ''); ?> ><?php _e('Default Style'); ?> </option>
  1156. <option value="av-menu-button av-menu-button-colored" <?php selected( $value, 'av-menu-button av-menu-button-colored'); ?> ><?php _e('Button Style (Colored)' ); ?> </option>
  1157. <option value="av-menu-button av-menu-button-bordered" <?php selected( $value, 'av-menu-button av-menu-button-bordered'); ?> ><?php _e('Button Style (Bordered)'); ?> </option>
  1158. </select>
  1159. </label>
  1160. </p>
  1161.  
  1162. <?php
  1163.  
  1164.  
  1165. }
  1166.  
  1167. add_filter('avf_mega_menu_post_meta_fields','avia_menu_button_style_save',10,3);
  1168. function avia_menu_button_style_save($check, $menu_id, $menu_item_db)
  1169. {
  1170. $check = array_merge($check, array('style'));
  1171. return $check;
  1172. }
  1173.  
  1174.  
  1175. }
  1176. if(!function_exists('avia_generate_grid_dimension'))
  1177. {
  1178. add_action('ava_generate_styles','avia_generate_grid_dimension', 30, 3); /*after theme update*/
  1179.  
  1180. function avia_generate_grid_dimension($options, $color_set, $styles)
  1181. {
  1182. global $avia_config;
  1183. extract($options);
  1184.  
  1185. if(empty($content_width)) $content_width = 73;
  1186. if(empty($combined_width)) $combined_width = 100;
  1187. if(empty($responsive_size)) $responsive_size = "1130px";
  1188.  
  1189. if($responsive_size != "")
  1190. {
  1191. $avia_config['style'][] = array(
  1192. 'key' => 'direct_input',
  1193. 'value' => ".container {width:".$combined_width."%;} .container .av-content-small.units {width:".$content_width."%; }
  1194.  
  1195. .responsive .boxed#top , .responsive.html_boxed.html_header_sticky #header{ width: ".$responsive_size."; max-width:90%; }
  1196. .responsive .container{ max-width: ".$responsive_size."; }
  1197. "
  1198. );
  1199. }
  1200. }
  1201. }
  1202.  
  1203.  
  1204.  
  1205. /*
  1206. function that saves the style options array into an external css file rather than fetching the data from the database
  1207. */
  1208.  
  1209. if(!function_exists('avia_generate_stylesheet'))
  1210. {
  1211. add_action('ava_after_theme_update', 'avia_generate_stylesheet', 30, 1); /*after theme update*/
  1212. add_action('ava_after_import_demo_settings', 'avia_generate_stylesheet', 30, 1); /*after demo settings imoport*/
  1213. add_action('avia_ajax_after_save_options_page', 'avia_generate_stylesheet', 30, 1); /*after options page saving*/
  1214.  
  1215. function avia_generate_stylesheet($options = false)
  1216. {
  1217. global $avia;
  1218. $safe_name = avia_backend_safe_string($avia->base_data['prefix']);
  1219.  
  1220. if( defined('AVIA_CSSFILE') && AVIA_CSSFILE === FALSE )
  1221. {
  1222. $dir_flag = update_option( 'avia_stylesheet_dir_writable'.$safe_name, 'false' );
  1223. $stylesheet_flag = update_option( 'avia_stylesheet_exists'.$safe_name, 'false' );
  1224. return;
  1225. }
  1226.  
  1227. $wp_upload_dir = wp_upload_dir();
  1228. $stylesheet_dir = $wp_upload_dir['basedir'].'/dynamic_avia';
  1229. $stylesheet_dir = str_replace('\\', '/', $stylesheet_dir);
  1230. $stylesheet_dir = apply_filters('avia_dyn_stylesheet_dir_path', $stylesheet_dir);
  1231. $isdir = avia_backend_create_folder($stylesheet_dir);
  1232.  
  1233. /*
  1234. * directory could not be created (WP upload folder not write able)
  1235. * @todo save error in db and output error message for user.
  1236. * @todo maybe add mkdirfix: http://php.net/manual/de/function.mkdir.php
  1237. */
  1238.  
  1239. if($isdir === false)
  1240. {
  1241. $dir_flag = update_option( 'avia_stylesheet_dir_writable'.$safe_name, 'false' );
  1242. $stylesheet_flag = update_option( 'avia_stylesheet_exists'.$safe_name, 'false' );
  1243. return;
  1244. }
  1245.  
  1246. /*
  1247. * Go ahead - WP managed to create the folder as expected
  1248. */
  1249. $stylesheet = trailingslashit( $stylesheet_dir ) . $safe_name.'.css';
  1250. $stylesheet = apply_filters('avia_dyn_stylesheet_file_path', $stylesheet);
  1251.  
  1252.  
  1253. //import avia_superobject and reset the options array
  1254. $avia_superobject = $GLOBALS['avia'];
  1255. $avia_superobject->reset_options();
  1256.  
  1257. //regenerate style array after saving options page so we can create a new css file that has the actual values and not the ones that were active when the script was called
  1258. avia_prepare_dynamic_styles();
  1259.  
  1260. //generate stylesheet content
  1261. $generate_style = new avia_style_generator($avia_superobject,false,false,false);
  1262. $styles = $generate_style->create_styles();
  1263.  
  1264. $created = avia_backend_create_file($stylesheet, $styles, true);
  1265.  
  1266. if($created === true)
  1267. {
  1268. $dir_flag = update_option( 'avia_stylesheet_dir_writable'.$safe_name, 'true' );
  1269. $stylesheet_flag = update_option( 'avia_stylesheet_exists'.$safe_name, 'true' );
  1270. $dynamic_id = update_option( 'avia_stylesheet_dynamic_version'.$safe_name, uniqid() );
  1271. }
  1272. }
  1273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement