Example #1
0
 function axiom_core_theme_setup()
 {
     // Add default posts and comments RSS feed links to head
     add_theme_support('automatic-feed-links');
     // Enable support for Post Thumbnails
     add_theme_support('post-thumbnails');
     // Custom header setup
     add_theme_support('custom-header', array('header-text' => false));
     // Custom backgrounds setup
     add_theme_support('custom-background');
     // Supported posts formats
     add_theme_support('post-formats', array('gallery', 'video', 'audio', 'link', 'quote', 'image', 'status', 'aside', 'chat'));
     // Autogenerate title tag
     add_theme_support('title-tag');
     // Add user menu
     add_theme_support('nav-menus');
     // WooCommerce Support
     add_theme_support('woocommerce');
     // Editor custom stylesheet - for user
     add_editor_style(axiom_get_file_url('css/editor-style.css'));
     // Make theme available for translation
     // Translations can be filed in the /languages/ directory
     load_theme_textdomain('axiom', axiom_get_folder_dir('languages'));
     /* Front and Admin actions and filters:
     		------------------------------------------------------------------------ */
     if (!is_admin()) {
         /* Front actions and filters:
         			------------------------------------------------------------------------ */
         // Get theme calendar (instead standard WP calendar) to support Events
         add_filter('get_calendar', 'axiom_get_calendar');
         // Filters wp_title to print a neat <title> tag based on what is being viewed
         if (floatval(get_bloginfo('version')) < "4.1") {
             add_filter('wp_title', 'axiom_wp_title', 10, 2);
         }
         // Add main menu classes
         //add_filter('wp_nav_menu_objects', 			'axiom_add_mainmenu_classes', 10, 2);
         // Prepare logo text
         add_filter('axiom_filter_prepare_logo_text', 'axiom_prepare_logo_text', 10, 1);
         // Add class "widget_number_#' for each widget
         add_filter('dynamic_sidebar_params', 'axiom_add_widget_number', 10, 1);
         // Frontend editor: Save post data
         add_action('wp_ajax_frontend_editor_save', 'axiom_callback_frontend_editor_save');
         add_action('wp_ajax_nopriv_frontend_editor_save', 'axiom_callback_frontend_editor_save');
         // Frontend editor: Delete post
         add_action('wp_ajax_frontend_editor_delete', 'axiom_callback_frontend_editor_delete');
         add_action('wp_ajax_nopriv_frontend_editor_delete', 'axiom_callback_frontend_editor_delete');
         // Enqueue scripts and styles
         add_action('wp_enqueue_scripts', 'axiom_core_frontend_scripts');
         add_action('wp_footer', 'axiom_core_frontend_scripts_inline');
         add_action('axiom_action_add_scripts_inline', 'axiom_core_add_scripts_inline');
         // Prepare theme core global variables
         add_action('axiom_action_prepare_globals', 'axiom_core_prepare_globals');
     }
     // Register theme specific nav menus
     axiom_register_theme_menus();
     // Register theme specific sidebars
     axiom_register_theme_sidebars();
 }
