本文整理汇总了PHP中rcube类的典型用法代码示例。如果您正苦于以下问题:PHP rcube类的具体用法?PHP rcube怎么用?PHP rcube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rcube类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* __construct
*
* Provide a uid, and parse message structure.
*
* @param string $uid The message UID.
* @param string $folder Folder name
*
* @see self::$app, self::$storage, self::$opt, self::$parts
*/
function __construct($uid, $folder = null)
{
$this->uid = $uid;
$this->app = rcube::get_instance();
$this->storage = $this->app->get_storage();
$this->folder = strlen($folder) ? $folder : $this->storage->get_folder();
$this->storage->set_options(array('all_headers' => true));
// Set current folder
$this->storage->set_folder($this->folder);
$this->headers = $this->storage->get_message($uid);
if (!$this->headers) {
return;
}
$this->mime = new rcube_mime($this->headers->charset);
$this->subject = $this->mime->decode_mime_string($this->headers->subject);
list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
$this->set_safe(intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid]);
$this->opt = array('safe' => $this->is_safe, 'prefer_html' => $this->app->config->get('prefer_html'), 'get_url' => $this->app->url(array('action' => 'get', 'mbox' => $this->storage->get_folder(), 'uid' => $uid)));
if (!empty($this->headers->structure)) {
$this->get_mime_numbers($this->headers->structure);
$this->parse_structure($this->headers->structure);
} else {
$this->body = $this->storage->get_body($uid);
}
// notify plugins and let them analyze this structured message object
$this->app->plugins->exec_hook('message_load', array('object' => $this));
}
示例2: _do_filterlearn
private function _do_filterlearn($uids, $spam)
{
$rcmail = rcube::get_instance();
$user = $rcmail->user;
foreach ($uids as $uid) {
$MESSAGE = new rcube_message($uid);
$from = $MESSAGE->sender['mailto'];
if ($from == "") {
$rcmail->output->command('display_message', 'email address not found ' . $from, 'error');
} else {
$new_arr['whatfilter'] = 'from';
$new_arr['searchstring'] = htmlspecialchars(addslashes($from));
$new_arr['destfolder'] = addslashes("Junk");
$new_arr['messages'] = 'all';
$new_arr['filterpriority'] = '';
$new_arr['markread'] = 'markread';
$arr_prefs = $user->get_prefs();
$arr_prefs['filters'][] = $new_arr;
if ($user->save_prefs($arr_prefs)) {
$rcmail->output->command('display_message', 'I learned that messages from ' . $from . ' are SPAM', 'confirmation');
} else {
$rcmail->output->command('display_message', 'I learned nothing', 'error');
}
}
}
}
示例3: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new database_attachments($rcube->api);
$this->assertInstanceOf('database_attachments', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例4: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new help($rcube->api);
$this->assertInstanceOf('help', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例5: html_output
/**
* This callback function adds a box below the message content
* if there is a vcard attachment available
*/
function html_output($p)
{
$attach_script = false;
foreach ($this->vcard_parts as $part) {
$vcards = rcube_vcard::import($this->message->get_part_content($part, null, true));
// successfully parsed vcards?
if (empty($vcards)) {
continue;
}
// remove part's body
if (in_array($part, $this->vcard_bodies)) {
$p['content'] = '';
}
foreach ($vcards as $idx => $vcard) {
// skip invalid vCards
if (empty($vcard->email) || empty($vcard->email[0])) {
continue;
}
$display = $vcard->displayname . ' <' . $vcard->email[0] . '>';
// add box below message body
$p['content'] .= html::p(array('class' => 'vcardattachment'), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . rcube::JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::span(null, rcube::Q($display))));
}
$attach_script = true;
}
if ($attach_script) {
$this->include_script('vcardattach.js');
$this->include_stylesheet($this->local_skin_path() . '/style.css');
}
return $p;
}
示例6: mailto_callback
/**
* Callback function used to build mailto: links around e-mail strings
*
* This also adds an onclick-handler to open the Rouncube compose message screen on such links
*
* @param array Matches result from preg_replace_callback
* @return int Index of saved string value
* @see rcube_string_replacer::mailto_callback()
*/
public function mailto_callback($matches)
{
$href = $matches[1];
$suffix = $this->parse_url_brackets($href);
$i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix);
return $i >= 0 ? $this->get_replacement($i) : '';
}
示例7: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new new_user_dialog($rcube->api);
$this->assertInstanceOf('new_user_dialog', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例8: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new additional_message_headers($rcube->api);
$this->assertInstanceOf('additional_message_headers', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例9: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new example_addressbook($rcube->api);
$this->assertInstanceOf('example_addressbook', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例10: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new debug_logger($rcube->api);
$this->assertInstanceOf('debug_logger', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例11: test_constructor
/**
* Plugin object construction test
*/
function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new newmail_notifier($rcube->api);
$this->assertInstanceOf('newmail_notifier', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
}
示例12: import
/**
*
*/
public function import($csv)
{
// convert to UTF-8
$head = substr($csv, 0, 4096);
$fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1');
// fallback to Latin-1?
$charset = rcube_charset::detect($head, RCUBE_CHARSET);
$csv = rcube_charset::convert($csv, $charset);
$head = '';
$this->map = array();
// Parse file
foreach (preg_split("/[\r\n]+/", $csv) as $i => $line) {
$elements = $this->parse_line($line);
if (empty($elements)) {
continue;
}
// Parse header
if (empty($this->map)) {
$this->parse_header($elements);
if (empty($this->map)) {
break;
}
} else {
$this->csv_to_vcard($elements);
}
}
}
示例13: init
function init()
{
$this->rc = rcube::get_instance();
$this->add_hook('authenticate', array($this, 'authentication'));
$this->add_hook('storage_connect', array($this, 'storage_connection'));
$this->add_hook('smtp_connect', array($this, 'smtp_connection'));
}
示例14: init
function init()
{
$this->rc = rcube::get_instance();
// register actions
$this->register_action('plugin.managesieve', array($this, 'managesieve_actions'));
$this->register_action('plugin.managesieve-action', array($this, 'managesieve_actions'));
$this->register_action('plugin.managesieve-vacation', array($this, 'managesieve_actions'));
$this->register_action('plugin.managesieve-save', array($this, 'managesieve_save'));
$this->register_action('plugin.managesieve-saveraw', array($this, 'managesieve_saveraw'));
if ($this->rc->task == 'settings') {
$this->add_hook('settings_actions', array($this, 'settings_actions'));
$this->init_ui();
} else {
if ($this->rc->task == 'mail') {
// register message hook
if ($this->rc->action == 'show') {
$this->add_hook('message_headers_output', array($this, 'mail_headers'));
}
// inject Create Filter popup stuff
if (empty($this->rc->action) || $this->rc->action == 'show' || strpos($this->rc->action, 'plugin.managesieve') === 0) {
$this->mail_task_handler();
}
}
}
}
示例15: init
function init()
{
$this->add_texts('localization/');
$this->register_action('plugin.archive', array($this, 'request_action'));
$rcmail = rcube::get_instance();
if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && ($archive_folder = $rcmail->config->get('archive_mbox'))) {
$this->add_hook('render_mailboxlist', array($this, 'render_mailboxlist'));
if ($rcmail->config->get('archive_show_button', true)) {
$this->add_button(array('type' => 'link', 'label' => 'buttontitle', 'command' => 'plugin.archive', 'class' => 'button buttonPas archive disabled', 'classact' => 'button archive', 'width' => 32, 'height' => 32, 'title' => 'buttontitle', 'domain' => $this->ID), 'toolbar');
}
$rcmail->output->set_env('archive_folder', $archive_folder);
if ($rcmail->config->get('skin', 'larry') == 'classic') {
$this->include_stylesheet('skins/classic/archivefolder.css');
}
} else {
if ($rcmail->task == 'settings') {
$dont_override = $rcmail->config->get('dont_override', array());
if (!in_array('archive_mbox', $dont_override)) {
$this->add_hook('preferences_sections_list', array($this, 'archivefoldersection'));
$this->add_hook('preferences_list', array($this, 'prefs_table'));
$this->add_hook('preferences_save', array($this, 'save_prefs'));
}
}
}
}