Read default attachments from config. Handy if you use images in your HTML template that are
in every mail.

@return array
338796
public function getDefaultAttachments() {
        $config = Zend_Registry::get('config');
        if (!isset($config->mailer->attachments)) {
            return array();
        }
        return $config->mailer->attachments->toArray();
    }
9962
public function getImagesUrls()
    {
        return Collection::make($this->event->get('attachments'))->where('contentType', 'image')->map(function ($item) {
            return new Image($item['contentUrl'], $item);
        })->toArray();
    }
361729
public function getExtensions()
  {
    $ext = array();

    foreach ($this->Config->get('file-extensions') as $key => $value)
    {
      $ext = array_merge($ext, $value['extensions']);
    }

    return $ext;
  }
965932
public function normalize()
    {
        $url = $this->getMediaUrl($this->mediaType);

        return [
            'type'    => $this->mediaType,
            'content' => [
                'attachment' => [
                    'type'    => $this->mediaType,
                    'payload' => [
                        'url'         => $url,
                        'is_reusable' => true
                    ]
                ]
            ]
        ];
    }
994550
protected static function define_properties() {
        return array(
            'name' => array(
                'type' => PARAM_TEXT
            ),
            'image' => array(
                'type' => PARAM_URL,
                'null' => NULL_ALLOWED,
                'default' => null
            ),
            'clientid' => array(
                'type' => PARAM_RAW_TRIMMED,
                'default' => ''
            ),
            'clientsecret' => array(
                'type' => PARAM_RAW_TRIMMED,
                'default' => ''
            ),
            'baseurl' => array(
                'type' => PARAM_URL,
                'default' => ''
            ),
            'enabled' => array(
                'type' => PARAM_BOOL,
                'default' => true
            ),
            'showonloginpage' => array(
                'type' => PARAM_BOOL,
                'default' => false
            ),
            'basicauth' => array(
                'type' => PARAM_BOOL,
                'default' => false
            ),
            'scopessupported' => array(
                'type' => PARAM_RAW,
                'null' => NULL_ALLOWED,
                'default' => null
            ),
            'loginscopes' => array(
                'type' => PARAM_RAW,
                'default' => 'openid profile email'
            ),
            'loginscopesoffline' => array(
                'type' => PARAM_RAW,
                'default' => 'openid profile email'
            ),
            'loginparams' => array(
                'type' => PARAM_RAW,
                'default' => ''
            ),
            'loginparamsoffline' => array(
                'type' => PARAM_RAW,
                'default' => ''
            ),
            'alloweddomains' => array(
                'type' => PARAM_RAW,
                'default' => ''
            ),
            'sortorder' => array(
                'type' => PARAM_INT,
                'default' => 0,
            ),
            'requireconfirmation' => array(
                'type' => PARAM_BOOL,
                'default' => true
            )
        );
    }
