IMP_Compose::canCompose PHP Method

canCompose() public static method

Is composing messages allowed?
public static canCompose ( ) : boolean
return boolean True if compose allowed.
    public static function canCompose()
    {
        try {
            return !$GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('disable_compose', 'imp');
        } catch (Horde_Exception_HookNotSet $e) {
            return true;
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Create content needed to output the compose page.
  *
  * @param IMP_Dynamic_Base $base  Base dynamic view object.
  * @param array $args             Configuration parameters:
  *   - redirect: (boolean) Display the redirect interface? If true,
  *               display only redirect. If false, don't add redirect
  *               interface to page.
  *   - resume: (boolean) Are we resuming a saved draft?
  *   - show_editor: (boolean) Show the HTML editor?
  *   - template: (string) Display the edit template interface?
  *
  * @return string  The compose HTML text.
  */
 public function compose(IMP_Dynamic_Base $base, array $args = array())
 {
     global $injector, $page_output, $prefs;
     $page_output->addScriptPackage('Horde_Core_Script_Package_Keynavlist');
     $page_output->addScriptPackage('IMP_Script_Package_ComposeBase');
     $page_output->addScriptPackage('IMP_Script_Package_ContactAutocomplete');
     $page_output->addScriptFile('compose-dimp.js');
     $page_output->addScriptFile('draghandler.js');
     $page_output->addScriptFile('editor.js');
     $page_output->addScriptFile('imp.js');
     if (!$prefs->isLocked('default_encrypt') && ($prefs->getValue('use_pgp') || $prefs->getValue('use_smime'))) {
         $page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
         $page_output->addScriptFile('passphrase.js');
     }
     $this->_addComposeVars($base);
     $view = $base->getEmptyView();
     $view->addHelper('Tag');
     $view->addHelper('FormTag');
     $view->compose_enable = IMP_Compose::canCompose();
     if (!empty($args['redirect'])) {
         $base->js_conf['redirect'] = 1;
         return $view->render('redirect');
     }
     $view->spellcheck = $injector->getInstance('IMP_Compose_Ui')->attachSpellChecker();
     $this->_compose($base, $view, $args);
     return $view->render('compose') . (isset($args['redirect']) ? '' : $view->render('redirect'));
 }
All Usage Examples Of IMP_Compose::canCompose