public function Thumbnail($page = 1)
 {
     // Only thumbnail PDF files
     if (strtolower($this->owner->getExtension()) != 'pdf') {
         return false;
     }
     $file_filename = Director::baseFolder() . '/' . $this->owner->getFilename();
     if (!file_exists($file_filename)) {
         return false;
     }
     $cache_filename = $this->owner->getFilename() . '.page-' . (int) $page . '.jpg';
     // Check for existing cached thumbnail
     if (file_exists(Director::baseFolder() . '/' . $cache_filename) && filemtime(Director::baseFolder() . '/' . $cache_filename) > filemtime($file_filename)) {
         $img = DataObject::get_one('Image', "Filename = '" . $cache_filename . "'");
         if ($img) {
             return $img;
         }
     }
     // Create and cache the thumbnail
     $command = self::$convert_path . ' -density 300x300 ' . escapeshellarg($file_filename . '[' . ((int) $page - 1) . ']') . ' -quality 100 -resize 2000x -units PixelsPerInch ' . escapeshellarg(Director::baseFolder() . '/' . $cache_filename);
     $out = shell_exec($command);
     //var_dump( $command );
     if (!file_exists(Director::baseFolder() . '/' . $cache_filename)) {
         return false;
     }
     $img = new Image();
     $img->setFilename($cache_filename);
     $img->write();
     $img = DataObject::get_one('Image', "Filename = '" . $cache_filename . "'");
     return $img;
 }
