API

This documentation is generated from PHPDOC.



Class: axelhahn\cdnorlocal

Methoden verstecken

 __constructpublic __construct( $aOptions = false)
constructor
@param array $aOptions with possible keys
- debug
- vendordir & vendorurl
- vendorrelpath

 _wdprotected _wd( $sText) ... all param(s) required
write debug output if the flag was set
@param string $sText message to show

 _getLocalfilenameprotected _getLocalfilename( $sRelUrl) ... all param(s) required
return the local filename (maybe it does not exist)

@param string $sRelUrl relative url of css/ js file (i.e. "jquery/3.2.1/jquery.min.js")
@return string

 getLocalfilepublic getLocalfile( $sRelUrl) ... all param(s) required
return the local filename if it exists

@param string $sRelUrl relative url of css/ js file (i.e. "jquery/3.2.1/jquery.min.js")
@return type

 setCdnpublic setCdn( $sNewCdn) ... all param(s) required
set a CDN to deliver sources; returns true if the CDN is supported;
returns false if CDN is not supported

@see getCdns() to get a list of supported CDNs

@param string $sNewCdn
@return boolean

 setDebugpublic setDebug( $sNewValue) ... all param(s) required
set a vendor url to use as link for libraries

@param string $sNewValue new url
@return string

 setVendorWithRelpathpublic setVendorWithRelpath( $sRelpath) ... all param(s) required
set a vendor dir to scan libraries as relative path to the class

@param string $sNewValue new local dir; relative to the class file
@return string

 setVendorDirpublic setVendorDir( $sNewValue, $bMustExist = false) ... 1 of 2 param(s) required
set a vendor dir to scan libraries as full path

@param string $sNewValue new local dir; absolute path
@param boolean $bMustExist optional flag: ensure that the directory exists
@return string

 setVendorUrlpublic setVendorUrl( $sNewValue) ... all param(s) required
set a vendor url to use as link for libraries

@param string $sNewValue new url
@return string

 addLibpublic addLib( $sReldir, $sFile = false) ... 1 of 2 param(s) required
add a library into lib stack
@param string $sReldir relative dir and version (i.e. "jquery/3.2.1")
@param string $sFile optional file (behind relpath)
@return boolean

 getCdnspublic getCdns()
get array with a flat list of supported CDNs
@return array

 getCurrentCdnpublic getCurrentCdn()
get array with a flat list of supported CDNs
@return array

 getFilteredLibspublic getFilteredLibs( $aFilter = Array)
return array of all libs filtered by criteria

@example

get used libs that are local:
$oCdn->getFilteredLibs(array('islocal'=>1));

get used libs that are loaded from CDN:
$oCdn->getFilteredLibs(array('islocal'=>0));

get unused libs that are still local (and can be deleted)
$oCdn->getFilteredLibs(array('islocal'=>1, 'isunused'=>1))

@param array $aFilter array with filter items containing these keys:
- islocal true|false; default is false
- isunused true|false; default is false
@return array

 getLibspublic getLibs( $bDetectUnused = false)
return all libs from lib stack; with enabled flag entries in local
vendor cache will be added to show the versions that can be deleted
(detectable by subkey "isunused" => true)

@param boolean $bDetectUnused flag: detect unused local libs
@return array

 _getLibItempublic _getLibItem( $sScanItem, $sScanValue, $sReturnKey) ... all param(s) required
find item with a value and return other value
@param string $sScanItem item to search (one of lib|version|relpath)
@param $sReldir$sScanValue needed value
@param $sReldir$sReturnKey return key (one of lib|version|relpath)
@return varia

 getLibVersionpublic getLibVersion( $sLib) ... all param(s) required
get the (first) version of a lib in the lib stack
@param string $sLib name of the library (i.e. "jquery"; relpath without version)
@return string

 getLibRelpathpublic getLibRelpath( $sLib) ... all param(s) required
get the (first) version of a lib in the lib stack
@param string $sLib name of the library (i.e. "jquery"; relpath without version)
@return string

 setLibspublic setLibs( $aLibs) ... all param(s) required
set an array of lib items to the lib
@param array $aLibs array of relpath (i.e. "jquery/3.2.1")
@return boolean

 _splitRelUrlprotected _splitRelUrl( $sRelUrl) ... all param(s) required

 getFullCdnUrlpublic getFullCdnUrl( $sRelUrl, $sCdn = false) ... 1 of 2 param(s) required

 getFullUrlpublic getFullUrl( $sRelUrl) ... all param(s) required
get full url based on relative filename. It returns the url of
local directory if it exists or a url of CDNJS

To use a local path a library must exist. Default vendor dir
is '[webroot]/vendor' and vendor url is '/vendor'
Use the setVendor* functions to override them.

@see setVendorDir()
@see setVendorUrl()
or
@see setVendorWithRelpath()

@param string $sRelUrl relative url of css/ js file (i.e. "jquery/3.2.1/jquery.min.js")
@return type

 getHtmlIncludepublic getHtmlInclude( $sRelUrl) ... all param(s) required
get html code to include a css or js file (kind of lazy function)
Remark: other file extensions are not supported
Use the method getFullUrl() to get a full url and then embed it directly

@see getFullUrl()

@param string $sRelUrl relative url of css/ js file (i.e. "jquery/3.2.1/jquery.min.js")
@return string

Properties verstecken

$_bDebugpublic $_bDebug = false
flag to show debugging infos (used in _wd method [write debug])
@var boolean
$sVendorDirpublic $sVendorDir = false
local vendor dir ... if a lib was downloaded with admin
@var string
$sVendorUrlpublic $sVendorUrl = false
local vendor url ... if a lib was downloaded with admin
this is the prefix for linking in html documents
@var string
$sCdnUrlpublic $sCdnUrl = https://cdnjs.cloudflare.com/ajax/libs
url prefix of CDNJS
@var string
$aCdnUrlspublic $aCdnUrls =
Array
(
    [cdnjs.cloudflare.com] => Array
        (
            [about] => 
            [url] => https://cdnjs.cloudflare.com/ajax/libs/[PKG]/[VERSION]/[FILE]
            [urlLatest] => https://cdnjs.cloudflare.com/ajax/libs/[PKG]/[VERSION]/[FILE]
        )

)

$_sCdnprotected $_sCdn = false
$_aLibspublic $_aLibs = false






Copyright © 2017-2020 Axel Hahn
project page: GitHub (en)
results will be here