Ejemplo n.º 1
0
 function vantage_metaslider_page_setting_save($post_id)
 {
     if (empty($_POST['_vantage_metaslider_nonce']) || !wp_verify_nonce($_POST['_vantage_metaslider_nonce'], 'save')) {
         return;
     }
     if (!current_user_can('edit_post', $post_id)) {
         return;
     }
     if (defined('DOING_AJAX')) {
         return;
     }
     update_post_meta($post_id, 'vantage_metaslider_slider', $_POST['vantage_page_metaslider']);
     $slider_stretch = !empty($_POST['vantage_page_metaslider_stretch']);
     update_post_meta($post_id, 'vantage_metaslider_slider_stretch', $slider_stretch);
     // If we're on the home page update the 'home_slider' theme setting as well.
     if ($post_id == get_option('page_on_front')) {
         siteorigin_settings_set('home_slider', $_POST['vantage_page_metaslider']);
         siteorigin_settings_set('home_slider_stretch', $slider_stretch);
     }
 }
Ejemplo n.º 2
0
function ultra_metaslider_page_setting_save($post_id)
{
    if (empty($_POST['_ultra_metaslider_nonce']) || !wp_verify_nonce($_POST['_ultra_metaslider_nonce'], 'save')) {
        return;
    }
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    if (defined('DOING_AJAX')) {
        return;
    }
    update_post_meta($post_id, 'ultra_metaslider_slider', $_POST['ultra_page_metaslider']);
    $slider_stretch = filter_input(INPUT_POST, 'ultra_page_metaslider_stretch') == "on";
    update_post_meta($post_id, 'ultra_metaslider_slider_stretch', $slider_stretch);
    $slider_overlap = filter_input(INPUT_POST, 'ultra_page_metaslider_overlap') == "on";
    update_post_meta($post_id, 'ultra_metaslider_slider_overlap', $slider_overlap);
    // If we're on the home page update the 'home_slider' theme setting as well.
    if ($post_id == get_option('page_on_front')) {
        siteorigin_settings_set('home_slider', $_POST['ultra_page_metaslider']);
        siteorigin_settings_set('home_slider_stretch', $slider_stretch);
        siteorigin_settings_set('home_header_overlaps', $slider_overlap);
    }
}
Ejemplo n.º 3
0
/**
 * Render the premium page
 */
function siteorigin_premium_page_render()
{
    $theme = basename(get_template_directory());
    define('SITEORIGIN_PREMIUM_SUPPORTED_COST', 10);
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    } else {
        $action = 'view';
    }
    switch ($action) {
        case 'view':
            global $siteorigin_premium_info;
            $siteorigin_premium_info = apply_filters('siteorigin_premium_content', array());
            get_template_part('extras/premium/tpl/upgrade-page');
            break;
        case 'enter-order':
            $option_name = 'siteorigin_order_number_' . $theme;
            if (isset($_POST['_upgrade_nonce']) && wp_verify_nonce($_POST['_upgrade_nonce'], 'save_order_number') && isset($_POST['order_number'])) {
                siteorigin_settings_set('premium_order_number', trim($_POST['order_number']));
            }
            // Validate the order number
            $result = wp_remote_get(add_query_arg(array('order_number' => siteorigin_setting('premium_order_number'), 'action' => 'validate_order_number'), SITEORIGIN_THEME_ENDPOINT . '/premium/' . $theme . '/'));
            $valid = null;
            if (!is_wp_error($result)) {
                $validation_result = unserialize($result['body']);
                $valid = isset($validation_result['valid']) ? $validation_result['valid'] : null;
                if ($valid) {
                    // Trigger a refresh of the theme update information
                    set_site_transient('update_themes', null);
                } else {
                    // Clear the order number if it is not valid
                    siteorigin_settings_set('premium_order_number', '');
                }
            }
            ?>
			<div class="wrap" id="theme-upgrade">
				<h2><?php 
            printf(__('Your Order Number Is [%s]', 'vantage'), siteorigin_setting('premium_order_number'));
            ?>
</h2>

				<?php 
            if (is_null($valid)) {
                ?>
				<p>
					<?php 
                _e("There was a problem contacting our validation servers.", 'vantage');
                ?>
					<?php 
                _e("Please try again later, or upgrade manually using the ZIP file we sent you.", 'vantage');
                ?>
				</p>
				<?php 
            } elseif ($valid) {
                ?>
				<p>
					<?php 
                _e("We've validated your order number.", 'vantage');
                ?>
					<?php 
                printf(__('You can update now, or later on your <a href="%s">Themes page</a>.', 'vantage'), admin_url('themes.php'));
                ?>
					<?php 
                _e('This update will add all the premium features.', 'vantage');
                ?>
				</p>
				<p class="submit">
					<?php 
                $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($theme)), 'upgrade-theme_' . $theme);
                $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any code customizations (CSS, PHP, Javascript, etc) you have made to the free version. You will not lose your content, images or settings. 'Cancel' to stop, 'OK' to update.", 'vantage')) . '\') ) {return true;}return false;"';
                ?>
					<a href="<?php 
                echo esc_url($update_url);
                ?>
" <?php 
                echo $update_onclick;
                ?>
 class="button-primary">
						<?php 
                _e('Update Theme', 'vantage');
                ?>
					</a>
				</p>
				<?php 
            } else {
                ?>
				<p>
					<?php 
                _e("We couldn't validate your order number.", 'vantage');
                ?>
					<?php 
                _e("There might be a problem with our validation server.", 'vantage');
                ?>
					<?php 
                _e("Please try again later, or upgrade manually using the ZIP file we sent you.", 'vantage');
                ?>
				</p>
				<?php 
            }
            ?>
			</div>
			<?php 
            break;
    }
}