/**
 * List available images that have been updoaded using the Genesis Extender Image Uploader.
 *
 * @since 1.0
 */
function genesis_extender_list_images($current_value = '')
{
    $files = array();
    $images_path = genesis_extender_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;
        }
    }
}
예제 #2
0
파일: init.php 프로젝트: kabrewer07/mrw
    add_action('init', 'genesis_extender_require_css_builder_popup');
}
function genesis_extender_require_css_builder_popup()
{
    if (current_user_can('administrator')) {
        require_once GENEXT_PATH . '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.
     */
    $genesis_extender_folders = array(get_stylesheet_directory(), get_stylesheet_directory() . '/my-templates', genesis_extender_get_stylesheet_location('path', $root = true), genesis_extender_get_stylesheet_location('path'), genesis_extender_get_stylesheet_location('path') . 'images', genesis_extender_get_stylesheet_location('path') . 'adminthumbnails', genesis_extender_get_stylesheet_location('path') . 'tmp', genesis_extender_get_stylesheet_location('path') . 'tmp/images', genesis_extender_get_stylesheet_location('path') . 'tmp/images/adminthumbnails');
    $genesis_extender_unwritable = false;
    foreach ($genesis_extender_folders as $genesis_extender_folder) {
        if (is_dir($genesis_extender_folder) && !is_writable($genesis_extender_folder)) {
            // Update $genesis_extender_unwritable global.
            $genesis_extender_unwritable = true;
        }
    }
    require_once GENEXT_PATH . 'lib/admin/build-menu.php';
    require_once GENEXT_PATH . 'lib/admin/genesis-extender-settings.php';
    require_once GENEXT_PATH . 'lib/admin/genesis-extender-custom-options.php';
    require_once GENEXT_PATH . 'lib/functions/genesis-extender-user-meta.php';
    require_once GENEXT_PATH . 'lib/functions/genesis-extender-build-styles.php';
    require_once GENEXT_PATH . 'lib/functions/genesis-extender-write-files.php';
    require_once GENEXT_PATH . 'lib/functions/genesis-extender-image-uploader.php';
    require_once GENEXT_PATH . 'lib/functions/genesis-extender-update.php';
/**
 * Import the specified Custom Option settings into
 * their appropriate sections of the wp_options table.
 *
 * @since 1.0
 */
function genesis_extender_custom_import($import_file, $theme_settings = '', $custom_css = '', $custom_functions = '', $custom_js = '', $custom_templates = '', $custom_labels = '', $conditionals = '', $widget_areas = '', $hook_boxes = '', $images = '')
{
    $genesis_extender_templates = get_option('genesis_extender_custom_templates');
    $genesis_extender_labels = get_option('genesis_extender_custom_labels');
    $genesis_extender_conditionals = get_option('genesis_extender_custom_conditionals');
    $genesis_extender_widgets = get_option('genesis_extender_custom_widget_areas');
    $genesis_extender_hooks = get_option('genesis_extender_custom_hook_boxes');
    if ('zip' == strtolower(substr(strrchr($import_file['name'], '.'), 1))) {
        genesis_extender_folders_open_permissions();
        require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
        $tmp_path = genesis_extender_get_stylesheet_location('path') . 'tmp';
        $tmp_import_folder = $tmp_path . '/import';
        $tmp_image_folder = $tmp_import_folder . '/images';
        $tmp_adthumbs_folder = $tmp_image_folder . '/adminthumbnails';
        $image_folder = genesis_extender_get_stylesheet_location('path') . 'images';
        $adthumbs_folder = $image_folder . '/adminthumbnails';
        if (!is_dir($tmp_path)) {
            @mkdir($tmp_path, 0755, true);
        }
        if (!is_dir($tmp_import_folder)) {
            @mkdir($tmp_import_folder, 0755, true);
        }
        $import_tmp_name = $import_file['tmp_name'];
        $zip_file = new PclZip($import_tmp_name);
        if (($unzip_result_list = $zip_file->extract(PCLZIP_OPT_PATH, $tmp_import_folder)) == 0) {
            die("Error : " . $zip_file->errorInfo(true));
        }
        $handle = opendir($tmp_import_folder);
        while (false !== ($file = readdir($handle))) {
            $ext = strtolower(substr(strrchr($file, '.'), 1));
            if ($ext == 'dat') {
                $import_data = file_get_contents($tmp_import_folder . '/' . $file);
                $genesis_extender_import = unserialize($import_data);
                if (!empty($theme_settings)) {
                    if (!empty($genesis_extender_import['genesis_extender_settings'])) {
                        $plugin_settings_import = array_merge(genesis_extender_settings_defaults(false, $genesis_extender_import['genesis_extender_settings']), $genesis_extender_import['genesis_extender_settings']);
                        update_option('genesis_extender_settings', $plugin_settings_import);
                    }
                }
                if (!empty($custom_css)) {
                    if (!empty($genesis_extender_import['genesis_extender_custom_css'])) {
                        $custom_css_import = array_merge(genesis_extender_custom_css_options_defaults(), $genesis_extender_import['genesis_extender_custom_css']);
                        update_option('genesis_extender_custom_css', $custom_css_import);
                    }
                }
                if (!empty($custom_functions)) {
                    if (!empty($genesis_extender_import['genesis_extender_custom_functions'])) {
                        $custom_functions_import = array_merge(genesis_extender_custom_functions_options_defaults(), $genesis_extender_import['genesis_extender_custom_functions']);
                        update_option('genesis_extender_custom_functions', $custom_functions_import);
                    }
                }
                if (!empty($custom_js)) {
                    if (!empty($genesis_extender_import['genesis_extender_custom_js'])) {
                        $custom_js_import = array_merge(genesis_extender_custom_js_options_defaults(), $genesis_extender_import['genesis_extender_custom_js']);
                        update_option('genesis_extender_custom_js', $custom_js_import);
                    }
                }
                if (!empty($custom_templates)) {
                    if (!empty($genesis_extender_import['genesis_extender_templates'])) {
                        $genesis_extender_templates_array = array();
                        foreach ($genesis_extender_templates as $key => $value) {
                            if (!in_array($genesis_extender_templates[$key]['template_file_name'], $genesis_extender_templates_array)) {
                                $genesis_extender_templates_array[] = $genesis_extender_templates[$key]['template_file_name'];
                            }
                        }
                        foreach ($genesis_extender_import['genesis_extender_templates'] as $key => $value) {
                            if (in_array($genesis_extender_import['genesis_extender_templates'][$key]['template_file_name'], $genesis_extender_templates_array)) {
                                unset($genesis_extender_import['genesis_extender_templates'][$key]);
                            }
                        }
                        $templates_import = array_merge($genesis_extender_templates, $genesis_extender_import['genesis_extender_templates']);
                        update_option('genesis_extender_custom_templates', $templates_import);
                    }
                }
                if (!empty($custom_labels)) {
                    if (!empty($genesis_extender_import['genesis_extender_labels'])) {
                        $genesis_extender_labels_array = array();
                        foreach ($genesis_extender_labels as $key => $value) {
                            if (!in_array($genesis_extender_labels[$key]['label_name'], $genesis_extender_labels_array)) {
                                $genesis_extender_labels_array[] = $genesis_extender_labels[$key]['label_name'];
                            }
                        }
                        foreach ($genesis_extender_import['genesis_extender_labels'] as $key => $value) {
                            if (in_array($genesis_extender_import['genesis_extender_labels'][$key]['label_name'], $genesis_extender_labels_array)) {
                                unset($genesis_extender_import['genesis_extender_labels'][$key]);
                            }
                        }
                        $labels_import = array_merge($genesis_extender_labels, $genesis_extender_import['genesis_extender_labels']);
                        update_option('genesis_extender_custom_labels', $labels_import);
                    }
                }
                if (!empty($conditionals)) {
                    if (!empty($genesis_extender_import['genesis_extender_conditionals'])) {
                        $genesis_extender_conditionals_array = array();
                        foreach ($genesis_extender_conditionals as $key => $value) {
                            $genesis_extender_conditionals_array[] = $genesis_extender_conditionals[$key]['conditional_id'];
                        }
                        foreach ($genesis_extender_import['genesis_extender_conditionals'] as $key => $value) {
                            if (in_array($genesis_extender_import['genesis_extender_conditionals'][$key]['conditional_id'], $genesis_extender_conditionals_array)) {
                                unset($genesis_extender_import['genesis_extender_conditionals'][$key]);
                            }
                        }
                        $conditionals_import = array_merge($genesis_extender_conditionals, $genesis_extender_import['genesis_extender_conditionals']);
                        update_option('genesis_extender_custom_conditionals', $conditionals_import);
                    }
                }
                if (!empty($widget_areas)) {
                    if (!empty($genesis_extender_import['genesis_extender_widgets'])) {
                        $genesis_extender_widgets_array = array();
                        foreach ($genesis_extender_widgets as $key => $value) {
                            if (!in_array($genesis_extender_widgets[$key]['widget_name'], $genesis_extender_widgets_array)) {
                                $genesis_extender_widgets_array[] = $genesis_extender_widgets[$key]['widget_name'];
                            }
                        }
                        foreach ($genesis_extender_import['genesis_extender_widgets'] as $key => $value) {
                            if (in_array($genesis_extender_import['genesis_extender_widgets'][$key]['widget_name'], $genesis_extender_widgets_array)) {
                                unset($genesis_extender_import['genesis_extender_widgets'][$key]);
                            }
                        }
                        $widgets_import = array_merge($genesis_extender_widgets, $genesis_extender_import['genesis_extender_widgets']);
                        update_option('genesis_extender_custom_widget_areas', $widgets_import);
                    }
                }
                if (!empty($hook_boxes)) {
                    if (!empty($genesis_extender_import['genesis_extender_hooks'])) {
                        $genesis_extender_hooks_array = array();
                        foreach ($genesis_extender_hooks as $key => $value) {
                            if (!in_array($genesis_extender_hooks[$key]['hook_name'], $genesis_extender_hooks_array)) {
                                $genesis_extender_hooks_array[] = $genesis_extender_hooks[$key]['hook_name'];
                            }
                        }
                        foreach ($genesis_extender_import['genesis_extender_hooks'] as $key => $value) {
                            if (in_array($genesis_extender_import['genesis_extender_hooks'][$key]['hook_name'], $genesis_extender_hooks_array)) {
                                unset($genesis_extender_import['genesis_extender_hooks'][$key]);
                            }
                        }
                        $hooks_import = array_merge($genesis_extender_hooks, $genesis_extender_import['genesis_extender_hooks']);
                        update_option('genesis_extender_custom_hook_boxes', $hooks_import);
                    }
                }
            }
        }
        closedir($handle);
        if (!empty($images)) {
            $handle = opendir($tmp_image_folder);
            while (false !== ($file = readdir($handle))) {
                $ext = strtolower(substr(strrchr($file, '.'), 1));
                if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') {
                    copy($tmp_image_folder . '/' . $file, $image_folder . '/' . $file);
                }
            }
            closedir($handle);
            $handle = opendir($tmp_adthumbs_folder);
            while (false !== ($file = readdir($handle))) {
                $ext = strtolower(substr(strrchr($file, '.'), 1));
                if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') {
                    copy($tmp_adthumbs_folder . '/' . $file, $adthumbs_folder . '/' . $file);
                }
            }
            closedir($handle);
        }
        genesis_extender_delete_dir($tmp_import_folder);
        genesis_extender_folders_close_permissions();
        genesis_extender_write_files();
        wp_redirect(admin_url('admin.php?page=genesis-extender-settings&activetab=genesis-extender-settings-nav-import-export&notice=import-complete'));
        exit;
    } elseif ('dat' == strtolower(substr(strrchr($import_file['name'], '.'), 1))) {
        $import_data = file_get_contents($import_file['tmp_name']);
        $genesis_extender_import = unserialize($import_data);
        if (!empty($theme_settings)) {
            if (!empty($genesis_extender_import['genesis_extender_settings'])) {
                $plugin_settings_import = array_merge(genesis_extender_settings_defaults(false, $genesis_extender_import['genesis_extender_settings']), $genesis_extender_import['genesis_extender_settings']);
                update_option('genesis_extender_settings', $plugin_settings_import);
            }
        }
        if (!empty($custom_css)) {
            if (!empty($genesis_extender_import['genesis_extender_custom_css'])) {
                $custom_css_import = array_merge(genesis_extender_custom_css_options_defaults(), $genesis_extender_import['genesis_extender_custom_css']);
                update_option('genesis_extender_custom_css', $custom_css_import);
            }
        }
        if (!empty($custom_functions)) {
            if (!empty($genesis_extender_import['genesis_extender_custom_functions'])) {
                $custom_functions_import = array_merge(genesis_extender_custom_functions_options_defaults(), $genesis_extender_import['genesis_extender_custom_functions']);
                update_option('genesis_extender_custom_functions', $custom_functions_import);
            }
        }
        if (!empty($custom_js)) {
            if (!empty($genesis_extender_import['genesis_extender_custom_js'])) {
                $custom_js_import = array_merge(genesis_extender_custom_js_options_defaults(), $genesis_extender_import['genesis_extender_custom_js']);
                update_option('genesis_extender_custom_js', $custom_functions_import);
            }
        }
        if (!empty($custom_templates)) {
            if (!empty($genesis_extender_import['genesis_extender_templates'])) {
                $genesis_extender_templates_array = array();
                foreach ($genesis_extender_templates as $key => $value) {
                    if (!in_array($genesis_extender_templates[$key]['template_file_name'], $genesis_extender_templates_array)) {
                        $genesis_extender_templates_array[] = $genesis_extender_templates[$key]['template_file_name'];
                    }
                }
                foreach ($genesis_extender_import['genesis_extender_templates'] as $key => $value) {
                    if (in_array($genesis_extender_import['genesis_extender_templates'][$key]['template_file_name'], $genesis_extender_templates_array)) {
                        unset($genesis_extender_import['genesis_extender_templates'][$key]);
                    }
                }
                $templates_import = array_merge($genesis_extender_templates, $genesis_extender_import['genesis_extender_templates']);
                update_option('genesis_extender_custom_templates', $templates_import);
            }
        }
        if (!empty($custom_labels)) {
            if (!empty($genesis_extender_import['genesis_extender_labels'])) {
                $genesis_extender_labels_array = array();
                foreach ($genesis_extender_labels as $key => $value) {
                    if (!in_array($genesis_extender_labels[$key]['label_name'], $genesis_extender_labels_array)) {
                        $genesis_extender_labels_array[] = $genesis_extender_labels[$key]['label_name'];
                    }
                }
                foreach ($genesis_extender_import['genesis_extender_labels'] as $key => $value) {
                    if (in_array($genesis_extender_import['genesis_extender_labels'][$key]['label_name'], $genesis_extender_labels_array)) {
                        unset($genesis_extender_import['genesis_extender_labels'][$key]);
                    }
                }
                $labels_import = array_merge($genesis_extender_labels, $genesis_extender_import['genesis_extender_labels']);
                update_option('genesis_extender_custom_labels', $labels_import);
            }
        }
        if (!empty($conditionals)) {
            if (!empty($genesis_extender_import['genesis_extender_conditionals'])) {
                $genesis_extender_conditionals_array = array();
                foreach ($genesis_extender_conditionals as $key => $value) {
                    $genesis_extender_conditionals_array[] = $genesis_extender_conditionals[$key]['conditional_id'];
                }
                foreach ($genesis_extender_import['genesis_extender_conditionals'] as $key => $value) {
                    if (in_array($genesis_extender_import['genesis_extender_conditionals'][$key]['conditional_id'], $genesis_extender_conditionals_array)) {
                        unset($genesis_extender_import['genesis_extender_conditionals'][$key]);
                    }
                }
                $conditionals_import = array_merge($genesis_extender_conditionals, $genesis_extender_import['genesis_extender_conditionals']);
                update_option('genesis_extender_custom_conditionals', $conditionals_import);
            }
        }
        if (!empty($widget_areas)) {
            if (!empty($genesis_extender_import['genesis_extender_widgets'])) {
                $genesis_extender_widgets_array = array();
                foreach ($genesis_extender_widgets as $key => $value) {
                    if (!in_array($genesis_extender_widgets[$key]['widget_name'], $genesis_extender_widgets_array)) {
                        $genesis_extender_widgets_array[] = $genesis_extender_widgets[$key]['widget_name'];
                    }
                }
                foreach ($genesis_extender_import['genesis_extender_widgets'] as $key => $value) {
                    if (in_array($genesis_extender_import['genesis_extender_widgets'][$key]['widget_name'], $genesis_extender_widgets_array)) {
                        unset($genesis_extender_import['genesis_extender_widgets'][$key]);
                    }
                }
                $widgets_import = array_merge($genesis_extender_widgets, $genesis_extender_import['genesis_extender_widgets']);
                update_option('genesis_extender_custom_widget_areas', $widgets_import);
            }
        }
        if (!empty($hook_boxes)) {
            if (!empty($genesis_extender_import['genesis_extender_hooks'])) {
                $genesis_extender_hooks_array = array();
                foreach ($genesis_extender_hooks as $key => $value) {
                    if (!in_array($genesis_extender_hooks[$key]['hook_name'], $genesis_extender_hooks_array)) {
                        $genesis_extender_hooks_array[] = $genesis_extender_hooks[$key]['hook_name'];
                    }
                }
                foreach ($genesis_extender_import['genesis_extender_hooks'] as $key => $value) {
                    if (in_array($genesis_extender_import['genesis_extender_hooks'][$key]['hook_name'], $genesis_extender_hooks_array)) {
                        unset($genesis_extender_import['genesis_extender_hooks'][$key]);
                    }
                }
                $hooks_import = array_merge($genesis_extender_hooks, $genesis_extender_import['genesis_extender_hooks']);
                update_option('genesis_extender_custom_hook_boxes', $hooks_import);
            }
        }
        genesis_extender_write_files();
        wp_redirect(admin_url('admin.php?page=genesis-extender-settings&activetab=genesis-extender-settings-nav-import-export&notice=import-complete'));
        exit;
    } else {
        wp_redirect(admin_url('admin.php?page=genesis-extender-settings&activetab=genesis-extender-settings-nav-import-export&notice=import-error'));
        exit;
    }
}
/**
 * Get the Genesis Extender Custom Hook Boxes file path.
 *
 * @since 1.0
 * @return the Genesis Extender Custom Hook Boxes file path.
 *
 */
