roundcubemail/plugins/enigma/enigma.php
function init()
    {
        $this->rc = rcube::get_instance();

        if ($this->rc->task == 'mail') {
            // message parse/display hooks
            $this->add_hook('message_part_structure', array($this, 'part_structure'));
            $this->add_hook('message_part_body', array($this, 'part_body'));
            $this->add_hook('message_body_prefix', array($this, 'status_message'));

            $this->register_action('plugin.enigmaimport', array($this, 'import_file'));
            $this->register_action('plugin.enigmakeys', array($this, 'preferences_ui'));

            // load the Enigma plugin configuration
            $this->load_config();

            $enabled = $this->rc->config->get('enigma_encryption', true);

            // message displaying
            if ($this->rc->action == 'show' || $this->rc->action == 'preview' || $this->rc->action == 'print') {
                $this->add_hook('message_load', array($this, 'message_load'));
                $this->add_hook('template_object_messagebody', array($this, 'message_output'));
            }
            // message composing
            else if ($enabled && $this->rc->action == 'compose') {
                $this->add_hook('message_compose_body', array($this, 'message_compose'));

                $this->load_ui();
                $this->ui->init();
            }
            // message sending (and draft storing)
            else if ($enabled && $this->rc->action == 'send') {
                $this->add_hook('message_ready', array($this, 'message_ready'));
            }

            $this->password_handler();
        }
        else if ($this->rc->task == 'settings') {
            // add hooks for Enigma settings
            $this->add_hook('settings_actions', array($this, 'settings_actions'));
            $this->add_hook('preferences_sections_list', array($this, 'preferences_sections_list'));
            $this->add_hook('preferences_list', array($this, 'preferences_list'));
            $this->add_hook('preferences_save', array($this, 'preferences_save'));

            // register handler for keys/certs management
            $this->register_action('plugin.enigmakeys', array($this, 'preferences_ui'));
//            $this->register_action('plugin.enigmacerts', array($this, 'preferences_ui'));

            $this->load_ui();

            if (empty($_REQUEST['_framed']) || strpos($this->rc->action, 'plugin.enigma') === 0) {
                $this->ui->add_css();
            }

            $this->password_handler();
        }
        else if ($this->rc->task == 'cli') {
            $this->add_hook('user_delete_commit', array($this, 'user_delete'));
        }

        $this->add_hook('refresh', array($this, 'refresh'));
    }
function init()
    {
        $this->rc = rcube::get_instance();

        if ($this->rc->task == 'mail') {
            // message parse/display hooks
            $this->add_hook('message_part_structure', array($this, 'part_structure'));
            $this->add_hook('message_part_body', array($this, 'part_body'));
            $this->add_hook('message_body_prefix', array($this, 'status_message'));

            $this->register_action('plugin.enigmaimport', array($this, 'import_file'));
            $this->register_action('plugin.enigmakeys', array($this, 'preferences_ui'));

            // load the Enigma plugin configuration
            $this->load_config();

            $enabled = $this->rc->config->get('enigma_encryption', true);

            // message displaying
            if ($this->rc->action == 'show' || $this->rc->action == 'preview' || $this->rc->action == 'print') {
                $this->add_hook('message_load', array($this, 'message_load'));
                $this->add_hook('template_object_messagebody', array($this, 'message_output'));
            }
            // message composing
            else if ($enabled && $this->rc->action == 'compose') {
                $this->add_hook('message_compose_body', array($this, 'message_compose'));

                $this->load_ui();
                $this->ui->init();
            }
            // message sending (and draft storing)
            else if ($enabled && $this->rc->action == 'send') {
                $this->add_hook('message_ready', array($this, 'message_ready'));
            }

            $this->password_handler();
        }
        else if ($this->rc->task == 'settings') {
            // add hooks for Enigma settings
            $this->add_hook('settings_actions', array($this, 'settings_actions'));
            $this->add_hook('preferences_sections_list', array($this, 'preferences_sections_list'));
            $this->add_hook('preferences_list', array($this, 'preferences_list'));
            $this->add_hook('preferences_save', array($this, 'preferences_save'));

            // register handler for keys/certs management
            $this->register_action('plugin.enigmakeys', array($this, 'preferences_ui'));
//            $this->register_action('plugin.enigmacerts', array($this, 'preferences_ui'));

            $this->load_ui();

            if (empty($_REQUEST['_framed']) || strpos($this->rc->action, 'plugin.enigma') === 0) {
                $this->ui->add_css();
            }

            $this->password_handler();
        }
        else if ($this->rc->task == 'cli') {
            $this->add_hook('user_delete_commit', array($this, 'user_delete'));
        }

        $this->add_hook('refresh', array($this, 'refresh'));
    }
