rapila
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ResourceIncluder Class Reference

Public Member Functions

 startDependencies ()
 
 addResourceEndingDependency ($mLocation, $sResourceType=null, $sIdentifier=null, $aExtraInfo=array(), $iPriority=self::PRIORITY_NORMAL, $sIeCondition=null, $bIncludeAll=false)
 
 addResource ($mLocation, $sResourceType=null, $sIdentifier=null, $aExtraInfo=null, $iPriority=self::PRIORITY_NORMAL, $sIeCondition=null, $bIncludeAll=false, $bEndsDependencyList=false)
 
 addJavaScriptLibrary ($sLibraryName, $sLibraryVersion, $bUseCompression=null, $bInlcudeDependencies=true, $bUseSsl= 'default', $iPriority=self::PRIORITY_NORMAL, $bUseLocalProxy=null, $sIeCondition=null)
 
 addCustomResource ($aResourceInfo, $iPriority=self::PRIORITY_NORMAL, $bEndsDependencyList=false)
 
 addCustomJs ($mCustomJs, $iPriority=self::PRIORITY_NORMAL, $bEndsDependencyList=false)
 
 addCustomCss ($mCustomCss, $iPriority=self::PRIORITY_NORMAL, $bEndsDependencyList=false)
 
 addMeta ($sName, $sContent, $bIsHttpEquiv=false)
 
 addReverseDependency ($sIdentifier, $bIsBefore=false)
 
 getIncludedResources ()
 
 getAllIncludedResources ()
 
 getResourceInfosForIncludedResourcesOfPriority ($iPriority=self::PRIORITY_NORMAL)
 
 getLocationsForIncludedResourcesOfPriority ($iPriority=self::PRIORITY_NORMAL)
 
 getIncludes ($bPrintNewlines=true, $bConsolidate=null)
 
 addResourceFromTemplateIdentifier ($oIdentifier)
 
 clearIncludedResources ()
 

Static Public Member Functions

static namedIncluder ($sName)
 
static defaultIncluder ()
 
static metaIncluder ()
 

Public Attributes

const DEFAULT_INSTANCE_NAME = 'ResourceIncluder_default'
 The default resource includer. Many plugins and internal modules use this so you should have at least one {{writeResourceIncludes}} without the includer name in your template.
 
const META_INSTANCE_NAME = 'meta'
 The Resource includer for meta tags like keywords, description and link tags (excluding stylesheet links). This ({{writeResourceIncludes=meta}}) is not required to have in your template but highly recommended.
 
const RESOURCE_TYPE_CSS = 'css'
 
const RESOURCE_TYPE_JS = 'js'
 
const RESOURCE_TYPE_IMAGE = 'images'
 
const RESOURCE_TYPE_ICON = 'icons'
 
const RESOURCE_TYPE_LINK = 'link'
 
const RESOURCE_TYPE_INTERNAL_LINK = 'internal_link'
 
const PRIORITY_FIRST = -1
 
const PRIORITY_NORMAL = 0
 
const PRIORITY_LAST = 1
 
const LIBRARY_VERSION_NEWEST = 'newest'
 
const RESOURCE_PREFIX_LIBRARY = 'lib_'
 
const RESOURCE_PREFIX_CUSTOM = 'cust_'
 
const RESOURCE_PREFIX_INTERNAL = 'int_'
 
const RESOURCE_PREFIX_EXTERNAL = 'ext_'
 
const IE_CONDITIONAL = '<!--[if {{condition}}]>{{content}}<![endif]-->'
 

Member Function Documentation

ResourceIncluder::addJavaScriptLibrary (   $sLibraryName,
  $sLibraryVersion,
  $bUseCompression = null,
  $bInlcudeDependencies = true,
  $bUseSsl = 'default',
  $iPriority = self::PRIORITY_NORMAL,
  $bUseLocalProxy = null,
  $sIeCondition = null 
)

Add a JavaScript Library to this ResourceIncluder instance.

