Beispiel #1
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);
    }
}
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');
    }
}
for($i=0;$i<count($field_name); $i++)
{
	/* Read in existing option value from database */
	
	$field_value[$i] = itro_get_field( $field_name[$i] );

	/* See if the user has posted us some information */
	/* If they did, this hidden field will be set to 'Y' */
	if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y' ) 
	{
		/* Read their posted value */
		if(isset($_POST[$field_name[$i]])) {$field_value[$i] = $_POST[ $field_name[$i] ]; }
		else{$field_value[$i] = NULL;}
		
		/* Save the posted value in the database */
		itro_update_field( $field_name[$i], $field_value[$i] );
	}
}

/* unsorted option and field */
if( isset($_POST[ $submitted_form ]) && $_POST[ $submitted_form ] == 'Y')
{
	if( isset($_POST['selected_page_id']) ) 
	{
		$selected_page_id=json_encode($_POST['selected_page_id']);
		itro_update_option('selected_page_id',$selected_page_id);
	}
	else
	{
		itro_update_option('selected_page_id',NULL);
	}
        $px_opt_val[$i] = itro_get_option('px_' . $opt_name[$i]);
        $perc_opt_val[$i] = itro_get_option('perc_' . $opt_name[$i]);
    }
}
/* unsorted option and field */
if (isset($_POST[$submitted_form]) && $_POST[$submitted_form] == 'Y') {
    //wp token check
    check_admin_referer('ipp_save_data', 'ipp_sec_nonce_fld');
    //WP Editor content
    if (isset($_POST['custom_html'])) {
        $field_value = ipp_validate_data('custom_html', $_POST['custom_html']);
    } else {
        $field_value = NULL;
    }
    /* Save the posted value in the database */
    itro_update_field('custom_html', $field_value);
    if (isset($_POST['selected_page_id'])) {
        $selected_page_id = json_encode($_POST['selected_page_id']);
        itro_update_option('selected_page_id', $selected_page_id);
    } else {
        itro_update_option('selected_page_id', NULL);
    }
    if (!empty($_POST['background_source'])) {
        itro_update_option('background_source', $_POST['background_source']);
    }
} else {
    //WP Editor Content
    $field_value = stripslashes(itro_get_field('custom_html'));
}
/* delete tables on plugin uninstall option */
if (isset($_POST['delete_data_hidden']) && $_POST['delete_data_hidden'] == 'Y') {