Пример #1
1
	}
	
	if( empty($_POST['background_source']) ) { $opt_val[22] = NULL; itro_update_option('background_source',NULL); }
	else { itro_update_option('background_source',$_POST['background_source']); }
}

/* delete tables on plugin uninstall option */
if( isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' )
{
	if( isset($_POST['delete_data']) )
	{
		itro_update_option('delete_data', $_POST['delete_data']);
	}
	else
	{
		itro_update_option('delete_data', NULL);
	}
}

/* Put an settings updated message on the screen */
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' || isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y' ) {
	?>
	<div class="updated"><p><strong><?php _e('settings saved.', 'itro-plugin' ); ?></strong></p></div>
	<?php
}
?>
<script type="text/javascript" src="<?php echo itroPath . 'scripts/'; ?>jscolor/jscolor.js"></script>

<div style="display:table; width:100%;">
	<h1 style="float:left;"><?php _e( 'I.T.RO. Popup Plugin - Settings', 'itro-plugin');?></h1>
	<h4 style="float:right; margin-right:30px;">VER: <?php echo $ITRO_VER; ?></h4>
function itro_update_db()
{
    global $wpdb;
    $prev_ver = get_option('itro_prev_ver');
    if ($prev_ver <= 3.68) {
        itro_update_option('popup_border_width', 3);
        itro_update_option('popup_border_radius', 8);
    }
    if (version_compare($prev_ver, 4.6) == -1 && $wpdb->prefix != 'wp_') {
        $wpdb->query("RENAME TABLE wp_itro_plugin_option TO " . $wpdb->prefix . "itro_plugin_option");
        $wpdb->query("RENAME TABLE wp_itro_plugin_field TO " . $wpdb->prefix . "itro_plugin_field");
    }
    if (version_compare($prev_ver, 4.7) == -1) {
        /* delete the obsolete and useless preview post */
        if (itro_get_option('preview_id') != NULL) {
            wp_delete_post(itro_get_option('preview_id'), true);
        }
    }
    // added the text for countdown
    if (version_compare($prev_ver, 4.91) == -1) {
        itro_update_option('countdown_text', 'This popup will close in:');
    }
    // reset the popup height after error for data sanitization
    if (version_compare($prev_ver, 4.95) == -1) {
        if (itro_get_option('select_popup_height') == 'px' && itro_get_option('px_popup_height') == 0) {
            itro_update_option('select_popup_height', 'auto');
        }
    }
}
Пример #3
0
function itro_init()
{
    /* -----load sample popup settings */
    if (get_option("itro_curr_ver") == NULL) {
        /* --------- initialize database */
        itro_db_init();
        itro_update_option('popup_time', 20);
        itro_update_option('cookie_time_exp', 0);
        itro_update_option('popup_background', '#FFFFFF');
        itro_update_option('popup_border_color', '#F7FF00');
        itro_update_option('px_popup_width', 300);
        itro_update_option('px_popup_height', 0);
        itro_update_option('show_countdown', 'yes');
        itro_update_option('auto_margin_check', 'yes');
        itro_update_option('select_popup_width', 'px');
        itro_update_option('select_popup_height', 'auto');
        itro_update_option('popup_bg_opacity', 0.4);
        itro_update_option('opaco_bg_color', '#8A8A8A');
        itro_update_option('popup_position', 'fixed');
        itro_update_option('popup_border_width', 3);
        itro_update_option('popup_border_radius', 8);
        itro_update_option('popup_padding', 2);
        itro_update_option('page_selection', 'none');
        switch (WPLANG) {
            case 'en_US':
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p>&nbsp;</p>';
                break;
            case 'it_IT':
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Questo &egrave; un esempio di popup.</span></h1><p style="text-align: center;">&nbsp;</p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Le impostazioni base per iniziare sono: Altezza popup, Tempo popup, Prossima visualizzazione, Colore bordo, Colore sfondo.</span></p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Scrivi qualunque cosa vuoi nell&#39;editor di testo di wordpress e buon lavoro!</span></p><p style="text-align: center;">&nbsp;</p>';
                break;
            default:
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p>&nbsp;</p>';
        }
        itro_update_field('custom_html', $welcome_text);
        itro_update_option('sample_popup', 'done');
    }
    /* ---------------create preview page */
    switch (WPLANG) {
        case 'en_US':
            $preview_text = 'ITRO - Preview page. This page is used to rightly display preview of your popup with site theme.';
            break;
        case 'it_IT':
            $preview_text = 'ITRO - Pagina di anteprima. Questa pagina &egrave; utilizzata per visualizzare correttamente il popup, integrato con lo stile del tema.';
            break;
        default:
            $preview_text = 'ITRO - Preview page. This page is used to rightly display preview of your popup with site theme.';
    }
    if (itro_get_option('preview_id') == NULL) {
        /* Create post object */
        $preview_post = array('post_title' => 'ITRO - Preview', 'post_name' => 'itro-preview', 'post_content' => $preview_text, 'post_status' => 'private', 'post_author' => 1, 'post_type' => 'page');
        /* Insert the post into the database */
        @($preview_id = wp_insert_post($preview_post));
        itro_update_option('preview_id', $preview_id);
    }
}
Пример #4
0
function itro_update_db()
{
    global $wpdb;
    if (get_option('itro_prev_ver') <= 3.68) {
        itro_update_option('popup_border_width', 3);
        itro_update_option('popup_border_radius', 8);
    }
    if (get_option('itro_prev_ver') <= 4.6 && $wpdb->prefix != 'wp_') {
        $wpdb->query("RENAME TABLE wp_itro_plugin_option TO " . $wpdb->prefix . "itro_plugin_option");
        $wpdb->query("RENAME TABLE wp_itro_plugin_field TO " . $wpdb->prefix . "itro_plugin_field");
    }
}
function itro_init()
{
    /* -----load sample popup settings */
    if (get_option("itro_curr_ver") == NULL) {
        /* --------- initialize database */
        itro_db_init();
        itro_update_option('popup_time', 20);
        itro_update_option('popup_delay', 0);
        itro_update_option('cookie_time_exp', 0);
        itro_update_option('popup_background', '#FFFFFF');
        itro_update_option('popup_border_color', '#F7FF00');
        itro_update_option('px_popup_width', 600);
        itro_update_option('px_popup_height', 0);
        itro_update_option('show_countdown', 'yes');
        itro_update_option('auto_margin_check', 'yes');
        itro_update_option('select_popup_width', 'px');
        itro_update_option('select_popup_height', 'auto');
        itro_update_option('popup_bg_opacity', 0.4);
        itro_update_option('opaco_bg_color', '#8A8A8A');
        itro_update_option('popup_position', 'fixed');
        itro_update_option('popup_border_width', 3);
        itro_update_option('popup_border_radius', 8);
        itro_update_option('popup_padding', 2);
        itro_update_option('page_selection', 'none');
        switch (get_locale()) {
            case 'en_US':
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p>&nbsp;</p>';
                break;
            case 'it_IT':
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Questo &egrave; un esempio di popup.</span></h1><p style="text-align: center;">&nbsp;</p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Le impostazioni base per iniziare sono: Altezza popup, Tempo popup, Prossima visualizzazione, Colore bordo, Colore sfondo.</span></p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Scrivi qualunque cosa vuoi nell&#39;editor di testo di wordpress e buon lavoro!</span></p><p style="text-align: center;">&nbsp;</p>';
                break;
            default:
                $welcome_text = '<h1 style="text-align: center;"><span style="color: #000000; font-size: 20;">Hello, this is a pop-up sample.</span></h1><p style="text-align: center;"><span style="color: #000000; font-size: 20;">The basic stetting to get started are: Popup height, Popup time, Next visualization, Popup border color, Popup background.</span></p><p style="text-align: center;"><span style="color: #000000; font-size: 20;">Write watever you want in the Custom text editor and enjoy our plugin!</span></p><p>&nbsp;</p>';
        }
        itro_update_field('custom_html', $welcome_text);
        itro_update_option('sample_popup', 'done');
    }
}
Пример #6
0
function itro_get_woo_shop_id()
{
    itro_update_option('woo_shop_id', get_the_id());
}
function itro_style()
{
    // check if user inputs no-sense values
    if (itro_get_option('select_popup_height') == 'px' && itro_get_option('px_popup_height') == 0 || itro_get_option('select_popup_height') == 'perc' && itro_get_option('perc_popup_height') == 0) {
        itro_update_option('select_popup_height', 'auto');
    }
    if (itro_get_option('select_popup_width') == 'px' && itro_get_option('px_popup_width') == 0) {
        itro_update_option('px_popup_width', '600');
    }
    if (itro_get_option('select_popup_width') == 'perc' && itro_get_option('perc_popup_width') == 0) {
        itro_update_option('perc_popup_width', '60');
    }
    ?>
	<style>
		/* POP-UP */
		#age_button_area
		{
			padding-top:10px;
			position: relative;
			width: 100%;
			bottom: 5px;
			padding-top:5px;
		}
		
		#ageEnterButton
		{
			border-color:<?php 
    echo itro_get_option('enter_button_border_color');
    ?>
;
			background:<?php 
    echo itro_get_option('enter_button_bg_color');
    ?>
;
			color: <?php 
    echo itro_get_option('enter_button_font_color');
    ?>
;
		}

		#ageLeaveButton
		{
			border-color:<?php 
    echo itro_get_option('leave_button_border_color');
    ?>
;
			background:<?php 
    echo itro_get_option('leave_button_bg_color');
    ?>
;
			color: <?php 
    echo itro_get_option('leave_button_font_color');
    ?>
;
		}
		
		#popup_content
		{
			<?php 
    if (itro_get_option('select_popup_height') == 'px' || itro_get_option('select_popup_height') == '%') {
        echo 'overflow-y:auto;';
    } else {
        echo 'overflow-y:hidden;';
    }
    ?>
			overflow-x: auto;
			height: 100%;
			width:100%;
		}
		
		#itro_popup
		{
			visibility: hidden;
			opacity: 0;
			position: <?php 
    echo itro_get_option('popup_position');
    ?>
;
			background-image: <?php 
    if (itro_get_option('background_select') != NULL) {
        echo 'url("' . itro_get_option('background_source') . '");';
    }
    ?>
			background-repeat: no-repeat;
			background-position: center center;
			margin: 0 auto;
			left:1px;
			right:1px;
			z-index: 2147483647 !important;
			<?php 
    if (itro_get_option('popup_padding') != NULL) {
        echo 'padding:' . itro_get_option('popup_padding') . 'px !important;';
    }
    ?>
			<?php 
    if (itro_get_option('auto_margin_check') == NULL) {
        if (itro_get_option('popup_top_margin') != NULL) {
            echo 'top:' . itro_get_option('popup_top_margin') . 'px;';
        } else {
            echo 'top: 0px;';
        }
    }
    if (itro_get_option('popup_border_color') != NULL) {
        echo 'border: solid;';
        echo 'border-color:' . itro_get_option('popup_border_color') . ';';
    }
    ?>
			border-radius: <?php 
    echo itro_get_option('popup_border_radius');
    ?>
px;
			border-width: <?php 
    echo itro_get_option('popup_border_width');
    ?>
px;
			width: <?php 
    if (itro_get_option('select_popup_width') == 'px') {
        echo itro_get_option('px_popup_width') . 'px';
    }
    if (itro_get_option('select_popup_width') == 'perc') {
        echo itro_get_option('perc_popup_width') . '%';
    }
    ?>
;
			height: <?php 
    switch (itro_get_option('select_popup_height')) {
        case 'px':
            echo itro_get_option('px_popup_height') . 'px';
            break;
        case 'perc':
            echo itro_get_option('perc_popup_height') . '%';
            break;
        case 'auto':
            echo 'auto';
            break;
        default:
            echo 'auto';
    }
    ?>
;
			background-color: <?php 
    echo itro_get_option('popup_background');
    ?>
;
			<?php 
    if (itro_get_option('show_countdown') != NULL) {
        echo 'padding-bottom: 15px;';
    }
    ?>
		}
		
		#close_cross
		{
			cursor:pointer; 
			width:20px; 
			position:absolute; 
			top:-22px; 
			right:-22px;
		}

		#popup_countdown 
		{
			color: <?php 
    echo itro_get_option('count_font_color');
    ?>
;
			width: 100%;
			padding-top: <?php 
    if (itro_get_option('show_countdown') != 'yes') {
        echo '0px';
    } else {
        echo '1px';
    }
    ?>
 ;
			padding-bottom:<?php 
    if (itro_get_option('show_countdown') != 'yes') {
        echo '0px';
    } else {
        echo '1px';
    }
    ?>
 ;
			background-color: <?php 
    echo itro_get_option('popup_border_color');
    ?>
;
			height: <?php 
    if (itro_get_option('show_countdown') != 'yes') {
        echo '0px';
    }
    ?>
 ;
			overflow: hidden;
			position:absolute;
			bottom:0px;
			left:0px;
			border-bottom-left:<?php 
    echo itro_get_option('popup_border_radius');
    ?>
px;
			border-bottom-right:<?php 
    echo itro_get_option('popup_border_radius');
    ?>
px;
		}

		#itro_opaco{
			display: none;
			position:fixed;
			background-color:  <?php 
    echo itro_get_option('opaco_bg_color');
    ?>
;
			font-size: 10px;
			font-family: Verdana;
			top: 100px;    
			width: 100%;
			height: 100%;
			z-index: 2147483646 !important;
			left: 0px ;
			right: 0px;
			top: 0px;
			bottom: 0px;
			opacity: <?php 
    echo itro_get_option('popup_bg_opacity');
    ?>
 ;
			filter:alpha(opacity = <?php 
    echo itro_get_option('popup_bg_opacity') * 100;
    ?>
); /* For IE8 and earlier */
		}
		
		/* label under the popup used to close it for mobile devices */
		#ipp_mobile_close_tab{
			display: none;
			border:none;
			position: absolute;
			padding: 5px;
			width: 80px;
			text-align: center;
			left: 1px;
			right: 1px;
			margin: auto;
			background-color: <?php 
    echo itro_get_option('popup_border_color') != NULL ? itro_get_option('popup_border_color') : 'white';
    ?>
		}
		#ipp_mobile_close_txt{
			font-weight: bold;
			cursor: pointer;
		}
		
		/* RESPONSIVE CSS */
		@media screen and (max-width: 780px)
		{
			#itro_popup{
				max-width: 470px;
				<?php 
    if (itro_get_option('absolute_mobile_pos') == 'yes') {
        echo "position: absolute; top: 50px";
    }
    ?>
			}
			#close_cross{
				display: none;
			}
			#ipp_mobile_close_tab{
				display: block;
			}
		}
		@media screen and (max-width: 480px){
			#itro_popup{
				max-width: 300px
			}
		}
			
		<?php 
    if (itro_get_option('disable_mobile') == 'yes') {
        echo '
			@media screen and (max-width: 1024px)
			{
				#itro_popup{display: none !important;}
				#itro_opaco{display: none !important;}
			}';
    }
    ?>
	</style>
<?php 
}