Beispiel #1
0
 /**
  * The constructor 
  * checks if we are currently viewing a post creation site and hooks into the admin_menu as well as into the save_post to create and safe the meta boxes
  * It also creates the html object necessary to render the boxes 
  */
 function avia_meta_box($avia_superobject)
 {
     if (basename($_SERVER['PHP_SELF']) == "post-new.php" || basename($_SERVER['PHP_SELF']) == "post.php") {
         $this->superobject = $avia_superobject;
         $this->html = new avia_htmlhelper($avia_superobject);
         $this->html->context = "metabox";
         $this->meta_prefix = avia_backend_safe_string($avia_superobject->base_data['prefix']);
         add_action('admin_menu', array(&$this, 'init_boxes'));
         add_action('save_post', array(&$this, 'save_post'));
     }
 }
Beispiel #2
0
function avia_woocommerce_first_activation()
{
    if (!is_admin()) {
        return;
    }
    $themeNice = avia_backend_safe_string(THEMENAME);
    if (get_option("{$themeNice}_woo_settings_enabled")) {
        return;
    }
    update_option("{$themeNice}_woo_settings_enabled", '1');
    avia_woocommerce_set_defaults();
}
Beispiel #3
0
 /**
  * The avia media get_custom_post function gets a custom post based on a post title. if no post cold be found it creates one
  * @param string $post_title the title of the post
  * @package 	AviaFramework
  */
 public static function get_custom_post($post_title)
 {
     $save_title = avia_backend_safe_string($post_title);
     $args = array('post_type' => 'avia_framework_post', 'post_title' => 'avia_' . $save_title, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed');
     $avia_post = avia_media::get_post_by_title($args['post_title']);
     if (!isset($avia_post['ID'])) {
         $avia_post_id = wp_insert_post($args);
     } else {
         $avia_post_id = $avia_post['ID'];
     }
     return $avia_post_id;
 }
 public function __construct(&$avia_superobject, $print_styles = true, $print_extra_output = true, $addaction = true)
 {
     $this->print_styles = $print_styles;
     $this->print_extra_output = $print_extra_output;
     //check if stylesheet exists...
     $safe_name = avia_backend_safe_string($avia_superobject->base_data['prefix']);
     if (get_option('avia_stylesheet_exists' . $safe_name) == 'true') {
         $this->print_styles = false;
     }
     if ($addaction) {
         add_action('wp_head', array(&$this, 'create_styles'), 1000);
     }
 }
 /**
  * The constructor sets up  $base_data and $option_prefix. It then gets database values and if we are viewing the backend it calls the option page creator as well
  */
 public function avia_superobject($base_data)
 {
     $this->base_data = $base_data;
     $this->option_prefix = 'avia_options_' . avia_backend_safe_string($this->base_data['prefix']);
     //set option array
     $this->_create_option_arrays();
     if (current_theme_supports('avia_mega_menu')) {
         new avia_megamenu($this);
     }
     $this->style = new avia_style_generator($this);
     add_action('wp_footer', array(&$this, 'set_javascript_framework_url'));
     if (is_admin()) {
         add_action('admin_print_scripts', array(&$this, 'set_javascript_framework_url'));
         new avia_adminpages($this);
         new avia_meta_box($this);
         new avia_wp_export($this);
     }
 }
 function avia_wpml_copy_options()
 {
     global $avia, $avia_config;
     $key = isset($avia->base_data['prefix_origin']) ? $avia->base_data['prefix_origin'] : $avia->base_data['prefix'];
     $original_key = 'avia_options_' . avia_backend_safe_string($key);
     $language_key = 'avia_options_' . avia_backend_safe_string($avia->base_data['prefix']);
     if ($original_key !== $language_key) {
         $lang_set = get_option($language_key);
         if (empty($lang_set)) {
             $lang_set = get_option($original_key);
             update_option($language_key, $lang_set);
             wp_redirect($_SERVER['REQUEST_URI']);
             exit;
         }
     }
 }
 function avia_register_frontend_scripts()
 {
     $template_url = get_template_directory_uri();
     $child_theme_url = get_stylesheet_directory_uri();
     //register js
     wp_enqueue_script('avia-compat', $template_url . '/js/avia-compat.js', array('jquery'), 2, false);
     //needs to be loaded at the top to prevent bugs
     wp_enqueue_script('avia-default', $template_url . '/js/avia.js', array('jquery'), 3, true);
     wp_enqueue_script('avia-shortcodes', $template_url . '/js/shortcodes.js', array('jquery'), 3, true);
     wp_enqueue_script('avia-popup', $template_url . '/js/aviapopup/jquery.magnific-popup.min.js', array('jquery'), 2, true);
     wp_enqueue_script('jquery');
     wp_enqueue_script('wp-mediaelement');
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     //register styles
     wp_register_style('avia-style', $child_theme_url . "/style.css", array(), '2', 'all');
     //register default style.css file. only include in childthemes. has no purpose in main theme
     wp_register_style('avia-custom', $template_url . "/css/custom.css", array(), '2', 'all');
     wp_enqueue_style('avia-grid', $template_url . "/css/grid.css", array(), '2', 'all');
     wp_enqueue_style('avia-base', $template_url . "/css/base.css", array(), '2', 'all');
     wp_enqueue_style('avia-layout', $template_url . "/css/layout.css", array(), '2', 'all');
     wp_enqueue_style('avia-scs', $template_url . "/css/shortcodes.css", array(), '2', 'all');
     wp_enqueue_style('avia-popup-css', $template_url . "/js/aviapopup/magnific-popup.css", array(), '1', 'screen');
     wp_enqueue_style('avia-media', $template_url . "/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen');
     wp_enqueue_style('avia-print', $template_url . "/css/print.css", array(), '1', 'print');
     if (is_rtl()) {
         wp_enqueue_style('avia-rtl', $template_url . "/css/rtl.css", array(), '1', 'all');
     }
     global $avia;
     $safe_name = avia_backend_safe_string($avia->base_data['prefix']);
     $safe_name = apply_filters('avf_dynamic_stylesheet_filename', $safe_name);
     if (get_option('avia_stylesheet_exists' . $safe_name) == 'true') {
         $avia_upload_dir = wp_upload_dir();
         if (is_ssl()) {
             $avia_upload_dir['baseurl'] = str_replace("http://", "https://", $avia_upload_dir['baseurl']);
         }
         $avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/' . $safe_name . '.css';
         $version_number = get_option('avia_stylesheet_dynamic_version' . $safe_name);
         if (empty($version_number)) {
             $version_number = '1';
         }
         wp_enqueue_style('avia-dynamic', $avia_dyn_stylesheet_url, array(), $version_number, 'all');
     }
     wp_enqueue_style('avia-custom');
     if ($child_theme_url != $template_url) {
         wp_enqueue_style('avia-style');
     }
 }
 function avia_generate_stylesheet($options = false)
 {
     global $avia;
     $safe_name = avia_backend_safe_string($avia->base_data['prefix']);
     $safe_name = apply_filters('avf_dynamic_stylesheet_filename', $safe_name);
     if (defined('AVIA_CSSFILE') && AVIA_CSSFILE === FALSE) {
         $dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'false');
         $stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'false');
         return;
     }
     $wp_upload_dir = wp_upload_dir();
     $stylesheet_dir = $wp_upload_dir['basedir'] . '/dynamic_avia';
     $stylesheet_dir = str_replace('\\', '/', $stylesheet_dir);
     $stylesheet_dir = apply_filters('avia_dyn_stylesheet_dir_path', $stylesheet_dir);
     $isdir = avia_backend_create_folder($stylesheet_dir);
     /*
      * directory could not be created (WP upload folder not write able)
      * @todo save error in db and output error message for user.
      * @todo maybe add mkdirfix: http://php.net/manual/de/function.mkdir.php
      */
     if ($isdir === false) {
         $dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'false');
         $stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'false');
         return;
     }
     /*
      *  Go ahead - WP managed to create the folder as expected
      */
     $stylesheet = trailingslashit($stylesheet_dir) . $safe_name . '.css';
     $stylesheet = apply_filters('avia_dyn_stylesheet_file_path', $stylesheet);
     //import avia_superobject and reset the options array
     $avia_superobject = $GLOBALS['avia'];
     $avia_superobject->reset_options();
     //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
     avia_prepare_dynamic_styles();
     //generate stylesheet content
     $generate_style = new avia_style_generator($avia_superobject, false, false, false);
     $styles = $generate_style->create_styles();
     $created = avia_backend_create_file($stylesheet, $styles, true);
     if ($created === true) {
         $dir_flag = update_option('avia_stylesheet_dir_writable' . $safe_name, 'true');
         $stylesheet_flag = update_option('avia_stylesheet_exists' . $safe_name, 'true');
         $dynamic_id = update_option('avia_stylesheet_dynamic_version' . $safe_name, uniqid());
     }
 }
 /**
  * 
  * The page_header method renders the beginning of the option page, with header area, logo and various other informations
  * @return string $output the string returned contains the html code generated within the method
  */
 function page_header()
 {
     $the_title = apply_filters('avia_filter_backend_page_title', $this->avia_superobject->base_data['Title']);
     $output = '<form id="avia_options_page" action="#" method="post">';
     $output .= '	<div class="avia_options_page_inner avia_sidebar_active">';
     $output .= '	<div class="avia_options_page_sidebar"><div class="avia_header">';
     $output .= apply_filters('avia_options_page_header', "");
     $output .= '	</div><div class="avia_sidebar_content"></div></div>';
     $output .= '		<div class="avia_options_page_content">';
     $output .= '			<div class="avia_header">';
     $output .= '			<h2 class="avia_logo">' . $the_title . ' ' . $this->avia_superobject->currentpage . '</h2>';
     $output .= '				<ul class="avia_help_links">';
     $output .= '					<li><a class="thickbox" onclick="return false;" href="http://docs.kriesi.at/' . avia_backend_safe_string($this->avia_superobject->base_data['prefix']) . '/changelog/index.php?TB_iframe=1">Changelog</a> |</li>';
     $output .= '					<li><a target="_blank" href="http://docs.kriesi.at/' . avia_backend_safe_string($this->avia_superobject->base_data['prefix']) . '/documentation/">Docs</a></li>';
     $output .= '				</ul>';
     $output .= '				<a class="avia_shop_option_link" href="#">Show all Options [+]</a>';
     $output .= '				<span class="avia_loading"></span>';
     $output .= $this->save_button();
     $output .= '			</div>';
     $output .= '			<div class="avia_options_container">';
     return $output;
 }
 function avia_backend_admin_bar_menu()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     global $avia, $wp_admin_bar;
     $real_id = is_admin() ? false : avia_get_the_ID();
     //home edit button for frontpage
     if (is_front_page()) {
         $front_id = avia_get_option('frontpage');
         $parent = "";
         if ($front_id && $real_id == $front_id) {
             $menu = array('id' => 'edit', 'title' => __('Edit Frontpage', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'));
             $wp_admin_bar->add_menu($menu);
         }
     }
     //dynamic tempalte edit for current entry, in case a dynamic tempalte is applied
     if ($real_id && ($template = avia_is_dynamic_template())) {
         $safeSlug = avia_backend_safe_string($template);
         $menu = array('id' => 'avia_edit', 'title' => __('Edit this entry', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
         $wp_admin_bar->add_menu($menu);
         $menu = array('id' => 'avia_edit_dynamic', 'title' => __('Edit Dynamic Template of this entry', 'avia_framework'), 'href' => admin_url("admin.php?page=templates#goto_" . $safeSlug), 'meta' => array('target' => 'blank'), 'parent' => 'edit');
         $wp_admin_bar->add_menu($menu);
     }
     // add all option pages
     if (empty($avia->option_pages)) {
         return;
     }
     $urlBase = admin_url('admin.php');
     foreach ($avia->option_pages as $avia_page) {
         $safeSlug = avia_backend_safe_string($avia_page['title']);
         $menu = array('id' => $avia_page['slug'], 'title' => strip_tags($avia_page['title']), 'href' => $urlBase . "?page=" . $avia_page['slug'], 'meta' => array('target' => 'blank'));
         if ($avia_page['slug'] != $avia_page['parent']) {
             $menu['parent'] = $avia_page['parent'];
             $menu['href'] = $urlBase . "?page=" . $avia_page['parent'] . "#goto_" . $avia_page['slug'];
         }
         if (is_admin()) {
             $menu['meta'] = array('onclick' => 'self.location.replace(encodeURI("' . $menu['href'] . '")); window.location.reload(true);  ');
         }
         $wp_admin_bar->add_menu($menu);
     }
 }
 function add_option_page($data)
 {
     $data['slug'] = avia_backend_safe_string(trim($data['name']));
     $data_to_check = array($data['parent'], $data['name'], $data['slug']);
     //check for invalid data
     foreach ($data_to_check as $input) {
         if (!avia_backend_check_by_regex($input, 'safe_data')) {
             return 'invalid_data';
         }
     }
     //check if the name already exists
     foreach ($this->avia_superobject->option_pages as $existing_page) {
         if ($existing_page['title'] == trim($data['name']) || $existing_page['slug'] == $data['slug']) {
             return 'name_already_exists';
         }
     }
     $page_key = $data['prefix'] . "_dynamic_pages";
     $current_options = get_option($page_key);
     if ($current_options == "") {
         $current_options = array();
     }
     $result = array('slug' => avia_backend_safe_string($data['slug']), 'parent' => $data['parent'], 'icon' => $data['icon'], 'title' => trim($data['name']), 'removable' => $data['remove_label']);
     if (isset($data['sortable'])) {
         $result['sortable'] = $data['sortable'];
     }
     $current_options[] = $result;
     update_option($page_key, $current_options);
     return $result;
 }
 /**
  * Send the form
  *
  * The send method tries to send the form. It builds the necessary email and submits it via wp_mail
  */
 function send()
 {
     $new_post = array();
     foreach ($_POST as $key => $post) {
         $new_post[str_replace('avia_', '', $key)] = $post;
     }
     $mymail = empty($this->form_params['myemail']) ? $new_post['myemail'] : $this->form_params['myemail'];
     $myblogname = empty($this->form_params['myblogname']) ? $new_post['myblogname'] : $this->form_params['myblogname'];
     if (empty($new_post['subject_' . $this->formID]) && !empty($this->form_params['subject'])) {
         $new_post['subject_' . $this->formID] = $this->form_params['subject'];
     }
     $subject = empty($new_post['subject_' . $this->formID]) ? __("New Message", 'avia_framework') . " (" . __('sent by contact form at', 'avia_framework') . " " . $myblogname . ")" : $new_post['subject_' . $this->formID];
     $default_from = parse_url(home_url());
     //hook to stop execution here and do something different with the data
     $proceed = apply_filters('avf_form_send', true, $new_post, $this->form_params);
     if (!$proceed) {
         return true;
     }
     //set the email adress
     $from = "*****@*****.**";
     $usermail = false;
     if (!empty($default_from['host'])) {
         $from = "no-reply@" . $default_from['host'];
     }
     if (!empty($this->autoresponder[0])) {
         $from = $_POST[$this->autoresponder[0]];
         $usermail = true;
     } else {
         $email_variations = array('e-mail', 'email', 'mail');
         foreach ($email_variations as $key) {
             foreach ($new_post as $current_key => $current_post) {
                 if (strpos($current_key, $key) !== false) {
                     $from = $new_post[$current_key];
                     $usermail = true;
                     break;
                 }
             }
             if ($usermail == true) {
                 break;
             }
         }
     }
     $to = urldecode($mymail);
     $delimiter = ",";
     if (strpos($to, ',') === false && strpos($to, ' ') !== false) {
         $delimiter = " ";
     }
     $to = array_filter(array_map('trim', explode($delimiter, $to)));
     $to = apply_filters("avf_form_sendto", $to, $new_post, $this->form_params);
     $from = urldecode($from);
     $from = apply_filters("avf_form_from", $from, $new_post, $this->form_params);
     $subject = urldecode($subject);
     $subject = apply_filters("avf_form_subject", $subject, $new_post, $this->form_params);
     $message = "";
     $iterations = 0;
     foreach ($this->form_elements as $key => $element) {
         $key = avia_backend_safe_string($key, '_', true);
         if (empty($key)) {
             $iterations++;
             $key = $iterations;
         }
         // substract 5 characters from the string length because we removed the avia_ prefix with 5 characters at the beginning of the send() function
         $key = avia_backend_truncate($key, $this->length - 5, "_", "", false, '', false);
         $key .= $this->id_sufix;
         if (!empty($new_post[$key])) {
             if ($element['type'] != 'hidden' && $element['type'] != 'decoy') {
                 if ($element['type'] == 'textarea') {
                     $message .= " <br/>";
                 }
                 $field_value = apply_filters("avf_form_mail_field_values", nl2br(urldecode($new_post[$key])), $new_post, $this->form_elements, $this->form_params);
                 $message .= $element['label'] . ": " . $field_value . " <br/>";
                 if ($element['type'] == 'textarea') {
                     $message .= " <br/>";
                 }
             }
         }
     }
     $use_wpmail = apply_filters("avf_form_use_wpmail", true, $new_post, $this->form_params);
     //$header  = 'MIME-Version: 1.0' . "\r\n";
     $header = 'Content-type: text/html; charset=utf-8' . "\r\n";
     $header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params);
     $copy = apply_filters("avf_form_copy", $to, $new_post, $this->form_params);
     $message = stripslashes($message);
     foreach ($copy as $send_to_mail) {
         if ($use_wpmail) {
             $header .= 'From: ' . $from . " <" . $from . "> \r\n";
             wp_mail($send_to_mail, $subject, $message, $header);
         } else {
             $header .= 'From:' . $from . " \r\n";
             mail($send_to_mail, $subject, $message, $header);
         }
     }
     //autoresponder?
     if ($usermail && !empty($this->form_params['autoresponder'])) {
         //$header  = 'MIME-Version: 1.0' . "\r\n";
         $header = 'Content-type: text/html; charset=utf-8' . "\r\n";
         $header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params);
         $message = nl2br($this->form_params['autoresponder']) . "<br/><br/><br/><strong>" . __('Your Message:', 'avia_framework') . " </strong><br/><br/>" . $message;
         $message = apply_filters("avf_form_autorespondermessage", $message);
         $from = apply_filters("avf_form_autoresponder_from", $from, $new_post, $this->form_params);
         if ($use_wpmail) {
             $header .= 'From:' . get_bloginfo('name') . ' <' . urldecode($this->form_params['autoresponder_email']) . "> \r\n";
             wp_mail($from, $this->form_params['autoresponder_subject'], $message, $header);
         } else {
             $header .= 'From:' . urldecode($this->form_params['autoresponder_email']) . " \r\n";
             mail($from, $this->form_params['autoresponder_subject'], $message, $header);
         }
     }
     unset($_POST);
     return true;
     //return wp_mail( $to, $subject, $message , $header);
 }
 function avia_ajax_import_parent_data()
 {
     //check if user is allowed to save and if its his intention with a nonce check
     if (function_exists('check_ajax_referer')) {
         check_ajax_referer('avia_nonce_import_parent_settings');
     }
     if (is_child_theme()) {
         global $avia;
         $theme = wp_get_theme();
         $parent = wp_get_theme($theme->get('Template'));
         $parent_option_prefix = 'avia_options_' . avia_backend_safe_string($parent->get('Name'));
         $parent_options = get_option($parent_option_prefix);
         if (empty($parent_options)) {
             die('No Parent Theme Options Found. There is nothing to import');
         }
         update_option($avia->option_prefix, $parent_options);
     } else {
         die('No Parent Theme found');
     }
     die('avia_import');
 }
 function register_custom_sidebars()
 {
     if (empty($this->sidebars)) {
         $this->sidebars = get_option($this->stored);
     }
     $args = array('before_widget' => '<div id="%1$s" class="widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>');
     $args = apply_filters('avia_custom_widget_args', $args);
     if (is_array($this->sidebars)) {
         foreach ($this->sidebars as $sidebar) {
             $args['name'] = $sidebar;
             $args['id'] = avia_backend_safe_string($sidebar, '-');
             $args['class'] = 'avia-custom';
             register_sidebar($args);
         }
     }
 }
 /**
  * Send the form
  *
  * The send method tries to send the form. It builds the necessary email and submits it via wp_mail
  */
 function send()
 {
     $new_post = array();
     foreach ($_POST as $key => $post) {
         $new_post[str_replace('avia_', '', $key)] = $post;
     }
     $mymail = empty($this->form_paramas['myemail']) ? $new_post['myemail'] : $this->form_paramas['myemail'];
     $myblogname = empty($this->form_paramas['myblogname']) ? $new_post['myblogname'] : $this->form_paramas['myblogname'];
     $subject = empty($new_post['subject']) ? __("New Message", 'avia_framework') : $new_post['subject'];
     $default_from = parse_url(get_option('home'));
     //set the email adress
     $from = "*****@*****.**";
     $usermail = false;
     if (!empty($default_from['host'])) {
         $from = "no-reply@" . $default_from['host'];
     }
     if (!empty($this->autoresponder[0])) {
         $from = $_POST[$this->autoresponder[0]];
         $usermail = true;
     } else {
         $email_variations = array('e-mail', 'email', 'mail');
         foreach ($email_variations as $key) {
             foreach ($new_post as $current_key => $current_post) {
                 if (strpos($current_key, $key) !== false) {
                     $from = $new_post[$current_key];
                     $usermail = true;
                     break;
                 }
             }
             if ($usermail == true) {
                 break;
             }
         }
     }
     $to = urldecode($mymail);
     $from = urldecode($from);
     $subject = urldecode($subject . " (" . __('sent by contact form at ', 'avia_framework') . $myblogname . ")");
     $message = "";
     $iterations = 0;
     foreach ($this->form_elements as $key => $element) {
         $key = avia_backend_safe_string($key);
         if (empty($key)) {
             $iterations++;
             $key = $iterations;
         }
         if (!empty($new_post[$key])) {
             if ($element['type'] != 'hidden' && $element['type'] != 'decoy') {
                 if ($element['type'] == 'textarea') {
                     $message .= "<br/>";
                 }
                 $message .= $element['label'] . ": " . nl2br(urldecode($new_post[$key])) . "<br/>";
                 if ($element['type'] == 'textarea') {
                     $message .= "<br/>";
                 }
             }
         }
     }
     $header = 'MIME-Version: 1.0' . "\r\n";
     $header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
     $header .= 'From:' . $from . " \r\n";
     mail($to, $subject, $message, $header);
     //autoresponder?
     if ($usermail && !empty($this->form_paramas['autoresponder'])) {
         $header = 'MIME-Version: 1.0' . "\r\n";
         $header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
         $header .= 'From:' . urldecode($this->form_paramas['autoresponder_email']) . " \r\n";
         $message = nl2br($this->form_paramas['autoresponder']) . "<br/><br/><br/><strong>Your Message:</strong><br/><br/>" . $message;
         mail($from, $this->form_paramas['autoresponder_subject'], $message, $header);
     }
     return true;
     //return wp_mail( $to, $subject, $message , $header);
 }
Beispiel #16
0
function avia_include_layerslider()
{
    if (!is_admin() && !post_has_layerslider()) {
        return;
    }
    // Path for LayerSlider WP main PHP file
    $layerslider = get_template_directory() . '/config-layerslider/LayerSlider/layerslider.php';
    $themeNice = avia_backend_safe_string(THEMENAME);
    // Check if the file is available and the user didnt activate the layerslide plugin to prevent warnings
    if (file_exists($layerslider)) {
        if (function_exists('layerslider')) {
            if (get_option("{$themeNice}_layerslider_activated", '0') == '0') {
                //import sample sliders
                avia_import_sample_slider();
                // Save a flag that it is activated, so this won't run again
                update_option("{$themeNice}_layerslider_activated", '1');
            }
        } else {
            // Include the file
            include $layerslider;
            $GLOBALS['lsPluginPath'] = get_template_directory_uri() . '/config-layerslider/LayerSlider/';
            $GLOBALS['lsAutoUpdateBox'] = false;
            // Activate the plugin if necessary
            if (get_option("{$themeNice}_layerslider_activated", '0') == '0') {
                // Run activation script
                layerslider_activation_scripts();
                //import sample sliders
                avia_import_sample_slider();
                // Save a flag that it is activated, so this won't run again
                update_option("{$themeNice}_layerslider_activated", '1');
            }
        }
    }
}
function avia_update_widget($prev_version, $new_version)
{
    //if the previous theme version is equal or bigger to 3.1 we don't need to update
    if (version_compare($prev_version, '3.1.4', ">=")) {
        return;
    }
    $map = array('av_everywhere', 'av_blog', 'av_pages');
    if (class_exists('woocommerce')) {
        $map[] = 'av_shop_overview';
        $map[] = 'av_shop_single';
    }
    for ($i = 1; $i <= avia_get_option('footer_columns', '5'); $i++) {
        $map[] = 'av_footer_' . $i;
    }
    if (class_exists('bbPress')) {
        $map[] = 'av_forum';
    }
    $dynamic = get_option('avia_sidebars');
    if (is_array($dynamic) && !empty($dynamic)) {
        foreach ($dynamic as $key => $value) {
            $map[] = avia_backend_safe_string($value, '-');
        }
    }
    $current_sidebars = get_option('sidebars_widgets');
    if (!empty($current_sidebars) && isset($current_sidebars['sidebar-1'])) {
        $new_sidebars = array('wp_inactive_widgets' => $current_sidebars['wp_inactive_widgets']);
        foreach ($map as $key => $sidebar) {
            if (isset($current_sidebars['sidebar-' . ($key + 1)])) {
                $new_sidebars[$sidebar] = $current_sidebars['sidebar-' . ($key + 1)];
            }
        }
        update_option('sidebars_widgets', $new_sidebars);
    }
}
Beispiel #18
0
 function avia_register_frontend_scripts()
 {
     $template_url = get_template_directory_uri();
     $child_theme_url = get_stylesheet_directory_uri();
     //register js
     wp_enqueue_script('avia-compat', $template_url . '/js/avia-compat.js', array('jquery'), 1, false);
     //needs to be loaded at the top to prevent bugs
     wp_enqueue_script('avia-default', $template_url . '/js/avia.js', array('jquery'), 1, true);
     wp_enqueue_script('avia-shortcodes', $template_url . '/js/shortcodes.js', array('jquery'), 1, true);
     wp_enqueue_script('avia-prettyPhoto', $template_url . '/js/prettyPhoto/js/jquery.prettyPhoto.js', 'jquery', "3.1.5", true);
     wp_deregister_script('wc-add-to-cart-variation');
     wp_dequeue_script('wc-add-to-cart-variation');
     wp_register_script('wc-add-to-cart-variation', $template_url . '/js/custom_variation.js', true);
     wp_enqueue_script('wc-add-to-cart-variation');
     wp_enqueue_script('jquery');
     wp_enqueue_script('wp-mediaelement');
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     //register styles
     wp_register_style('avia-style', $child_theme_url . "/style.css", array(), '1', 'all');
     //register default style.css file. only include in childthemes. has no purpose in main theme
     wp_register_style('avia-custom', $template_url . "/css/custom.css", array(), '1', 'all');
     wp_enqueue_style('bootstrap', $template_url . "/css/bootstrap.css");
     wp_enqueue_style('avia-grid', $template_url . "/css/grid.css", array(), '1', 'all');
     wp_enqueue_style('avia-base', $template_url . "/css/base.css", array(), '1', 'all');
     wp_enqueue_style('avia-layout', $template_url . "/css/layout.css", array(), '1', 'all');
     wp_enqueue_style('avia-scs', $template_url . "/css/shortcodes.css", array(), '1', 'all');
     wp_enqueue_style('avia-prettyP', $template_url . "/js/prettyPhoto/css/prettyPhoto.css", array(), '1', 'screen');
     wp_enqueue_style('avia-media', $template_url . "/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen');
     wp_enqueue_style('avia-print', $template_url . "/css/print.css", array(), '1', 'print');
     if (is_rtl()) {
         wp_enqueue_style('avia-rtl', $template_url . "/css/rtl.css", array(), '1', 'screen');
     }
     global $avia;
     $safe_name = avia_backend_safe_string($avia->base_data['prefix']);
     if (get_option('avia_stylesheet_exists' . $safe_name) == 'true') {
         $avia_upload_dir = wp_upload_dir();
         $avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/' . $safe_name . '.css';
         wp_enqueue_style('avia-dynamic', $avia_dyn_stylesheet_url, array(), '1', 'all');
     }
     wp_enqueue_style('avia-custom');
     if ($child_theme_url != $template_url) {
         wp_enqueue_style('avia-style');
     }
 }
$avia_elements[] = array("slug" => "styling", "type" => "visual_group_end", "nodescription" => true);
$avia_elements[] = array("name" => "Heading Font", "slug" => "styling", "desc" => "The Font heading utilizes cufon and allows you to use a wide range of custom fonts for your headings", "id" => "font_heading", "type" => "select", "no_first" => true, "std" => "", "subtype" => array('no custom font' => '', 'Arvo' => 'arvo__1.3', 'Bevan' => 'bevan__1.3', 'Cantarell' => 'cantarell__1.3', 'Cardo' => 'cardo__1.3', 'Droid Sans' => 'droidsans__1.3', 'Inconsolata' => 'inconsolata__1.3', 'Josefin All Characters' => 'josefine__1.3', 'Josefin Common Characters' => 'josefine_small__1.3', 'Kreon' => 'kreon__1.3', 'Lobster' => 'lobster__1.3', 'Molengo' => 'molengo__1.3', 'Oswald' => 'oswald__1.3', 'Reenie Beanie' => 'reeniebeanie__1.6', 'Tangerine' => 'tangerine__2.2', 'Vollkorn' => 'vollkorn__1.3', 'Yanone Kaffeesatz' => 'yanonekaffeesatz__1.3'));
$avia_elements[] = array("slug" => "styling", "name" => "Quick CSS", "desc" => "Just want to do some quick CSS changes? Enter them here, they will be applied to the theme. If you need to change major portions of the theme please use the custom.css file.", "id" => "quick_css", "type" => "textarea");
/*Layout Settings*/
$avia_elements[] = array("slug" => "layout", "name" => "Do you want to use a stretched layout or a boxed?", "desc" => "The stretched layout expands from the left side of the viewport to the right.", "id" => "boxed", "type" => "select", "std" => "boxed", "subtype" => array('Stretched layout' => 'stretched', 'Boxed Layout' => 'boxed'));
$avia_elements[] = array("slug" => "layout", "name" => "Default Blog Layout", "desc" => "Choose the default blog layout here. You can create multiple blogs with different layouts by using the template builder if you want to", "id" => "blog_layout", "type" => "select", "std" => "big_image sidebar_right single_sidebar", "no_first" => true, "subtype" => array('Big preview image, left sidebar' => 'big_image sidebar_left single_sidebar', 'Big preview image, right sidebar' => 'big_image sidebar_right single_sidebar', 'Medium preview image, left sidebar' => 'medium_image sidebar_left single_sidebar', 'Medium preview image, right sidebar' => 'medium_image sidebar_right single_sidebar', 'Medium preview image, left and right sidebar' => 'medium_image dual-sidebar', 'Small preview image, left sidebar' => 'small_image sidebar_left single_sidebar', 'Small preview image, right sidebar' => 'small_image sidebar_right single_sidebar'));
$avia_elements[] = array("slug" => "layout", "name" => "Default Page Layout", "desc" => "Choose the default page layout here. You can change the setting of each individual page when editing that page", "id" => "page_layout", "type" => "select", "std" => "big_image sidebar_left single_sidebar", "no_first" => true, "subtype" => array('Big preview image, left sidebar' => 'big_image sidebar_left single_sidebar', 'Big preview image, right sidebar' => 'big_image sidebar_right single_sidebar', 'Medium preview image, left and right sidebar' => 'medium_image dual-sidebar', 'Fullsize preview image, no sidebar' => 'fullwidth'));
$avia_elements[] = array("slug" => "layout", "name" => "Page Sidebar navigation", "desc" => "You can choose to display a sidebar navigation for all nested subpages of a page automatically. ", "id" => "page_nesting_nav", "type" => "select", "std" => "true", "no_first" => true, "subtype" => array('Display sidebar navigation' => 'true', 'Don\'t display Sidebar navigation' => ""));
/*Contact + social stuff*/
$avia_elements[] = array("name" => "Contact Form Page", "slug" => "contact", "desc" => "Select which page should be used to display your contact form.", "id" => "email_page", "type" => "select", "subtype" => 'page');
$avia_elements[] = array("name" => "Your email adress", "slug" => "contact", "desc" => "Enter the Email adress where mails should be delivered to. (default is '" . get_option('admin_email') . "')", "id" => "email", "std" => get_option('admin_email'), "type" => "text");
$avia_elements[] = array("name" => "Your twitter account", "slug" => "contact", "desc" => "Enter your twitter account name. If you leave this blank the twitter link in the head and footer of your site wont be displayed.", "id" => "twitter", "std" => "envato", "type" => "text");
$avia_elements[] = array("name" => "RSS feed url", "slug" => "contact", "desc" => "If you want to use a service like feedburner enter the feed url here. Otherwise the default wordpress feed url will be used", "id" => "feedburner", "std" => "", "type" => "text");
$avia_elements[] = array("name" => "Your facebook page/group/account", "desc" => "Enter the url to your facebook page/group/account. If you leave this blank the facebook link in the head and footer of your site wont be displayed.", "id" => "facebook", "slug" => "contact", "std" => "http://www.facebook.com/kriesi.at", "type" => "text");
/*sidebar settings*/
$avia_elements[] = array("name" => "Add new widget areas for pages and categories:", "desc" => "Here you can add widget areas for single pages or categories. that way you can put different content for each page/category into your sidebar.\nAfter you have choosen the Pages and Categorys which should receive a unique widget area press the 'Save Changes' button and then start adding widgets to the new widget areas <a href='widgets.php'>here</a>.\n<br/><br/>\n<strong>Attention when removing areas:</strong> You have to be carefull when deleting widget areas that are not the last one in the list.\nIt is recommended to avoid this. If you want to know more about this topic please read the documentation that comes with this theme.", "id" => "widgetdescription", "std" => "", "slug" => "sidebar", "type" => "heading", "nodescription" => true);
$avia_elements[] = array("slug" => "sidebar", "type" => "visual_group_start", "id" => "sidebar_left", "class" => "avia_one_half avia_first", "nodescription" => true);
$avia_elements[] = array("type" => "group", "id" => "widget_pages", "slug" => "sidebar", "linktext" => "Add another widget", "deletetext" => "Remove widget", "blank" => true, "nodescription" => true, 'subelements' => array(array("name" => "Select a PAGE that should receive a new widget area:", "desc" => "", "id" => "widget_page", "type" => "select", "slug" => "sidebar", "subtype" => 'page')));
$avia_elements[] = array("slug" => "sidebar", "type" => "visual_group_end", "nodescription" => true);
$avia_elements[] = array("slug" => "sidebar", "type" => "visual_group_start", "id" => "sidebar_right", "class" => "avia_one_half", "nodescription" => true);
$avia_elements[] = array("type" => "group", "slug" => "sidebar", "id" => "widget_categories", "linktext" => "Add another widget", "deletetext" => "Remove widget", "blank" => true, "nodescription" => true, 'subelements' => array(array("name" => "Select a Category that should receive a new widget area:", "desc" => "", "id" => "widget_cat", "slug" => "sidebar", "type" => "select", "subtype" => 'cat')));
$avia_elements[] = array("slug" => "sidebar", "type" => "visual_group_end", "nodescription" => true);
/*footer settings*/
$avia_elements[] = array("name" => "Logo Footer", "desc" => "Here you can add a Logo Gallery that will appear at your footer. Display the logos of partner shops for example", "id" => "gallery_image", "type" => "upload", "slug" => "footer", "subtype" => "advanced", "button-label" => "Upload", "label" => "Update Gallery", "attachment-prefix" => 'smart-logo-gallery', "no-attachment-id" => true);
$avia_elements[] = array("slug" => "footer", "name" => "Footer Logo Display", "desc" => "You can choose were to display the footer logos here. ", "id" => "footer_logo_where", "type" => "select", "std" => "true", "no_first" => true, "subtype" => array('Display only on frontpage' => '', 'Display everywhere' => "everywhere"));
$avia_elements[] = array("slug" => "footer", "name" => "Footer Columns", "desc" => "How many colmns should be diplayed in your footer", "id" => "footer_columns", "type" => "select", "std" => "4", "subtype" => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5'));
######################################################################
# TEMPLATE BUILDER
######################################################################
$avia_elements[] = array("name" => "How does this work?", "desc" => "\n\t\t\t\t\t\t\t<p>It only takes a few simple steps to create any number of unique page layouts with the template builder. The description bellow is just a short intro on how it works, you can read more about it in the <a target='_blank' href='http://docs.kriesi.at/" . avia_backend_safe_string($this->base_data['prefix']) . "/documentation#template_builder'>documentation</a></p>\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t<li>First you need to create a new Template by adding a name and hitting the 'Create template' Button</li>\n\t\t\t\t\t\t\t\t<li>Next you select your template from the sidebar at the left. Add elements like columns, post snippets, text content and widget areas.</li>\n\t\t\t\t\t\t\t\t<li>Once that is done save the changes by hitting 'Save all Changes'</li>\n\t\t\t\t\t\t\t\t<li>Now create or edit a page/post and you will notice that you can select your template at the <strong>Post or Page Layout</strong> section. If you do, it will be applied to the post or page.</li>\n\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t\t", "id" => "template_builder_description", "std" => "", "type" => "heading", "slug" => "templates", "nodescription" => true);
$avia_elements[] = array("name" => "Create a new dynamic template", "desc" => "Enter a name for your new template, then hit the 'Create template' Button<br/><strong>Please Note:</strong> Allowed characters include: a-z, A-Z, 0-9, space, underscore and dash", "label" => "Create template", "remove_label" => "remove this template", "id" => "template_builder", "type" => "create_options_page", "slug" => "templates", "template_sortable" => 'avia_sortable', "temlate_parent" => "templates", "temlate_icon" => "layout_header_footer_3_mix.png", "temlate_default_elements" => array(array("slug" => "templates", "name" => "Dynamic Template Page Layout", "desc" => "Choose the default page layout here. You can change the setting of each individual page when editing that page", "id" => "dynamic_page_layout", "type" => "select", "std" => "fullwidth", "no_first" => true, "subtype" => array('Left sidebar' => 'big_image sidebar_left single_sidebar', 'Right sidebar' => 'big_image sidebar_right single_sidebar', 'Left and Right sidebar' => 'medium_image dual-sidebar', 'Fullsize, no sidebar' => 'fullwidth')), array("type" => "dynamical_add_elements", "slug" => 'templates', "name" => "Add Elements", "desc" => "Select an Element and hit the 'Add Element' Button.<br/>The Element will be added to the template and you will be able to position it via drag and drop", "std" => "", "id" => "add_template_option", "options_file" => "includes/admin/register-admin-dynamic-options.php")));