当前位置: 首页>>代码示例>>PHP>>正文


PHP Director::getAbsFile方法代码示例

本文整理汇总了PHP中Director::getAbsFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::getAbsFile方法的具体用法?PHP Director::getAbsFile怎么用?PHP Director::getAbsFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Director的用法示例。


在下文中一共展示了Director::getAbsFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Create the new notification email.
  * 
  * @param Member $customer
  * @param Order $order
  * @param String $from
  * @param String $to
  * @param String $subject
  * @param String $body
  * @param String $bounceHandlerURL
  * @param String $cc
  * @param String $bcc
  */
 public function __construct(Member $customer, Order $order, $from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     $siteConfig = ShopConfig::get()->first();
     if ($siteConfig->NotificationTo) {
         $this->to = $siteConfig->NotificationTo;
     }
     if ($siteConfig->NotificationSubject) {
         $this->subject = $siteConfig->NotificationSubject . ' - Order #' . $order->ID;
     }
     if ($siteConfig->NotificationBody) {
         $this->body = $siteConfig->NotificationBody;
     }
     if ($customer->Email) {
         $this->from = $customer->Email;
     } elseif (Email::getAdminEmail()) {
         $this->from = Email::getAdminEmail();
     } else {
         $this->from = 'no-reply@' . $_SERVER['HTTP_HOST'];
     }
     $this->signature = '';
     $adminLink = Director::absoluteURL('/admin/shop/');
     //Get css for Email by reading css file and put css inline for emogrification
     $this->setTemplate('Order_NotificationEmail');
     if (file_exists(Director::getAbsFile($this->ThemeDir() . '/css/ShopEmail.css'))) {
         $css = file_get_contents(Director::getAbsFile($this->ThemeDir() . '/css/ShopEmail.css'));
     } else {
         $css = file_get_contents(Director::getAbsFile('swipestripe/css/ShopEmail.css'));
     }
     $this->populateTemplate(array('Message' => $this->Body(), 'Order' => $order, 'Customer' => $customer, 'InlineCSS' => "<style>{$css}</style>", 'Signature' => $this->signature, 'AdminLink' => $adminLink));
     parent::__construct($from, null, $subject, $body, $bounceHandlerURL, $cc, $bcc);
 }
开发者ID:vinstah,项目名称:body,代码行数:44,代码来源:NotificationEmail.php

