Zend_Exception example


    public static function loadClass($class$dirs = null)
    {
        if (class_exists($class, false) || interface_exists($class, false)) {
            return;
        }

        if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) {
            throw new Zend_Exception('Directory argument must be a string or an array');
        }

        $file = self::standardiseFile($class);

        if (!empty($dirs)) {
            // use the autodiscovered path             $dirPath = dirname($file);
            if (is_string($dirs)) {
                $dirs = explode(PATH_SEPARATOR, $dirs);
            }
            foreach ($dirs as $key => $dir) {
                

    public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
    {
        $result = false;
        switch ($mode) {
            case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
            case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
                if (empty($tags)) {
                    throw new Zend_Exception('Cannot use tag matching modes as no tags were defined');
                }
                if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
                    $this->_tagged = $tagged;
                } elseif (!$this->_tagged) {
                    return true;
                }
                foreach ($tags as $tag) {
                    $urls = array_keys($this->_tagged);
                    foreach ($urls as $url) {
                        if (isset($this->_tagged[$url]['tags']) && in_array($tag$this->_tagged[$url]['tags'])) {
                            $this->remove($url);
                            
// position after first boundary line         $start = $p + 3 + strlen($boundary);

        while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
            $res[] = substr($body$start$p-$start);
            $start = $p + 3 + strlen($boundary);
        }

        // no more parts, find end boundary         $p = strpos($body, '--' . $boundary . '--', $start);
        if ($p===false) {
            throw new Zend_Exception('Not a valid Mime Message: End Missing');
        }

        // the remaining part also needs to be parsed:         $res[] = substr($body$start$p-$start);
        return $res;
    }

    /** * decodes a mime encoded String and returns a * struct of parts with header and body * * @param string $message raw message content * @param string $boundary boundary as found in content-type * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found * @throws Zend_Exception */
// position after first boundary line         $start = $p + 3 + strlen($boundary);

        while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
            $res[] = substr($body$start$p-$start);
            $start = $p + 3 + strlen($boundary);
        }

        // no more parts, find end boundary         $p = strpos($body, '--' . $boundary . '--', $start);
        if ($p===false) {
            throw new Zend_Exception('Not a valid Mime Message: End Missing');
        }

        // the remaining part also needs to be parsed:         $res[] = substr($body$start$p-$start);
        return $res;
    }

    /** * Decodes a MIME encoded string and returns a Zend_Mime_Message object with * all the MIME parts set according to the given string * * @param string $message * @param string $boundary * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return Zend_Mime_Message */
Home | Imprint | This part of the site doesn't use cookies.