require_once CHILD_DIR . '/lib/functions/dynamik-fonts.php'; require_once CHILD_DIR . '/lib/functions/dynamik-ez-functions.php'; if (is_admin() || $dynamik_css_builder_popup) { require_once CHILD_DIR . '/lib/functions/dynamik-option-lists.php'; } if ($dynamik_css_builder_popup) { require_once CHILD_DIR . '/lib/admin/css-builder-popup.php'; } /** * Create globals and Require files only needed for admin. */ if (is_admin()) { /** * Create globals to define both the folder locations to be written to and their current writable state. */ $dynamik_folders = array(CHILD_DIR, CHILD_DIR . '/my-templates', dynamik_get_stylesheet_location('path', $root = true), dynamik_get_stylesheet_location('path'), dynamik_get_stylesheet_location('path') . 'images', dynamik_get_stylesheet_location('path') . 'adminthumbnails', dynamik_get_stylesheet_location('path') . 'tmp', dynamik_get_stylesheet_location('path') . 'tmp/images', dynamik_get_stylesheet_location('path') . 'tmp/images/adminthumbnails'); $dynamik_unwritable = false; foreach ($dynamik_folders as $dynamik_folder) { if (is_dir($dynamik_folder) && !is_writable($dynamik_folder)) { // Update $dynamik_unwritable global. $dynamik_unwritable = true; } } if (defined('GENEXT_VERSION')) { add_action('admin_notices', 'dynamik_extender_is_active_nag'); /** * Build "Extender Is Active" Nag HTML. * * @since 1.2.2 */ function dynamik_extender_is_active_nag()
/** * Perform Dynamik activation actions. * * @since 1.0 */ function dynamik_activate() { global $dynamik_folders; if (!get_option('dynamik_gen_version_number')) { update_option('dynamik_gen_version_number', '1.2.2'); } if (!get_option('dynamik_gen_theme_settings')) { update_option('dynamik_gen_theme_settings', dynamik_theme_settings_defaults()); } if (!get_option('dynamik_gen_design_options')) { update_option('dynamik_gen_design_options', dynamik_design_options_defaults()); } if (!get_option('dynamik_gen_responsive_options')) { update_option('dynamik_gen_responsive_options', dynamik_responsive_options_defaults()); } if (!get_option('dynamik_gen_design_snapshot_options')) { dynamik_design_snapshot_update($activation = true); } if (!get_option('dynamik_gen_custom_css')) { update_option('dynamik_gen_custom_css', dynamik_custom_css_options_defaults()); } if (!get_option('dynamik_gen_custom_functions')) { update_option('dynamik_gen_custom_functions', dynamik_custom_functions_options_defaults()); } if (!get_option('dynamik_gen_custom_js')) { update_option('dynamik_gen_custom_js', dynamik_custom_js_options_defaults()); } if (!get_option('dynamik_gen_custom_templates')) { update_option('dynamik_gen_custom_templates', array()); } if (!get_option('dynamik_gen_custom_labels')) { update_option('dynamik_gen_custom_labels', array()); } if (!get_option('dynamik_gen_custom_conditionals')) { update_option('dynamik_gen_custom_conditionals', array()); } if (!get_option('dynamik_gen_custom_widget_areas')) { update_option('dynamik_gen_custom_widget_areas', array()); } if (!get_option('dynamik_gen_custom_hook_boxes')) { update_option('dynamik_gen_custom_hook_boxes', array()); } if (!is_dir(CHILD_DIR . '/my-templates')) { mkdir(CHILD_DIR . '/my-templates'); @chmod(CHILD_DIR . '/my-templates', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path', $root = true))) { mkdir(dynamik_get_stylesheet_location('path', $root = true)); @chmod(dynamik_get_stylesheet_location('path', $root = true), 0755); } if (!is_dir(dynamik_get_stylesheet_location('path', $root = true) . 'theme')) { mkdir(dynamik_get_stylesheet_location('path', $root = true) . 'theme'); @chmod(dynamik_get_stylesheet_location('path', $root = true) . 'theme', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path') . 'default-images')) { mkdir(dynamik_get_stylesheet_location('path') . 'default-images'); @chmod(dynamik_get_stylesheet_location('path') . 'default-images', 0755); mkdir(dynamik_get_stylesheet_location('path') . 'default-images/post-formats'); @chmod(dynamik_get_stylesheet_location('path') . 'default-images/post-formats', 0755); $handle = opendir(CHILD_DIR . '/images'); while (false !== ($file = readdir($handle))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { copy(CHILD_DIR . '/images/' . $file, dynamik_get_stylesheet_location('path') . 'default-images/' . $file); } } closedir($handle); $handle2 = opendir(CHILD_DIR . '/images/post-formats'); while (false !== ($file = readdir($handle2))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { copy(CHILD_DIR . '/images/post-formats/' . $file, dynamik_get_stylesheet_location('path') . 'default-images/post-formats/' . $file); } } closedir($handle2); } $handle3 = opendir(CHILD_DIR . '/images'); while (false !== ($file = readdir($handle3))) { if ($file == 'icon-plus.png' || $file == 'icon-plus-white.png') { copy(CHILD_DIR . '/images/' . $file, dynamik_get_stylesheet_location('path') . 'default-images/' . $file); } } closedir($handle3); if (!is_dir(dynamik_get_stylesheet_location('path') . 'images')) { mkdir(dynamik_get_stylesheet_location('path') . 'images'); @chmod(dynamik_get_stylesheet_location('path') . 'images', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path') . 'images/adminthumbnails')) { mkdir(dynamik_get_stylesheet_location('path') . 'images/adminthumbnails'); @chmod(dynamik_get_stylesheet_location('path') . 'images/adminthumbnails', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path') . 'tmp')) { mkdir(dynamik_get_stylesheet_location('path') . 'tmp'); @chmod(dynamik_get_stylesheet_location('path') . 'tmp', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path') . 'tmp/images')) { mkdir(dynamik_get_stylesheet_location('path') . 'tmp/images'); @chmod(dynamik_get_stylesheet_location('path') . 'tmp/images', 0755); } if (!is_dir(dynamik_get_stylesheet_location('path') . 'tmp/images/adminthumbnails')) { mkdir(dynamik_get_stylesheet_location('path') . 'tmp/images/adminthumbnails'); @chmod(dynamik_get_stylesheet_location('path') . 'tmp/images/adminthumbnails', 0755); } dynamik_write_files(); dynamik_create_custom_functions_file(); $dynamik_unwritable = false; foreach ($dynamik_folders as $dynamik_folder) { if (is_dir($dynamik_folder) && !dynamik_writable($dynamik_folder)) { $dynamik_unwritable = true; } } if ($dynamik_unwritable) { wp_redirect(admin_url('admin.php?page=dynamik-settings¬ice=dynamik-unwritable')); } }
/** * List available images that have been updoaded using the Dynamik Image Uploader. * * @since 1.0 */ function dynamik_list_images($current_value = '') { $files = array(); $images_path = dynamik_get_stylesheet_location('path') . 'images'; $handle = opendir($images_path); while (false !== ($file = readdir($handle))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif') { array_push($files, $file); } } closedir($handle); echo '<option></option>'; if (count($files) != 0) { sort($files); foreach ($files as $file) { $image_list_option = '<option value="' . $file . '"'; if ($current_value == $file) { $image_list_option .= ' selected="selected"'; } $image_list_option .= '>' . $file . '</option>' . "\n"; echo $image_list_option; } } }
_e('Dynamik CSS', 'dynamik'); ?> </p> </div> <div class="dynamik-design-option"> <p class="bg-box-design" style="padding-top:8px;"> <input type="checkbox" id="dynamik-minify-css" name="dynamik[minify_css]" value="1" <?php if (checked(1, dynamik_get_design('minify_css'))) { } ?> /> <?php _e('Minify the Dynamik Stylesheet', 'dynamik'); ?> <span id="dynamik-css-options-tooltip" class="tooltip-mark tooltip-center-left">[?]</span> <span class="tooltip tooltip-400" style="color: #666666 !important;"> <?php _e('This option should be active for general use. When the option is checked, style.css, dynamik.css and any Dynamik Custom CSS are merged into one stylesheet (dynamik-min.css) and minified for effeciency. When unchecked the un-minified stylesheets are called separately, which is ideal for testing purposes only.', 'dynamik'); ?> </span> | <a href="<?php echo dynamik_get_stylesheet_location('url') . 'dynamik.css'; ?> " target="_blank"><span style="font-style:underline;"><?php _e('Click here to view the dynamik.css stylesheet', 'dynamik'); ?> </a> </p> </div> </div> </div>
/** * Get the Dynamik Custom Hook Boxes file path. * * @since 1.0 * @return the Dynamik Custom Hook Boxes file path. * */ function dynamik_get_custom_hook_boxes_path() { return dynamik_get_stylesheet_location('path') . 'custom-hook-boxes.php'; }
/** * Add scripts and HTML to the <head> that are necessary * for the front-end CSS builder to function. * * @since 1.0 */ function css_builder_popup() { ?> <script type="text/javascript"> var cssBuilderImagesUrl = 'url(<?php echo dynamik_get_stylesheet_location('url') . 'images'; ?> '; var cssBuilderLabelsUrl = '<?php echo CHILD_URL . '/lib/css/images/css-builder-element-labels'; ?> '; var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> '; <?php if (dynamik_get_settings('html_five_active')) { ?> var cssBtabsSiteInner = '.site-inner'; var cssBtabsSiteHeader = '.site-header'; var cssBtabsNavPrimary = '.nav-primary'; var cssBtabsNavSecondary = '.nav-secondary'; var cssBtabsContent = '.content'; var cssBtabsSidebarPrimary = '.sidebar-primary'; var cssBtabsSidebarSecondary = '.sidebar-secondary'; var cssBtabsSiteFooter = '.site-footer'; <?php } else { ?> var cssBtabsSiteInner = '#inner'; var cssBtabsSiteHeader = '#header'; var cssBtabsNavPrimary = '#nav'; var cssBtabsNavSecondary = '#subnav'; var cssBtabsContent = '#content'; var cssBtabsSidebarPrimary = '#sidebar'; var cssBtabsSidebarSecondary = '#sidebar-alt'; var cssBtabsSiteFooter = '#footer'; <?php } ?> </script> <?php if (dynamik_get_custom_css('css_builder_popup_editor_only')) { echo '<span id="css-builder-custom-css-only"></span>' . "\n"; } else { echo '<span id="css-builder-custom-css"></span>' . "\n"; } echo '<span id="css-builder-editor-css"></span>' . "\n"; echo '<span id="css-builder-highlight-css"></span>' . "\n"; require_once CHILD_DIR . '/lib/admin/boxes/custom-css-builder-popup.php'; }
/** * Clone the Genesis Extender Plugin Settings & Images over to the Dynamik Child Theme. * * @since 1.0.2 */ function genesis_extender_clone($clone_plugin_settings = '', $clone_plugin_metadata = '', $clone_plugin_images = '') { if (!empty($clone_plugin_settings)) { $plugin_settings_clone = array_merge(dynamik_theme_settings_defaults(), get_option('genesis_extender_settings')); update_option('dynamik_gen_theme_settings', $plugin_settings_clone); $custom_css_clone = array_merge(dynamik_custom_css_options_defaults(), get_option('genesis_extender_custom_css')); update_option('dynamik_gen_custom_css', $custom_css_clone); $custom_functions_clone = array_merge(dynamik_custom_functions_options_defaults(), get_option('genesis_extender_custom_functions')); update_option('dynamik_gen_custom_functions', $custom_functions_clone); $custom_js_clone = array_merge(dynamik_custom_js_options_defaults(), get_option('genesis_extender_custom_js')); update_option('dynamik_gen_custom_js', $custom_js_clone); update_option('dynamik_gen_custom_templates', get_option('genesis_extender_custom_templates')); update_option('dynamik_gen_custom_labels', get_option('genesis_extender_custom_labels')); $genesis_extender_custom_conditionals = get_option('genesis_extender_custom_conditionals'); foreach ($genesis_extender_custom_conditionals as $key => $value) { if (substr($value['conditional_tag'], 0, 8) == 'extender') { $genesis_extender_custom_conditionals[$key]['conditional_tag'] = str_replace(substr($value['conditional_tag'], 0, 8), 'dynamik', $value['conditional_tag']); } } update_option('dynamik_gen_custom_conditionals', $genesis_extender_custom_conditionals); update_option('dynamik_gen_custom_widget_areas', get_option('genesis_extender_custom_widget_areas')); update_option('dynamik_gen_custom_hook_boxes', get_option('genesis_extender_custom_hook_boxes')); } if (!empty($clone_plugin_metadata)) { global $wpdb; $wpdb->update($wpdb->postmeta, array('meta_key' => '_dyn_labels'), array('meta_key' => '_genext_labels')); } if (!empty($clone_plugin_images)) { dynamik_folders_open_permissions(); $plugin_image_folder = genesis_extender_get_stylesheet_location('path') . 'images'; $plugin_adthumbs_folder = $plugin_image_folder . '/adminthumbnails'; $theme_image_folder = dynamik_get_stylesheet_location('path') . 'images'; $theme_adthumbs_folder = $theme_image_folder . '/adminthumbnails'; dynamik_delete_images($theme_image_folder); dynamik_delete_images($theme_adthumbs_folder); $handle = opendir($plugin_image_folder); while (false !== ($file = readdir($handle))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { copy($plugin_image_folder . '/' . $file, $theme_image_folder . '/' . $file); } } closedir($handle); $handle = opendir($plugin_adthumbs_folder); while (false !== ($file = readdir($handle))) { $ext = strtolower(substr(strrchr($file, '.'), 1)); if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') { copy($plugin_adthumbs_folder . '/' . $file, $theme_adthumbs_folder . '/' . $file); } } closedir($handle); dynamik_folders_close_permissions(); } dynamik_write_files($css = true, $ez = false); wp_redirect(admin_url('admin.php?page=dynamik-settings&activetab=dynamik-theme-settings-nav-import-export¬ice=plugin-clone-complete')); exit; }
<?php /** * Display either the EZ Static Homepage, a custom home.php page template, if found * in /wp-content/uploads/dynamik-gen/, or call to the genesis() Framework function. * * @package Dynamik */ if (is_front_page() && dynamik_get_design_alt('dynamik_homepage_type') == 'static_home') { get_header(); ?> <div id="home-hook-wrap" class="clearfix"> <?php do_action('dynamik_hook_home'); ?> </div><!-- end #home-hook-wrap --> <?php get_footer(); } elseif (is_front_page() && file_exists(dynamik_get_stylesheet_location('path', $root = true) . 'home.php')) { require_once dynamik_get_stylesheet_location('path', $root = true) . 'home.php'; } else { genesis(); }
/** * Enqueue various bits of javascript. * * @since 1.0 */ function dynamik_enqueue_scripts() { global $dynamik_css_builder_popup; if ($dynamik_css_builder_popup && !is_admin()) { wp_enqueue_script('css-builder-popup', CHILD_URL . '/lib/js/dynamik-custom-css-builder-popup.js', false, CHILD_THEME_VERSION, true); wp_enqueue_script('js-color-popup', CHILD_URL . '/lib/js/jscolor/jscolor-popup.js', false, CHILD_THEME_VERSION, true); wp_enqueue_script('jquery-ui-draggable'); } if (dynamik_get_settings('responsive_enabled')) { wp_enqueue_script('responsive', CHILD_URL . '/lib/js/dynamik-responsive.js', false, CHILD_THEME_VERSION, true); } $custom_js = get_option('dynamik_gen_custom_js'); if (!empty($custom_js['custom_js_in_head'])) { $in_footer = false; } else { $in_footer = true; } if (file_exists(dynamik_get_custom_js_path()) && 0 != filesize(dynamik_get_custom_js_path())) { wp_enqueue_script('custom-scripts', dynamik_get_stylesheet_location('url') . 'custom-scripts.js', false, CHILD_THEME_VERSION, $in_footer); } }
<?php /** * Builds the Image Uploader that Dynamik and many other * Dynamik Child Themes utilize. * * @package Dynamik */ //IMAGE STORAGE SETTINGS $dynamik_uploader_settings['uploadpath'] = dynamik_get_stylesheet_location('path') . 'images/'; // The full size images will be stored here. Must have forward slash on end. $dynamik_uploader_settings['realpath'] = dynamik_get_stylesheet_location('url') . 'images/'; // This is the real URL location of your gallery images, this is used by the admin script to porvide a full URL link to the uploaded images. $dynamik_uploader_settings['adminthumbpath'] = dynamik_get_stylesheet_location('path') . 'images/adminthumbnails/'; // Regardless of whether or not you have enabled automatic thumbnail creation above, a 100 pixel wide admin thumbnail is always created for use by the admin panel when listing images. $dynamik_uploader_settings['adminthumbpath2'] = dynamik_get_stylesheet_location('url') . 'images/adminthumbnails/'; $dynamik_uploader_settings['filetypes'] = array("image/gif", "image/pjpeg", "image/jpeg", "image/x-png", "image/png"); // Only these filetypes are allowed to be uploaded. add_action('admin_init', 'dynamik_images_check'); /** * Build image check function to determine which Uploader sub-function to run based on the type of POST. * * @since 1.0 */ function dynamik_images_check() { if (!empty($_GET['fct'])) { switch ($_GET['fct']) { case 'upload': uploadimage(); break;