86338
protected static function define_other_properties() {
        $attachmentdefinition = stored_file_exporter::read_properties_definition();
        $attachmentdefinition['urls'] = [
            'type' => [
                'export' => [
                    'type' => PARAM_URL,
                    'description' => 'The URL used to export the attachment',
                    'optional' => true,
                    'default' => null,
                    'null' => NULL_ALLOWED
                ]
            ]
        ];
        $attachmentdefinition['html'] = [
            'type' => [
                'plagiarism' => [
                    'type' => PARAM_RAW,
                    'description' => 'The HTML source for the Plagiarism Response',
                    'optional' => true,
                    'default' => null,
                    'null' => NULL_ALLOWED
                ],
            ]
        ];

        return [
            'id' => ['type' => PARAM_INT],
            'subject' => ['type' => PARAM_TEXT],
            'message' => ['type' => PARAM_RAW],
            'messageformat' => ['type' => PARAM_INT],
            'author' => ['type' => author_exporter::read_properties_definition()],
            'discussionid' => ['type' => PARAM_INT],
            'hasparent' => ['type' => PARAM_BOOL],
            'parentid' => [
                'type' => PARAM_INT,
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED
            ],
            'timecreated' => ['type' => PARAM_INT],
            'unread' => [
                'type' => PARAM_BOOL,
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED
            ],
            'isdeleted' => ['type' => PARAM_BOOL],
            'isprivatereply' => ['type' => PARAM_BOOL],
            'haswordcount' => ['type' => PARAM_BOOL],
            'wordcount' => [
                'type' => PARAM_INT,
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED
            ],
            'capabilities' => [
                'type' => [
                    'view' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can view the post',
                    ],
                    'edit' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can edit the post',
                    ],
                    'delete' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can delete the post',
                    ],
                    'split' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can split the post',
                    ],
                    'reply' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can reply to the post',
                    ],
                    'export' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can export the post',
                    ],
                    'controlreadstatus' => [
                        'type' => PARAM_BOOL,
                        'null' => NULL_ALLOWED,
                        'description' => 'Whether the user can control the read status of the post',
                    ],
                ]
            ],
            'urls' => [
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED,
                'type' => [
                    'view' => [
                        'description' => 'The URL used to view the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'viewisolated' => [
                        'description' => 'The URL used to view the post in isolation',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'viewparent' => [
                        'description' => 'The URL used to view the parent of the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'edit' => [
                        'description' => 'The URL used to edit the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'delete' => [
                        'description' => 'The URL used to delete the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'split' => [
                        'description' => 'The URL used to split the discussion ' .
                            'with the selected post being the first post in the new discussion',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'reply' => [
                        'description' => 'The URL used to reply to the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'export' => [
                        'description' => 'The URL used to export the post',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'markasread' => [
                        'description' => 'The URL used to mark the post as read',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'markasunread' => [
                        'description' => 'The URL used to mark the post as unread',
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ],
                    'discuss' => [
                        'type' => PARAM_URL,
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED
                    ]
                ]
            ],
            'attachments' => [
                'multiple' => true,
                'type' => $attachmentdefinition
            ],
            'tags' => [
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED,
                'multiple' => true,
                'type' => [
                    'id' => [
                        'type' => PARAM_INT,
                        'description' => 'The ID of the Tag',
                        'null' => NULL_NOT_ALLOWED,
                    ],
                    'tagid' => [
                        'type' => PARAM_INT,
                        'description' => 'The tagid',
                        'null' => NULL_NOT_ALLOWED,
                    ],
                    'isstandard' => [
                        'type' => PARAM_BOOL,
                        'description' => 'Whether this is a standard tag',
                        'null' => NULL_NOT_ALLOWED,
                    ],
                    'displayname' => [
                        'type' => PARAM_TEXT,
                        'description' => 'The display name of the tag',
                        'null' => NULL_NOT_ALLOWED,
                    ],
                    'flag' => [
                        'type' => PARAM_BOOL,
                        'description' => 'Wehther this tag is flagged',
                        'null' => NULL_NOT_ALLOWED,
                    ],
                    'urls' => [
                        'description' => 'URLs associated with the tag',
                        'null' => NULL_NOT_ALLOWED,
                        'type' => [
                            'view' => [
                                'type' => PARAM_URL,
                                'description' => 'The URL to view the tag',
                                'null' => NULL_NOT_ALLOWED,
                            ],
                        ]
                    ]
                ]
            ],
            'html' => [
                'optional' => true,
                'default' => null,
                'null' => NULL_ALLOWED,
                'type' => [
                    'rating' => [
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED,
                        'type' => PARAM_RAW,
                        'description' => 'The HTML source to rate the post',
                    ],
                    'taglist' => [
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED,
                        'type' => PARAM_RAW,
                        'description' => 'The HTML source to view the list of tags',
                    ],
                    'authorsubheading' => [
                        'optional' => true,
                        'default' => null,
                        'null' => NULL_ALLOWED,
                        'type' => PARAM_RAW,
                        'description' => 'The HTML source to view the author details',
                    ],
                ]
            ]
        ];
    }
1123952
public function &getImagesConfig()
    {
        if (!isset($this->_imagesConfigCache)) {
            $this->_imagesConfigCache = new CKFinder_Connector_Core_ImagesConfig(isset($GLOBALS['config']['Images']) ? $GLOBALS['config']['Images'] : array());
        }

        return $this->_imagesConfigCache;
    }
10077
public function getTemplates()
    {
        $templates = array();

        if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
            while (false !== ($entry = readdir($handle))) {
                if (substr($entry, 0, 1) !== '.') {
                    $templates[] = array(
                        'id' => $entry,
                        'title' => preg_replace('/[^A-Za-z0-9]/', ' ', $entry),
                    );
                }
            }

            closedir($handle);
        }

        return $templates;
    }
60885
protected static function getAttachmentArray($attachment)
    {
        $default = array(
            'content_type'  => 'text/plain',    // 'application/octet-stream',
            'disposition'   => 'attachment',    // inline
            'body'          => '',
            'file'          => null,
            'filename'      => null,
            'content_id'    => null,
        );
        $eol = "\r\n";
        $attachment = array_merge($default, $attachment);
        if (isset($attachment['file'])) {
            $attachment['body'] = file_get_contents($attachment['file']);
            if (empty($attachment['filename'])) {
                $attachment['filename'] = basename($attachment['file']);
            }
            $attachment['content_transfer_encoding'] = 'base64';
            $attachment['body'] = chunk_split(base64_encode($attachment['body']), 68, $eol);
            $attachment['body'] = substr($a['body'], 0, -strlen($eol));  // remove final $eol
            $attachment['file'] = null;
        }
        return $attachment;
    }
1173006
public function fetchAttachmentsOfLastMessage()
    {
        $email = $this->fetchLastMessage();
        $response = $this->client->get("inboxes/{$this->config['inbox_id']}/messages/{$email->id}/attachments")->getBody();

        return json_decode($response, true);
    }
490750
public function getEmailTemplateDropdownValues()
    {
        $templates = [];

        $finder = new FileFinder();
        $finder->setOption('name_regex', '/^.*\.ss$/');

        $parent = $this->getFormParent();

        if (!$parent) {
            return [];
        }

        $emailTemplateDirectory = $parent->config()->get('email_template_directory');
        $templateDirectory = ModuleResourceLoader::resourcePath($emailTemplateDirectory);

        if (!$templateDirectory) {
            return [];
        }

        $found = $finder->find(BASE_PATH . DIRECTORY_SEPARATOR . $templateDirectory);

        foreach ($found as $key => $value) {
            $template = pathinfo($value);
            $absoluteFilename = $template['dirname'] . DIRECTORY_SEPARATOR . $template['filename'];

            // Optionally remove vendor/ path prefixes
            $resource = ModuleResourceLoader::singleton()->resolveResource($emailTemplateDirectory);
            if ($resource instanceof ModuleResource && $resource->getModule()) {
                $prefixToStrip = $resource->getModule()->getPath();
            } else {
                $prefixToStrip = BASE_PATH;
            }
            $templatePath = substr($absoluteFilename, strlen($prefixToStrip) + 1);

            // Optionally remove "templates/" prefixes
            if (preg_match('/(?<=templates\/).*$/', $templatePath, $matches)) {
                $templatePath = $matches[0];
            }

            $templates[$templatePath] = $template['filename'];
        }

        return $templates;
    }
929025
public function attachments()
    {
        $files = func_get_args();

        foreach ($files as $file) {
            if (is_string($file)) {
                $this->_attachments[] = ['file' => $file];
            } elseif (is_array($file)) {
                foreach ($file as $key => $value) {
                    $this->_attachments[] = ['name' => $key, 'file' => $value];
                }
            }
        }

        return $this;
    }
294909
private function prepareAttachments($attachments = null)
    {
        $file_params = [];

        if ($attachments) {
            $counter = 1;

            foreach ($attachments as $attachment) {
                $path = is_array($attachment) ? $attachment[0] : $attachment;

                if (is_readable($path)) {
                    $file_params['attachment_'.$counter++] = $attachment;
                } else {
                    throw new FileNotReadable($attachment);
                }
            }
        }

        return $file_params;
    }
280358
final protected function getDefaultFilterValues()
    {
        $defaultFilterValues = [];

        $this->configureDefaultFilterValues($defaultFilterValues);

        foreach ($this->getExtensions() as $extension) {
            // NEXT_MAJOR: remove method check in next major release
            if (method_exists($extension, 'configureDefaultFilterValues')) {
                $extension->configureDefaultFilterValues($this, $defaultFilterValues);
            }
        }

        return $defaultFilterValues;
    }
955803
public static function GetDefaultOptions () {
		return [
			static::ATTR_ENCODING_INTERNAL	=> static::DEFAULT_ENCODING_INTERNAL,
			static::ATTR_ENCODING_FILE		=> static::DEFAULT_ENCODING_FILE,
			static::ATTR_QUOTE_MODE			=> static::DEFAULT_QUOTE_MODE,
			static::ATTR_READ_LENGTH		=> static::DEFAULT_READ_LENGTH,
			static::ATTR_EOL				=> static::DEFAULT_EOL,
			static::ATTR_DELIMITER			=> static::DEFAULT_DELIMITER,
			static::ATTR_ENCLOSURE			=> static::DEFAULT_ENCLOSURE,
			static::ATTR_ESCAPE				=> static::DEFAULT_ESCAPE,
			static::ATTR_FOPEN_MODE_READ	=> static::DEFAULT_FOPEN_MODE_READ,
			static::ATTR_FOPEN_MODE_WRITE	=> static::DEFAULT_FOPEN_MODE_WRITE,
		];
	}
212511
public function getDefaultHeaders()
    {
        return [
            'User-Agent' => 'plivo-php/' . implode('.',
                    [Version::MAJOR, Version::MINOR, Version::PATCH])
                    . ' (PHP ' . $this->phpVersion . ')',
            'Accept-Encoding' => '*',
            'Content-type' => 'application/json'
        ];
    }
317656
public function getAttachments()
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        if (!empty(parent::getAttachments())) {
            /** @noinspection PhpUndefinedMethodInspection */
            return parent::getAttachments();
        }

        $attachments = $this->_storage->getAttachments($this);

        /** @noinspection PhpUndefinedMethodInspection */
        $this->setAttachments($attachments);

        return $attachments;
    }