예제 #2
0
 public static function createFromUpload($basePath, $uploadPath)
 {
     $image = new Image($uploadPath);
     if (!$image->valid) {
         return null;
     }
     $targetName = self::getNewName($image->extension);
     $scaledTargetPath = $basePath . $targetName;
     $originalTargetPath = $scaledTargetPath;
     // Do we want to create a scaled down version of this image?
     if ($image->width > CONFIG::IMAGE_MAX_WIDTH) {
         $scaledWidth = CONFIG::IMAGE_MAX_WIDTH;
         $scaledHeight = $scaledWidth / $image->width * $image->height;
         $image->writeThumb($scaledTargetPath, CONFIG::IMAGE_JPEG_QUALITY, $scaledWidth, $scaledHeight, CONFIG::IMAGE_SHARPEN);
         setFileMode($scaledTargetPath);
         // We created a scaled down version, so the original has to be moved
         // in a separate big/ folder
         $originalTargetPath = $basePath . CONFIG::IMAGE_BIG_PATH . $targetName;
     }
     // If the image had an exif orientation, save the rotated version
     // and delete the original.
     if ($image->exifRotated) {
         $image->write($originalTargetPath, CONFIG::IMAGE_JPEG_QUALITY);
         unlink($uploadPath);
     } else {
         move_uploaded_file($uploadPath, $originalTargetPath);
     }
     setFileMode($originalTargetPath);
     return self::open($scaledTargetPath);
 }
 public function getPdfPreviewImage()
 {
     $pdfFile = Director::getAbsFile($this->owner->getFileName());
     $pathInfo = pathinfo($pdfFile);
     if (strtolower($pathInfo['extension']) != 'pdf') {
         //@Todo if dev then exception? else fail silently
         return null;
     }
     $fileName = $pathInfo['filename'];
     $savePath = __DIR__ . '/../../';
     $saveImage = $this->imagePrefix . '-' . $fileName . '.jpg';
     // Fix illegal characters
     $filter = FileNameFilter::create();
     $saveImage = $filter->filter($saveImage);
     $saveTo = $savePath . $this->folderToSave . $saveImage;
     $image = DataObject::get_one('Image', "`Name` = '{$saveImage}'");
     if (!$image) {
         $folderObject = DataObject::get_one("Folder", "`Filename` = '{$this->folderToSave}'");
         if ($folderObject) {
             if ($this->generator->generatePreviewImage($pdfFile, $saveTo)) {
                 $image = new Image();
                 $image->ParentID = $folderObject->ID;
                 $image->setName($saveImage);
                 $image->write();
             }
         }
     } else {
         //check LastEdited to update
         $cacheInValid = false;
         if (strtotime($image->LastEdited) < strtotime($this->owner->LastEdited)) {
             $cacheInValid = true;
         }
         if ($cacheInValid) {
             $this->generator->generatePreviewImage($pdfFile, $saveTo);
             $image->setName($saveImage);
             $image->write(false, false, true);
         }
     }
     return $image;
 }
 private function getFileByURL($url, $fileName)
 {
     $folder = Folder::find_or_make(self::$media_upload_folder);
     // relative to assets
     // create the file in database (sets title and safely names)
     $file = new Image();
     $file->ParentID = $folder->ID;
     $file->setName($fileName);
     $file->write();
     // download the file
     $fp = fopen($file->getFullPath(), 'w');
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     $data = curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     return $file;
 }
 /**
  * Save Snapshots of extension in assets folder
  *
  * @param string $thumbnailUrl, $extensionName
  * @return int
  */
 public static function save_snapshot($thumbnailUrl, $extensionName)
 {
     $folderToSave = 'assets/Uploads/Snapshots/';
     $folderObject = Folder::get()->filter("Filename", $folderToSave)->first();
     if (!$folderObject) {
         $folderObject = Folder::find_or_make('Uploads/Snapshots/');
         $folderObject->write();
     }
     $fileExtension = preg_replace('/^.*\\.([^.]+)$/D', '$1', $thumbnailUrl);
     $thumbnailBaseName = str_replace('/', '-', $extensionName);
     $thumbnailName = $thumbnailBaseName . '-thumbnail.' . $fileExtension;
     $ch = curl_init();
     $timeout = 30;
     curl_setopt($ch, CURLOPT_URL, $thumbnailUrl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
     $data = curl_exec($ch);
     $response = curl_getinfo($ch);
     curl_close($ch);
     if ($response['http_code'] == '404') {
         throw new InvalidArgumentException("Image not found on given Url Please check 'Snapshot' field in composer.json file");
     }
     $imageContent = $data;
     if ($folderObject) {
         $thumbnailFile = fopen(BASE_PATH . DIRECTORY_SEPARATOR . $folderToSave . $thumbnailName, 'w');
         fwrite($thumbnailFile, $imageContent);
         fclose($thumbnailFile);
     } else {
         throw new InvalidArgumentException("Could not create {$folderToSave} , Please create it mannually ");
     }
     if ($thumbnailObject = Image::get()->filter("Name", $thumbnailName)->first()) {
         return $thumbnailObject->ID;
     } else {
         $thumbnailObject = new Image();
         $thumbnailObject->ParentID = $folderObject->ID;
         $thumbnailObject->Name = $thumbnailName;
         $thumbnailObject->OwnerID = Member::currentUser() ? Member::currentUser()->ID : 0;
         $thumbnailObject->write();
         return $thumbnailObject->ID;
     }
 }
예제 #6
0
 public function run($request)
 {
     $this->deleteAll(ArticlePage::get());
     $faker = Faker\Factory::create();
     $blogPage = BlogPage::get()->first();
     $img = new Image();
     $imgFile = 'themes/Helix/assets/images/doof.jpg';
     // var_dump($imgFile);
     $img->Filename = $imgFile;
     $img->Title = 'Template image';
     $img->write();
     for ($articles = 0; $articles < 20; $articles++) {
         $articlePage = new ArticlePage();
         $articlePage->Title = "Article " . $articles;
         $articlePage->Content = $faker->text(400);
         // $articlePage->summarySize = rand(1,3);
         $articlePage->summarySize = 1;
         $articlePage->SummaryImageID = $img->ID;
         $articlePage->setParent($blogPage);
         $articlePage->write();
         $articlePage->publish("Stage", "Live");
         $articlePage->flushCache();
     }
 }
 /**
  * Adds a new image to the given product.
  * 
  * @param SilvercartProduct $product           Product to add image to
  * @param string            $filename          Filename
  * @param string            $description       Description
  * @param int               $consecutiveNumber Consecutive number
  */
 protected function addNewImage(SilvercartProduct $product, $filename, $description, $consecutiveNumber)
 {
     $fileEnding = strrev(substr(strrev($filename), 0, strpos(strrev($filename), '.')));
     $nameFilter = FileNameFilter::create();
     $targetFilename = $product->ProductNumberShop . '-' . $nameFilter->filter($product->Title) . '-' . $consecutiveNumber . '.' . $fileEnding;
     $originalFile = self::get_absolute_upload_folder() . '/' . $filename;
     $targetFile = self::get_absolute_product_image_folder() . '/' . $targetFilename;
     $parentFolder = Folder::find_or_make('Uploads/product-images');
     rename($originalFile, $targetFile);
     $image = new Image();
     $image->Name = basename($targetFilename);
     $image->ParentID = $parentFolder->ID;
     $image->write();
     $silvercartImage = new SilvercartImage();
     $silvercartImage->ImageID = $image->ID;
     $silvercartImage->Title = $description;
     $silvercartImage->write();
     $product->SilvercartImages()->add($silvercartImage);
 }
 public function importSet()
 {
     $page = 1;
     static $only_new_photos = false;
     $canAccess = Director::isDev() || Director::is_cli() || Permission::check("ADMIN");
     if (!$canAccess) {
         return Security::permissionFailure($this);
     }
     /*
     // For testing
     $flickrPhoto = FlickrPhoto::get()->filter('ID',100)->first();
     $flickrPhoto->loadExif();
     die;
     */
     // Code for the register action here
     $flickrSetID = $this->request->param('ID');
     $path = $_GET['path'];
     $parentNode = SiteTree::get_by_link($path);
     if ($parentNode == null) {
         echo "ERROR: Path " . $path . " cannot be found in this site\n";
         die;
     }
     $this->FlickrSetId = $flickrSetID;
     $photos = $this->f->photosets_getPhotos($flickrSetID, 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_m, url_o, url_l,description', null, 500);
     $photoset = $photos['photoset'];
     $flickrSet = $this->getFlickrSet($flickrSetID);
     // reload from DB with date - note the use of quotes as flickr set id is a string
     $flickrSet = DataObject::get_one('FlickrSet', 'FlickrID=\'' . $flickrSetID . "'");
     $flickrSet->FirstPictureTakenAt = $photoset['photo'][0]['datetaken'];
     $flickrSet->KeepClean = true;
     $flickrSet->Title = $photoset['title'];
     $flickrSet->write();
     echo "Title set to : " . $flickrSet->Title;
     if ($flickrSet->Title == null) {
         echo "ABORTING DUE TO NULL TITLE FOUND IN SET - ARE YOU AUTHORISED TO READ SET INFO?";
         die;
     }
     $datetime = explode(' ', $flickrSet->FirstPictureTakenAt);
     $datetime = $datetime[0];
     list($year, $month, $day) = explode('-', $datetime);
     echo "Month: {$month}; Day: {$day}; Year: {$year}<br />\n";
     // now try and find a flickr set page
     $flickrSetPage = DataObject::get_one('FlickrSetPage', 'FlickrSetForPageID=' . $flickrSet->ID);
     if (!$flickrSetPage) {
         $flickrSetPage = new FlickrSetPage();
         $flickrSetPage->Title = $photoset['title'];
         $flickrSetPage->Description = $flickrSet->Description;
         //update FlickrSetPage set Description = (select Description from FlickrSet where FlickrSet.ID = FlickrSetPage.FlickrSetForPageID);
         $flickrSetPage->FlickrSetForPageID = $flickrSet->ID;
         $flickrSetPage->write();
         // create a stage version also
     }
     $flickrSetPage->Title = $photoset['title'];
     $flickrSetPage->ParentID = $parentNode->ID;
     $flickrSetPage->write();
     $flickrSetPage->publish("Live", "Stage");
     $flickrSetPageID = $flickrSetPage->ID;
     gc_enable();
     $f1 = Folder::find_or_make("flickr/{$year}");
     $f1->Title = $year;
     $f1->write();
     $f1 = Folder::find_or_make("flickr/{$year}/{$month}");
     $f1->Title = $month;
     $f1->write();
     $f1 = Folder::find_or_make("flickr/{$year}/{$month}/{$day}");
     $f1->Title = $day;
     $f1->write();
     exec("chmod 775 ../assets/flickr/{$year}");
     exec("chmod 775 ../assets/flickr/{$year}/{$month}");
     exec("chmod 775 ../assets/flickr/{$year}/{$month}/{$day}");
     exec("chown gordon:www-data ../assets/flickr/{$year}");
     exec("chown gordon:www-data ../assets/flickr/{$year}/{$month}");
     exec("chown gordon:www-data ../assets/flickr/{$year}/{$month}/{$day}");
     $folder = Folder::find_or_make("flickr/{$year}/{$month}/{$day}/" . $flickrSetID);
     $cmd = "chown gordon:www-data ../assets/flickr";
     exec($cmd);
     exec('chmod 775 ../assets/flickr');
     // new folder case
     if ($flickrSet->AssetFolderID == 0) {
         $flickrSet->AssetFolderID = $folder->ID;
         $folder->Title = $flickrSet->Title;
         $folder->write();
         $cmd = "chown gordon:www-data ../assets/flickr/{$year}/{$month}/{$day}/" . $flickrSetID;
         exec($cmd);
         $cmd = "chmod 775 ../assets/flickr/{$year}/{$month}/{$day}/" . $flickrSetID;
         exec($cmd);
     }
     $flickrSetAssetFolderID = $flickrSet->AssetFolderID;
     $flickrSetPageDatabaseID = $flickrSetPage->ID;
     //$flickrSet = NULL;
     $flickrSetPage = NULL;
     $numberOfPics = count($photoset['photo']);
     $ctr = 1;
     foreach ($photoset['photo'] as $key => $value) {
         echo "Importing photo {$ctr}/{$numberOfPics}\n";
         $flickrPhoto = $this->createFromFlickrArray($value);
         if ($value['isprimary'] == 1) {
             $flickrSet->MainImage = $flickrPhoto;
         }
         $flickrPhoto->write();
         $flickrSet->FlickrPhotos()->add($flickrPhoto);
         gc_collect_cycles();
         $flickrPhoto->write();
         gc_collect_cycles();
         if (!$flickrPhoto->LocalCopyOfImage) {
             //mkdir appears to be relative to teh sapphire dir
             $structure = "../assets/flickr/{$year}/{$month}/{$day}/" . $flickrSetID;
             if (!file_exists('../assets/flickr')) {
                 echo "Creating path:" . $structure;
                 /*
                 					// To create the nested structure, the $recursive parameter
                 					// to mkdir() must be specified.
                 
                 					if (!mkdir($structure, 0, true)) {
                 					 //   die('Failed to create folders...');
                 					}
                 
                 					$cmd = "chown  gordon:www-data $structure";
                 					exec($cmd);
                 
                 					$cmd = "chown gordon:www-data ../assets/Uploads/flickr";
                 					exec($cmd);
                 
                 					exec('chmod 775 ../assets/Uploads/flickr');
                 					exec("chmod 775 $structure");
                 	error_log("Created dir?");
                 				} else {
                 					echo "Dir already exists";
                 				}
                 */
                 $galleries = Folder::find_or_make('flickr');
                 $galleries->Title = 'Flickr Images';
                 $galleries->write();
                 $galleries = NULL;
             }
             $download_images = Config::inst()->get($this->class, 'download_images');
             if ($download_images && !$flickrPhoto->LocalCopyOfImageID) {
                 $largeURL = $flickrPhoto->LargeURL;
                 $fpid = $flickrPhoto->FlickrID;
                 $cmd = "wget -O {$structure}/{$fpid}.jpg {$largeURL}";
                 exec($cmd);
                 $cmd = "chown  gordon:www-data {$structure}/{$fpid}.jpg";
                 // $cmd = "pwd";
                 echo "EXECCED:" . exec($cmd);
                 $image = new Image();
                 $image->Name = $this->Title;
                 $image->Title = $this->Title;
                 $image->Filename = str_replace('../', '', $structure . '/' . $fpid . ".jpg");
                 $image->Title = $flickrPhoto->Title;
                 //$image->Name = $flickrPhoto->Title;
                 $image->ParentID = $flickrSetAssetFolderID;
                 gc_collect_cycles();
                 $image->write();
                 gc_collect_cycles();
                 $flickrPhoto->LocalCopyOfImageID = $image->ID;
                 $flickrPhoto->write();
                 $image = NULL;
             }
             $result = $flickrPhoto->write();
         }
         $ctr++;
         $flickrPhoto = NULL;
     }
     //update orientation
     $sql = 'update FlickrPhoto set Orientation = 90 where ThumbnailHeight > ThumbnailWidth;';
     DB::query($sql);
     // now download exifs
     $ctr = 0;
     foreach ($photoset['photo'] as $key => $value) {
         echo "IMPORTING EXIF {$ctr}/{$numberOfPics}\n";
         $flickrPhotoID = $value['id'];
         $flickrPhoto = FlickrPhoto::get()->filter('FlickrID', $flickrPhotoID)->first();
         $flickrPhoto->loadExif();
         $flickrPhoto->write();
         $ctr++;
     }
     $this->fixSetMainImages();
     $this->fixDateSetTaken();
     die;
     // abort rendering
 }
 /**
  * creates test data on /dev/build or by adding test data in ModelAdmin.
  *
  * @return bool
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 02.07.2011
  */
 public static function createTestData()
 {
     if (self::$enableTestData === true) {
         if (SiteTree::get_by_link(_t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT'))) {
             // test data already created
             return false;
         }
         self::createTestTaxRates();
         // get SilvercartProductGroupHolder and tax rate
         $silvercartProductGroupHolder = SilvercartProductGroupHolder::get()->first();
         $taxRateID = SilvercartTax::get()->filter('Rate', '19')->first()->ID;
         //create a manufacturer
         $manufacturer = new SilvercartManufacturer();
         $manufacturer->Title = 'pixeltricks GmbH';
         $manufacturer->URL = 'http://www.pixeltricks.de/';
         $manufacturer->write();
         //create product groups
         $productGroupPayment = new SilvercartProductGroupPage();
         $productGroupPayment->Title = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_TITLE');
         $productGroupPayment->URLSegment = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT');
         $productGroupPayment->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupPayment->Status = "Published";
         $productGroupPayment->IdentifierCode = 'SilvercartProductGroupPayment';
         $productGroupPayment->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupPayment->ShowInMenus = true;
         $productGroupPayment->ShowInSearch = true;
         $productGroupPayment->Sort = 1;
         $productGroupPayment->write();
         $productGroupPayment->publish("Live", "Stage");
         $productGroupMarketing = new SilvercartProductGroupPage();
         $productGroupMarketing->Title = _t('SilvercartTestData.PRODUCTGROUPMARKETING_TITLE');
         $productGroupMarketing->URLSegment = _t('SilvercartTestData.PRODUCTGROUPMARKETING_URLSEGMENT');
         $productGroupMarketing->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupMarketing->Status = "Published";
         $productGroupMarketing->IdentifierCode = 'SilvercartproductGroupMarketing';
         $productGroupMarketing->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupMarketing->ShowInMenus = true;
         $productGroupMarketing->ShowInSearch = true;
         $productGroupMarketing->Sort = 2;
         $productGroupMarketing->write();
         $productGroupMarketing->publish("Live", "Stage");
         $productGroupOthers = new SilvercartProductGroupPage();
         $productGroupOthers->Title = _t('SilvercartTestData.PRODUCTGROUPOTHERS_TITLE');
         $productGroupOthers->URLSegment = _t('SilvercartTestData.PRODUCTGROUPOTHERS_URLSEGMENT');
         $productGroupOthers->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupOthers->Status = "Published";
         $productGroupOthers->IdentifierCode = 'SilvercartproductGroupOthers';
         $productGroupOthers->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupOthers->ShowInMenus = true;
         $productGroupOthers->ShowInSearch = true;
         $productGroupOthers->Sort = 3;
         $productGroupOthers->write();
         $productGroupOthers->publish("Live", "Stage");
         // Define products
         $products = array(array('en_US' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'en_GB' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'de_DE' => array('Title' => 'Paypal', 'ShortDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'LongDescription' => 'PayPal für Ihren Shop Sie haben einen Online-Shop und fragen sich, warum Sie PayPal anbieten sollen? Ganz einfach: Ihre Kunden bezahlen mit nur zwei Klicks. Sie schließen den Kauf zufrieden ab, kommen gerne wieder - und Sie steigern Ihren Umsatz! Das kann PayPal für Sie tun – und mehr!', 'MetaDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'MetaKeywords' => 'SilverCart, Modul, PayPal, Zahlart', 'MetaTitle' => 'Paypal'), 'PriceGrossAmount' => 9.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 9.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 9.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 9.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 250, 'StockQuantity' => 5, 'ProductNumberShop' => '10001', 'ProductNumberManufacturer' => 'SC_Mod_100', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logopaypal.jpg'), array('en_US' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'en_GB' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'de_DE' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'LongDescription' => 'ipayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht. Je nach genutztem Zahlungsanbieter können Sie Ihren Kunden über ipayment die Bezahlung mit folgenden Zahlungsmedien anbieten: Visa MasterCard Maestro American Express JCB Diners Club Visa Electron Solo Internetbasiertes Elektronisches Lastschriftverfahren (ELV) paysafecard Das Unternehmen, über das Sie Ihre Onlinezahlungen abwickeln möchten, können Sie dabei selbst auswählen - ipayment verfügt über Schnittstellen zu den wichtigsten Zahlungsanbietern. Sie schließen den Akzeptanzvertrag mit dem Anbieter Ihrer Wahl - ipayment sorgt für die reibungslose und sichere Abwicklung! Dazu nimmt ipayment die Zahlungsvorgänge direkt aus Ihrem System auf und verarbeitet sie im Hochleistungsrechenzentrum von 1&1 in Karlsruhe. Selbstverständlich erfüllt ipayment dabei die Zertifizierungsanforderungen gemäß dem PCI DSS (Payment Card Industry Data Security Standard). ', 'MetaDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'MetaKeywords' => 'SilverCart, Module, iPayment, Zahlart', 'MetaTitle' => 'iPayment'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 260, 'StockQuantity' => 3, 'ProductNumberShop' => '10002', 'ProductNumberManufacturer' => 'SC_Mod_101', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoipayment.gif'), array('en_US' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'en_GB' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'de_DE' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'LongDescription' => '<h3>Saferpay E-Payment-Lösungen für Profis und Einsteiger</h3><p>Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet." Dank Saferpay müssen sich Online-Händler wie Karteninhaber über die Sicherheit beim Einkaufen im Internet keine Sorgen mehr machen. Händler kennen und schätzen das sichere Bezahlen im Internet über Saferpay weltweit.</p><p>Saferpay integriert alle gängigen Zahlungsmittel in Ihren Webshop - über eine einzige Schnittstelle. Dadurch sind Anpassungen und Erweiterungen problemlos umsetzbar. Darüber hinaus ermöglicht Saferpay die sichere Onlineabwicklung von schriftlichen und telefonischen Bestellungen.</p><h3>Mehr Zahlungsmittel – mehr Umsatz!</h3><p>Steigern Sie Ihren Umsatz durch das Angebot einer Vielzahl an Zahlungsmitteln! Mit Saferpay bieten Sie Ihren Kunden alle gängigen Zahlungsmittel über eine einzige Schnittstelle – flexibel, einfach & sicher! Mit Saferpay können Sie alle gängigen Kreditkarten und Debitkarten akzeptieren. Sie können jederzeit neue Zahlungsmittel aufschalten oder bestehende wieder abschalten und somit flexibel auf die Bedürfnisse im E-Commerce reagieren.</p><h3>Mit Sicherheit mehr Gewinn!</h3><p>Um die bargeldlose, elektronische Zahlungsabwicklung für Sie als Händler im E-Commerce oder Phone-/Mail-Order Business so sicher und bequem wie möglich zu machen, bietet die SIX Card Solutions Ihnen als Händler Komplettlösungen aus einer Hand. Die E-Payment-Lösung unterstützt alle heutigen Sicherheitsstandards. Stärken Sie das Vertrauen Ihrer Kunden !</p>', 'MetaDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'MetaKeywords' => 'SilverCart, Module, Saferpay, Zahlart', 'MetaTitle' => 'Saferpay'), 'PriceGrossAmount' => 36.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 36.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 36.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 36.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 270, 'StockQuantity' => 12, 'ProductNumberShop' => '10003', 'ProductNumberManufacturer' => 'SC_Mod_102', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logosaferpay.jpg'), array('en_US' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'en_GB' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'de_DE' => array('Title' => 'Vorkasse', 'ShortDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'LongDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern. Dieses Modul bietet neben der Vorkasse auch Rechnung als Zahlungsart.', 'MetaDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'MetaKeywords' => 'SilverCart, Module, Prepayment, Zahlart', 'MetaTitle' => 'Vorkasse'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 290, 'StockQuantity' => 9, 'ProductNumberShop' => '10004', 'ProductNumberManufacturer' => 'SC_Mod_103', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoprepayment.png'), array('en_US' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'en_GB' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'de_DE' => array('Title' => 'Cross-Selling', 'ShortDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'LongDescription' => 'Verkaufs- bzw. Marketinginstrument, bei dem Informationen über bereits existierende Kunden oder über bekanntes Konsumentenverhalten genutzt wird, um zusätzliche Käufe anderer Produkte zu begünstigen. Quelle: www.desig-n.de ', 'MetaDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'MetaKeywords' => 'SilverCart, Modul, Cross-Selling, Marketing', 'MetaTitle' => 'Cross-Selling'), 'PriceGrossAmount' => 12.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 12.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 12.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 12.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 145, 'StockQuantity' => 26, 'ProductNumberShop' => '10006', 'ProductNumberManufacturer' => 'SC_Mod_104', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logocrossselling.png'), array('en_US' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'en_GB' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'de_DE' => array('Title' => 'eKomi', 'ShortDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'LongDescription' => 'Beginnen Sie noch heute, durch intelligente Kundenbefragung authentisches und wertvolles Kundenfeedback zu gewinnen und damit Ihre Kundenzufriedenheit und Ihren Umsatz zu steigern. ', 'MetaDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'MetaKeywords' => 'SilverCart, Modul, Ekomi, Marketing', 'MetaTitle' => 'eKomi'), 'Title' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'ShortDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'LongDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_LONGDESC'), 'MetaDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'MetaTitle' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'MetaKeywords' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_KEYWORDS'), 'Weight' => 345, 'StockQuantity' => 146, 'ProductNumberShop' => '10007', 'ProductNumberManufacturer' => 'SC_Mod_105', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoekomi.jpg'), array('en_US' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'en_GB' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'de_DE' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'LongDescription' => 'Wer im Internet handelt, ist mit einer unüberschaubaren Menge rechtlicher Vorgaben konfrontiert, die bei Nichteinhaltung zu einem teuren Unterfangen werden können. Gerade von Konkurrenten, die ihren Mitbewerb durch teuere Abmahnungen zu schädigen versuchen, geht für Ihr Unternehmen eine große Gefahr aus. Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. 67% der Online Käufer vertrauen auf Online-Konsumentenbewertungen (Quelle: www.nielsen.com vom 24.07.2009). Mit unserer Vote Connect Schnittstelle integrieren Sie das Protected Shops Kundenbewertungssystem in Ihren Shop. ', 'MetaDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'MetaKeywords' => 'SilverCart, Module, ProtectedShops, Marketing', 'MetaTitle' => 'Protected Shops'), 'PriceGrossAmount' => 49.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 49.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 49.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 49.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 75, 'StockQuantity' => 101, 'ProductNumberShop' => '10008', 'ProductNumberManufacturer' => 'SC_Mod_106', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoprotectedshops.jpg'), array('en_US' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'en_GB' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'de_DE' => array('Title' => 'DHL', 'ShortDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'LongDescription' => 'Paketschnittstelle zum Versandanbieter DHL für den Export von Bestellungen nach Easylog und den Import von Sendungsnachverfolgungsnummern in SilverCart.', 'MetaDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'MetaKeywords' => 'SilverCart, Module, Versand, DHL', 'MetaTitle' => 'DHL'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 95, 'StockQuantity' => 12, 'ProductNumberShop' => '10009', 'ProductNumberManufacturer' => 'SC_Mod_107', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logodhl.jpg'), array('en_US' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'en_GB' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'de_DE' => array('Title' => 'PDF-Rechnung', 'ShortDescription' => 'Automatische Generierung von PDF-Rechnungen', 'LongDescription' => 'Erstellt automatisiert PDF-Rechnungen bei Bestellungen.', 'MetaDescription' => 'Automatische Generierung von PDF-Rechnungen', 'MetaKeywords' => 'SilverCart, Module, PDF-Rechnung', 'MetaTitle' => 'PDF-Rechnung'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 173, 'StockQuantity' => 14, 'ProductNumberShop' => '10011', 'ProductNumberManufacturer' => 'SC_Mod_109', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logopdfinvoice.jpg'), array('en_US' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'en_GB' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'de_DE' => array('Title' => 'Gutscheine', 'ShortDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'LongDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaKeywords' => 'Silvercart, Module, Gutscheine', 'MetaTitle' => 'Gutscheine'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 373, 'StockQuantity' => 24, 'ProductNumberShop' => '10012', 'ProductNumberManufacturer' => 'SC_Mod_110', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logovouchers.png'));
         // Create folder for product images
         $exampleDataDir = Director::baseFolder() . '/assets/test-images/';
         $imageFolder = new Folder();
         $imageFolder->setName('test-images');
         $imageFolder->write();
         if (!file_exists($exampleDataDir)) {
             mkdir($exampleDataDir);
         }
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         // Create products
         foreach ($products as $product) {
             $productItem = new SilvercartProduct();
             $productItem->SilvercartTaxID = $taxRateID;
             $productItem->SilvercartManufacturerID = $manufacturer->ID;
             $productItem->Weight = $product['Weight'];
             $productItem->StockQuantity = $product['StockQuantity'];
             $productItem->ProductNumberShop = $product['ProductNumberShop'];
             $productItem->ProductNumberManufacturer = $product['ProductNumberManufacturer'];
             $productItem->SilvercartProductGroupID = $product['SilvercartProductGroupID'];
             $productItem->PriceGrossAmount = $product['PriceGrossAmount'];
             $productItem->PriceGrossCurrency = $product['PriceGrossCurrency'];
             $productItem->PriceNetAmount = $product['PriceNetAmount'];
             $productItem->PriceNetCurrency = $product['PriceNetCurrency'];
             $productItem->MSRPriceAmount = $product['MSRPriceAmount'];
             $productItem->MSRPriceCurrency = $product['MSRPriceCurrency'];
             $productItem->PurchasePriceAmount = $product['PurchasePriceAmount'];
             $productItem->PurchasePriceCurrency = $product['PurchasePriceCurrency'];
             $productItem->write();
             if ($fallbackLocale !== false) {
                 $product[$fallbackLocale] = $product['en_US'];
             }
             //create the language objects for the locales
             foreach ($locales as $locale) {
                 /*
                  * We need to check if a language object exists alredy because
                  * a hook of SilvercartProduct defaultly creates one.
                  */
                 $language = SilvercartProductLanguage::get()->filter(array('SilvercartProductID' => $productItem->ID, 'Locale' => $locale))->first();
                 if (!$language) {
                     $language = new SilvercartProductLanguage();
                     $language->Locale = $locale;
                 }
                 $language->SilvercartProductID = $productItem->ID;
                 if (array_key_exists($locale, $product)) {
                     foreach ($product[$locale] as $attribute => $value) {
                         $language->{$attribute} = $value;
                     }
                 }
                 $language->write();
             }
             // Add product image
             if (array_key_exists('productImage', $product)) {
                 copy(Director::baseFolder() . '/silvercart/img/exampledata/' . $product['productImage'], $exampleDataDir . $product['productImage']);
                 $productImage = new Image();
                 $productImage->setName($product['productImage']);
                 $productImage->setFilename($exampleDataDir . '/' . $product['productImage']);
                 $productImage->setParentID($imageFolder->ID);
                 $productImage->write();
                 $silvercartImage = new SilvercartImage();
                 $silvercartImage->SilvercartProductID = $productItem->ID;
                 $silvercartImage->ImageID = $productImage->ID;
                 $silvercartImage->write();
             }
         }
         // create widget sets
         $widgetSetFrontPageContentArea = new WidgetArea();
         $widgetSetFrontPageContentArea->write();
         $widgetSetFrontPageContent = new WidgetSet();
         $widgetSetFrontPageContent->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT_TITLE'));
         $widgetSetFrontPageContent->setField('WidgetAreaID', $widgetSetFrontPageContentArea->ID);
         $widgetSetFrontPageContent->write();
         $widgetSetFrontPageSidebarArea = new WidgetArea();
         $widgetSetFrontPageSidebarArea->write();
         $widgetSetFrontPageSidebar = new WidgetSet();
         $widgetSetFrontPageSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_SIDEBAR_TITLE'));
         $widgetSetFrontPageSidebar->setField('WidgetAreaID', $widgetSetFrontPageSidebarArea->ID);
         $widgetSetFrontPageSidebar->write();
         $widgetSetProductGroupPagesSidebarArea = new WidgetArea();
         $widgetSetProductGroupPagesSidebarArea->write();
         $widgetSetProductGroupPagesSidebar = new WidgetSet();
         $widgetSetProductGroupPagesSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_PRODUCTGROUPPAGES_SIDEBAR_TITLE'));
         $widgetSetProductGroupPagesSidebar->setField('WidgetAreaID', $widgetSetProductGroupPagesSidebarArea->ID);
         $widgetSetProductGroupPagesSidebar->write();
         // Attribute widget sets to pages
         $frontPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartFrontPage');
         if ($frontPage) {
             $frontPage->WidgetSetContent()->add($widgetSetFrontPageContent);
             $frontPage->WidgetSetSidebar()->add($widgetSetFrontPageSidebar);
         }
         $productGroupHolderPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartProductGroupHolder');
         if ($productGroupHolderPage) {
             $productGroupHolderPage->WidgetSetSidebar()->add($widgetSetProductGroupPagesSidebar);
         }
         // Create Widgets
         $widgetFrontPageContent1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent1->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_TITLE'));
         $widgetFrontPageContent1->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_CONTENT'));
         $widgetFrontPageContent1->setField('numberOfProductsToShow', 4);
         $widgetFrontPageContent1->setField('SilvercartProductGroupPageID', $productGroupPayment->ID);
         $widgetFrontPageContent1->setField('GroupView', 'tile');
         $widgetFrontPageContent1->setField('isContentView', 1);
         $widgetFrontPageContent1->setField('useSlider', 0);
         $widgetFrontPageContent1->setField('buildArrows', 0);
         $widgetFrontPageContent1->setField('buildNavigation', 1);
         $widgetFrontPageContent1->setField('buildStartStop', 0);
         $widgetFrontPageContent1->setField('slideDelay', 6000);
         $widgetFrontPageContent1->setField('transitionEffect', 'fade');
         $widgetFrontPageContent1->setField('Sort', 2);
         $widgetFrontPageContent1->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent1);
         $widgetFrontPageContent2 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent2->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_TITLE'));
         $widgetFrontPageContent2->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_CONTENT'));
         $widgetFrontPageContent2->setField('numberOfProductsToShow', 1);
         $widgetFrontPageContent2->setField('numberOfProductsToFetch', 4);
         $widgetFrontPageContent2->setField('SilvercartProductGroupPageID', $productGroupOthers->ID);
         $widgetFrontPageContent2->setField('GroupView', 'list');
         $widgetFrontPageContent2->setField('isContentView', 1);
         $widgetFrontPageContent2->setField('useSlider', 1);
         $widgetFrontPageContent2->setField('buildArrows', 0);
         $widgetFrontPageContent2->setField('buildNavigation', 1);
         $widgetFrontPageContent2->setField('buildStartStop', 0);
         $widgetFrontPageContent2->setField('slideDelay', 6000);
         $widgetFrontPageContent2->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageContent2->setField('Sort', 3);
         $widgetFrontPageContent2->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent2);
         $widgetFrontPageContent3 = new SilvercartImageSliderWidget();
         $widgetFrontPageContent3->setField('buildArrows', 0);
         $widgetFrontPageContent3->setField('buildNavigation', 1);
         $widgetFrontPageContent3->setField('buildStartStop', 0);
         $widgetFrontPageContent3->setField('slideDelay', 10000);
         $widgetFrontPageContent3->setField('transitionEffect', 'fade');
         $widgetFrontPageContent3->setField('Sort', 0);
         $widgetFrontPageContent3->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent3);
         copy(Director::baseFolder() . '/silvercart/img/exampledata/silvercart_teaser.jpg', $exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage = new Image();
         $teaserImage->setFilename($exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage->setParentID($imageFolder->ID);
         $teaserImage->write();
         $slideImage = new SilvercartImageSliderImage();
         #$slideImage->setField('Title',   'Silvercart Teaser');
         $slideImage->setField('ImageID', $teaserImage->ID);
         $slideImage->write();
         $sliderImageTranslations = array('en_GB' => 'SilverCart Teaser', 'en_US' => 'SilverCart Teaser', 'de_DE' => 'SilverCart Teaser');
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         if ($fallbackLocale !== false) {
             $sliderImageTranslations[$fallbackLocale] = $sliderImageTranslations['en_US'];
         }
         foreach ($sliderImageTranslations as $locale => $translation) {
             $translationObj = SilvercartImageSliderImageLanguage::get()->filter('Locale', $locale)->first();
             if (!$translationObj) {
                 $translationObj = new SilvercartImageSliderImageLanguage();
                 $translationObj->Locale = $locale;
                 $translationObj->SilvercartImageSliderImageID = $slideImage->ID;
             }
             $translationObj->Title = $translation;
             $translationObj->write();
         }
         $widgetFrontPageContent3->slideImages()->add($slideImage);
         $widgetFrontPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetFrontPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetFrontPageSidebar1->setField('useSlider', 0);
         $widgetFrontPageSidebar1->setField('GroupView', 'list');
         $widgetFrontPageSidebar1->setField('isContentView', 0);
         $widgetFrontPageSidebar1->setField('buildArrows', 0);
         $widgetFrontPageSidebar1->setField('buildNavigation', 1);
         $widgetFrontPageSidebar1->setField('buildStartStop', 0);
         $widgetFrontPageSidebar1->setField('slideDelay', 4000);
         $widgetFrontPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageSidebar1->setField('Sort', 0);
         $widgetFrontPageSidebar1->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar1);
         $widgetFrontPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetFrontPageSidebar2->setField('Sort', 1);
         $widgetFrontPageSidebar2->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar2);
         $widgetFrontPageSidebar3 = new SilvercartLoginWidget();
         $widgetFrontPageSidebar3->setField('Sort', 2);
         $widgetFrontPageSidebar3->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar3);
         // product group page widgets
         $widgetProductGroupPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetProductGroupPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetProductGroupPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetProductGroupPageSidebar1->setField('useSlider', 0);
         $widgetProductGroupPageSidebar1->setField('GroupView', 'list');
         $widgetProductGroupPageSidebar1->setField('isContentView', 0);
         $widgetProductGroupPageSidebar1->setField('buildArrows', 0);
         $widgetProductGroupPageSidebar1->setField('buildNavigation', 1);
         $widgetProductGroupPageSidebar1->setField('buildStartStop', 0);
         $widgetProductGroupPageSidebar1->setField('slideDelay', 4000);
         $widgetProductGroupPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetProductGroupPageSidebar1->setField('Sort', 0);
         $widgetProductGroupPageSidebar1->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar1);
         $widgetProductGroupPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetProductGroupPageSidebar2->setField('Sort', 1);
         $widgetProductGroupPageSidebar2->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar2);
         $widgetProductGroupPageSidebar3 = new SilvercartLoginWidget();
         $widgetProductGroupPageSidebar3->setField('Sort', 2);
         $widgetProductGroupPageSidebar3->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar3);
         //self::createTestDataSlidorion($widgetSetFrontPageContentArea);
         return true;
     }
 }
 public function loadTranscodedFiles()
 {
     // get (a) source file to deduct name etc from...
     $source = false;
     if (!$source && $this->SourceID) {
         $source = $this->Source();
     }
     if (!$source && $this->MP4ID) {
         $source = $this->MP4();
     }
     if (!$source && $this->WEBMID) {
         $source = $this->WEBM();
     }
     if (!$source && $this->OGVID) {
         $source = $this->OGV();
     }
     $ext = pathinfo($source->getFilename(), PATHINFO_EXTENSION);
     $vid_name = basename($source->getFilename(), "." . $ext);
     // with extension stripped
     $vid_path = Config::inst()->get('Transcoding', 'transcode_relative_video_path_base');
     $poster_path = "{$vid_path}{$vid_name}-01.jpg";
     $mp4_path = "{$vid_path}{$vid_name}.mp4";
     $webm_path = "{$vid_path}{$vid_name}.webm";
     $ogv_path = "{$vid_path}{$vid_name}.ogv";
     if (!$this->PosterID && file_exists(BASE_PATH . "/" . $poster_path)) {
         $file = new Image();
         $file->setFilename($poster_path);
         $file->write();
         $this->PosterID = $file->ID;
     }
     if (!$this->MP4ID && file_exists(BASE_PATH . "/" . $mp4_path)) {
         $file = new File();
         $file->setFilename($mp4_path);
         $file->write();
         $this->MP4ID = $file->ID;
     }
     if (!$this->WEBMID && file_exists(BASE_PATH . "/" . $webm_path)) {
         $file = new File();
         $file->setFilename($webm_path);
         $file->write();
         $this->WEBMID = $file->ID;
     }
     if (!$this->OGVID && file_exists(BASE_PATH . "/" . $ogv_path)) {
         $file = new File();
         $file->setFilename($ogv_path);
         $file->write();
         $this->OGVID = $file->ID;
     }
     $this->write();
 }
