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; } ?>

General actions

Migrate again from old plugin
Show old plugin options
Clear migration flag
get_active_languages() as $code=>$name) { echo $code.': '.$name['english_name']."
\n"; } } } else { echo 'WPML not installed'; } */ echo '

WPML state and active languages

'; if(function_exists('icl_get_languages')){ $languages = icl_get_languages(); echo '

Active languages

'; foreach($languages as $code=>$langarray) { echo $code.': '.$langarray['id'].' '. $langarray['language_code'].' '. $langarray['native_name'].' '. $langarray['translated_name']."
\n"; } echo '

Are translations enabled

'; $sitepress_settings=get_option('icl_sitepress_settings'); if(isset($sitepress_settings['custom_posts_sync_option'][DGDSCROLLBOXTYPE]) && $sitepress_settings['custom_posts_sync_option'][DGDSCROLLBOXTYPE]) { echo "Scrollboxes translation enabled
\n"; } else { // put wpml-config.xml to plugin root and it will be not configurable any more // $sitepress->save_settings(array('custom_posts_sync_option'=>array(DGDSCROLLBOXTYPE=>1)) ); // echo "Scrollboxes translation re-enabled
\n"; } } else { echo 'WPML not installed
'; } if(isset($_GET['action'])) { echo 'action:'.$_GET['action']."
\n"; } echo '

---

'; } function display_donate_box() { ?>

If you like Dreamgrow Scroll Triggered Box. Please help to keep it alive by donating. Every cent counts!

PayPal - The safer, easier way to pay online!

Leava a raving review *****

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); ?>

Where and how to trigger?

Triggering action Scroll: Additional time delay: Element:
Placement on screen
Popup frequency
Hide on mobiles
Show
On all following:



stb_get_post_types($dgd_stb_show); ?>

Exceptions:
  • Include
  • Exclude
Pages:
Categories:
Tags:
Pages:
Categories:
Tags:

Actions after form submission

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

Auto close

Hide box automatically after it has been visible for
Keep open

Lightbox

Lightbox
Overlay color
Overlay opacity
Page content blur

Scrollbox design

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

Permanent tab

Show tab
"Tab" text
(this field accepts html)

Social buttons




* Pin it button will only be displayed on the pages that have a featured image.

$label) { $rv.='\n"; } } closedir($handle); $templates.= ''; return $templates; } return false; } function save_dgd_scrollbox_fields( $post_id, $post ) { // Check post type for Dgd Popup if ( $post->post_type == DGDSCROLLBOXTYPE ) { $this->save_options($post_id, false); // Clear cache when saving Scrollbox - otherwise cached pages will show old Scrollbox // Hint from http://scratch99.com/wordpress/development/clearing-cache-when-widget-saved/ // it's experimental, but sometimes worth to try?? /* if (function_exists('w3tc_pgcache_flush')) { // W3 Total Cache @w3tc_pgcache_flush(); } if (function_exists('wp_cache_clean_cache')) { // WP Super Cache @wp_cache_clean_cache( $GLOBALS['file_prefix'] ); } */ } } private function save_options($post_id, $option_name) { if(isset($_POST['dgd_stb']) && is_array($_POST['dgd_stb'])) { update_post_meta( $post_id, 'dgd_stb', $_POST['dgd_stb']); } if(isset($_POST['dgd_stb_show']) && is_array($_POST['dgd_stb_show'])) { update_post_meta( $post_id, 'dgd_stb_show', $_POST['dgd_stb_show']); } else { delete_post_meta( $post_id, 'dgd_stb_show'); } if(isset($_POST['dgd_stb_hide']) && is_array($_POST['dgd_stb_hide'])) { update_post_meta( $post_id, 'dgd_stb_hide', $_POST['dgd_stb_hide']); } else { delete_post_meta( $post_id, 'dgd_stb_hide'); } } public function clear_migration_flag() { $old_meta=get_option('stb_settings'); if($old_meta) { unset($old_meta['migrated']); update_option('stb_settings', $old_meta); } } public static function migrate_from_old_version($force=false) { $old_meta=get_option('stb_settings', DgdScrollboxHelper::$defaults_old); $feedback=''; // var_dump($old_meta); if($force || !isset($old_meta['migrated'])) { $feedback.='

'; $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='

'.$content.'
'; } else { // open door for themes support $content=str_replace(array('id="stbMsgArea"', 'id=\'stbMsgArea\'', 'id=stbMsgArea'), 'id="stbMsgArea" class="stbMsgArea"', $content); $content=str_replace(array('id="email"', "id='email'"), 'id="email" class="email"', $content); $content=str_replace(array('id="stbContactForm"', 'id=\'stbContactForm\'', 'id=stbContactForm'), 'id="stbContactForm" class="stbContactForm"', $content); $content='
x'.$content.'
'; } $args=array( 'post_content'=>$content, 'post_title'=>'Upgraded Box ('.date('d M H:i').')', 'post_status'=>'publish', 'post_type'=>DGDSCROLLBOXTYPE, ); $post_id=wp_insert_post($args, true); if($post_id) { update_post_meta( $post_id, 'dgd_stb', $meta); update_post_meta( $post_id, 'dgd_stb_show', $meta_show); if($lan==$wpml_default_language) { $default_language_post_id=$post_id; } else { $translations[$lan]=$post_id; } $feedback.='New post was migrated from old version, language code: '.$lan."
\n"; $migration_success=true; } } if(!empty($translations) && $default_language_post_id) { foreach($translations as $lan=>$post_id) { $success=DgdScrollboxHelper::translate($post_id, $default_language_post_id, $lan, DGDSCROLLBOXTYPE ); if($success) { $feedback.="Translation for ".$lan." is ".$success."
\n"; } else { $migration_success=false; } } } else { $feedback.='Single language was used'."
\n"; } $feedback.='

'; if($migration_success) { $old_meta['migrated']=1; update_option('stb_settings', $old_meta); } } return $feedback; } public function control_requests($arg) { // fires when request hits edit.php?post_type=dgd_scrollbox // does not fire on edit.php?post_type='.DGDSCROLLBOXTYPE.'&page=dgd_scrollbox_general_settings; // var_dump($_REQUEST); // die(); } public static function install() { $old_version=get_option('stb_version', '1.4'); if(version_compare($old_version, '2.0', '<')) { $old_version_settings=get_option('stb_settings'); if($old_version_settings && !isset($old_version_settings['migrated'])) { DgdScrollboxAdmin::migrate_from_old_version(false); } } if(version_compare($old_version, '2.1', '<')) { // upgrading to 2.1, fill "thankyou" value with default $pop_ups = get_pages( array('post_type'=>DGDSCROLLBOXTYPE, 'post_status' => 'publish')); if(is_array($pop_ups)) { foreach($pop_ups as $pop_up) { $meta=get_post_meta($pop_up->ID, 'dgd_stb', true); if(!isset($meta['thankyou'])) { $meta['thankyou']=DgdScrollboxHelper::$dgd_stb_meta_default['thankyou']; } update_post_meta( $pop_up->ID, 'dgd_stb', $meta); } } } update_option('stb_version', DGDSCROLLBOX_VERSION); } public static function uninstall() { // clean up. delete default options // $pop_ups = get_pages( array('post_type'=>DGDSCROLLBOXTYPE)); // foreach($pop_ups as $pop_up) { // wp_delete_post($pop_up->ID, true); // } } }