Example #2
0
 function import_essgrids()
 {
     if (axiom_exists_essgrids()) {
         $dir = axiom_get_folder_dir($this->options['folder_with_essgrids']);
         if (is_dir($dir)) {
             $hdir = @opendir($dir);
             if ($hdir) {
                 echo '<br><b>' . __('Import Essential Grids ...', 'axiom') . '</b><br>';
                 flush();
                 while (($file = readdir($hdir)) !== false) {
                     $pi = pathinfo($dir . '/' . $file);
                     if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || $pi['extension'] != 'json') {
                         continue;
                     }
                     if ($this->options['debug']) {
                         printf(__('Ess.Grid "%s":', 'axiom'), $file);
                     }
                     try {
                         $im = new Essential_Grid_Import();
                         $data = json_decode(axiom_fgc($dir . '/' . $file), true);
                         // Prepare arrays with overwrite flags
                         $tmp = array();
                         foreach ($data as $k => $v) {
                             if ($k == 'grids') {
                                 $name = 'grids';
                                 $name_1 = 'grid';
                                 $name_id = 'id';
                             } else {
                                 if ($k == 'skins') {
                                     $name = 'skins';
                                     $name_1 = 'skin';
                                     $name_id = 'id';
                                 } else {
                                     if ($k == 'elements') {
                                         $name = 'elements';
                                         $name_1 = 'element';
                                         $name_id = 'id';
                                     } else {
                                         if ($k == 'navigation-skins') {
                                             $name = 'navigation-skins';
                                             $name1 = 'nav-skin';
                                             $name_id = 'id';
                                         } else {
                                             if ($k == 'punch-fonts') {
                                                 $name = 'punch-fonts';
                                                 $name1 = 'punch-fonts';
                                                 $name_id = 'handle';
                                             } else {
                                                 if ($k == 'custom-meta') {
                                                     $name = 'custom-meta';
                                                     $name1 = 'custom-meta';
                                                     $name_id = 'handle';
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             if ($k == 'global-css') {
                                 $tmp['import-global-styles'] = "on";
                                 $tmp['global-styles-overwrite'] = "append";
                             } else {
                                 $tmp['import-' . $name] = "true";
                                 $tmp['import-' . $name . '-' . $name_id] = array();
                                 foreach ($v as $v1) {
                                     $tmp['import-' . $name . '-' . $name_id][] = $v1[$name_id];
                                     $tmp[$name_1 . '-overwrite-' . $name_id] = 'append';
                                 }
                             }
                         }
                         $im->set_overwrite_data($tmp);
                         //set overwrite data global to class
                         $skins = @$data['skins'];
                         if (!empty($skins) && is_array($skins)) {
                             $skins_ids = @$tmp['import-skins-id'];
                             $skins_imported = $im->import_skins($skins, $skins_ids);
                         }
                         $navigation_skins = @$data['navigation-skins'];
                         if (!empty($navigation_skins) && is_array($navigation_skins)) {
                             $navigation_skins_ids = @$tmp['import-navigation-skins-id'];
                             $navigation_skins_imported = $im->import_navigation_skins(@$navigation_skins, $navigation_skins_ids);
                         }
                         $grids = @$data['grids'];
                         if (!empty($grids) && is_array($grids)) {
                             $grids_ids = @$tmp['import-grids-id'];
                             $grids_imported = $im->import_grids($grids, $grids_ids);
                         }
                         $elements = @$data['elements'];
                         if (!empty($elements) && is_array($elements)) {
                             $elements_ids = @$tmp['import-elements-id'];
                             $elements_imported = $im->import_elements(@$elements, $elements_ids);
                         }
                         $custom_metas = @$data['custom-meta'];
                         if (!empty($custom_metas) && is_array($custom_metas)) {
                             $custom_metas_handle = @$tmp['import-custom-meta-handle'];
                             $custom_metas_imported = $im->import_custom_meta($custom_metas, $custom_metas_handle);
                         }
                         $custom_fonts = @$data['punch-fonts'];
                         if (!empty($custom_fonts) && is_array($custom_fonts)) {
                             $custom_fonts_handle = @$tmp['import-punch-fonts-handle'];
                             $custom_fonts_imported = $im->import_punch_fonts($custom_fonts, $custom_fonts_handle);
                         }
                         if (@$tmp['import-global-styles'] == 'on') {
                             $global_css = @$data['global-css'];
                             $global_styles_imported = $im->import_global_styles($tglobal_css);
                         }
                         if ($this->options['debug']) {
                             echo ' ' . __('imported', 'axiom') . '<br>';
                         }
                     } catch (Exception $d) {
                         if ($this->options['debug']) {
                             echo ' ' . __('import error:', 'axiom') . '<br>' . dumpVar($response);
                         }
                     }
                     flush();
                     break;
                 }
                 @closedir($hdir);
             }
         }
     } else {
         if ($this->options['debug']) {
             printf(__('Can not locate Essential Grid plugin: %s', 'axiom'), EG_PLUGIN_PATH . '/essential-grid.php<br>');
             flush();
         }
     }
 }
Example #3
0
 function axiom_get_list_fonts_custom($prepend_inherit = false)
 {
     static $list = false;
     if (is_array($list)) {
         return $list;
     }
     $list = array();
     $dir = axiom_get_folder_dir("css/font-face");
     if (is_dir($dir)) {
         $hdir = @opendir($dir);
         if ($hdir) {
             while (($file = readdir($hdir)) !== false) {
                 $pi = pathinfo($dir . '/' . $file);
                 if (substr($file, 0, 1) == '.' || !is_dir($dir . '/' . $file)) {
                     continue;
                 }
                 $css = file_exists($dir . '/' . $file . '/' . $file . '.css') ? axiom_get_folder_url("css/font-face/" . $file . '/' . $file . '.css') : (file_exists($dir . '/' . $file . '/stylesheet.css') ? axiom_get_folder_url("css/font-face/" . $file . '/stylesheet.css') : '');
                 if ($css != '') {
                     $list[$file . ' (' . __('uploaded font', 'axiom') . ')'] = array('css' => $css);
                 }
             }
             @closedir($hdir);
         }
     }
     return $list;
 }