예제 #11
0
 /**
  * @param string $format
  * @return \Sokil\Image\AbstractWriteStrategy
  */
 public function writeImage(Image $image, $format, $configuratorCallable = null)
 {
     $writeStrategyClassName = $this->getWriteStrategyClassNameByWriteFormat($format);
     $writeStrategy = new $writeStrategyClassName();
     if (!$writeStrategy instanceof \Sokil\Image\AbstractWriteStrategy) {
         throw new \Exception('Write strategy must extend AbstractWriteStrategy');
     }
     // configure
     if ($configuratorCallable) {
         if (!is_callable($configuratorCallable)) {
             throw new \Exception('Wrong configurator specified');
         }
         call_user_func($configuratorCallable, $writeStrategy);
     }
     $image->write($writeStrategy);
     return $this;
 }
 public function requireDefaultRecords()
 {
     // If "no product image" is not in DB, add it
     if (!Image::get()->filter('Name', 'no-image.png')->first()) {
         $image = new Image();
         $image->Name = 'no-image.png';
         $image->Title = 'No Image';
         $image->Filename = 'commerce/images/no-image.png';
         $image->ShowInSearch = 0;
         $image->write();
         DB::alteration_message('No image file added to DB', 'created');
     }
 }
 /**
  * Creates the upload folder for payment images if it doesn't exist.
  *
  * @param array  $paymentLogos      The payment logos as associative array:
  *                                  ['LogoName' => 'PATH_TO_FILE', ....]
  * @param string $paymentModuleName The name of the payment module
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 16.06.2014
  */
 public function createLogoImageObjects($paymentLogos, $paymentModuleName)
 {
     //make sure that the folder "Uploads" exists
     Folder::find_or_make('Uploads');
     $paymentModule = SilvercartPaymentMethod::get()->filter(array("ClassName" => $paymentModuleName))->sort(array("ID" => "ASC"))->first();
     if ($paymentModule) {
         if (count($this->getPossiblePaymentChannels()) > 0) {
             // Multiple payment channels
             foreach ($paymentLogos as $paymentChannel => $logos) {
                 $paymentChannelMethod = DataObject::get_one($paymentModuleName, sprintf("\"PaymentChannel\"='%s'", $paymentChannel), true, $paymentModuleName . ".ID");
                 if ($paymentChannelMethod) {
                     if (!$paymentChannelMethod->PaymentLogos()->exists()) {
                         foreach ($logos as $title => $logo) {
                             $paymentLogo = new SilvercartImage();
                             $paymentLogo->Title = $title;
                             $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                             if ($storedLogo) {
                                 $paymentLogo->ImageID = $storedLogo->ID;
                             } else {
                                 file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                                 $image = new Image();
                                 $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                                 $image->setName(basename($logo));
                                 $image->Title = basename($logo, '.png');
                                 $image->ParentID = $this->uploadsFolder->ID;
                                 $image->write();
                                 $paymentLogo->ImageID = $image->ID;
                             }
                             $paymentLogo->write();
                             $paymentChannelMethod->PaymentLogos()->add($paymentLogo);
                         }
                     }
                 }
             }
         } else {
             // Single payment channels
             foreach ($paymentLogos as $title => $logo) {
                 if (!$paymentModule->PaymentLogos()->exists()) {
                     $paymentLogo = new SilvercartImage();
                     $paymentLogo->Title = $title;
                     $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                     if ($storedLogo) {
                         $paymentLogo->ImageID = $storedLogo->ID;
                     } else {
                         file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                         $image = new Image();
                         $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                         $image->setName(basename($logo));
                         $image->Title = basename($logo, '.png');
                         $image->ParentID = $this->uploadsFolder->ID;
                         $image->write();
                         $paymentLogo->ImageID = $image->ID;
                     }
                     $paymentLogo->write();
                     $paymentModule->PaymentLogos()->add($paymentLogo);
                 }
             }
         }
     }
 }
 public function updateFromUpdate(stdClass $update, $save = true)
 {
     // print_r($update);
     $pageid = SiteConfig::current_site_config()->FacebookPageId;
     $postid = str_replace($pageid . '_', '', $update->id);
     try {
         $picUrl = $this->resolveUrl('https://graph.facebook.com/' . $postid . '/picture');
     } catch (Exception $e) {
         $picUrl = '';
     }
     if ($picUrl && $picUrl != 'https://fbstatic-a.akamaihd.net/rsrc.php/v2/yA/r/gPCjrIGykBe.gif' && $picUrl != 'https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/_xS7LcbxKS4.gif') {
         // get url
         $img = $picUrl;
         // sanity check
         if (!is_dir(ASSETS_PATH . '/social-updates/')) {
             mkdir(ASSETS_PATH . '/social-updates/');
         }
         // prep img data
         $noq = explode('?', $img);
         $pi = pathinfo($noq[0]);
         $absPath = ASSETS_PATH . '/social-updates/' . $pi['basename'];
         $relPath = ASSETS_DIR . '/social-updates/' . $pi['basename'];
         // pull down image
         if (!file_exists($absPath)) {
             $imgData = file_get_contents($img);
             file_put_contents($absPath, $imgData);
         }
         // does the file exist
         if (file_exists($absPath)) {
             // try to find the existing image
             if (!($image = DataObject::get_one('Image', "Filename='" . $relPath . "'"))) {
                 // create image record
                 $image = new Image();
                 $image->setFilename($relPath);
                 $image->write();
             }
             // associate
             if ($image->ID) {
                 $this->PrimaryImageID = $image->ID;
             }
         }
     }
     // extract content
     $content = empty($update->message) ? empty($update->description) ? empty($update->story) ? null : $update->story : $update->description : $update->message;
     if (!$content) {
         echo 'Encountered error with: ' . print_r($update, 1);
         return false;
     } else {
         $this->Title = 'Facebook Update - ' . $update->id;
         $this->URLSegment = 'FBUpdate-' . $update->id;
         $this->UpdateID = $update->id;
         $this->OriginalCreated = date('Y-m-d H:i:s', strtotime($update->created_time));
         $this->Content = $content;
         $this->OriginalUpdate = json_encode($update);
         $this->findParent();
         return $save ? $this->write() : true;
     }
 }
 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $data = ClassInfo::subclassesFor("SiteTree");
     $templateOverviewPage = TemplateOverviewPage::get()->First();
     $fileList = null;
     if ($this->Config()->get("image_source_folder")) {
         $fileList = CMSHelp::get_list_of_files($this->Config()->get("image_source_folder"));
         if (!is_array($fileList)) {
             $fileList = null;
         } elseif (!count($fileList)) {
             $fileList = null;
         }
     }
     if ($fileList) {
         $destinationDir = Director::baseFolder() . "/assets/" . $this->Config()->get("image_folder_name") . "/";
         $destinationFolder = Folder::find_or_make($this->Config()->get("image_folder_name"));
     }
     if ($data && $templateOverviewPage) {
         foreach ($data as $className) {
             $object = TemplateOverviewDescription::get()->filter(array("ClassNameLink" => $className))->First();
             if (!$object) {
                 $object = new TemplateOverviewDescription();
                 $object->ClassNameLink = $className;
                 $object->ParentID = $templateOverviewPage->ID;
                 $object->write();
                 DB::alteration_message("adding template description for {$className}", "created");
             } else {
                 $otherObjects = TemplateOverviewDescription::get()->filter(array("ClassNameLink" => $className))->exclude(array("ID" => $object->ID));
                 foreach ($otherObjects as $otherObject) {
                     DB::alteration_message("Deleting superfluous TemplateOverviewDescription with Class Name Link: {$className}", "deleted");
                     $otherObject->delete();
                 }
             }
             if ($fileList) {
                 $i = 0;
                 foreach ($fileList as $fileArray) {
                     $explodeByDot = explode(".", $fileArray["FileName"]);
                     if (is_array($explodeByDot) && count($explodeByDot)) {
                         $base = $explodeByDot[0];
                         $explodeByUnderscore = explode("_", $base);
                         if (is_array($explodeByUnderscore) && count($explodeByUnderscore)) {
                             $base = $explodeByUnderscore[0];
                             $classNameOptionArray = array($className);
                             for ($j = 0; $j < 10; $j++) {
                                 $classNameOptionArray[] = $className . $j;
                             }
                             foreach ($classNameOptionArray as $potentialBase) {
                                 if ($base == $potentialBase) {
                                     $i++;
                                     $filename = "" . $this->Config()->get("image_folder_name") . "/" . $fileArray["FileName"];
                                     if (!file_exists($destinationDir . $fileArray["FileName"])) {
                                         copy($fileArray["FullLocation"], $destinationDir . $fileArray["FileName"]);
                                     }
                                     $image = $Image::get()->filter(array("ParentID" => $destinationFolder - ID, "Name" => $fileArray["FileName"]))->First();
                                     if (!$image) {
                                         $image = new Image();
                                         $image->ParentID = $destinationFolder->ID;
                                         $image->Filename = $filename;
                                         $image->Name = $fileArray["FileName"];
                                         $image->Title = $fileArray["Title"];
                                         $image->write();
                                     }
                                     $fieldName = "Image{$i}" . "ID";
                                     if ($object->{$fieldName} != $image->ID) {
                                         $object->{$fieldName} = $image->ID;
                                         $object->write();
                                         DB::alteration_message("adding image to {$className}: " . $image->Title . " (" . $image->Filename . ") using {$fieldName} field.", "created");
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 DB::alteration_message("no design images found for {$className}", "deleted");
             }
         }
     }
     $helpDirectory = Director::baseFolder() . "/" . Config::inst()->get("CMSHelp", "help_file_directory_name") . "/";
     if (!file_exists($helpDirectory)) {
         mkdir($helpDirectory);
     }
     $this->createManifestExcludeFile($helpDirectory);
     $devDirectory = Director::baseFolder() . "/" . Config::inst()->get("CMSHelp", "dev_file_directory_name") . "/";
     if (!file_exists($devDirectory)) {
         mkdir($devDirectory);
     }
     $this->createManifestExcludeFile($devDirectory);
     $this->createHTACCESSDenyAll($devDirectory);
 }
 public function updateFromTweet(stdClass $tweet, $save = true)
 {
     if (!empty($tweet->entities->media[0])) {
         // extract media
         $media = $tweet->entities->media[0];
         // only process photos
         if ($media->type == 'photo') {
             // get url
             $img = $media->media_url;
             // sanity check
             if (!is_dir(ASSETS_PATH . '/social-updates/')) {
                 mkdir(ASSETS_PATH . '/social-updates/');
             }
             // prep img data
             $pi = pathinfo($img);
             $absPath = ASSETS_PATH . '/social-updates/' . $pi['basename'];
             $relPath = ASSETS_DIR . '/social-updates/' . $pi['basename'];
             // pull down image
             if (!file_exists($absPath)) {
                 $imgData = file_get_contents($img);
                 file_put_contents($absPath, $imgData);
             }
             // does the file exist
             if (file_exists($absPath)) {
                 // try to find the existing image
                 if (!($image = DataObject::get_one('Image', "Filename='" . $relPath . "'"))) {
                     // create image record
                     $image = new Image();
                     $image->setFilename($relPath);
                     $image->write();
                 }
                 // associate
                 if ($image->ID) {
                     $this->PrimaryImageID = $image->ID;
                 }
             }
         }
     }
     $this->Title = 'Tweet - ' . $tweet->id_str;
     $this->URLSegment = 'Tweet-' . $tweet->id_str;
     $this->TweetID = $tweet->id_str;
     $this->OriginalCreated = date('Y-m-d H:i:s', strtotime($tweet->created_at));
     $this->Content = $tweet->text;
     $this->OriginalTweet = json_encode($tweet);
     $this->findParent();
     return $save ? $this->write() : true;
 }
예제 #17
0
 private function createThumbnail()
 {
     $img_title = "flv_thumb_" . $this->ID;
     if ($existing = DataObject::get("Image", "Title = '{$img_title}'")) {
         foreach ($existing as $file) {
             $file->delete();
         }
     }
     $folder = Folder::findOrMake(self::$thumbnail_folder);
     $img_filename = self::clean_file(self::remove_file_extension($this->Title)) . ".jpg";
     $abs_thumb = Director::baseFolder() . "/" . $folder->Filename . $img_filename;
     $args = sprintf("-y -i %s -an -s %s -ss %d -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg %s", $this->absoluteFLVPath(), self::$default_thumbnail_width . "x" . self::$default_thumbnail_height, self::$thumbnail_seconds, $abs_thumb);
     self::ffmpeg($args);
     $img = new Image();
     $img->setField('ParentID', $folder->ID);
     $img->Filename = $folder->Filename . $img_filename;
     $img->Title = $img_title;
     $img->write();
 }
 public function updateFromUpdate(stdClass $update, $save = true)
 {
     $content = empty($update->caption) ? '' : $update->caption->text;
     $img = empty($update->images) ? '' : $update->images->standard_resolution->url;
     if (!$content && !$img) {
         echo 'Encountered error with: ' . print_r($update, 1);
         return false;
     } else {
         // sanity check
         if (!is_dir(ASSETS_PATH . '/social-updates/')) {
             mkdir(ASSETS_PATH . '/social-updates/');
         }
         // prep img data
         $pi = pathinfo($img);
         $absPath = ASSETS_PATH . '/social-updates/' . $pi['basename'];
         $relPath = ASSETS_DIR . '/social-updates/' . $pi['basename'];
         // pull down image
         if (!file_exists($absPath)) {
             $imgData = file_get_contents($img);
             file_put_contents($absPath, $imgData);
         }
         // does the file exist
         if (file_exists($absPath)) {
             // try to find the existing image
             if (!($image = DataObject::get_one('Image', "Filename='" . $relPath . "'"))) {
                 // create image record
                 $image = new Image();
                 $image->setFilename($relPath);
                 $image->write();
             }
             // associate
             if ($image->ID) {
                 $this->PrimaryImageID = $image->ID;
             }
         }
         // update
         $this->Title = 'Instagram Update - ' . $update->id;
         $this->URLSegment = 'InstagramUpdate-' . $update->id;
         $this->UpdateID = $update->id;
         $this->OriginalCreated = date('Y-m-d H:i:s', $update->created_time);
         $this->Content = $content;
         $this->OriginalUpdate = json_encode($update);
         $this->findParent();
         return $save ? $this->write() : true;
     }
 }
예제 #19
0
 public function createImageFile($photo, $url, $item)
 {
     $tmpImage = tmpfile();
     $fileContents = file_get_contents($url);
     fwrite($tmpImage, $fileContents);
     // check if this is a valid image
     $metaData = stream_get_meta_data($tmpImage);
     $imageSizeInfo = getimagesize($metaData['uri']);
     if (!$imageSizeInfo) {
         continue;
     }
     $imageFolder = Folder::find_or_make($this->folder . '/' . $item->getId());
     $name = basename($url);
     $fileSize = filesize($metaData['uri']);
     $tmpName = $metaData['uri'];
     $relativeImagePath = $imageFolder->getRelativePath() . $name;
     $imagePath = BASE_PATH . '/' . $relativeImagePath;
     fclose($tmpImage);
     if (file_exists($imagePath)) {
         $pathInfo = pathinfo($url);
         if (isset($pathInfo['extension'])) {
             $name = basename($tmpName) . '.' . $pathInfo['extension'];
             $relativeImagePath = $imageFolder->getRelativePath() . $name;
             $imagePath = BASE_PATH . '/' . $relativeImagePath;
         }
     }
     $image = fopen($imagePath, 'w');
     fwrite($image, $fileContents);
     fclose($image);
     $image = new Image();
     $image->setParentID($imageFolder->ID);
     $image->setName($name);
     $image->Title = $photo->getAlt();
     $image->setFilename($relativeImagePath);
     $image->write();
     return $image;
 }
 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $bt = defined('DB::USE_ANSI_SQL') ? '"' : '`';
     $update = array();
     $siteConfig = DataObject::get_one('SiteConfig');
     $folder = Folder::findOrMake(self::get_folder_name());
     if ($siteConfig && $folder) {
         $fullArray = self::get_images_to_replace();
         //copying ....
         if ($fullArray) {
             foreach ($fullArray as $key => $array) {
                 $className = $array["ClassName"];
                 $fieldName = $array["FieldName"] . "ID";
                 if (class_exists($className)) {
                     $dataObject = singleton($className);
                     $dbFieldName = $array["DBFieldName"];
                     $fileName = basename($array["CopyFromPath"]);
                     $fromLocationLong = Director::baseFolder() . '/' . $array["CopyFromPath"];
                     $toLocationShort = "assets/" . self::get_folder_name() . "/{$fileName}";
                     $toLocationLong = Director::baseFolder() . '/' . $toLocationShort;
                     $image = DataObject::get_one('Image', "Filename='{$toLocationShort}' AND ParentID = " . $folder->ID);
                     if (!$image) {
                         if (!file_exists($toLocationLong)) {
                             copy($fromLocationLong, $toLocationLong);
                         }
                         $image = new Image();
                         $image->ParentID = $folder->ID;
                         $image->FileName = $toLocationShort;
                         $image->setName($fileName);
                         $image->write();
                     } elseif (!$image && file_exists($toLocationLong)) {
                         debug::show("need to update files");
                     }
                     if ($image && $image->ID) {
                         if (!$siteConfig->{$dbFieldName}) {
                             $siteConfig->{$dbFieldName} = $image->ID;
                             $update[] = "created placeholder image for {$key}";
                         }
                         $updateSQL = " UPDATE {$bt}" . $className . "{$bt}";
                         if (isset($_GET["removeplaceholderimages"])) {
                             $setSQL = " SET {$bt}" . $fieldName . "{$bt} = 0";
                             $whereSQL = " WHERE {$bt}" . $fieldName . "{$bt}  = " . $image->ID;
                             DB::alteration_message("removing " . $className . "." . $fieldName . " placeholder images", 'deleted');
                         } else {
                             DB::alteration_message("adding " . $className . "." . $fieldName . " placeholder images", 'created');
                             $setSQL = " SET {$bt}" . $fieldName . "{$bt} = " . $image->ID;
                             if (!isset($_GET["forceplaceholder"])) {
                                 $whereSQL = " WHERE {$bt}" . $fieldName . "{$bt} IS NULL OR {$bt}" . $fieldName . "{$bt} = 0";
                             } else {
                                 $whereSQL = '';
                             }
                         }
                         $sql = $updateSQL . $setSQL . $whereSQL;
                         DB::query($sql);
                         $versioningPresent = false;
                         $array = $dataObject->stat('extensions');
                         if (is_array($array) && count($array)) {
                             if (in_array("Versioned('Stage', 'Live')", $array)) {
                                 $versioningPresent = true;
                             }
                         }
                         if ($dataObject->stat('versioning')) {
                             $versioningPresent = true;
                         }
                         if ($versioningPresent) {
                             $sql = str_replace("{$bt}{$className}{$bt}", "{$bt}{$className}_Live{$bt}", $sql);
                             DB::query($sql);
                         }
                     } else {
                         debug::show("could not create image!" . print_r($array));
                     }
                 } else {
                     debug::show("bad classname reference " . $className);
                 }
             }
         }
         if (count($update)) {
             $siteConfig->write();
             DB::alteration_message($siteConfig->ClassName . " created/updated: " . implode(" --- ", $update), 'created');
         }
     } elseif (!$folder) {
         debug::show("COULD NOT CREATE FOLDER: " . self::get_folder_name());
     }
 }