Parameters
string$sLibraryNameThe library’s name as configured in the config files
string$sLibraryVersionThe library’s version number, should be as specific as possible. If multiple libraries are included at different versions, only the higher versioned instances are included.
boolean | null$bUseCompressionWhether we should include a GZIPped-Minified version of the said Library. If set to null, the default will be used (as configured in the “use_compressed_libraries” setting of the “general” section of the resource_includer.yml config file).
boolean$bInlcudeDependenciesWhether to include all the necessary dependencies (as configured in the “library_dependencies” section of the resource_includer.yml config file) of this library.
boolean | null$bUseSslWhether to force the usage or non-usage of SSL. If null, this will use the library’s configured location (which should start with a protocol-agnostic “//”). To force either HTTP or HTTPS, use false or true, respectively. This will also determine how the library will be included when proxied (not, however, how it will be fetched, which is always unencrypted HTTP).
int$iPriorityWhich priority level to use when addin this library’s reference. One of the defined priority constants (ResourceIncluder::PRIORITY_FIRST, ResourceIncluder::PRIORITY_NORMAL, ResourceIncluder::PRIORITY_LAST).
boolean | null$bUseLocalProxyWhether we should proxy the included library through our own server. If set to null, the default will be used (as configured in the “use_local_library_cache” setting of the “general” section of the resource_includer.yml config file, which is off by default for production environments). This is useful for environments that need to be testable without an active internet connection or for production environments where libraries should not be loaded from external sources due to privacy concerns.
string$sIeConditionAn IE conditional-comment condition to put around the include. Will only print conditional comments when not null. Example: “lt IE 9”.
ResourceIncluder::addMeta (   $sName,
  $sContent,
  $bIsHttpEquiv = false 
)

Add a meta tag. This adds a custom resource with the “meta” template. Note: This will not add anything if the content is empty.

Parameters
$sNameThe name (or http-equiv) attribute of the resulting tag.
$sContentThe resulting tag’s content.
$bIsHttpEquivWhether this is a meta tag used with the name or the http-equiv attribute.
static ResourceIncluder::defaultIncluder ( )
static

Get the default includer. Same as calling ResourceIncluder::namedIncluder(ResourceIncluder::DEFAULT_INSTANCE_NAME).

Returns
ResourceIncluder the default includer
ResourceIncluder::getIncludes (   $bPrintNewlines = true,
  $bConsolidate = null 
)

Returns a Template containing all of the necessary HTML code for the browser to load the included resources.

Parameters
$bPrintNewlinesWhether to put each include on a new line. Turn this off for “location_only”-type includes.
$bConsolidateWhether to consolidate CSS and JS includes into a single tag which will point to a new location which will serve all the scripts of one type concatenated. Valid values — true: Consolidate all css/js resources, false: Don’t consolidate, 'internal': Only consolidate internal scripts, but not the ones loaded from external servers, null: Use the default value from the general/consolidate_resources configuration seting from resource_includer.yml. Note that all concatenated scripts will have to be in the same charset, namely the one defined in the encoding/browser configuration setting. Also note that a value of "internal" for $bConsolidate will only have an effect on js libraries if they’re not being locally cached (use_local_library_cache is false)
static ResourceIncluder::metaIncluder ( )
static

Get the includer used for meta tags. Same as calling ResourceIncluder::namedIncluder(ResourceIncluder::META_INSTANCE_NAME).

Returns
ResourceIncluder the meta includer
static ResourceIncluder::namedIncluder (   $sName)
static
Parameters
$sNamename of the static includer
Returns
ResourceIncluder the named static includer or a new instance if name did not yet reference an includer.
ResourceIncluder::startDependencies ( )

Use this to start a new dependency stack. This means that all dependencies added between this call and a resource added with addResourceEndingDependency will have the latter added as dependees. This means: the resource added using addResourceEndingDependency will always come after all the resources added between the two calls. Whenever one of the dependencies is added again later, the dependee will be moved down.


The documentation for this class was generated from the following file: