Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • AllTests
  • ArgumentLexer
  • Autoescape_Tag
  • Block_Tag
  • BlockContext
  • Blocktrans_Tag
  • Cache_Tag
  • class_vcard
  • CommentNode
  • Consoleation
  • CoreFilters
  • Cycle_Tag
  • DatetimeFilters
  • Debug_Tag
  • Describe_Argument_Lexer
  • Describe_array_lookup
  • Describe_comment_node
  • Describe_context_lookup_basic_data_types
  • Describe_file_loader
  • Describe_for_tag
  • Describe_H2o_block_tag
  • Describe_h2o_block_variable
  • Describe_h2o_extends_tag
  • Describe_h2o_filter_registration
  • Describe_h2o_tag_registration
  • Describe_hash_loader
  • Describe_if_tag
  • Describe_include_tag
  • Describe_Lexer
  • Describe_local_variable
  • Describe_object_context_lookup
  • Describe_Parser
  • Describe_Parser_Patterns
  • Describe_Template
  • Describe_text_node
  • Describe_variable_node
  • Document
  • Evaluator
  • Extends_Tag
  • FilterCollection
  • For_Tag
  • H2o
  • H2o_Apc_Cache
  • H2o_Context
  • H2o_File_Cache
  • H2o_File_Loader
  • H2o_Hash_Loader
  • H2o_I18n
  • H2o_Info
  • H2o_Lexer
  • H2o_Loader
  • H2o_Memcache_Cache
  • H2o_Node
  • H2o_Parser
  • H2O_RE
  • H2o_Token
  • Have_Matcher
  • HtmlFilters
  • If_Tag
  • Include_Tag
  • Ldap
  • Load_Tag
  • Lorem_Tag
  • Markdown_Parser
  • NodeList
  • Now_Tag
  • NumberFilters
  • PasswordHash
  • Person
  • S3
  • S3Request
  • Sample_Tag
  • SampleFilters
  • Services_JSON_Error
  • SimpleSpec
  • Site_Tag
  • SpecMatcher
  • StreamWriter
  • StringFilters
  • Textile
  • TextNode
  • TokenStream
  • Trans_Tag
  • VariableNode
  • With_Tag

Exceptions

  • H2o_Error
  • ParseError
  • S3Exception
  • TemplateNotFound
  • TemplateSyntaxError

Functions

  • _swiftmailer_init
  • create_context
  • expects
  • file_loader
  • h2o
  • h2o_cache
  • hash_loader
  • identify_modifier_markdown
  • is_sym
  • lorem_dictionary
  • lorem_paragraphs
  • lorem_sentences
  • lorem_words
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • sample_filter
  • smarty_modifier_markdown
  • strip_regex
  • sym_to_str
  • symbol
  • templize
  • w

Class S3

Amazon S3 PHP class

Direct known subclasses

AmazonS3

Version: 0.5.0-dev
Link: http://undesigned.org.za/2007/10/22/amazon-s3-php-class
Located at vendors/amazons3/S3.php

Methods summary

public
# __construct( string $accessKey = null, string $secretKey = null, boolean $useSSL = false, mixed $endpoint = 's3.amazonaws.com' )

Constructor - if you're not using the class statically

Constructor - if you're not using the class statically

Parameters

$accessKey
string
$accessKey Access key
$secretKey
string
$secretKey Secret key
$useSSL
boolean
$useSSL Enable SSL
$endpoint
public
# setEndpoint( string $host )

Set the sertvice endpoint

Set the sertvice endpoint

Parameters

$host
string
$host Hostname
public static
# setAuth( string $accessKey, string $secretKey )

Set AWS access key and secret key

Set AWS access key and secret key

Parameters

$accessKey
string
$accessKey Access key
$secretKey
string
$secretKey Secret key
public static boolean
# hasAuth( )

Check if AWS keys have been set

Check if AWS keys have been set

Returns

boolean
public static
# setSSL( boolean $enabled, boolean $validate = true )

Set SSL on or off

Set SSL on or off

Parameters

$enabled
boolean
$enabled SSL enabled
$validate
boolean
$validate SSL certificate validation
public static
# setSSLAuth( string $sslCert = null, string $sslKey = null, string $sslCACert = null )

Set SSL client certificates (experimental)

Set SSL client certificates (experimental)

Parameters

$sslCert
string
$sslCert SSL client certificate
$sslKey
string
$sslKey SSL client key
$sslCACert
string
$sslCACert SSL CA cert (only required if you are having problems with your system CA cert)
public static
# setProxy( string $host, string $user = null, string $pass = null, constant $type = CURLPROXY_SOCKS5 )

Set proxy information

Set proxy information

Parameters

$host
string
$host Proxy hostname and port (localhost:1234)
$user
string
$user Proxy username
$pass
string
$pass Proxy password
$type
constant
$type CURL proxy type
public static
# setExceptions( boolean $enabled = true )

Set the error mode to exceptions

Set the error mode to exceptions

Parameters

$enabled
boolean
$enabled Enable exceptions
public static boolean
# setSigningKey( string $keyPairId, string $signingKey, boolean $isFile = true )

Set signing key

Set signing key

Parameters

$keyPairId
string
$keyPairId AWS Key Pair ID
$signingKey
string
$signingKey Private Key
$isFile
boolean
$isFile Load private key from file, set to false to load string

Returns

boolean
public static
# freeSigningKey( )

Free signing key from memory, MUST be called if you are using setSigningKey()

Free signing key from memory, MUST be called if you are using setSigningKey()

private static
# __triggerError( string $message, string $file, integer $line, integer $code = 0 )

Internal error handler

Internal error handler

Parameters

$message
string
$message Error message
$file
string
$file Filename
$line
integer
$line Line number
$code
integer
$code Error code
public static array
# listBuckets( boolean $detailed = false )

Get a list of buckets

Get a list of buckets

Parameters

$detailed
boolean
$detailed Returns detailed bucket list when true

Returns

array
| false
public static
# getBucket( mixed $bucket, mixed $prefix = null, mixed $marker = null, mixed $maxKeys = null, mixed $delimiter = null, mixed $returnCommonPrefixes = false )
public static boolean
# putBucket( string $bucket, constant $acl = S3::ACL_PRIVATE, string $location = false )

Put a bucket

Put a bucket

Parameters

$bucket
string
$bucket Bucket name
$acl
constant
$acl ACL flag
$location
string
$location Set as "EU" to create buckets hosted in Europe

Returns

boolean
public static boolean
# deleteBucket( string $bucket )

Delete an empty bucket

Delete an empty bucket

Parameters

$bucket
string
$bucket Bucket name

Returns

boolean
public static array
# inputFile( string $file, mixed $md5sum = true )

Create input info array for putObject()

Create input info array for putObject()

Parameters

$file
string
$file Input file
$md5sum
mixed
$md5sum Use MD5 hash (supply a string if you want to use your own)

Returns

array
| false
public static array
# inputResource( string & $resource, integer $bufferSize, string $md5sum = '' )

Create input array info for putObject() with a resource

Create input array info for putObject() with a resource

Parameters

$resource
string
$resource Input resource to read from
$bufferSize
integer
$bufferSize Input byte size
$md5sum
string
$md5sum MD5 hash to send (optional)

Returns

array
| false
public static boolean
# putObject( mixed $input, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE, array $metaHeaders = array(), array $requestHeaders = array(), constant $storageClass = S3::STORAGE_CLASS_STANDARD )

Put an object

Put an object

Parameters

$input
mixed
$input Input data
$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$acl
constant
$acl ACL constant
$metaHeaders
array
$metaHeaders Array of x-amz-meta-* headers
$requestHeaders
array
$requestHeaders Array of request headers or content type as a string
$storageClass
constant
$storageClass Storage class constant

Returns

boolean
public static boolean
# putObjectFile( string $file, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE, array $metaHeaders = array(), string $contentType = null )

Put an object from a file (legacy function)

Put an object from a file (legacy function)

Parameters

$file
string
$file Input file path
$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$acl
constant
$acl ACL constant
$metaHeaders
array
$metaHeaders Array of x-amz-meta-* headers
$contentType
string
$contentType Content type

Returns

boolean
public static boolean
# putObjectString( string $string, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE, array $metaHeaders = array(), string $contentType = 'text/plain' )

Put an object from a string (legacy function)

Put an object from a string (legacy function)

Parameters

$string
string
$string Input data
$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$acl
constant
$acl ACL constant
$metaHeaders
array
$metaHeaders Array of x-amz-meta-* headers
$contentType
string
$contentType Content type

Returns

boolean
public static mixed
# getObject( string $bucket, string $uri, mixed $saveTo = false )

Get an object

Get an object

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$saveTo
mixed
$saveTo Filename or resource to write to

Returns

mixed
public static mixed
# getObjectInfo( string $bucket, string $uri, boolean $returnInfo = true )

Get object information

Get object information

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$returnInfo
boolean
$returnInfo Return response information

Returns

mixed
| false
public static mixed
# copyObject( string $srcBucket, string $srcUri, string $bucket, string $uri, constant $acl = S3::ACL_PRIVATE, array $metaHeaders = array(), array $requestHeaders = array(), constant $storageClass = S3::STORAGE_CLASS_STANDARD )

Copy an object

Copy an object

Parameters

$srcBucket
string
$bucket Source bucket name
$srcUri
string
$uri Source object URI
$bucket
string
$bucket Destination bucket name
$uri
string
$uri Destination object URI
$acl
constant
$acl ACL constant
$metaHeaders
array
$metaHeaders Optional array of x-amz-meta-* headers
$requestHeaders
array
$requestHeaders Optional array of request headers (content type, disposition, etc.)
$storageClass
constant
$storageClass Storage class constant

Returns

mixed
| false
public static boolean
# setBucketLogging( string $bucket, string $targetBucket, string $targetPrefix = null )

Set logging for a bucket

Set logging for a bucket

Parameters

$bucket
string
$bucket Bucket name
$targetBucket
string
$targetBucket Target bucket (where logs are stored)
$targetPrefix
string
$targetPrefix Log prefix (e,g; domain.com-)

Returns

boolean
public static array
# getBucketLogging( string $bucket )

Get logging status for a bucket

Get logging status for a bucket

This will return false if logging is not enabled. Note: To enable logging, you also need to grant write access to the log group

Parameters

$bucket
string
$bucket Bucket name

Returns

array
| false
public static boolean
# disableBucketLogging( string $bucket )

Disable bucket logging

Disable bucket logging

Parameters

$bucket
string
$bucket Bucket name

Returns

boolean
public static string
# getBucketLocation( string $bucket )

Get a bucket's location

Get a bucket's location

Parameters

$bucket
string
$bucket Bucket name

Returns

string
| false
public static boolean
# setAccessControlPolicy( string $bucket, string $uri = '', array $acp = array() )

Set object or bucket Access Control Policy

Set object or bucket Access Control Policy

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$acp
array
$acp Access Control Policy Data (same as the data returned from getAccessControlPolicy)

Returns

boolean
public static mixed
# getAccessControlPolicy( string $bucket, string $uri = '' )

Get object or bucket Access Control Policy

Get object or bucket Access Control Policy

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI

Returns

mixed
| false
public static boolean
# deleteObject( string $bucket, string $uri )

Delete an object

Delete an object

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI

Returns

boolean
public static string
# getAuthenticatedURL( string $bucket, string $uri, integer $lifetime, boolean $hostBucket = false, boolean $https = false )

Get a query string authenticated URL

Get a query string authenticated URL

Parameters

$bucket
string
$bucket Bucket name
$uri
string
$uri Object URI
$lifetime
integer
$lifetime Lifetime in seconds
$hostBucket
boolean
$hostBucket Use the bucket name as the hostname
$https
boolean
$https Use HTTPS ($hostBucket should be false for SSL verification)

Returns

string
public static string
# getSignedPolicyURL( array $policy )

Get a CloudFront signed policy URL

Get a CloudFront signed policy URL

Parameters

$policy
array
$policy Policy

Returns

string
public static string
# getSignedCannedURL( string $url, integer $lifetime )

Get a CloudFront canned policy URL

Get a CloudFront canned policy URL

Parameters

$url
string
$string URL to sign
$lifetime
integer
$lifetime URL lifetime

Returns

string
public static object
# getHttpUploadPostParams( string $bucket, string $uriPrefix = '', constant $acl = S3::ACL_PRIVATE, integer $lifetime = 3600, integer $maxFileSize = 5242880, string $successRedirect = "201", array $amzHeaders = array(), array $headers = array(), boolean $flashVars = false )

Get upload POST parameters for form uploads

Get upload POST parameters for form uploads

Parameters

$bucket
string
$bucket Bucket name
$uriPrefix
string
$uriPrefix Object URI prefix
$acl
constant
$acl ACL constant
$lifetime
integer
$lifetime Lifetime in seconds
$maxFileSize
integer
$maxFileSize Maximum filesize in bytes (default 5MB)
$successRedirect
string
$successRedirect Redirect URL or 200 / 201 status code
$amzHeaders
array
$amzHeaders Array of x-amz-meta-* headers
$headers
array
$headers Array of request headers or content type as a string
$flashVars
boolean
$flashVars Includes additional "Filename" variable posted by Flash

Returns

object
public static array
# createDistribution( string $bucket, boolean $enabled = true, array $cnames = array(), string $comment = null, string $defaultRootObject = null, string $originAccessIdentity = null, array $trustedSigners = array() )

Create a CloudFront distribution

Create a CloudFront distribution

Parameters