示例2: FeedItems

	function FeedItems() {
		$output = new DataObjectSet();
		
		include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php'));
		
		$t1 = microtime(true);
		$this->feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER);
		$this->feed->init();
		if($items = $this->feed->get_items(0, $this->NumberToShow)) {
			foreach($items as $item) {
				
				// Cast the Date
				$date = new Date('Date');
				$date->setValue($item->get_date());

				// Cast the Title
				$title = new Text('Title');
				$title->setValue($item->get_title());

				$output->push(new ArrayData(array(
					'Title' => $title,
					'Date' => $date,
					'Link' => $item->get_link()
				)));
			}
			return $output;
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:28,代码来源:RSSWidget.php

示例3: css

 function css($file, $media = null)
 {
     /* If file is CSS, check if there is a LESS file */
     if (preg_match('/\\.css$/i', $file)) {
         $less = preg_replace('/\\.css$/i', '.less', $file);
         if (is_file(Director::getAbsFile($less))) {
             $file = $less;
         }
     }
     /* If less file, then check/compile it */
     if (preg_match('/\\.less$/i', $file)) {
         $compiler = 'checkedCompile';
         $out = preg_replace('/\\.less$/i', '.css', $file);
         /* Force recompile if ?flush */
         if (isset($_GET['flush'])) {
             $compiler = 'compileFile';
         }
         /* Create instance */
         $less = new lessc();
         /* Automatically compress if in live mode */
         if (DIRECTOR::isLive()) {
             $less->setFormatter("compressed");
         }
         try {
             $less->{$compiler}(Director::getAbsFile($file), Director::getAbsFile($out));
         } catch (Exception $ex) {
             trigger_error("lessphp fatal error: " . $ex->getMessage(), E_USER_ERROR);
         }
         $file = $out;
     }
     /* Return css path */
     return parent::css($file, $media);
 }
开发者ID:helpfulrobot,项目名称:tardinha-silverstripe-lesscss,代码行数:33,代码来源:LessCompiler.php

示例4: __construct

 /**
  * Open a CSV file for parsing.
  * You can use the object returned in a foreach loop to extract the data
  * @param $filename The name of the file.  If relative, it will be relative to the site's base dir
  * @param $delimiter The character for seperating columns
  * @param $enclosure The character for quoting or enclosing columns
  */
 function __construct($filename, $delimiter = ",", $enclosure = '"')
 {
     $filename = Director::getAbsFile($filename);
     $this->filename = $filename;
     $this->delimiter = $delimiter;
     $this->enclosure = $enclosure;
     parent::__construct();
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:15,代码来源:CSVParser.php

示例5: javascriptTemplate

 /**
  * Load the given javascript template with the page.
  * @param file The template file to load.
  * @param vars The array of variables to load.  These variables are loaded via string search & replace.
  */
 static function javascriptTemplate($file, $vars, $uniquenessID = null)
 {
     $script = file_get_contents(Director::getAbsFile($file));
     foreach ($vars as $k => $v) {
         $search[] = '$' . $k;
         $replace[] = str_replace("\\'", "'", Convert::raw2js($v));
     }
     $script = str_replace($search, $replace, $script);
     Requirements::customScript($script, $uniquenessID);
 }
开发者ID:ramziammar,项目名称:websites,代码行数:15,代码来源:Requirements.php

示例6: css

 function css($file, $media = null)
 {
     /* Only initiate if webiste is in dev mode or a ?flush is called */
     if (preg_match('/\\.less$/i', $file) || Director::isDev() || isset($_GET['flush'])) {
         /* If file is CSS, check if there is a LESS file */
         if (preg_match('/\\.css$/i', $file)) {
             $less = preg_replace('/\\.css$/i', '.less', $file);
             if (is_file(Director::getAbsFile($less))) {
                 $file = $less;
             }
         }
         /* If less file exists, then check/compile it */
         if (preg_match('/\\.less$/i', $file)) {
             $out = preg_replace('/\\.less$/i', '.css', $file);
             $css_file = Director::getAbsFile($out);
             $options = array();
             /* Automatically compress if in live mode */
             if (Director::isLive()) {
                 $options['compress'] = true;
             }
             try {
                 /* Force recompile & only write to css if updated */
                 if (isset($_GET['flush']) || !Director::isLive()) {
                     /* Force deleting of all cache files on flush */
                     if (file_exists(self::$cacheDir) && isset($_GET['flush']) && !self::$already_flushed) {
                         $paths = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(self::$cacheDir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
                         foreach ($paths as $path) {
                             $path->isDir() && !$path->isLink() ? rmdir($path->getPathname()) : unlink($path->getPathname());
                         }
                         /* make sure we only flush once per request and not for each *.less */
                         self::$already_flushed = true;
                     }
                     /* Set cache directory */
                     $options['cache_dir'] = self::$cacheDir;
                     /* Set cache method */
                     $options['cache_method'] = self::$cacheMethod;
                     /* Calculate the LESS file's parent URL */
                     $css_dir = dirname(Director::baseURL() . $file) . '/';
                     /* Generate and return cached file path */
                     $cached_file = self::$cacheDir . '/' . Less_Cache::Get(array(Director::getAbsFile($file) => $css_dir), $options, self::$variables);
                     /* check cache vs. css and overwrite if necessary */
                     if (!is_file($css_file) || md5_file($css_file) != md5_file($cached_file)) {
                         copy($cached_file, $css_file);
                     }
                 }
             } catch (Exception $ex) {
                 trigger_error('Less.php fatal error: ' . $ex->getMessage(), E_USER_ERROR);
             }
             $file = $out;
         }
     }
     /* Return css file path */
     return parent::css($file, $media);
 }
开发者ID:helpfulrobot,项目名称:axllent-silverstripe-less,代码行数:54,代码来源:LessCompiler.php

示例7: download

 /**
  * Sends download request to registered members
  * 
  * @param	object	GET 'filename' request 
  * @return	object	HTTP request
  */
 public function download(SS_HTTPRequest $request)
 {
     $filename = $request->param('Filename');
     if (Member::currentUserID() && $request->isGET() && !empty($filename)) {
         $file = DB::query("SELECT Filename FROM File  WHERE Name = '" . Convert::raw2sql($filename) . "'")->value();
         if (!empty($file) && Director::fileExists($file)) {
             $file_contents = file_get_contents(Director::getAbsFile($file));
             return SS_HTTPRequest::send_file($file_contents, $filename);
         }
     }
     return Security::permissionFailure($this);
 }
开发者ID:rixrix,项目名称:silverstripe-clickbank,代码行数:18,代码来源:ClickBankController.php

示例8: api

 /**
  * Gets the GAPI object. Creates if necessary.
  *
  * @return gapi
  */
 public function api()
 {
     if (!$this->gapi) {
         try {
             $this->gapi = new gapi(self::config()->email, Director::getAbsFile(self::config()->key_file_path));
         } catch (Exception $e) {
             $this->error = $e->getMessage();
             return $this->gapi;
         }
     }
     return $this->gapi;
 }
开发者ID:helpfulrobot,项目名称:unclecheese-dashboard,代码行数:17,代码来源:DashboardGoogleAnalyticsPanel.php

示例9: setOptions

 /**
  * Set options for Crypt_GPG.
  *
  * @see Crypt_GPGAbstract::__construct() for available options
  */
 private function setOptions()
 {
     $options = GPGMailer::config()->options;
     if (isset($options[0]) && is_array($options[0])) {
         $this->options = $options[0];
     }
     // Option to override home dir and provide a relative path instead
     if (isset($this->options['relative_homedir'])) {
         $this->options['homedir'] = Director::getAbsFile($this->options['relative_homedir']);
         unset($this->options['relative_homedir']);
     }
 }
开发者ID:edlinklater,项目名称:silverstripe-gpgmailer,代码行数:17,代码来源:GPGMailer.php

示例10: attachFile

 public function attachFile($filename, $attachedFilename = null, $mimetype = null)
 {
     if (!$attachedFilename) {
         $attachedFilename = str_replace(Director::baseFolder(), '', $filename);
     }
     $absoluteFileName = Director::getAbsFile($filename);
     if (file_exists($absoluteFileName)) {
         $this->attachFileFromString(file_get_contents($absoluteFileName), $attachedFilename, $mimetype);
     } else {
         user_error("Could not attach '{$absoluteFileName}' to email. File does not exist.", E_USER_NOTICE);
     }
     return $this;
 }
开发者ID:et-innovations,项目名称:abc-silverstripe-mailer,代码行数:13,代码来源:SMTPEmail.php

示例11: ExifData

 /**
  * Returns EXIF info defined by $field from images (JPEG, TIFF) stored by the camera.
  *
  * @param string $field String with EXIF field to be returned
  * @return EXIF data or null
  */
 public function ExifData($field = 'DateTimeOriginal')
 {
     // only JPEG and TIFF files contain EXIF data
     $image_extension = strtolower($this->owner->Extension);
     if (!in_array($image_extension, array('jpg', 'jpeg', 'tif', 'tiff'))) {
         return null;
     }
     // extract requested EXIF field
     $image_path = Director::getAbsFile($this->owner->Filename);
     $exif_data = @exif_read_data($image_path, 'EXIF', false, false);
     $exif_field = isset($exif_data[$field]) ? $exif_data[$field] : null;
     return $exif_field;
 }
开发者ID:helpfulrobot,项目名称:cwsoft-silverstripe-foldergallery,代码行数:19,代码来源:cwsFolderGalleryImageExtension.php

示例12: init

 /**
  * Set up for interacting with Stomp, icnluding creating the connection. Configuration
  * info is taken from the interface configuration.
  * @param <type> $config
  * @return void
  */
 protected function init($config)
 {
     if (self::$conn) {
         return;
     }
     require_once Director::getAbsFile("messagequeue/thirdparty/stomp-php-1.0.0/Stomp.php");
     $conf = $config["stomp"];
     self::$conn = new Stomp($conf["server"]);
     if (isset($conf["durableClientId"])) {
         self::$conn->clientId = $conf["durableClientId"];
     }
     // @TODO: handle authentication and any other connection properties
     self::$conn->connect();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-messagequeue,代码行数:20,代码来源:StompMQ.php

示例13: process

 function process()
 {
     $dir = Director::getAbsFile(VirutalProductDecorator::$downloadFolder);
     $files = scandir($dir);
     foreach ($files as $file) {
         $filelastmodified = filemtime($dir . $file);
         //Skip ., .. and .htaccess files
         if (strpos($file, '.') !== 0) {
             if ($filelastmodified < strtotime('-' . VirutalProductDecorator::$downloadWindow)) {
                 unlink($dir . $file);
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:14,代码来源:VirtualProductCleanupTask.php

示例14: css

 function css($file, $media = null)
 {
     /**
      * Only initiate automatically if:
      * - webiste is in dev mode
      * - or a ?flush is called
      */
     if (preg_match('/\\.less$/i', $file) || Director::isDev() || isset($_GET['flush'])) {
         /* If file is CSS, check if there is a LESS file */
         if (preg_match('/\\.css$/i', $file)) {
             $less = preg_replace('/\\.css$/i', '.less', $file);
             if (is_file(Director::getAbsFile($less))) {
                 $file = $less;
             }
         }
         /* If less file exists, then check/compile it */
         if (preg_match('/\\.less$/i', $file)) {
             $out = preg_replace('/\\.less$/i', '.css', $file);
             $css_file = Director::getAbsFile($out);
             $options = array();
             /* Automatically compress if in live mode */
             if (Director::isLive()) {
                 $options['compress'] = true;
             }
             try {
                 /* Force recompile & only write to css if updated */
                 if (isset($_GET['flush']) || !Director::isLive()) {
                     /* Create instance */
                     $parser = new Less_Parser($options);
                     if (!empty(self::$variables)) {
                         $parser->ModifyVars(self::$variables);
                     }
                     /* calculate the LESS file's parent URL */
                     $css_dir = rtrim(Director::baseURL(), '/') . Director::makeRelative(dirname(Director::getAbsFile($file)) . '/');
                     $parser->parseFile(Director::getAbsFile($file), $css_dir);
                     $css = $parser->getCss();
                     if (!is_file($css_file) || md5_file($css_file) != md5($css)) {
                         file_put_contents($css_file, $css);
                     }
                 }
             } catch (Exception $ex) {
                 trigger_error("Less.php fatal error: " . $ex->getMessage(), E_USER_ERROR);
             }
             $file = $out;
         }
     }
     /* Return css path */
     return parent::css($file, $media);
 }
开发者ID:vizo,项目名称:silverstripe-less,代码行数:49,代码来源:LessCompiler.php

示例15: path_for_file

 /**
  * Finds the path for specified file.
  *
  * @param string $fileOrUrl
  * @return string|boolean
  */
 protected function path_for_file($fileOrUrl)
 {
     if (preg_match('{^//|http[s]?}', $fileOrUrl)) {
         return $fileOrUrl;
     } elseif (Director::fileExists($fileOrUrl)) {
         $path = pathinfo($fileOrUrl);
         $absoluteFile = Director::getAbsFile(preg_replace('/([^\\?]*)?.*/', '$1', $fileOrUrl));
         $v = '.' . filemtime($absoluteFile) . '.';
         $prefix = Director::baseURL();
         $fileOrUrl = $path['dirname'] . '/' . str_replace('.', $v, $path['basename']);
         return "{$prefix}{$fileOrUrl}";
     } else {
         return false;
     }
 }
开发者ID:helpfulrobot,项目名称:christopherdarling-silverstripe-betterrequirementsversioning,代码行数:21,代码来源:BetterRequirementsVersioning_Backend.php


注:本文中的Director::getAbsFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。