function genesis_extender_get_custom_hook_boxes_path()
{
    return genesis_extender_get_stylesheet_location('path') . 'custom-hook-boxes.php';
}
예제 #5
0
/**
 * Add scripts and HTML to the <head> that are necessary
 * for the front-end CSS builder to function.
 *
 * @since 1.0
 */
function genesis_extender_css_builder_popup()
{
    ?>
<script type="text/javascript">
var cssBuilderImagesUrl = 'url(<?php 
    echo genesis_extender_get_stylesheet_location('url') . 'images';
    ?>
';
var cssBuilderLabelsUrl = '<?php 
    echo GENEXT_URL . 'lib/css/images/css-builder-element-labels';
    ?>
';
var ajaxurl = '<?php 
    echo admin_url('admin-ajax.php');
    ?>
';
<?php 
    if (current_theme_supports('html5')) {
        ?>
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 (genesis_extender_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 GENEXT_PATH . 'lib/admin/boxes/custom-css-builder-popup.php';
}
예제 #6
0
/**
 * 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&notice=plugin-clone-complete'));
    exit;
}
예제 #7
0
/**
 * Perform Genesis Extender activation actions.
 *
 * @since 1.0
 */
function genesis_extender_activate()
{
    if (!get_option('genesis_extender_version_number')) {
        update_option('genesis_extender_version_number', '1.2.2');
    }
    if (!get_option('genesis_extender_settings')) {
        update_option('genesis_extender_settings', genesis_extender_settings_defaults());
    }
    if (!get_option('genesis_extender_custom_css')) {
        update_option('genesis_extender_custom_css', genesis_extender_custom_css_options_defaults());
    }
    if (!get_option('genesis_extender_custom_functions')) {
        update_option('genesis_extender_custom_functions', genesis_extender_custom_functions_options_defaults());
    }
    if (!get_option('genesis_extender_custom_js')) {
        update_option('genesis_extender_custom_js', genesis_extender_custom_js_options_defaults());
    }
    if (!get_option('genesis_extender_custom_templates')) {
        update_option('genesis_extender_custom_templates', array());
    }
    if (!get_option('genesis_extender_custom_labels')) {
        update_option('genesis_extender_custom_labels', array());
    }
    if (!get_option('genesis_extender_custom_conditionals')) {
        update_option('genesis_extender_custom_conditionals', array());
    }
    if (!get_option('genesis_extender_custom_widget_areas')) {
        update_option('genesis_extender_custom_widget_areas', array());
    }
    if (!get_option('genesis_extender_custom_hook_boxes')) {
        update_option('genesis_extender_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(genesis_extender_get_stylesheet_location('path', $root = true))) {
        mkdir(genesis_extender_get_stylesheet_location('path', $root = true));
        @chmod(genesis_extender_get_stylesheet_location('path', $root = true), 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path', $root = true) . 'plugin')) {
        mkdir(genesis_extender_get_stylesheet_location('path', $root = true) . 'plugin');
        @chmod(genesis_extender_get_stylesheet_location('path', $root = true) . 'plugin', 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'default-images')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'default-images');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'default-images', 0755);
        mkdir(genesis_extender_get_stylesheet_location('path') . 'default-images/post-formats');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'default-images/post-formats', 0755);
        $handle = opendir(GENEXT_PATH . 'images');
        while (false !== ($file = readdir($handle))) {
            $ext = strtolower(substr(strrchr($file, '.'), 1));
            if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') {
                copy(GENEXT_PATH . 'images/' . $file, genesis_extender_get_stylesheet_location('path') . 'default-images/' . $file);
            }
        }
        closedir($handle);
        $handle2 = opendir(GENEXT_PATH . 'images/post-formats');
        while (false !== ($file = readdir($handle2))) {
            $ext = strtolower(substr(strrchr($file, '.'), 1));
            if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') {
                copy(GENEXT_PATH . 'images/post-formats/' . $file, genesis_extender_get_stylesheet_location('path') . 'default-images/post-formats/' . $file);
            }
        }
        closedir($handle2);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'images')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'images');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'images', 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'images/adminthumbnails')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'images/adminthumbnails');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'images/adminthumbnails', 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'tmp')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'tmp');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'tmp', 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'tmp/images')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'tmp/images');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'tmp/images', 0755);
    }
    if (!is_dir(genesis_extender_get_stylesheet_location('path') . 'tmp/images/adminthumbnails')) {
        mkdir(genesis_extender_get_stylesheet_location('path') . 'tmp/images/adminthumbnails');
        @chmod(genesis_extender_get_stylesheet_location('path') . 'tmp/images/adminthumbnails', 0755);
    }
    genesis_extender_write_files();
    genesis_extender_create_custom_functions_file();
    $genesis_extender_folders = array(genesis_extender_get_stylesheet_location('path'), genesis_extender_get_stylesheet_location('path') . 'images', genesis_extender_get_stylesheet_location('path') . 'adminthumbnails', genesis_extender_get_stylesheet_location('path') . 'tmp', genesis_extender_get_stylesheet_location('path') . 'tmp/images', genesis_extender_get_stylesheet_location('path') . 'tmp/images/adminthumbnails');
    $genesis_extender_unwritable = false;
    foreach ($genesis_extender_folders as $genesis_extender_folder) {
        if (is_dir($genesis_extender_folder) && !genesis_extender_writable($genesis_extender_folder)) {
            $genesis_extender_unwritable = true;
        }
    }
    if ($genesis_extender_unwritable) {
        wp_redirect(admin_url('admin.php?page=genesis-extender-settings&notice=genesis-extender-unwritable'));
    }
}
<?php

