/** * Write to the Dynamik Custom Widget Areas file if it exists. * * @since 1.0 * */ function dynamik_write_custom_widget_areas($code = '') { dynamik_folders_open_permissions(); if (!file_exists(dynamik_get_custom_widget_areas_path())) { dynamik_create_custom_widget_areas_file(); } $handle = @fopen(dynamik_get_custom_widget_areas_path(), 'w+'); @fwrite($handle, stripslashes($code)); @fclose($handle); dynamik_folders_close_permissions(); }
/** * Create all the appropriate files and content that reflect the exported Child Theme * and then zip it up and spit it out into the browser for download. * * @since 1.0 */ function child_export($child_name, $author = 'Genesis Theme', $author_uri = 'http://dynamik.catalysttheme.com/genesis/', $at_style = 'no', $include_settings = 'no', $include_design = 'yes', $include_css = 'yes', $include_functions = 'yes', $include_js = 'yes', $include_templates = 'yes', $include_labels = 'yes', $include_widget_areas = 'yes', $include_hook_boxes = 'yes') { dynamik_folders_open_permissions(); require_once ABSPATH . 'wp-admin/includes/class-pclzip.php'; $custom_functions = get_option('dynamik_gen_custom_functions'); $child_export_zip = strtolower(str_replace(' ', '-', $child_name)) . '.zip'; $tmp_path = dynamik_get_stylesheet_location('path') . 'tmp'; $tmp_child = $tmp_path . '/child'; $tmp_image_folder = $tmp_child . '/images'; $tmp_post_formats_image_folder = $tmp_image_folder . '/post-formats'; $tmp_my_templates_folder = $tmp_child . '/my-templates'; $tmp_metaboxes_folder = $tmp_child . '/metaboxes'; $tmp_js_folder = $tmp_child . '/js'; $dollar_sign = '$'; $new_line = '"\\n"'; $single_quote = "'"; $image_folder = dynamik_get_stylesheet_location('path') . 'images'; $dynamik_image_folder = dynamik_get_stylesheet_location('path') . 'default-images'; $dynamik_post_formats_image_folder = dynamik_get_stylesheet_location('path') . 'default-images/post-formats'; $dynamik_my_templates_folder = CHILD_DIR . '/my-templates'; $dynamik_metaboxes_folder = CHILD_DIR . '/lib/admin/metaboxes'; if (!is_dir($tmp_path)) { @mkdir($tmp_path, 0755, true); } if (!is_dir($tmp_child)) { @mkdir($tmp_child, 0755, true); } if (!is_dir($tmp_image_folder)) { @mkdir($tmp_image_folder, 0755, true); } if (!is_dir($tmp_post_formats_image_folder) && dynamik_get_settings('post_formats_active')) { @mkdir($tmp_post_formats_image_folder, 0755, true); } if (!is_dir($tmp_my_templates_folder) && $include_templates == 'yes') { @mkdir($tmp_my_templates_folder, 0755, true); } if ($include_labels == 'yes' && get_option('dynamik_gen_custom_labels') != array()) { if (!is_dir($tmp_metaboxes_folder)) { @mkdir($tmp_metaboxes_folder, 0755, true); } if (!is_dir($tmp_metaboxes_folder . '/js')) { @mkdir($tmp_metaboxes_folder . '/js', 0755, true); } if (!is_dir($tmp_metaboxes_folder . '/images')) { @mkdir($tmp_metaboxes_folder . '/images', 0755, true); } } if (!is_dir($tmp_js_folder)) { @mkdir($tmp_js_folder, 0755, true); } $style_css = '/* Theme Name: ' . $child_name . ' Theme URI: http: //studiopress.com/ Description: A Genesis Child Theme Author: ' . $author . ' Author URI: ' . $author_uri . ' Template: genesis Version: 1.0 */ '; if ($at_style == 'yes') { $style_css .= ' /* Import Genesis Parent Styles ------------------------------------------------------------ */ @import url(../genesis/style.css); '; } if ($include_design == 'yes') { $style_css .= dynamik_build_design_styles('yes'); } if ($include_css == 'yes' && dynamik_get_custom_css('custom_css') != '') { $custom_css_prefix = "\n\n" . '/* ' . __('Custom CSS', 'dynamik') . "\n" . '------------------------------------------------------------ */' . "\n\n"; $custom_css = dynamik_get_custom_css('custom_css') . "\n"; if ($include_design == 'yes' && dynamik_get_settings('responsive_enabled')) { $custom_mq_css_prefix = "\n" . '/* ' . __('Custom Responsive CSS', 'dynamik') . "\n" . '------------------------------------------------------------ */' . "\n"; $media_query_css = ' @media only screen and (max-width: ' . dynamik_get_responsive('media_wrap_width') . 'px) { ' . dynamik_get_responsive('media_query_large_cascading_content') . ' } @media only screen and (min-width: 768px) and (max-width: ' . dynamik_get_responsive('media_wrap_width') . 'px) { ' . dynamik_get_responsive('media_query_large_content') . ' } @media only screen and (min-width: 480px) and (max-width: ' . dynamik_get_responsive('media_wrap_width') . 'px) { ' . dynamik_get_responsive('media_query_medium_large_content') . ' } @media only screen and (max-width: 767px) { ' . dynamik_get_responsive('media_query_medium_cascading_content') . ' } @media only screen and (min-width: 480px) and (max-width: 767px) { ' . dynamik_get_responsive('media_query_medium_content') . ' } @media only screen and (max-width: 479px) { ' . dynamik_get_responsive('media_query_small_content') . ' }'; } else { $custom_mq_css_prefix = ''; $media_query_css = ''; } $style_css .= $custom_css_prefix . $custom_css . $custom_mq_css_prefix . $media_query_css; } $nav_placement_comment = "\n/**\n * Manage the placement of navbars.\n */\n"; if (dynamik_get_settings('responsive_enabled') && dynamik_get_responsive('navbar_media_query_default') == 'vertical_toggle') { if (dynamik_get_design('nav1_location') == "Above Header") { $nav_1_action = "add_action( 'genesis_before_header', 'child_mobile_nav_1' );\nremove_action( 'genesis_after_header', 'genesis_do_nav' );\nadd_action( 'genesis_before_header', 'genesis_do_nav' );\n"; } elseif (dynamik_get_design('nav1_location') == "Below Header") { $nav_1_action = "add_action( 'genesis_after_header', 'child_mobile_nav_1', 9 );\n"; } if (dynamik_get_design('nav2_location') == "Above Header") { $nav_2_action = "add_action( 'genesis_before_header', 'child_mobile_nav_2' );\nremove_action( 'genesis_after_header', 'genesis_do_subnav' );\nadd_action( 'genesis_before_header', 'genesis_do_subnav' );\n"; } elseif (dynamik_get_design('nav2_location') == "Below Header") { $nav_2_action = "add_action( 'genesis_after_header', 'child_mobile_nav_2', 9 );\n"; } $mobile_nav_functions = ' /** * Build Nav Mobile Menu HTML. * * @since 1.0 */ function child_mobile_nav_1() { if ( ! has_nav_menu( ' . $single_quote . 'primary' . $single_quote . ' ) ) return; ?> <h3 class="mobile-primary-toggle">' . dynamik_get_responsive("dropdown_menu_1_text") . '</h3> <?php } /** * Build Subnav Mobile Menu HTML. * * @since 1.0 */ function child_mobile_nav_2() { if ( ! has_nav_menu( ' . $single_quote . 'secondary' . $single_quote . ' ) ) return; ?> <h3 class="mobile-secondary-toggle">' . dynamik_get_responsive("dropdown_menu_2_text") . '</h3> <?php } '; $dropdown_menu_register = ''; $nav_dropdown_functions = ''; } elseif (dynamik_get_settings('responsive_enabled') && (dynamik_get_responsive('navbar_media_query_default') == 'tablet_dropdown' || dynamik_get_responsive('navbar_media_query_default') == 'mobile_dropdown')) { if (dynamik_get_design('nav1_location') == "Above Header") { $nav_1_action = "remove_action( 'genesis_after_header', 'genesis_do_nav' );\nadd_action( 'genesis_before_header', 'genesis_do_nav' ); add_action( 'genesis_before_header', 'child_dropdown_nav_1' );\n"; } elseif (dynamik_get_design('nav1_location') == "Below Header") { $nav_1_action = "add_action( 'genesis_after_header', 'child_dropdown_nav_1' );\n"; } if (dynamik_get_design('nav2_location') == "Above Header") { $nav_2_action = "remove_action( 'genesis_after_header', 'genesis_do_subnav' );\nadd_action( 'genesis_before_header', 'genesis_do_subnav' ); add_action( 'genesis_before_header', 'child_dropdown_nav_2' );\n"; } elseif (dynamik_get_design('nav2_location') == "Below Header") { $nav_2_action = "add_action( 'genesis_after_header', 'child_dropdown_nav_2' );\n"; } $mobile_nav_functions = ''; $dropdown_menu_register = "\n/**\n * Register the additional Responsive Dropdown Menus.\n */\nadd_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'dynamik' ), 'secondary' => __( 'Secondary Navigation Menu', 'dynamik' ), 'primary_dropdown' => __( 'Responsive Dropdown 1', 'dynamik' ), 'secondary_dropdown' => __( 'Responsive Dropdown 2', 'dynamik' ) ) );\n"; $nav_dropdown_functions = ' /** * Build Nav Dropdown HTML. * * @since 1.0 */ function child_dropdown_nav_1() { if ( ! has_nav_menu( ' . $single_quote . 'primary_dropdown' . $single_quote . ' ) ) return; ?> <div id="dropdown-nav-wrap"> <!-- dropdown nav for responsive design --> <nav id="dropdown-nav" role="navigation"> <form id="dropdown-nav-form" action="" method="post"> <select class="nav-chosen-select"> <option value="">' . dynamik_get_responsive("dropdown_menu_1_text") . '</option> <?php $menu = wp_nav_menu( array( ' . $single_quote . 'theme_location' . $single_quote . ' => ' . $single_quote . 'primary_dropdown' . $single_quote . ', ' . $single_quote . 'echo' . $single_quote . ' => false ) ); if ( preg_match_all( "#(<a [^<]+</a>)#", $menu,$matches ) ) { $hrefpat = ' . $single_quote . '/(href *= *([\\"\\' . $single_quote . ']?)([^\\"\\' . $single_quote . ' ]+)\\2)/' . $single_quote . '; foreach ( $matches[0] as $link ) { if ( preg_match( $hrefpat, $link,$hrefs ) ) $href = $hrefs[3]; if( preg_match( "#>([^<]+)<#", $link,$names ) ) $name = $names[1]; echo "<option value=\\"$href\\">$name</option>"; } } ?> </select> </form> </nav><!-- #dropdown-nav --> <!-- /end dropdown nav --> </div> <?php } /** * Build Subnav Dropdown HTML. * * @since 1.0 */ function child_dropdown_nav_2() { if ( ! has_nav_menu( ' . $single_quote . 'secondary_dropdown' . $single_quote . ' ) ) return; ?> <div id="dropdown-subnav-wrap"> <!-- dropdown nav for responsive design --> <nav id="dropdown-subnav" role="navigation"> <form id="dropdown-subnav-form" action="" method="post"> <select class="subnav-chosen-select"> <option value="">' . dynamik_get_responsive("dropdown_menu_2_text") . '</option> <?php $menu = wp_nav_menu( array( ' . $single_quote . 'theme_location' . $single_quote . ' => ' . $single_quote . 'secondary_dropdown' . $single_quote . ', ' . $single_quote . 'echo' . $single_quote . ' => false ) ); if ( preg_match_all( "#(<a [^<]+</a>)#", $menu,$matches ) ) { $hrefpat = ' . $single_quote . '/(href *= *([\\"\\' . $single_quote . ']?)([^\\"\\' . $single_quote . ' ]+)\\2)/' . $single_quote . '; foreach ( $matches[0] as $link ) { if( preg_match( $hrefpat, $link,$hrefs ) ) $href = $hrefs[3]; if( preg_match( "#>([^<]+)<#", $link,$names ) ) $name = $names[1]; echo "<option value=\\"$href\\">$name</option>"; } } ?> </select> </form> </nav><!-- #dropdown-subnav --> <!-- /end dropdown subnav --> </div> <?php } '; } else { if (dynamik_get_design('nav1_location') == "Above Header") { $nav_1_action = "remove_action( 'genesis_after_header', 'genesis_do_nav' );\nadd_action( 'genesis_before_header', 'genesis_do_nav' );\n"; } elseif (dynamik_get_design('nav1_location') == "Below Header") { $nav_1_action = ""; } if (dynamik_get_design('nav2_location') == "Above Header") { $nav_2_action = "remove_action( 'genesis_after_header', 'genesis_do_subnav' );\nadd_action( 'genesis_before_header', 'genesis_do_subnav' );\n"; } elseif (dynamik_get_design('nav2_location') == "Below Header") { $nav_2_action = ""; } if (dynamik_get_design('nav1_location') == "Below Header" && dynamik_get_design('nav2_location') == "Below Header") { $nav_placement_comment = ""; } $mobile_nav_functions = ''; $dropdown_menu_register = ''; $nav_dropdown_functions = ''; } if (dynamik_get_settings('responsive_enabled')) { $responsive_viewport_meta = '<meta name="viewport" content="' . dynamik_get_responsive('viewport_meta_content') . '"/>'; $responsive_viewport = "\nadd_action( 'genesis_meta', 'child_responsive_viewport' );\n/**\n * Add viewport meta tag to the genesis_meta hook\n * to force 'real' scale of site when viewed in mobile devices.\n *\n * @since 1.0\n */\nfunction child_responsive_viewport() {\necho '{$responsive_viewport_meta}' . {$new_line};\n}"; $responsive_js_enqueue = "\nadd_action( 'get_header', 'child_enqueue_responsive_scripts' );\n/**\n * Enqueue Responsive Design javascript code.\n *\n * @since 1.0\n */\nfunction child_enqueue_responsive_scripts() {\t\n\twp_enqueue_script( 'responsive', CHILD_URL . '/js/responsive.js', false, CHILD_THEME_VERSION, true );\n}"; } else { $responsive_viewport_meta = ''; $responsive_viewport = ''; $responsive_js_enqueue = ''; } if ($include_js == 'yes' && file_exists(dynamik_get_custom_js_path()) && 0 != filesize(dynamik_get_custom_js_path())) { $custom_js = get_option('dynamik_gen_custom_js'); if (!empty($custom_js['custom_js_in_head'])) { $in_footer = 'false'; } else { $in_footer = 'true'; } $custom_js_enqueue = "\nadd_action( 'get_header', 'child_enqueue_custom_scripts' );\n/**\n * Enqueue Custom javascript code.\n *\n * @since 1.0\n */\nfunction child_enqueue_custom_scripts() {\t\n\twp_enqueue_script( 'custom-scripts', CHILD_URL . '/js/custom-scripts.js', false, CHILD_THEME_VERSION, " . $in_footer . " );\n}"; } else { $custom_js_enqueue = ''; } if ($include_settings == 'yes') { if (dynamik_get_settings('custom_image_size_one_mode') != '') { if (dynamik_get_settings('custom_image_size_one_mode') != '') { $custom_image_size_one_crop = dynamik_get_settings('custom_image_size_one_mode') == 'crop' ? 'true' : 'false'; $custom_image_size_one = "\n\n/**\n * Add custom thumbnail sizes.\n */\nadd_image_size( 'custom-thumb-1', " . dynamik_get_settings('custom_image_size_one_width') . ", " . dynamik_get_settings('custom_image_size_one_height') . ", " . $custom_image_size_one_crop . " );"; } else { $custom_image_size_one = ''; } if (dynamik_get_settings('custom_image_size_two_mode') != '') { $custom_image_size_two_crop = dynamik_get_settings('custom_image_size_two_mode') == 'crop' ? 'true' : 'false'; $custom_image_size_two = "\nadd_image_size( 'custom-thumb-2', " . dynamik_get_settings('custom_image_size_two_width') . ", " . dynamik_get_settings('custom_image_size_two_height') . ", " . $custom_image_size_two_crop . " );"; } else { $custom_image_size_two = ''; } if (dynamik_get_settings('custom_image_size_three_mode') != '') { $custom_image_size_three_crop = dynamik_get_settings('custom_image_size_three_mode') == 'crop' ? 'true' : 'false'; $custom_image_size_three = "\nadd_image_size( 'custom-thumb-3', " . dynamik_get_settings('custom_image_size_three_width') . ", " . dynamik_get_settings('custom_image_size_three_height') . ", " . $custom_image_size_three_crop . " );"; } else { $custom_image_size_three = ''; } if (dynamik_get_settings('custom_image_size_four_mode') != '') { $custom_image_size_four_crop = dynamik_get_settings('custom_image_size_four_mode') == 'crop' ? 'true' : 'false'; $custom_image_size_four = "\nadd_image_size( 'custom-thumb-4', " . dynamik_get_settings('custom_image_size_four_width') . ", " . dynamik_get_settings('custom_image_size_four_height') . ", " . $custom_image_size_four_crop . " );"; } else { $custom_image_size_four = ''; } if (dynamik_get_settings('custom_image_size_five_mode') != '') { $custom_image_size_five_crop = dynamik_get_settings('custom_image_size_five_mode') == 'crop' ? 'true' : 'false'; $custom_image_size_five = "\nadd_image_size( 'custom-thumb-5', " . dynamik_get_settings('custom_image_size_five_width') . ", " . dynamik_get_settings('custom_image_size_five_height') . ", " . $custom_image_size_five_crop . " );"; } else { $custom_image_size_five = ''; } } $post_title_hook = dynamik_get_settings('html_five_active') ? 'genesis_entry_header' : 'genesis_post_title'; if (dynamik_get_settings('remove_all_page_titles')) { $remove_page_titles = "\n\t\t\t\nadd_action( 'get_header', 'child_remove_page_titles' );\n/**\n * Remove all page titles.\n *\n * @since 1.0\n */\nfunction child_remove_page_titles() {\n if ( is_page() && ! is_page_template( 'page_blog.php' ) )\n remove_action( '" . $post_title_hook . "', 'genesis_do_post_title' );\n}"; } elseif (dynamik_get_settings('remove_page_titles_ids') != '') { $remove_page_titles = "\n\t\t\t\nadd_action( 'get_header', 'child_remove_page_titles' );\n/**\n * Remove specific page titles.\n *\n * @since 1.0\n */\nfunction child_remove_page_titles() {\n\tglobal " . $dollar_sign . "post;\n\t" . $dollar_sign . "page_ids = explode( ',', '" . dynamik_get_settings('remove_page_titles_ids') . "' );\n\tif ( is_page() && ! is_page_template( 'page_blog.php' ) ) {\n\t\tforeach ( " . $dollar_sign . "page_ids as " . $dollar_sign . "page_id ) {\n\t\t\tif ( " . $dollar_sign . "post->ID == " . $dollar_sign . "page_id )\n\t\t\t\tremove_action( '" . $post_title_hook . "', 'genesis_do_post_title' );\n\t\t}\n\t}\n}"; } else { $remove_page_titles = ''; } if (dynamik_get_settings('include_inpost_cpt_all')) { $include_inpost_cpt_names = "\n\nadd_action( 'init', 'child_add_post_type_support' );\n/**\n * Add Genesis In-Post options into ALL Custom Post Types.\n *\n * @since 1.0\n */\nfunction child_add_post_type_support() {\n\tforeach( get_post_types( array( 'public' => true ) ) as " . $dollar_sign . "post_type ) {\n\t\tadd_post_type_support( " . $dollar_sign . "post_type, array( 'genesis-seo', 'genesis-scripts', 'genesis-layouts' ) );\n\t}\n}"; } elseif (dynamik_get_settings('include_inpost_cpt_names') != '') { $include_inpost_cpt_names = "\n\nadd_action( 'init', 'child_add_post_type_support' );\n/**\n * Add Genesis In-Post options into specified Custom Post Types.\n *\n * @since 1.0\n */\nfunction child_add_post_type_support() {\n\t" . $dollar_sign . "post_types = explode( ',', '" . dynamik_get_settings('include_inpost_cpt_names') . "' );\n\t\n\tforeach ( " . $dollar_sign . "post_types as " . $dollar_sign . "post_type ) {\n\t\tadd_post_type_support( " . $dollar_sign . "post_type, array( 'genesis-seo', 'genesis-scripts', 'genesis-layouts' ) );\n\t}\n}"; } else { $include_inpost_cpt_names = ''; } if (dynamik_get_settings('post_formats_active')) { $post_formats = "\n\n/**\n * Enable Custom Post Format functionality.\n */\nadd_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );\nadd_theme_support( 'genesis-post-format-images' );"; } else { $post_formats = ''; } if (dynamik_get_settings('html_five_active')) { $html_five = "\n\n/**\n * Add support for Genesis HTML5 Markup.\n */\nadd_theme_support( 'html5' );"; } else { $html_five = ''; } if (dynamik_get_settings('html_five_active') && dynamik_get_settings('fancy_dropdowns_active')) { $fancy_dropdowns = "\n\n/**\n * Add support for Genesis 'Fancy Dropdowns'.\n */\nadd_filter( 'genesis_superfish_enabled', '__return_true' );"; } else { $fancy_dropdowns = ''; } } $conditional_functions = "\n\n/**\n * This is altered version of the genesis_get_custom_field() function\n * which includes the additional ability to work with array() values.\n *\n * @since 1.0\n */\nfunction dynamik_get_custom_field( " . $dollar_sign . "field, " . $dollar_sign . "single = true, " . $dollar_sign . "explode = false )\n{\n\tif( null === get_the_ID() )\n\t\treturn '';\n\n\t" . $dollar_sign . "custom_field = get_post_meta( get_the_ID(), " . $dollar_sign . "field, " . $dollar_sign . "single );\n\n\tif( !" . $dollar_sign . "custom_field )\n\t\treturn '';\n\n\tif( !" . $dollar_sign . "single )\n\t{\n\t\t" . $dollar_sign . "custom_field_string = implode( ',', " . $dollar_sign . "custom_field );\n\t\tif( " . $dollar_sign . "explode )\n\t\t{\n\t\t\t" . $dollar_sign . "custom_field_array_pre = explode( ',', " . $dollar_sign . "custom_field_string );\n\t\t\tforeach( " . $dollar_sign . "custom_field_array_pre as " . $dollar_sign . "key => " . $dollar_sign . "value )\n\t\t\t{\n\t\t\t\t" . $dollar_sign . "custom_field_array[" . $dollar_sign . "value] = " . $dollar_sign . "value;\n\t\t\t}\n\t\t\treturn " . $dollar_sign . "custom_field_array;\n\t\t}\n\t\treturn " . $dollar_sign . "custom_field_string;\n\t}\n\n\treturn is_array( " . $dollar_sign . "custom_field ) ? stripslashes_deep( " . $dollar_sign . "custom_field ) : stripslashes( wp_kses_decode_entities( " . $dollar_sign . "custom_field ) );\n}\n\n/**\n * Create a Dynamik Label conditional tag which\n * allows content to be conditionally placed on pages and posts\n * that have specific Dynamik Labels assigned to them.\n *\n * @since 1.0\n */\nfunction dynamik_has_label( " . $dollar_sign . "label = 'label' )\n{\n\t" . $dollar_sign . "labels_meta_array = dynamik_get_custom_field( '_dyn_labels', false, true ) != '' ? dynamik_get_custom_field( '_dyn_labels', false, true ) : array();\n\n\tif( is_singular() )\n\t{\n\t\tif( in_array( " . $dollar_sign . "label, " . $dollar_sign . "labels_meta_array ) ) return true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Create a Genesis Simple Sidebars conditional tag which\n * allows content to be conditionally placed on pages and posts\n * that have specific simple sidebars assigned to them.\n *\n * @since 1.0\n */\nfunction dynamik_is_ss( " . $dollar_sign . "sidebar_id = 'sb-id' )\n{\n\tif( !defined( 'SS_SETTINGS_FIELD' ) )\n\t\treturn false;\n\n\tstatic " . $dollar_sign . "taxonomies = null;\n\n\tif( is_singular() )\n\t{\n\t\tif( " . $dollar_sign . "sidebar_id == genesis_get_custom_field( '_ss_sidebar' ) ) return true;\n\t}\n\n\tif( is_category() )\n\t{\n\t\t" . $dollar_sign . "term = get_term( get_query_var( 'cat' ), 'category' );\n\t\tif( isset( " . $dollar_sign . "term->meta['_ss_sidebar'] ) && " . $dollar_sign . "sidebar_id == " . $dollar_sign . "term->meta['_ss_sidebar'] ) return true;\n\t}\n\n\tif( is_tag() )\n\t{\n\t\t" . $dollar_sign . "term = get_term( get_query_var( 'tag_id' ), 'post_tag' );\n\t\tif( isset( " . $dollar_sign . "term->meta['_ss_sidebar'] ) && " . $dollar_sign . "sidebar_id == " . $dollar_sign . "term->meta['_ss_sidebar'] ) return true;\n\t}\n\n\tif( is_tax() )\n\t{\n\t\tif ( null === " . $dollar_sign . "taxonomies )\n\t\t\t" . $dollar_sign . "taxonomies = ss_get_taxonomies();\n\n\t\tforeach ( " . $dollar_sign . "taxonomies as " . $dollar_sign . "tax )\n\t\t{\n\t\t\tif ( 'post_tag' == " . $dollar_sign . "tax || 'category' == " . $dollar_sign . "tax )\n\t\t\t\tcontinue;\n\n\t\t\tif ( is_tax( " . $dollar_sign . "tax ) )\n\t\t\t{\n\t\t\t\t" . $dollar_sign . "obj = get_queried_object();\n\t\t\t\t" . $dollar_sign . "term = get_term( " . $dollar_sign . "obj->term_id, " . $dollar_sign . "tax );\n\t\t\t\tif( isset( " . $dollar_sign . "term->meta['_ss_sidebar'] ) && " . $dollar_sign . "sidebar_id == " . $dollar_sign . "term->meta['_ss_sidebar'] ) return true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n"; $do_shortcode_text_widget = "\n/**\n * Enable Shortcodes in Text Widgets.\n */\nadd_filter( 'widget_text', 'do_shortcode' );"; if ($include_labels == 'yes' && get_option('dynamik_gen_custom_labels') != array()) { if (dynamik_get_settings('include_inpost_cpt_all')) { foreach (get_post_types(array('public' => true)) as $post_type) { $post_types[] = $post_type; } } else { $post_types = dynamik_get_settings('include_inpost_cpt_names') != '' ? explode(',', 'page,post,' . dynamik_get_settings('include_inpost_cpt_names')) : array('page', 'post'); } $post_type_string = implode(',', $post_types); $labels = get_option('dynamik_gen_custom_labels'); asort($labels); $labels_array = ''; foreach ($labels as $key => $value) { $labels_array .= "'" . $value['label_id'] . "' => '" . $value['label_name'] . "',"; } $custom_labels = "\n\nif( is_admin() )\n{\n\tadd_filter( 'cmb_meta_boxes', 'child_lables_metabox' );\n\t/**\n\t * Define the metabox and field configurations.\n\t *\n\t * @since 1.0\n\t * @return array\n\t */\n\tfunction child_lables_metabox( array " . $dollar_sign . "meta_boxes )\n\t{\n\t\t// Start with an underscore to hide fields from custom fields list\n\t\t" . $dollar_sign . "prefix = '_dyn_';\n\t\t" . $dollar_sign . "post_type_array = explode( ',', '" . $post_type_string . "' );\n\n\t\t" . $dollar_sign . "meta_boxes[] = array(\n\t\t\t'id' => 'dynamik_labels',\n\t\t\t'title' => 'Dynamik Labels',\n\t\t\t'pages' => " . $dollar_sign . "post_type_array, // Post type\n\t\t\t'context' => 'normal',\n\t\t\t'priority' => 'high',\n\t\t\t'show_names' => true, // Show field names on the left\n\t\t\t'fields' => array(\n\t\t\t\tarray(\n\t\t\t\t\t'name' => 'Select Labels',\n\t\t\t\t\t'desc' => 'Select labels appropriate to this page/post.',\n\t\t\t\t\t'id' => " . $dollar_sign . "prefix . 'labels',\n\t\t\t\t\t'type' => 'multicheck',\n\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t" . $labels_array . "\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\treturn " . $dollar_sign . "meta_boxes;\n\t}\n\n\tadd_action( 'init', 'child_initialize_cmb_meta_boxes', 9999 );\n\t/**\n\t * Initialize the metabox class.\n\t * @since 1.0\n\t */\n\tfunction child_initialize_cmb_meta_boxes()\n\t{\n\t\tif( !class_exists( 'cmb_Meta_Box' ) )\n\t\t\trequire_once CHILD_DIR . '/metaboxes/init.php';\n\t}\n}"; $custom_labels_classes = "\n\n\tif( is_singular() && dynamik_get_custom_field( '_dyn_labels', false, true ) != '' )\n\t{\n\t\tforeach ( dynamik_get_custom_field( '_dyn_labels', false, true ) as " . $dollar_sign . "key => " . $dollar_sign . "value )\n\t\t{\n\t\t\t" . $dollar_sign . "classes[] = 'label-' . " . $dollar_sign . "key;\n\t\t}\n\t}"; } else { $custom_labels = ''; $custom_labels_classes = ''; } /** * Build the EZ Structures file if it exists. */ if (file_exists(dynamik_get_ez_structure_path()) && (dynamik_get_design_alt('dynamik_homepage_type') == 'static_home' || dynamik_get_design_alt('ez_home_slider_display') || dynamik_get_design_alt('ez_feature_top_select') != 'disabled' || dynamik_get_design_alt('ez_fat_footer_select') != 'disabled')) { $ez_structures = substr(file_get_contents(dynamik_get_ez_structure_path()), 67, -64) . "\n"; } else { $ez_structures = ''; } /** * EZ Static Homepage. */ if ($ez_structures != '' && dynamik_get_design('dynamik_homepage_type') == 'static_home') { $ez_home_structure_classes = '$classes[] = "ez-home";'; $ez_home_code = "\n/**\n * Hook the EZ Home Structure function into the 'dynamik_hook_home' Hook.\n */\nadd_action( 'dynamik_hook_home', 'ez_home' );\n"; } else { $ez_home_structure_classes = ""; $ez_home_code = ""; } /** * EZ Home Sidebar. */ if ($ez_structures != '' && dynamik_get_design('dynamik_homepage_type') == 'static_home' && dynamik_get_design('ez_static_home_sb_display')) { $ez_home_sidebar_active_classes = '$classes[] = "ez-home-sidebar";'; if (dynamik_get_design('ez_static_home_sb_location') == 'left') { $ez_home_sidebar_left_classes = '$classes[] = "home-sidebar-left";'; } else { $ez_home_sidebar_left_classes = ""; } $ez_home_sidebar_code = "\n/**\n * Hook the Homepage Sidebar Structure function into the 'dynamik_hook_home' Hook.\n */\nadd_action( 'dynamik_hook_home', 'ez_home_sidebar' );\n"; } else { $ez_home_sidebar_active_classes = ""; $ez_home_sidebar_left_classes = ""; $ez_home_sidebar_code = ""; } if ($ez_structures != '' && dynamik_get_design('ez_home_slider_display')) { $ez_home_slider_active_classes = '$classes[] = "ez-home-slider";'; /** * Determine where to hook in the Home Image Slider based on * whether or not the Static Homepage is active. */ if (dynamik_get_design('dynamik_homepage_type') == 'default_home') { /** * Determine where to hook in the Home Image Slider based on * Home Slider Layout option setting. */ if (dynamik_get_design('ez_home_slider_location') == 'outside') { $ez_home_slider_inside_classes = ''; $ez_home_slider_code = "\n/**\n * Hook the Home Slider structure function into the 'genesis_before_content_sidebar_wrap' Hook.\n */\nadd_action( 'genesis_before_content_sidebar_wrap', 'ez_home_slider' );\n"; } else { $ez_home_slider_inside_classes = '$classes[] = "slider-inside";'; $ez_home_slider_code = "\n/**\n * Hook the Home Slider structure function into the 'genesis_before_loop' Hook.\n */\nadd_action( 'genesis_before_loop', 'ez_home_slider' );\n"; } } else { /** * Determine where to hook in the Home Image Slider based on * Home Slider Layout option setting. */ if (dynamik_get_design('ez_home_slider_location') == 'outside') { $ez_home_slider_inside_classes = ''; $ez_home_slider_code = "\n/**\n * Hook the Home Slider structure function into the 'dynamik_hook_home' Hook.\n */\nadd_action( 'dynamik_hook_home', 'ez_home_slider', 6 );\n"; } else { $ez_home_slider_inside_classes = '$classes[] = "slider-inside";'; $ez_home_slider_code = "\n/**\n * Hook the Home Slider structure function into the 'dynamik_hook_before_ez_home' Hook.\n */\nadd_action( 'dynamik_hook_before_ez_home', 'ez_home_slider' );\n"; } } } else { $ez_home_slider_active_classes = ''; $ez_home_slider_inside_classes = ''; $ez_home_slider_code = ""; } /** * EZ Feature Top. */ if (!dynamik_get_design('ez_feature_top_display_front_page')) { $ez_feature_top_front_page = 'if ( is_front_page() ) { return; }'; } else { $ez_feature_top_front_page = ''; } if (!dynamik_get_design('ez_feature_top_display_posts')) { $ez_feature_top_posts = 'if ( is_single() ) { return; }'; } else { $ez_feature_top_posts = ''; } if (!dynamik_get_design('ez_feature_top_display_pages')) { $ez_feature_top_pages = "if ( ( is_page() || is_404() ) && ! is_front_page() && ! is_page_template( 'page_blog.php' ) ) { return; }"; } else { $ez_feature_top_pages = ''; } if (!dynamik_get_design('ez_feature_top_display_archives')) { $ez_feature_top_archives = 'if ( is_archive() || is_search() ) { return; }'; } else { $ez_feature_top_archives = ''; } if (!dynamik_get_design('ez_feature_top_display_blog')) { $ez_feature_top_blog = "if ( is_page_template( 'page_blog.php' ) ) { return; }"; } else { $ez_feature_top_blog = ''; } if (dynamik_get_design('ez_feature_top_position') == 'outside_inner') { $ez_feature_top_add_action = "add_action( 'genesis_after_header', 'ez_feature_top' );"; } elseif (dynamik_get_design('dynamik_homepage_type') != 'static_home' && dynamik_get_design('ez_feature_top_position') == 'inside_inner') { $ez_feature_top_add_action = "add_action( 'genesis_before_content_sidebar_wrap', 'ez_feature_top', 5 );"; } else { $ez_feature_top_add_action = "is_front_page() ? add_action( 'dynamik_hook_home', 'ez_feature_top', 5 ) : add_action( 'genesis_before_content_sidebar_wrap', 'ez_feature_top', 5 );"; } if ($ez_structures != '' && dynamik_get_design('ez_feature_top_select') != 'disabled') { $ez_feature_top_classes = dynamik_get_design('ez_feature_top_position') == 'outside_inner' ? '$classes[] = "feature-top-outside";' : ''; $ez_feature_top_code = "\n/**\n * Hook the Feature Top Structure function into the 'wp_head' Hook.\n */\nadd_action( 'wp_head', 'child_feature_top' );\n\n/**\n * Determine where NOT to display the Feature Top section before hooking it in.\n *\n * @since 1.0\n */\nfunction child_feature_top() {\n\t/**\n\t * Add conditional tags to control where the Feature Top Widget Area displays.\n\t */\n\tif ( is_page_template( 'landing.php' ) ) { return; }\n\t" . $ez_feature_top_front_page . " " . $ez_feature_top_posts . " " . $ez_feature_top_pages . " " . $ez_feature_top_archives . " " . $ez_feature_top_blog . "\n\t\n\t/**\n\t * Hook the Feature Top Structure function into the appropriate Genesis Hook.\n\t */\n\t" . $ez_feature_top_add_action . "\n}\n"; } else { $ez_feature_top_classes = ""; $ez_feature_top_code = ""; } /** * EZ Fat Footer. */ if (!dynamik_get_design('ez_fat_footer_display_front_page')) { $ez_fat_footer_front_page = 'if ( is_front_page() ) { return; }'; } else { $ez_fat_footer_front_page = ''; } if (!dynamik_get_design('ez_fat_footer_display_posts')) { $ez_fat_footer_posts = 'if ( is_single() ) { return; }'; } else { $ez_fat_footer_posts = ''; } if (!dynamik_get_design('ez_fat_footer_display_pages')) { $ez_fat_footer_pages = "if ( ( is_page() || is_404() ) && ! is_front_page() && ! is_page_template( 'page_blog.php' ) ) { return; }"; } else { $ez_fat_footer_pages = ''; } if (!dynamik_get_design('ez_fat_footer_display_archives')) { $ez_fat_footer_archives = 'if ( is_archive() || is_search() ) { return; }'; } else { $ez_fat_footer_archives = ''; } if (!dynamik_get_design('ez_fat_footer_display_blog')) { $ez_fat_footer_blog = "if ( is_page_template( 'page_blog.php' ) ) { return; }"; } else { $ez_fat_footer_blog = ''; } if (dynamik_get_design('ez_fat_footer_position') == 'outside_inner') { $ez_fat_footer_add_action = "add_action( 'genesis_before_footer', 'ez_fat_footer' );"; } elseif (dynamik_get_design('dynamik_homepage_type') != 'static_home' && dynamik_get_design('ez_fat_footer_position') == 'inside_inner') { $ez_fat_footer_add_action = "add_action( 'genesis_after_content_sidebar_wrap', 'ez_fat_footer' );"; } else { $ez_fat_footer_add_action = "is_front_page() ? add_action( 'dynamik_hook_home', 'ez_fat_footer' ) : add_action( 'genesis_after_content_sidebar_wrap', 'ez_fat_footer' );"; } if ($ez_structures != '' && dynamik_get_design('ez_fat_footer_select') != 'disabled') { $ez_fat_footer_classes = dynamik_get_design('ez_fat_footer_position') == 'inside_inner' ? '$classes[] = \'fat-footer-inside\';' : ''; $ez_fat_footer_code = "\n/**\n * Hook the Fat Footer Structure function into the 'wp_head' Hook.\n */\nadd_action( 'wp_head', 'child_fat_footer' );\n\n/**\n * Determine where NOT to display the Fat Footer section before hooking it in.\n *\n * @since 1.0\n */\nfunction child_fat_footer() {\n\t/**\n\t * Add conditional tags to control where the Fat Footer Widget Area displays.\n\t */\n\tif ( is_page_template( 'landing.php' ) ) { return; }\n\t" . $ez_fat_footer_front_page . " " . $ez_fat_footer_posts . " " . $ez_fat_footer_pages . " " . $ez_fat_footer_archives . " " . $ez_fat_footer_blog . "\n\t\n\t/**\n\t * Hook the Fat Footer Structure function into the appropriate Genesis Hook.\n\t */\n\t" . $ez_fat_footer_add_action . "\n}\n"; } else { $ez_fat_footer_classes = ''; $ez_fat_footer_code = ''; } if (dynamik_get_design('wrap_structure') == 'fluid') { $site_fluid_classes = '$classes[] = \'site-fluid\';'; } else { $site_fluid_classes = ''; } $custom_fucntions_content = $include_functions == 'yes' ? substr(stripslashes(wp_kses_decode_entities($custom_functions['custom_functions'])), 64) : ''; $custom_widget_areas = $include_widget_areas == 'yes' ? substr(file_get_contents(dynamik_get_custom_widget_areas_register_path()), 5) . substr(file_get_contents(dynamik_get_custom_widget_areas_path()), 5) : ''; $custom_hook_boxes = $include_hook_boxes == 'yes' ? substr(file_get_contents(dynamik_get_custom_hook_boxes_path()), 5) : ''; $functions_php = "<?php\n/**\n * Define and require all the necessary 'bits and pieces'\n * and build all necessary Static Homepage and Featured area functions.\n *\n * @package Dynamik\n */\n\n/**\n * Call Genesis's core functions.\n */\nrequire_once( get_template_directory() . '/lib/init.php' );\n\n/**\n * Define child theme constants.\n */\ndefine( 'CHILD_THEME_NAME', '" . $child_name . "' );\ndefine( 'CHILD_THEME_URL', '" . $author_uri . "' );\ndefine( 'CHILD_THEME_VERSION', '1.0' );\n\nadd_filter( 'avatar_defaults', 'child_default_avatar' );\n/**\n * Display a Custom Avatar if one exists with the correct name\n * and in the correct images directory.\n *\n * @since 1.0\n * @return custom avatar.\n */\nfunction child_default_avatar( {$dollar_sign}avatar_defaults )\n{\n\t{$dollar_sign}custom_avatar_image = '';\n\tif( file_exists( CHILD_DIR . '/images/custom-avatar.png' ) )\n\t\t{$dollar_sign}custom_avatar_image = CHILD_URL . '/images/custom-avatar.png';\n\telseif( file_exists( CHILD_DIR . '/images/custom-avatar.jpg' ) )\n\t\t{$dollar_sign}custom_avatar_image = CHILD_URL . '/images/custom-avatar.jpg';\n\telseif( file_exists( CHILD_DIR . '/images/custom-avatar.gif' ) )\n\t\t{$dollar_sign}custom_avatar_image = CHILD_URL . '/images/custom-avatar.gif';\n\telseif( file_exists( CHILD_DIR . '/images/custom-avatar.jpg' ) )\n\t\t{$dollar_sign}custom_avatar_image = CHILD_URL . '/images/custom-avatar.jpg';\n\n\t{$dollar_sign}custom_avatar = apply_filters( 'child_custom_avatar_path', {$dollar_sign}custom_avatar_image );\n\t{$dollar_sign}avatar_defaults[{$dollar_sign}custom_avatar] = 'Custom Avatar';\n\t\n\treturn {$dollar_sign}avatar_defaults;\n}\n{$nav_placement_comment}{$nav_1_action}{$nav_2_action}{$mobile_nav_functions}{$dropdown_menu_register}{$nav_dropdown_functions}{$responsive_viewport}{$custom_image_size_one}{$custom_image_size_two}{$custom_image_size_three}{$custom_image_size_four}{$custom_image_size_five}{$remove_page_titles}{$include_inpost_cpt_names}{$post_formats}{$html_five}{$fancy_dropdowns}{$conditional_functions}{$do_shortcode_text_widget}{$custom_labels}\n{$ez_home_code}{$ez_home_sidebar_code}{$ez_home_slider_code}{$ez_feature_top_code}{$ez_fat_footer_code}{$ez_structures}{$custom_widget_areas}{$custom_hook_boxes}\n/**\n * Filter in specific body classes based on option values.\n */\nadd_filter( 'body_class', 'child_body_classes' );\n/**\n * Determine which classes will be filtered into the body class.\n *\n * @since 1.0\n * @return array of all classes to be filtered into the body class.\n */\nfunction child_body_classes( {$dollar_sign}classes ) {\n\tif ( is_front_page() ) {\n\t\t{$ez_home_structure_classes}\n\t\t{$ez_home_sidebar_active_classes}\n\t\t{$ez_home_sidebar_left_classes}\n\t\t{$ez_home_slider_active_classes}\n\t\t{$ez_home_slider_inside_classes}\n\t}\n\t\n\t{$ez_feature_top_classes}\n\t{$ez_fat_footer_classes}\n\t{$site_fluid_classes}\n\t{$custom_labels_classes}\n\n\t{$dollar_sign}classes[] = 'override';\n\t\n\treturn {$dollar_sign}classes;\n}\n\n{$responsive_js_enqueue}\n{$custom_js_enqueue}\n{$custom_fucntions_content}\n\n//end functions.php"; if (dynamik_get_settings('responsive_enabled')) { $responsive_js = file_get_contents(CHILD_DIR . '/lib/js/dynamik-responsive.js'); } if ($include_js == 'yes' && file_exists(dynamik_get_custom_js_path()) && 0 != filesize(dynamik_get_custom_js_path())) { $custom_js = file_get_contents(dynamik_get_stylesheet_location('url') . 'custom-scripts.js'); } $home_php = '<?php /** * Build the basic structural wrap for the EZ Static Homepage. * * @package Dynamik */ get_header(); ?> <div id="home-hook-wrap" class="clearfix"> <?php do_action( ' . $single_quote . 'dynamik_hook_home' . $single_quote . ' ); ?> </div><!-- end #home-hook-wrap --> <?php get_footer(); //end home.php'; $style_file = $tmp_child . '/style.css'; $make_style = fopen($style_file, 'x'); fwrite($make_style, $style_css); fclose($make_style); $functions_file = $tmp_child . '/functions.php'; $make_functions = fopen($functions_file, 'x'); fwrite($make_functions, $functions_php); fclose($make_functions); if (dynamik_get_settings('responsive_enabled')) { $responsive_js_file = $tmp_js_folder . '/responsive.js'; $make_responsive_js = fopen($responsive_js_file, 'x'); fwrite($make_responsive_js, $responsive_js); fclose($make_responsive_js); } if ($include_js == 'yes' && file_exists(dynamik_get_custom_js_path()) && 0 != filesize(dynamik_get_custom_js_path())) { $custom_js_file = $tmp_js_folder . '/custom-scripts.js'; $make_custom_js = fopen($custom_js_file, 'x'); fwrite($make_custom_js, $custom_js); fclose($make_custom_js); } else { $custom_js_file = ''; } if (dynamik_get_design('dynamik_homepage_type') == 'static_home') { $home_file = $tmp_child . '/home.php'; $make_home = fopen($home_file, 'x'); fwrite($make_home, $home_php); fclose($make_home); } else { $home_file = ''; } $handle = opendir($image_folder); while (false !== ($file = readdir($handle))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { if ($file != 'screenshot.png') { copy($image_folder . '/' . $file, $tmp_image_folder . '/' . $file); } else { $screenshot = $file; copy($image_folder . '/' . $file, $tmp_child . '/' . $file); } } } closedir($handle); $handle2 = opendir($dynamik_image_folder); while (false !== ($file = readdir($handle2))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { if ($file != 'screenshot.png') { copy($dynamik_image_folder . '/' . $file, $tmp_image_folder . '/' . $file); } elseif ($file == 'screenshot.png' && empty($screenshot)) { copy($dynamik_image_folder . '/' . $file, $tmp_child . '/' . $file); } } } closedir($handle2); if (dynamik_get_settings('post_formats_active')) { $handle3 = opendir($dynamik_post_formats_image_folder); while (false !== ($file = readdir($handle3))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { copy($dynamik_post_formats_image_folder . '/' . $file, $tmp_post_formats_image_folder . '/' . $file); } } closedir($handle3); } if ($include_templates == 'yes') { $handle4 = opendir($dynamik_my_templates_folder); while (false !== ($file = readdir($handle4))) { if ($file !== "." && $file !== "..") { copy($dynamik_my_templates_folder . '/' . $file, $tmp_my_templates_folder . '/' . $file); } } closedir($handle4); $handle5 = opendir(CHILD_DIR); while (false !== ($file = readdir($handle5))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'php' && $file != 'functions.php' && $file != 'home.php') { $wp_templates_files = true; copy(CHILD_DIR . '/' . $file, $tmp_child . '/' . $file); $wp_template_files_array[] = $tmp_child . '/' . $file; } } closedir($handle5); } if ($include_labels == 'yes' && get_option('dynamik_gen_custom_labels') != array()) { $handle6 = opendir($dynamik_metaboxes_folder); while (false !== ($file = readdir($handle6))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'php' || $ext == 'css' || $ext == 'md') { copy($dynamik_metaboxes_folder . '/' . $file, $tmp_metaboxes_folder . '/' . $file); } } closedir($handle6); $handle7 = opendir($dynamik_metaboxes_folder . '/js'); while (false !== ($file = readdir($handle7))) { if ($file !== "." && $file !== "..") { copy($dynamik_metaboxes_folder . '/js/' . $file, $tmp_metaboxes_folder . '/js/' . $file); } } closedir($handle7); $handle8 = opendir($dynamik_metaboxes_folder . '/images'); while (false !== ($file = readdir($handle8))) { if ($file !== "." && $file !== "..") { copy($dynamik_metaboxes_folder . '/images/' . $file, $tmp_metaboxes_folder . '/images/' . $file); } } closedir($handle8); } $export_files = array($style_file, $functions_file, $responsive_js_file, $custom_js_file, $home_file, $dat_file, $tmp_image_folder); if (count(scandir($tmp_my_templates_folder)) > 2) { $export_files[] = $tmp_my_templates_folder; } if (true == $wp_templates_files) { foreach ($wp_template_files_array as $key => $value) { $export_files[] = $value; } } if ($include_labels == 'yes' && get_option('dynamik_gen_custom_labels') != array()) { $export_files[] = $tmp_metaboxes_folder; } if (!empty($screenshot)) { $export_files[] = $tmp_child . '/' . $screenshot; } else { $export_files[] = $tmp_child . '/screenshot.png'; } $dynamik_pclzip = new PclZip($tmp_child . '/' . $child_export_zip); $dynamik_zipped = $dynamik_pclzip->create($export_files, PCLZIP_OPT_REMOVE_PATH, $tmp_child); if ($dynamik_zipped == 0) { die("Error : " . $dynamik_pclzip->errorInfo(true)); } if (ob_get_level()) { ob_end_clean(); } header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename={$child_export_zip}"); readfile($tmp_child . '/' . $child_export_zip); dynamik_delete_dir($tmp_child); dynamik_folders_close_permissions(); exit; }
/** * Require the Dynamik Custom Widget Areas file only on the * site's front-end and only if it exists. * * @since 1.0 * */ function dynamik_require_custom_widget_areas_file() { if (!is_admin() && file_exists(dynamik_get_custom_widget_areas_path())) { require_once dynamik_get_custom_widget_areas_path(); } }