dg_tw_activation

Plugin activation hook set basic options if not set already, and start cronjobs if necessary.

Description

dg_tw_activation(); 

Usage

  1. if ( !function_exists( 'dg_tw_activation' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'twitter-posts-to-blog/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = dg_tw_activation(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function dg_tw_activation() { 
  2. global $dg_tw_queryes, $dg_tw_time, $dg_tw_publish, $dg_tw_tags, $dg_tw_cats, $dg_tw_ft; 
  3.  
  4. $dg_tw_queryes = get_option('dg_tw_queryes'); 
  5. $dg_tw_time = get_option('dg_tw_time'); 
  6. $dg_tw_publish = (string) get_option('dg_tw_publish'); 
  7. $dg_tw_tags = (string) get_option('dg_tw_tags'); 
  8. $dg_tw_cats = get_option('dg_tw_cats'); 
  9. $dg_tw_ft = get_option('dg_tw_ft'); 
  10.  
  11. if(!$dg_tw_publish) { 
  12. update_option('dg_tw_publish', 'draft'); 
  13.  
  14. if(!$dg_tw_time) { 
  15. update_option('dg_tw_time', array('run'=>'never')); 
  16.  
  17. if(!$dg_tw_ft) { 
  18. update_option('dg_tw_ft', array( 
  19. 'ui'=>true,  
  20. 'text'=>true,  
  21. 'img_size'=>'bigger',  
  22. 'method'=>'multiple',  
  23. 'ipp'=>25,  
  24. 'author'=>0,  
  25. 'title_format'=>'Tweet from %tweet%',  
  26. 'privileges'=>'activate_plugins',  
  27. 'badwords'=>'',  
  28. 'maxtitle'=>'60')); 
  29.  
  30. if ( !wp_next_scheduled( 'dg_tw_event_start' ) && $dg_tw_time && $dg_tw_time['run'] != "never") { 
  31. $recurrences = wp_get_schedules(); 
  32. wp_schedule_event( time()+$recurrences[$dg_tw_time['run']]['interval'], $dg_tw_time['run'], 'dg_tw_event_start');