function init ( ) { $ this -> rc = rcube :: get_instance ( ) ; if ( $ this -> rc -> task == 'mail' ) { // message parse/display hooks $ this -> add_hook ( 'message_part_structure' , array ( $ this , 'part_structure' ) ) ; $ this -> add_hook ( 'message_part_body' , array ( $ this , 'part_body' ) ) ; $ this -> add_hook ( 'message_body_prefix' , array ( $ this , 'status_message' ) ) ; $ this -> register_action ( 'plugin.enigmaimport' , array ( $ this , 'import_file' ) ) ; $ this -> register_action ( 'plugin.enigmakeys' , array ( $ this , 'preferences_ui' ) ) ; // load the Enigma plugin configuration $ this -> load_config ( ) ; $ enabled = $ this -> rc -> config -> get ( 'enigma_encryption' , true ) ; // message displaying if ( $ this -> rc -> action == 'show' || $ this -> rc -> action == 'preview' || $ this -> rc -> action == 'print' ) { $ this -> add_hook ( 'message_load' , array ( $ this , 'message_load' ) ) ; $ this -> add_hook ( 'template_object_messagebody' , array ( $ this , 'message_output' ) ) ; } // message composing else if ( $ enabled && $ this -> rc -> action == 'compose' ) { $ this -> add_hook ( 'message_compose_body' , array ( $ this , 'message_compose' ) ) ; $ this -> load_ui ( ) ; $ this -> ui -> init ( ) ; } // message sending (and draft storing) else if ( $ enabled && $ this -> rc -> action == 'send' ) { $ this -> add_hook ( 'message_ready' , array ( $ this , 'message_ready' ) ) ; } $ this -> password_handler ( ) ; } else if ( $ this -> rc -> task == 'settings' ) { // add hooks for Enigma settings $ this -> add_hook ( 'settings_actions' , array ( $ this , 'settings_actions' ) ) ; $ this -> add_hook ( 'preferences_sections_list' , array ( $ this , 'preferences_sections_list' ) ) ; $ this -> add_hook ( 'preferences_list' , array ( $ this , 'preferences_list' ) ) ; $ this -> add_hook ( 'preferences_save' , array ( $ this , 'preferences_save' ) ) ; // register handler for keys/certs management $ this -> register_action ( 'plugin.enigmakeys' , array ( $ this , 'preferences_ui' ) ) ; //            $this->register_action('plugin.enigmacerts', array($this, 'preferences_ui')); $ this -> load_ui ( ) ; if ( empty ( $ _REQUEST [ '_framed' ] ) || strpos ( $ this -> rc -> action , 'plugin.enigma' ) === 0 ) { $ this -> ui -> add_css ( ) ; } $ this -> password_handler ( ) ; } else if ( $ this -> rc -> task == 'cli' ) { $ this -> add_hook ( 'user_delete_commit' , array ( $ this , 'user_delete' ) ) ; } $ this -> add_hook ( 'refresh' , array ( $ this , 'refresh' ) ) ; }
Plugin initialization.
Plugin initialization .