if ($isPopup) {
/* If the attachments cache is not empty, we must reload this page
* and delete the attachments. */
- if ($imp_compose->numberOfAttachments()) {
+ if (count($imp_compose)) {
$cancel_url = Horde::selfUrl()->setRaw(true)->add(array(
'actionID' => 'cancel_compose',
'composeCache' => $composeCacheID,
} else {
/* If the attachments cache is not empty, we must reload this page and
delete the attachments. */
- if ($imp_compose->numberOfAttachments()) {
+ if (count($imp_compose)) {
$cancel_url = $imp_ui->mailboxReturnUrl(Horde::selfUrl()->setRaw(true))->add(array(
'actionID' => 'cancel_compose',
'composeCache' => $composeCacheID
$t->set('attach_options', $attach_options);
}
- $t->set('numberattach', $imp_compose->numberOfAttachments());
+ $t->set('numberattach', count($imp_compose));
if ($t->get('numberattach')) {
$atc = array();
$v = $injector->getInstance('Horde_Mime_Viewer');
* @license http://www.fsf.org/copyleft/gpl.html GPL
* @package IMP
*/
-class IMP_Compose
+class IMP_Compose implements Countable
{
/* The virtual path to use for VFS data. */
const VFS_ATTACH_PATH = '.horde/imp/compose';
$imp_message->flag(array('\\answered'), $reply_uid);
$imp_message->flag(array('\\flagged'), $reply_uid, false);
break;
-
}
}
/* Add attachments now. */
$attach_flag = true;
- if (empty($options['noattach']) && $this->numberOfAttachments()) {
+ if (empty($options['noattach']) && count($this)) {
if (($this->_linkAttach &&
$GLOBALS['conf']['compose']['link_attachments']) ||
!empty($GLOBALS['conf']['compose']['link_all_attachments'])) {
}
/**
- * Returns the number of attachments currently in this message.
- *
- * @return integer The number of attachments in this message.
- */
- public function numberOfAttachments()
- {
- return count($this->_cache);
- }
-
- /**
* Returns the size of the attachments in bytes.
*
* @return integer The size of the attachments (in bytes).
public function additionalAttachmentsAllowed()
{
return empty($GLOBALS['conf']['compose']['attach_count_limit']) ||
- ($GLOBALS['conf']['compose']['attach_count_limit'] - $this->numberOfAttachments());
+ ($GLOBALS['conf']['compose']['attach_count_limit'] - count($this));
}
/**
return $search;
}
+ /* Countable methods. */
+
+ /**
+ * Returns the number of attachments currently in this message.
+ *
+ * @return integer The number of attachments in this message.
+ */
+ public function count()
+ {
+ return count($this->_cache);
+ }
+
}
{
$fwd_list = array();
- if ($imp_compose->numberOfAttachments()) {
+ if (count($imp_compose)) {
foreach ($imp_compose->getAttachments() as $atc_num => $data) {
$mime = $data['part'];
$imp_ui = $injector->getInstance('IMP_Ui_Compose');
$result['js'] = array_merge($result['js'], $imp_ui->identityJs());
- if ($t->get('composeCache') &&
- $imp_compose->numberOfAttachments()) {
+ if ($t->get('composeCache') && count($imp_compose)) {
foreach ($imp_compose->getAttachments() as $num => $atc) {
$mime = $atc['part'];
$opts = Horde_Serialize::serialize(array(