/**
     * @since 1.0.0
     * 
     * @return void
     */
    protected function _delete_old_items()
    {
        global $wpdb;
        $logs_lifespan = absint(AAL_Main::instance()->settings->get_option('logs_lifespan'));
        if (empty($logs_lifespan)) {
            return;
        }
        $wpdb->query($wpdb->prepare('DELETE FROM `%1$s`
					WHERE `hist_time` < %2$d', $wpdb->activity_log, strtotime('-' . $logs_lifespan . ' days', current_time('timestamp'))));
    }
 /**
  * Returns the active handlers that were activated through the settings page
  * 
  * @return array
  */
 public function get_enabled_handlers()
 {
     $enabled = array();
     $options = AAL_Main::instance()->settings->get_options();
     foreach ($this->get_available_handlers() as $id => $handler_obj) {
         // make sure handler is active
         if (isset($options['notification_handlers'][$id]) && 1 == $options['notification_handlers'][$id]) {
             $enabled[$id] = $handler_obj;
         }
     }
     return $enabled;
 }
 private static function _set_name_and_value(&$args)
 {
     if (!isset($args['name'])) {
         $args['name'] = sprintf('%s[%s]', esc_attr($args['page']), esc_attr($args['id']));
     }
     if (!isset($args['value'])) {
         $args['value'] = AAL_Main::instance()->settings->get_option($args['id']);
     }
 }
 public function add_settings_field_helper($option_name, $title, $callback, $description = '', $default_value = '')
 {
     $settings_page_slug = AAL_Main::instance()->settings->slug();
     $handler_options = isset($this->aal_options["handler_options_{$this->id}"]) ? $this->aal_options["handler_options_{$this->id}"] : array();
     add_settings_field("notification_handler_{$this->id}_{$option_name}", $title, $callback, $settings_page_slug, "notification_{$this->id}", array('name' => $this->settings_field_name_attr($option_name), 'value' => isset($handler_options[$option_name]) ? $handler_options[$option_name] : $default_value, 'desc' => $description, 'id' => $option_name, 'page' => $settings_page_slug));
 }
     * @return void
     */
    public function __clone()
    {
        // Cloning instances of the class is forbidden
        _doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'aryo-aal'), '2.0.7');
    }
    /**
     * Disable unserializing of the class
     *
     * @since 2.0.7
     * @return void
     */
    public function __wakeup()
    {
        // Unserializing instances of the class is forbidden
        _doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'aryo-aal'), '2.0.7');
    }
    /**
     * @return AAL_Main
     */
    public static function instance()
    {
        if (is_null(self::$_instance)) {
            self::$_instance = new AAL_Main();
        }
        return self::$_instance;
    }
}
AAL_Main::instance();
// EOF
 public function test_getinstance()
 {
     $this->assertInstanceOf('AAL_Main', AAL_Main::instance());
 }