protected function imgHandler($attributes)
    {
        $attributesName = array('alt', 'legend');
        foreach ( $attributesName as $attributeName )
        {
            if ( !isset($attributes[$attributeName]) )
            {
                $attributes[$attributeName] = '';
            }
        }

        $filePath       = $attributes['src'];
        $filenamePos    = strrpos($filePath, '/');
        $fileName       = substr($filePath, $filenamePos ? $filenamePos + 1 : 0);

        $file = SQLIContent::create( new SQLIContentOptions( array(
            'class_identifier'      => 'image',
            'remote_id'             => md5($this->article->remoteId() . $fileName),
            'language'              => $this->article->getLanguage()
        )));

        $file->fields->headline        = $attributes['alt'];
        //$file->fields->original_size   = $attributes['width'] . 'x' . $attributes['height'];
        $file->fields->alternate_text = $attributes['legend'] ? $attributes['legend'] : $attributes['alt'];
        $file->fields->language        = $this->article->getLanguage();
        $img                            = MMSynchFileManager::fromFileName($this->article->getOrigin(), $this->article->getPublisher(), MMSynchFileManager::IMAGE_FOLDER, $filePath);
        $fullPath                       = $img->getFullPath();
        $file->fields->file             = $fullPath;
        $file->fields->size             = filesize($fullPath);
        $fileInfo                       = finfo_open(FILEINFO_MIME_TYPE);
        $file->fields->media_encoding   = finfo_file($fileInfo, $fullPath);
        finfo_close($fileInfo);
        $location = $this->article->getPublisher()->getContentMediaImage()->defaultLocation;
        $file->addLocation($location);

        MMSynchContentPublisher::getInstance()->publish($file);
        $img->setCanArchived();

        $replacement = '<img src="' . '/newsletter/image/' . $file->id . '/' . $this->article->getLanguage() . '/fmc' . '" alt="' . $attributes['legend'] . '" />';

        return sprintf($replacement, $file->id);
    }
    protected function createHtmlObject($filePath, $location, $publisher)
    {
        $file           = MMSynchFileManager::fromFileName($this->article->getOrigin(), $publisher, MMSynchFileManager::HTML_FOLDER, $filePath);
        $fullPath       = $file->getFullPath();
        $html           = self::getFileContent($fullPath);
        $filenamePos    = strrpos($filePath, '/');
        $fileName       = substr($filePath, $filenamePos ? $filenamePos + 1 : 0);
        $remoteID       = md5($this->article->remoteId().$fileName);
        $lang           = $this->article->getLanguage();
        $content        = SQLIContent::fromRemoteID($remoteID);

        if ( $content instanceof SQLIContent )
        {
            if ( !isset($content->fields[$lang]) )
            {
                $content->addTranslation( $lang );
            }
            $content->setActiveLanguage( $lang );
        }
        else
        {
            $content = SQLIContent::create( new SQLIContentOptions( array(
                'class_identifier'  => 'html',
                'remote_id'         => md5($this->article->remoteId() . $fileName),
                'language'          => $lang
            )));
        }

        $content->fields->title = $fileName;
        $content->fields->text  = $html;

        $content->addLocation($location);

        MMSynchContentPublisher::getInstance()->publish($content);
        $file->setCanArchived();

        return $content;
    }
    public static function create($options)
    {
        $contentOptions = array();
        if (isset($options['remote_id']))
            $contentOptions['remote_id'] = $options['remote_id'];

        if (isset($options['section_id']))
            $contentOptions['section_id'] = $options['section_id'];

        if (isset($options['creator_id']))
            $contentOptions['creator_id'] = $options['creator_id'];

        if (isset($options['language']))
            $contentOptions['language'] = $options['language'];

        if (isset($options['class_identifier']))
            $contentOptions['class_identifier'] = $options['class_identifier'];

        $content = SQLIContent::create( new SQLIContentOptions($contentOptions) );

        if (isset($contentOptions['language']))
        {
            if (!isset($content->fields[$contentOptions['language']]))
            {
                $content->addTranslation($contentOptions['language']);
            }

            $content->setActiveLanguage($contentOptions['language']);
        }

        if (isset($options['parent_node_id']))
        {
            $location = SQLILocation::fromNodeID( $options['parent_node_id'] );
            $content->addLocation($location);
        }

        if (isset($options['data_map']))
        {
            if (isset($options['data_map']['default']) && is_array($options['data_map']['default']))
            {
                foreach($options['data_map']['default'] as $attributeIdentifier => $attributeString)
                {
                    $content->fields->{$attributeIdentifier} = $attributeString;
                }
            }

            foreach($options['data_map'] as $language => $dataMap)
            {
                if ($language == 'default')
                    continue;

                if (!isset($content[$language]))
                    $content->addTranslation($language);

                foreach($dataMap as $attributeIdentifier => $attributeString)
                {
                    $content->fields[$language]->{$attributeIdentifier} = $attributeString;
                }
            }
        }

        if (isset($options['publish']) && $options['publish'])
        {
            MMSynchContentPublisher::getInstance()->publish($content);
        }

        return $content;
    }