/**
 * Builds the Image Uploader that Genesis Extender and many other
 * Genesis Extender Child Themes utilize.
 *
 * @package Extender
 */
//IMAGE STORAGE SETTINGS
$genesis_extender_uploader_settings['uploadpath'] = genesis_extender_get_stylesheet_location('path') . 'images/';
// The full size images will be stored here.  Must have forward slash on end.
$genesis_extender_uploader_settings['realpath'] = genesis_extender_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.
$genesis_extender_uploader_settings['adminthumbpath'] = genesis_extender_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.
$genesis_extender_uploader_settings['adminthumbpath2'] = genesis_extender_get_stylesheet_location('url') . 'images/adminthumbnails/';
$genesis_extender_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', 'genesis_extender_images_check');
/**
 * Build image check function to determine which Uploader sub-function to run based on the type of POST.
 *
 * @since 1.0
 */
function genesis_extender_images_check()
{
    if (!empty($_GET['fct'])) {
        switch ($_GET['fct']) {
            case 'upload':
                genesis_extender_uploadimage();
                break;
예제 #9
0
/**
 * Enqueue various bits of javascript.
 *
 * @since 1.0
 */
function genesis_extender_enqueue_scripts()
{
    global $genesis_extender_css_builder_popup;
    if (genesis_extender_get_custom_css('css_builder_popup_active') && current_user_can('administrator')) {
        $genesis_extender_css_builder_popup = true;
    }
    if ($genesis_extender_css_builder_popup && !is_admin()) {
        wp_enqueue_script('css-builder-popup', GENEXT_URL . 'lib/js/genesis-extender-custom-css-builder-popup.js', false, GENEXT_VERSION, true);
        wp_enqueue_script('js-color-popup', GENEXT_URL . 'lib/js/jscolor/jscolor-popup.js', false, GENEXT_VERSION, true);
        wp_enqueue_script('jquery-ui-draggable');
    }
    $custom_js = get_option('genesis_extender_custom_js');
    if (!empty($custom_js['custom_js_in_head'])) {
        $in_footer = false;
    } else {
        $in_footer = true;
    }
    if (file_exists(genesis_extender_get_custom_js_path()) && 0 != filesize(genesis_extender_get_custom_js_path())) {
        wp_enqueue_script('custom-scripts', genesis_extender_get_stylesheet_location('url') . 'custom-scripts.js', false, GENEXT_VERSION, $in_footer);
    }
}