$bucket
string
$bucket Bucket name
$enabled
boolean
$enabled Enabled (true/false)
$cnames
array
$cnames Array containing CNAME aliases
$comment
string
$comment Use the bucket name as the hostname
$defaultRootObject
string
$defaultRootObject Default root object
$originAccessIdentity
string
$originAccessIdentity Origin access identity
$trustedSigners
array
$trustedSigners Array of trusted signers

Returns

array
| false
public static array
# getDistribution( string $distributionId )

Get CloudFront distribution info

Get CloudFront distribution info

Parameters

$distributionId
string
$distributionId Distribution ID from listDistributions()

Returns

array
| false
public static array
# updateDistribution( array $dist )

Update a CloudFront distribution

Update a CloudFront distribution

Parameters

$dist
array
$dist Distribution array info identical to output of getDistribution()

Returns

array
| false
public static boolean
# deleteDistribution( array $dist )

Delete a CloudFront distribution

Delete a CloudFront distribution

Parameters

$dist
array
$dist Distribution array info identical to output of getDistribution()

Returns

boolean
public static array
# listDistributions( )

Get a list of CloudFront distributions

Get a list of CloudFront distributions

Returns

array
public static array
# listOriginAccessIdentities( )

List CloudFront Origin Access Identities

List CloudFront Origin Access Identities

Returns

array
public static boolean
# invalidateDistribution( string $distributionId, array $paths )

Invalidate objects in a CloudFront distribution

Invalidate objects in a CloudFront distribution

Thanks to Martin Lindkvist for S3::invalidateDistribution()

Parameters

$distributionId
string
$distributionId Distribution ID from listDistributions()
$paths
array
$paths Array of object paths to invalidate

Returns

boolean
private static string
# __getCloudFrontInvalidationBatchXML( array $paths, mixed $callerReference = '0' )

Get a InvalidationBatch DOMDocument

Get a InvalidationBatch DOMDocument

Parameters

$paths
array
$paths Paths to objects to invalidateDistribution
$callerReference

Returns

string
private static string
# __getCloudFrontDistributionConfigXML( string $bucket, boolean $enabled, string $comment, string $callerReference = '0', array $cnames = array(), string $defaultRootObject = null, string $originAccessIdentity = null, array $trustedSigners = array() )

Get a DistributionConfig DOMDocument

Get a DistributionConfig DOMDocument

http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?PutConfig.html

Parameters

$bucket
string
$bucket S3 Origin bucket
$enabled
boolean
$enabled Enabled (true/false)
$comment
string
$comment Comment to append
$callerReference
string
$callerReference Caller reference
$cnames
array
$cnames Array of CNAME aliases
$defaultRootObject
string
$defaultRootObject Default root object
$originAccessIdentity
string
$originAccessIdentity Origin access identity
$trustedSigners
array
$trustedSigners Array of trusted signers

Returns

string
private static array
# __parseCloudFrontDistributionConfig( object & $node )

Parse a CloudFront distribution config

Parse a CloudFront distribution config

See http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?GetDistribution.html

Parameters

$node
object
&$node DOMNode

Returns

array
private static object
# __getCloudFrontResponse( object & $rest )

Grab CloudFront response

Grab CloudFront response

Parameters

$rest
object
&$rest S3Request instance

Returns

object
public static string
# __getMimeType( string & $file )

Get MIME type for file

Get MIME type for file

Parameters

$file
string
&$file File path

Returns

string
public static string
# __getSignature( string $string )

Generate the auth string: "AWS AccessKey:Signature"

Generate the auth string: "AWS AccessKey:Signature"

Parameters

$string
string
$string String to sign

Returns

string
private static string
# __getHash( string $string )

Creates a HMAC-SHA1 hash

Creates a HMAC-SHA1 hash

This uses the hash extension if loaded

Parameters

$string
string
$string String to sign

Returns

string

Magic methods summary

Constants summary

string ACL_PRIVATE 'private'
#
string ACL_PUBLIC_READ 'public-read'
#
string ACL_PUBLIC_READ_WRITE 'public-read-write'
#
string ACL_AUTHENTICATED_READ 'authenticated-read'
#
string STORAGE_CLASS_STANDARD 'STANDARD'
#
string STORAGE_CLASS_RRS 'REDUCED_REDUNDANCY'
#

Properties summary

private static mixed $__accessKey
#
private static mixed $__secretKey
#
private static mixed $__sslKey
#
public static string $endpoint
#
public static mixed $proxy
#
public static boolean $useSSL
#
public static boolean $useSSLValidation
#
public static boolean $useExceptions
#
public static mixed $sslKey
#
public static mixed $sslCert
#
public static mixed $sslCACert
#
private static mixed $__signingKeyPairId
#
private static boolean $__signingKeyResource
#
Blesta API documentation generated by ApiGen 2.8.0