true, ); protected $height_select_options = array('auto'=>'auto', '60'=>'60', '80'=>'80', '100'=>'100', '120'=>'120', '140'=>'140', '160'=>'160', '180'=>'180', '200'=>'200', '220'=>'220', '240'=>'240', '260'=>'260', '280'=>'280', '300'=>'300', '350'=>'350', '400'=>'400', '450'=>'450', '500'=>'500', '550'=>'550', '600'=>'600', '650'=>'650', '700'=>'700', '100%' => '100%'); // popup width protected $width_options = array ( 0 => true, ); protected $width_select_options = array('60'=>'60', '80'=>'80', '100'=>'100', '120'=>'120', '140'=>'140', '160'=>'160', '180'=>'180', '200'=>'200', '220'=>'220', '240'=>'240', '260'=>'260', '280'=>'280', '300'=>'300', '350'=>'350', '400'=>'400', '450'=>'450', '500'=>'500', '550'=>'550', '600'=>'600', '650'=>'650', '700'=>'700', '100%' => '100%'); protected $trigger_options = array( 'scroll' => 'Scroll and/or Time delay', 'element' => 'Scroll to Element', 'click' => 'Click on Element', 'mouseover' => 'Mouse over Element', ); protected $delaytime_options = array( '0' => '0 sec', '1000' => '1 sec', '3000' => '3 sec', '5000' => '5 sec', '10000' => '10 sec', '20000' => '20 sec', '40000' => '40 sec', '60000' => '1 minute', '120000'=> '2 minutes', '180000'=> '3 minutes', ); protected $scroll_options = array( '0' => '0 %', '10' => '10 %', '20' => '20 %', '30' => '30 %', '40' => '40 %', '50' => '50 %', '60' => '60 %', '70' => '70 %', '80' => '80 %', '90' => '90 %', '99' => '100 %', ); protected $clicks_options = array( '1' => '1 click', '2' => '2 clicks', '3' => '3 clicks', '5' => '5 clicks', '8' => '8 clicks', '10' => '10 clicks', '15' => '15 clicks', '20' => '20 clicks', '42' => '42 clicks', ); // how long popup is visible, msec protected $delay_auto_close_options = array( '0' => 'No auto close', '3' => '3 sec', '5' => '5 sec', '8' => '8 sec', '10' => '10 sec', '20' => '20 sec', '40' => '40 sec', '60' => '1 minute', '120'=> '2 minutes', '180'=> '3 minutes', ); // Vertical positioning options protected $vpos_options = array( 'top' => 'top', 'center' => 'center', 'bottom' => 'bottom', ); // Horisontal positioning options protected $hpos_options = array( 'left' => 'left', 'center' => 'center', 'right' => 'right', ); // div transition effects protected $trans_options = array( 'none' => 'None', 'fade' => 'Fade in/out', ); // div slide direction options protected $from_options = array( 'n' => 'None', 't' => 'from Top', 'b' => 'from Bottom', 'l' => 'from Left', 'r' => 'from Right', ); // div transition speed, msec protected $speed_options = array( '0' => 'None', '100' => 'ultra-fast (100ms)', '200' => 'fast (200ms)', '400' => 'medium (400ms)', '600' => 'slow (600ms)', '1000' => 'ultra-slow (1 s)', ); protected $bgcolor_options = array( 0 => true, // all input is good ); protected $bordercolor_options = array( 0 => true, // all input is good ); protected $bgimage_options = array( 0 => true, // all input is good ); protected $closeimage_options = array( 0 => true, // all input is good ); protected $blur_options = array( '0'=>'None', '1' => '1 px', '2' => '2 px', '3' => '3 px', '4' => '4 px', '5' => '5 px' ); protected $opacity_options = array( '0' => 'None', '0.1' => '10 %', '0.2' => '20 %', '0.3' => '30 %', '0.4' => '40 %', '0.5' => '50 %', '0.6' => '60 %', '0.7' => '70 %', '0.8' => '80 %', '0.9' => '90 %', '1' => '100%' ); protected $padding_options = array( '0' => '0px', '1' => '1px', '2' => '2px', '3' => '3px', '4' => '4px', '5' => '5px', '6' => '6px', '7' => '7px', '8' => '8px', '9' => '9px', '10' => '10px', '12' => '12px', '14' => '14px', '16' => '16px', '18' => '18px', '20' => '20px', '25'=>'25px', '30'=>'30px', '35'=>'35px', '40'=>'40px', '45'=>'45px', '50'=>'50px'); protected $margin_options = array( '0' => '0px', '1' => '1px', '2' => '2px', '3' => '3px', '4' => '4px', '5' => '5px', '6' => '6px', '7' => '7px', '8' => '8px', '9' => '9px', '10' => '10px', '12' => '12px', '14' => '14px', '16' => '16px', '18' => '18px', '20' => '20px', '25'=>'25px', '30'=>'30px', '35'=>'35px', '40'=>'40px', '45'=>'45px', '50'=>'50px'); protected $borderwidth_options = array( '0px' => '0px', '1px' => '1px', '2px' => '2px', '3px' => '3px', '4px' => '4px', '5px' => '5px', '6px' => '6px', '7px' => '7px', '8px' => '8px', '9px' => '9px', '10px' => '10px', '12px' => '12px', '14px' => '14px', '16px' => '16px', '18px' => '18px', '20px' => '20px', '25px'=>'25px', '30px'=>'30px', '35px'=>'35px', '40px'=>'40px', '45px'=>'45px', '50px'=>'50px'); protected $borderradius_options = array( '0px' => '0px', '1px' => '1px', '2px' => '2px', '3px' => '3px', '4px' => '4px', '5px' => '5px', '6px' => '6px', '7px' => '7px', '8px' => '8px', '9px' => '9px', '10px' => '10px', '12px' => '12px', '14px' => '14px', '16px' => '16px', '18px' => '18px', '20px' => '20px', '25px'=>'25px', '30px'=>'30px', '35px'=>'35px', '40px'=>'40px', '45px'=>'45px', '50px'=>'50px'); protected $shadow_options = array( '0px' => '0px', '1px' => '1px', '2px' => '2px', '3px' => '3px', '4px' => '4px', '5px' => '5px', '6px' => '6px', '7px' => '7px', '8px' => '8px', '9px' => '9px', '10px' => '10px', '12px' => '12px', '14px' => '14px', '16px' => '16px', '18px' => '18px', '20px' => '20px', '25px'=>'25px', '30px'=>'30px', '35px'=>'35px', '40px'=>'40px', '45px'=>'45px', '50px'=>'50px'); protected $submit_auto_close_values = array ('0' => 'no auto close', '0.1'=>'immediately', '1'=>'1 second', '2'=>'2 seconds', '3'=>'3 seconds', '5'=>'5 seconds', '10'=>'10 seconds', '20'=>'20 seconds', '60'=>'1 minute', ); protected static $cookie_options=array( '-1' =>'Each time', '0' => 'Once per session', '1' => 'Once per 24 hours', '7' => 'Once per week', '30'=> 'Once per month', '92'=> 'Once per 3 months', '183'=>'Once per 6 months', '365'=>'Once per year', ); protected $facebook_options=array( '' => 'Inactive', 'standard'=> 'Button', 'button_count'=>'Button Count', 'box_count'=>'Box', ); protected $twitter_options=array( ''=>'Inactive', 'no-count'=>'Button', 'regular'=>'Button Count', 'vertical'=>'Box' ); protected $google_options=array( ''=>'Inactive', 'annotation'=>'Button', 'medium'=>'Button Count', 'tall'=>'Box', ); protected $linkedin_options=array( ''=>'Inactive', 'none'=>'Button', 'right'=>'Button Count', 'top'=>'Box', ); protected $stumbleupon_options=array( ''=>'Inactive', '1'=>'Button', '4'=>'Button Count', '5'=>'Box', ); protected $pinterest_options=array( ''=>'Inactive', 'none'=>'Button', 'horizontal'=>'Button Count', 'vertical'=>'Box', ); protected $active_pages=array(); protected $active_pages_options=array(); protected $active_categories=array(); protected $active_categories_options=array(); protected $active_tags=array(); protected $active_tags_options=array(); protected $available_options = array('active_pages', 'active_categories', 'active_tags', 'height', 'width', 'padding', 'margin', 'trigger', 'delaytime', 'scroll', 'clicks', 'showtime', 'vpos', 'hpos', 'trans', 'speed', 'dir', 'bgcolor', 'bgimage', 'bordercolor', 'borderwidth', 'borderradius', 'shadow', 'cookie', 'closeimage',); public function __construct() { // register_activation_hook(__FILE__, array($this, 'install') ); // register_deactivation_hook(__FILE__, array($this, 'uninstall') ); // wp_register_script( 'dgd-scrollbox-plugin-admin', plugins_url('js/admin.js', __FILE__ ), array('jquery','media-upload'), DGDSCROLLBOX_VERSION, true ); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_style_n_script') ); add_action('admin_init', array($this, 'dgd_scrollbox_editor') ); add_action('save_post', array($this, 'save_dgd_scrollbox_fields'), 10, 2 ); add_filter('default_content', array($this, 'dgd_scrollbox_default'), 10, 2); add_action('admin_menu', array($this, 'register_general_settings_page')); add_action('parse_request', array($this, 'control_requests') ); add_filter('tiny_mce_before_init', array($this, 'tiny_mce_fix')); add_filter('admin_footer', array($this, 'display_dgd_scrollbox_preview')); // add_filter('admin_footer', array($this, 'display_donate_box')); // add_action( 'admin_notices', array($this, 'migrate_from_old_version')); } function tiny_mce_fix( $init ) { global $post; // assuming that scrollbox will not contain html copy-pasted from Word etc. // $valid_elements = 'div[!id|!name|!class|!style],p[!id|!name|!class|!style],span[!id|!name|!class|!style]'; $valid_elements = 'div[!id|!name|!class|!style],span[!id|!name|!class|!style]'; if($post->post_type == DGDSCROLLBOXTYPE) { if(isset($init['extended_valid_elements'])) { $init['extended_valid_elements'] .= ','.$valid_elements; } else { $init['extended_valid_elements'] = $valid_elements; } } return $init; } function dgd_scrollbox_default($content, $post) { if($post->post_type == DGDSCROLLBOXTYPE) { $content = DgdScrollboxHelper::sampleHtml(); } return $content; } public function enqueue_admin_style_n_script( $hook_suffix ) { global $wp_version; // first check that $hook_suffix is appropriate for your admin page // http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/ // Init $DGD variable for preview $data = array( 'ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('dgd_stb_nonce'), 'debug' => '1', 'permalink' => get_home_url(), 'title' => 'Dreamgrow Scroll Triggered Box Preview', 'thumbnail' => '', 'scripthost' => plugins_url('/', __FILE__), ); $meta=DgdScrollboxHelper::$dgd_stb_meta_default; $meta['id']='dgd_scrollbox-preview'; $meta['voff']=0; $meta['hoff']=0; if(version_compare($wp_version, '3.3', '>=')) { // WP=3.3 or newer $data['scrollboxes']= array($meta); } else { // WP<3.3 does not support multi-dimensional arrays in wp_localize_script // so we add $DGD.scrollboxes separately, without wp_localize_script encoding help $data['l10n_print_after'] = '$DGD.scrollboxes = ' . json_encode( array($meta) ) . ';'; } wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'dgd-scrollbox-plugin', plugins_url( 'css/adminstyle.css', __FILE__ ), array(), DGDSCROLLBOX_VERSION ); wp_enqueue_style( 'dgd-scrollbox-plugin-core', plugins_url( 'css/style.css', __FILE__ ), array(), DGDSCROLLBOX_VERSION ); wp_register_script( 'dgd-scrollbox-plugin-admin', plugins_url('js/admin.js', __FILE__ ), array('jquery'), DGDSCROLLBOX_VERSION, true ); wp_register_script( 'dgd-scrollbox-plugin', plugins_url( 'js/script.js', __FILE__ ), array('jquery'), DGDSCROLLBOX_VERSION, false ); wp_register_script( 'dgd-scrollbox-plugin-preview', plugins_url('js/preview.js', __FILE__ ), array('jquery', 'dgd-scrollbox-plugin'), DGDSCROLLBOX_VERSION, true ); wp_enqueue_script('wp-color-picker' ); wp_enqueue_script( 'dgd-scrollbox-plugin-admin' ); wp_enqueue_script( 'dgd-scrollbox-plugin-preview' ); wp_localize_script('dgd-scrollbox-plugin', '$DGD', $data); } function dgd_scrollbox_editor() { add_meta_box( 'dgd_scrollbox_meta_box', // meta box section html id 'Pop-up details and customization', // meta box title array($this, 'display_dgd_scrollbox_meta_box'), // meta box editor html function DGDSCROLLBOXTYPE, // post_type 'normal', // where to display (normal|advanced|side) 'high' // priority among other boxes (high|core|default|low) ); add_meta_box( 'dgd_donate_box', // meta box section html id 'Donate $10, $20 or $50', // meta box title array($this, 'display_donate_box'), // meta box editor html function DGDSCROLLBOXTYPE, // post_type 'side', // where to display (normal|advanced|side) 'default' // priority among other boxes (high|core|default|low) ); /* add_meta_box( 'dgd_preview_box', // meta box section html id 'Preview', // meta box title array($this, 'display_dgd_scrollbox_preview'), // meta box editor html function DGDSCROLLBOXTYPE, // post_type 'advanced', // where to display (normal|advanced|side) 'low' // priority among other boxes (high|core|default|low) ); */ } function register_general_settings_page() { // add_submenu_page( 'edit.php?post_type='.DGDSCROLLBOXTYPE, 'General settings', 'General settings', 'edit_plugins', 'dgd_scrollbox_general_settings', array($this, 'general_settings') ); // add_submenu_page( 'edit.php?post_type='.DGDSCROLLBOXTYPE, 'Debug', 'Debug', 'edit_plugins', 'dgd_scrollbox_debug', array($this, 'debug_page') ); } function general_settings() { $version=get_option('stb_version'); if(isset($version) && $version) { echo '
You have version '.$version.'
'; } $feedback=''; if(isset($_GET['action'])) { $action=$_GET['action']; switch($action) { case 'migrate': $this->migrate_from_old_version(false); break; case 'force_migrate': $feedback=$this->migrate_from_old_version(true); break; case 'undo_migration': $this->clear_migration_flag(); break; case 'show_stb_options': $old_meta=get_option('stb_settings', $defaults_old); echo ''; var_dump($old_meta); var_dump($version); echo '
'; break; } echo $feedback; } ?>---
'; } function display_donate_box() { ?>If you like Dreamgrow Scroll Triggered Box. Please help to keep it alive by donating. Every cent counts!
Link to the plugin's home page from your blog: http://www.dreamgrow.com/dreamgrow-scroll-triggered-box/
Spread the word on Twitter or Facebook
ID, 'dgd_stb', true ); $dgd_stb_show=get_post_meta( $post->ID, 'dgd_stb_show', true ); $dgd_stb_hide=get_post_meta( $post->ID, 'dgd_stb_hide', true ); if(!$dgd_stb) { $dgd_stb=DgdScrollboxHelper::$dgd_stb_meta_default; } if(!$dgd_stb_show){ $dgd_stb_show=DgdScrollboxHelper::$dgd_stb_show_meta_default; } if($dgd_stb['receiver_email']===false) $dgd_stb['receiver_email']= get_option('admin_email'); /* Re-define some variables for old version scrollboxes */ if(!isset($dgd_stb['thankyou'])) $dgd_stb['thankyou']=DgdScrollboxHelper::$dgd_stb_meta_default['thankyou']; if(!isset($dgd_stb['tabhtml'])) $dgd_stb['tabhtml']=DgdScrollboxHelper::$dgd_stb_meta_default['tabhtml']; if(!isset($dgd_stb['submit_auto_close'])) $dgd_stb['submit_auto_close'] = 5; if(!isset($dgd_stb['delay_auto_close'])) $dgd_stb['delay_auto_close'] = 0; if(!array_key_exists($dgd_stb['height'], $this->height_select_options)) { $this->height_select_options[$dgd_stb['height']]=$dgd_stb['height']; ksort($this->height_select_options); } if(!array_key_exists($dgd_stb['width'], $this->width_select_options)) { $this->width_select_options[$dgd_stb['width']]=$dgd_stb['width']; ksort($this->width_select_options); } // var_dump($dgd_stb_show); ?>| Send submitted values to email | (Leave email field empty if you want to use form from third party plugin) |
| "Thank you" message |
(this field accepts html) (Please note, that you can change it for each translation separately)';} ?> |
| Close box automatically after "Thank You" message is shown for | |
| Close permanently |
| Hide box automatically after it has been visible for | |
| Keep open |
| Lightbox | |
| Overlay color | |
| Overlay opacity | |
| Page content blur |
| Theme | |
| Widget | |
| Popup box dimensions (px) |
Height:
Width:
Padding:
Margin:
(When using background image, box size will default to image size.) |
| Popup style | Back color Box shadow |
| Border | Color Width Corner radius |
| Background Image | |
| Close button Image | |
| Slide in direction | |
| Additional effect | |
| Transition duration |
| Show tab | |
| "Tab" text |
(this field accepts html) |
|
* Pin it button will only be displayed on the pages that have a featured image. |
'; $socialHTML=''; $meta=DgdScrollboxHelper::$dgd_stb_meta_default; $meta_show=DgdScrollboxHelper::$dgd_stb_show_meta_default; $meta['migrated']='1.4'; if(!$old_meta['cookie_life']) { $meta['cookieLifetime']='-1'; } else if ($old_meta['cookie_life']>365) { $meta['cookieLifetime']='365'; } else { // find nearest bigger or equal option foreach(DgdScrollboxAdmin::$cookie_options as $days=>$label) { if($old_meta['cookie_life']<=(int) $days) { $meta['cookieLifetime']=$days; break 1; } } } $meta['trigger']['scroll']=round($old_meta['trigger_height'], -1); $meta['trigger']['element']=$old_meta['trigger_element']; $meta['width']=$old_meta['width']; $meta['hpos']=($old_meta['position']=='middle' ? 'center' : $old_meta['position'] ); $meta['include_css']=$old_meta['include_css']; $meta['hide_mobile']=$old_meta['hide_mobile']; // BUG: implement $meta_show['admin_only']=$old_meta['show_admin']; foreach($old_meta['show'] as $post_type=>$on) { $meta_show['post_types'][$post_type]=1; } $meta['theme']=$old_meta['theme']; $meta['social']=$old_meta['social']; $meta['receiver_email']=$old_meta['receiver_email']; if(isset($old_meta['include_css'])) { $meta['theme']=$old_meta['theme']; switch($meta['theme']){ case 'default': $meta['jsCss']['backgroundColor']='#ffe14f'; $meta['jsCss']['borderWidth']='3'; $meta['jsCss']['borderColor']='#ffffff'; $meta['jsCss']['margin']='10'; break; } } else { $meta['theme']=''; $meta['migrated_no_css']=1; } $html=get_option('stb_html'); $translations=array(); $wpml_default_language=DgdScrollboxHelper::get_default_language(); $default_language_post_id=false; $migration_success=false; foreach($html as $lan=>$content) { // if no mutlilanguage, then $lan='0' if(isset($old_meta['include_css'])) { // do only if includecss true // replace id with css, because id's will become into conflict $content=str_replace(array('id="stbMsgArea"', 'id=\'stbMsgArea\'', 'id=stbMsgArea'), 'class="stbMsgArea"', $content); $content=str_replace(array('id="email"', "id='email'"), 'class="email"', $content); $content=str_replace(array('id="stbContactForm"', 'id=\'stbContactForm\'', 'id=stbContactForm'), 'class="stbContactForm"', $content); $content='