Exemplo n.º 1
0
 function __construct($module, $version, $module_id = null)
 {
     $this->module = $module;
     $this->version = $version;
     $this->module_id = $module_id;
     $this->prefix = 'newsletter_' . $module;
     $this->logger = new NewsletterLogger($module);
     $this->options = $this->get_options();
     $this->store = NewsletterStore::singleton();
     //$this->logger->debug($module . ' constructed');
     // Version check
     if (is_admin()) {
         $old_version = get_option($this->prefix . '_version', '');
         if (strcmp($old_version, $this->version) != 0) {
             $this->logger->info('Version changed from ' . $old_version . ' to ' . $this->version);
             // Do all the stuff for this version change
             $this->upgrade();
             update_option($this->prefix . '_version', $this->version);
         }
         add_action('admin_menu', array($this, 'admin_menu'));
         $this->available_version = get_option($this->prefix . '_available_version');
     }
     //        if (!empty($this->module_id)) {
     //            add_action($this->prefix . '_version_check', array($this, 'hook_version_check'), 1);
     //        }
 }