예제 #1
0
function concerto_install()
{
    if (get_current_theme() == 'Concerto' && get_option('concerto_is_installed') != 1) {
        require_once CONCERTO_LIBS . 'defaults.php';
        defaultOptions('default', null, true);
        update_option('concerto_is_installed', 1);
    }
}
예제 #2
0
/**
 * Restore Concerto Options
 *
 * Restores Default Configuration Options for Concerto depending on the Context
 */
function restoreConcertoOptions($stage = 'default', $context = null)
{
    include CONCERTO_LIBS . 'defaults.php';
    defaultOptions($stage, $context);
}
예제 #3
0
파일: admin.php 프로젝트: jmrocela/Concerto
	 *
	 * @return void
	 */
    public function __construct()
    {
        global $extensions, $stage;
        $stage = get_option('concerto_stage');
        // Require the individual Administration Pages
        require_once CONCERTO_ADM . 'general.php';
        require_once CONCERTO_ADM . 'design.php';
        require_once CONCERTO_ADM . 'tools.php';
        require_once CONCERTO_ADM . 'support.php';
        // Hook boxes to their assigned places
        require_once CONCERTO_ADM . 'actions.php';
        // Bind Concerto to Wordpress
        add_action('admin_init', array($this, 'init'));
        add_action('admin_menu', array($this, 'menu'));
    }
    /**
	 * Init
	 *
	 * Hooked to admin_init. Sets up the scripts and nonce for use in the admin.
	 * Registers the settings and passes the upload
	 *
	 * @return void
	 */
    public function init()
    {
        // We Include our Javascript Files
        $stylesheet_directory = get_bloginfo('stylesheet_directory');
        wp_register_script('jQueryMasonry', $stylesheet_directory . '/core/scripts/jquery.masonry.js', null, CONCERTO_VERSION);
        wp_register_script('jQuerySWFUpload', $stylesheet_directory . '/core/scripts/jquery.swfupload.js', null, CONCERTO_VERSION);
        wp_register_script('concertoAdmin', $stylesheet_directory . '/core/scripts/concerto.admin.js', null, CONCERTO_VERSION);
        wp_enqueue_script('jQueryMasonry');
        wp_enqueue_style('concertoAdmin', $stylesheet_directory . '/core/admin/style.css');
        // Attach ajax functionality
        add_action('wp_ajax_pinglicense', array($this, 'license'));
        // Check if we have valid configurations for our Stage
        global $stage;
        if (!get_option('concerto_' . $stage . '_design_html_version')) {
            require_once CONCERTO_LIBS . 'defaults.php';
            defaultOptions($stage, null, true);
        }
        if (is_plugin_page()) {
            if ($_GET['page'] == 'concerto_admin_menu' || $_GET['page'] == 'concerto_admin_design' || $_GET['page'] == 'concerto_admin_tools') {
                wp_enqueue_script('swfupload');
                wp_enqueue_script('jQuerySWFUpload');
                wp_enqueue_script('concertoAdmin');
            }
            if ($_GET['page'] == 'concerto_admin_menu' || $_GET['page'] == 'concerto_admin_design') {
                wp_enqueue_script('jquery-ui-sortable', null, array('jquery-ui-core'));
            }
            if ($_GET['page'] == 'concerto_admin_design') {
                wp_enqueue_script('farbtastic');
                wp_enqueue_style('farbtastic');
            }
            if ($_GET['page'] == 'concerto_admin_tools') {
                if (!empty($_POST['concerto_exportconfig_nonce']) || !empty($_POST['concerto_restoreconfig_nonce']) || !empty($_POST['concerto_newstage_nonce'])) {
                    require_once 'functions.php';
                    $context = array();
                    if (!empty($_POST['concerto_tools_export_from'])) {
                        if (wp_verify_nonce($_POST['concerto_exportconfig_nonce'], 'concerto_exportconfig')) {
                            if (@$_POST['concerto_tools_export_general'] == 1) {
                                $context[] = 'general';
                            }
                            if (@$_POST['concerto_tools_export_design'] == 1) {
                                $context[] = 'design';
                            }
                            $stage = $_POST['concerto_tools_export_from'];
                            if (!empty($context)) {
                                exportConcertoOptions($stage, $context);
                            }
                        }
                    }
                    if (!empty($_POST['concerto_tools_restore_from'])) {
                        if (wp_verify_nonce($_POST['concerto_restoreconfig_nonce'], 'concerto_restoreconfig')) {
                            if (@$_POST['concerto_tools_restore_general'] == 1) {
                                $context[] = 'general';
                            }
                            if (@$_POST['concerto_tools_restore_design'] == 1) {
                                $context[] = 'design';
                            }
                            $stage = $_POST['concerto_tools_restore_from'];
                            if (!empty($context)) {
                                restoreConcertoOptions($stage, $context);
                                $location = get_bloginfo('url') . '/wp-admin/admin.php?page=concerto_admin_tools&restored=1&restored_to=' . urlencode($stage) . '&restored_context=' . urlencode(implode(',', $context));
                                wp_redirect($location);
                                exit;
                            }
                        }
                    }
                    if (!empty($_POST['concerto_newstage_nonce']) && !empty($_POST['concerto_tools_stage_name'])) {
                        if (wp_verify_nonce($_POST['concerto_newstage_nonce'], 'concerto_newstage')) {
                            $stage = $_POST['concerto_tools_stage_name'];
                            $code = createStage($stage);
                            if ($code == 1) {