idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
10,900
public function build ( array $ filters = [ ] ) { $ assets = [ ] ; foreach ( array_keys ( $ this -> _queued ) as $ alias ) { $ this -> _resolveDependencies ( $ this -> _collection -> get ( $ alias ) , $ assets ) ; } $ result = [ Asset :: TYPE_JS_FILE => [ ] , Asset :: TYPE_JS_CODE => [ ] , Asset :: TYPE_JSX_FILE => [ ]...
Build assets .
10,901
protected function _resolveDependencies ( Asset $ asset , & $ resolved = [ ] , & $ unresolved = [ ] ) { $ unresolved [ $ asset -> getAlias ( ) ] = $ asset ; foreach ( $ asset -> getDependencies ( ) as $ dependency ) { if ( ! Arr :: key ( $ dependency , $ resolved ) ) { if ( isset ( $ unresolved [ $ dependency ] ) ) { t...
Resolves asset dependencies .
10,902
public function init ( $ sourceId , $ resourceId , $ resource ) { $ this -> resourceId = $ resourceId ; $ this -> sourceId = $ sourceId ; if ( ! $ resource instanceof ZendMessage ) { throw new BadResourceConfigurationException ( sprintf ( 'Remote resource handler is expected to be an instance of \'\Zend\Mail\Storage\Me...
Initializes a Resource object
10,903
public function moveToOutputFolder ( $ outputFolder ) { try { if ( $ this -> message -> isMultipart ( ) ) { $ contentPart = $ this -> message -> getPart ( 1 ) ; $ content = $ contentPart -> getContent ( ) ; $ part = $ this -> message -> getPart ( 2 ) ; if ( $ part -> getHeaders ( ) -> has ( 'Content-Disposition' ) ) { ...
Saves the current resource to the given path . Returns true if move action was successful ; false otherwise .
10,904
protected function getContentFileName ( $ outputFolder ) { return sprintf ( "%s%s%s_%s" , $ this -> getContentFileFolder ( $ outputFolder ) , DIRECTORY_SEPARATOR , $ this -> toString ( ) , time ( ) ) ; }
Returns the content file name as the concatenation of the given output folder + message sub folder + current object string representation + timestamp .
10,905
protected function getAttachmentFileName ( $ originalAttachmentFileName , $ baseOutputFolder ) { $ pathInfo = pathinfo ( $ originalAttachmentFileName ) ; $ extension = '' ; if ( isset ( $ pathInfo [ 'extension' ] ) ) { $ extension = $ pathInfo [ 'extension' ] ; } $ attachmentFileName = sprintf ( "%s%s%s_%s_%s.%s" , $ t...
Returns the attachment file name as the concatenation of the given output folder + message sub folder + current object string representation + timestamp .
10,906
public function findFile ( $ class ) { if ( false === $ file = wincache_ucache_get ( $ this -> prefix . $ class ) ) { wincache_ucache_set ( $ this -> prefix . $ class , $ file = $ this -> decorated -> findFile ( $ class ) , 0 ) ; } return $ file ; }
Finds a file by class name while caching lookups to WinCache .
10,907
public function render ( ItemInterface $ item , array $ options = array ( ) ) { $ options = array_merge ( $ this -> defaultOptions , $ options ) ; $ options [ 'rootLevel' ] = $ item -> getLevel ( ) ; return $ this -> getMenu ( $ item , $ options ) ? : '' ; }
Renders menu tree .
10,908
public function setParentControl ( Control $ parentControl = null ) { $ this -> parentControl = $ parentControl ; $ this -> matcher -> setParentControl ( $ parentControl ) ; }
Sets the parent control - this is important for link generation
10,909
public function concat ( ) { $ args = func_get_args ( ) ; $ cols = ezcQuerySelect :: arrayFlatten ( $ args ) ; if ( count ( $ cols ) < 1 ) { throw new ezcQueryVariableParameterException ( 'concat' , count ( $ args ) , 1 ) ; } $ cols = $ this -> getIdentifiers ( $ cols ) ; return join ( ' + ' , $ cols ) ; }
Returns a series of strings concatinated
10,910
public function register ( ) { $ that = $ this ; set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) use ( $ that ) { if ( ! ( $ errno & error_reporting ( ) ) ) { return ; } $ options = [ 'type' => $ errno , 'message' => $ errstr , 'file' => $ errfile , 'line' => $ errline , 'isError' => true , ...
Registers itself as error and exception handler .
10,911
public function mapErrorsToLogType ( $ code ) { switch ( $ code ) { case E_ERROR : case E_RECOVERABLE_ERROR : case E_CORE_ERROR : case E_COMPILE_ERROR : case E_USER_ERROR : case E_PARSE : return Logger :: ERROR ; case E_WARNING : case E_USER_WARNING : case E_CORE_WARNING : case E_COMPILE_WARNING : return Logger :: WARN...
Maps error code to a log type .
10,912
protected function fire ( Model $ model ) : array { $ recipient = $ this -> getRecipient ( ) ; if ( $ recipient -> phone === null ) { $ recipient -> phone = config ( 'antares/notifications::default.sms' ) ; } $ params = [ 'variables' => [ 'user' => $ recipient ] , 'recipients' => [ $ recipient ] ] ; return event ( $ mo...
Fires notification events
10,913
protected function getRecipient ( ) { if ( Input :: get ( 'test' ) ) { return user ( ) ; } $ route = app ( 'router' ) -> getRoutes ( ) -> match ( app ( 'request' ) -> create ( url ( ) -> previous ( ) ) ) ; return ( in_array ( 'users' , $ route -> parameterNames ( ) ) && $ uid = $ route -> parameter ( 'users' ) ) ? user...
Gets recipient for notification
10,914
public static function emoticonsToHtml ( $ str ) { $ str = str_replace ( " :)" , ' <img src="/media/emot/icon_biggrin.gif" alt="big_grin" />' , $ str ) ; $ str = str_replace ( " :(" , ' <img src="/media/emot/icon_cry.gif" alt="cry" />' , $ str ) ; $ str = str_replace ( " ;)" , ' <img src="/media/emot/icon_wink.gif" al...
Converts emoticons shortcuts to images
10,915
public static function clean ( $ str , $ allow_email = false ) { $ str = self :: typoFix ( $ str ) ; $ str = \ sb \ String \ HTML :: escape ( $ str ) ; $ str = self :: convertQuotes ( $ str ) ; $ str = self :: listsToHtml ( $ str ) ; $ str = self :: tablesToHtml ( $ str ) ; $ str = self :: linksToHtml ( $ str , $ allow...
Clean up the text according to the textBling rules
10,916
public static function miscTags ( $ str ) { $ str = str_replace ( '[hr]' , '<hr style="clear:both;" />' , $ str ) ; $ str = str_replace ( '[br]' , '<br />' , $ str ) ; $ str = preg_replace ( "~\[box\]\n?(.*?)\n?\[\/box\]\n{1,}?~is" , "<div class=\"box\">\\1</div>" , $ str ) ; return $ str ; }
Parses out misc tags such as horizontal rule and a scrolling box
10,917
public static function linksToHtml ( $ str , $ allow_email = false , $ link_markup = null ) { if ( ! $ allow_email ) { $ str = preg_replace ( "#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i" , '<b> \\2 AT \\3 </b>' , $ str ) ; } else { $ str = preg_replace ( "#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?...
Converts email and http links to HTML links
10,918
public static function addSearches ( $ str ) { preg_match_all ( "/\[google\](.*?)\[\/google\]/s" , $ str , $ matches ) ; $ match = $ matches [ 0 ] ; $ data = $ matches [ 1 ] ; $ count = count ( $ match ) ; for ( $ x = 0 ; $ x < $ count ; $ x ++ ) { $ query = str_replace ( " " , "+" , $ data [ $ x ] ) ; $ query = str_re...
Adds search tags to link text to searches both on and off site
10,919
public static function convertQuotes ( $ str ) { $ r = "/\[q(?:uote)?\](.*?)\[\/q(?:uote)?\]/is" ; while ( preg_match ( $ r , $ str ) ) { $ str = preg_replace ( $ r , '<blockquote class="quote"><p>\\1</p></blockquote>' , $ str ) ; } return $ str ; }
Converts quotes into quoted text blocks
10,920
public static function stripAll ( $ str ) { $ str = stripslashes ( $ str ) ; $ str = strip_tags ( $ str ) ; $ str = \ sb \ Strings :: unicodeUrldecode ( $ str ) ; $ str = self :: stripBling ( $ str ) ; $ str = \ sb \ Strings :: stripMicrosoftChars ( $ str ) ; return $ str ; }
Strips everything including textBlng tags this is useful for RSS feed and text summaries in search results
10,921
public static function typoFix ( $ str ) { $ common_typos = array ( "adn" => "and" , "agian" => "again" , "ahve" => "have" , "ahd" => "had" , "alot" => "a lot" , "amke" => "make" , "arent" => "aren't" , "beleif" => "belief" , "beleive" => "believe" , "broswer" => "browser" , "cant" => "can't" , "cheif" => "chief" , "co...
Fixed common typos can be used directly as it is a static property
10,922
public static function textStyles ( $ str ) { $ str = preg_replace ( "~\[b\](.*?)\[/b\]~is" , '<strong class="tb_b">$1</strong>' , $ str ) ; $ str = preg_replace ( "~\[sup\](.*?)\[/sup\]~is" , '<sup class="tb_sup">$1</sup>' , $ str ) ; $ str = preg_replace ( "~\[sub\](.*?)\[/sub\]~is" , '<sub class="tb_sub">$1</sub>' ,...
Converts text style tags
10,923
public function getCss ( ) { if ( isset ( $ this -> _themeConfig [ 'css' ] ) ) { return array_merge ( $ this -> _themeConfig [ 'css' ] , $ this -> _data [ 'css' ] ) ; } else { return $ this -> _data [ 'css' ] ; } }
Get array of css files to include in theme
10,924
public function getJs ( ) { if ( isset ( $ this -> _themeConfig [ 'js' ] ) ) { return array_merge ( $ this -> _themeConfig [ 'js' ] , $ this -> _data [ 'js' ] ) ; } else { return $ this -> _data [ 'js' ] ; } }
Get array of js files to include
10,925
public function addJs ( $ name , $ jsFile , $ order = 10 , $ active = 1 ) { $ this -> _data [ 'js' ] [ $ name ] = array ( 'file' => $ jsFile , 'order' => $ order , 'active' => $ active ) ; }
Add js file to page
10,926
public function getTemplateHtml ( $ partial ) { $ config = $ this -> getThemeConfig ( ) ; $ filename = $ this -> getTemplateFolder ( ) . $ config [ 'templates' ] [ $ partial ] [ 'file' ] ; $ html = $ this -> getTemplateFile ( $ filename , $ this -> getContextConfig ( ) ) ; return $ html ; }
Get template file populated by the config
10,927
public function toHtml ( ) { $ this -> getContextConfig ( ) ; $ this -> getThemeConfig ( ) ; $ filename = $ this -> getTemplateFolder ( ) . $ this -> getTemplate ( ) ; $ html = $ this -> getTemplateFile ( $ filename , $ this ) ; return $ html ; }
Output content to html
10,928
protected function processDir ( $ dir ) { $ dir = $ this -> replacePattern ( $ dir ) ; if ( Path :: isRelative ( $ dir ) ) { $ dir = Path :: makeAbsolute ( $ dir , dirname ( $ this -> configFile ) ) ; } return rtrim ( $ dir , '/' ) ; }
Process given dir with replacements and makes it absolute .
10,929
protected function replacePattern ( $ pattern ) { $ replace = array ( '$DIR' => dirname ( $ this -> configFile ) , '$CWD' => getcwd ( ) , ) ; return str_replace ( array_keys ( $ replace ) , array_values ( $ replace ) , $ pattern ) ; }
Helper to replace certain patterns with actual values .
10,930
public function hasEnabledUsername ( ) { if ( $ this -> usernameClass === false || ! is_string ( $ this -> usernameClass ) || ! class_exists ( $ this -> usernameClass ) ) { return false ; } return true ; }
Check whether this user enables the username feature or not .
10,931
public function getUsername ( ) { if ( ! $ this -> hasEnabledUsername ( ) ) { return null ; } $ usernameClass = $ this -> usernameClass ; $ noInit = $ usernameClass :: buildNoInitModel ( ) ; return $ this -> hasOne ( $ usernameClass , [ $ noInit -> createdByAttribute => $ this -> guidAttribute ] ) ; }
Get username . This method may return null please consider processing the abnormal conditions .
10,932
public function createUsername ( $ username ) { if ( ! $ this -> hasEnabledUsername ( ) ) { return null ; } $ usernameClass = $ this -> usernameClass ; $ model = $ usernameClass :: findOne ( $ this -> getGUID ( ) ) ; if ( ! $ model ) { $ model = $ this -> create ( $ usernameClass ) ; $ model -> setGUID ( $ this -> getG...
Create or get username .
10,933
public function setUsername ( $ username = null ) { if ( $ username === null && ( $ model = $ this -> getUsername ( ) -> one ( ) ) ) { return $ model -> delete ( ) > 0 ; } if ( $ username instanceof Username ) { $ username = $ username -> content ; } $ model = $ this -> createUsername ( $ username ) ; return $ model ->...
Set username .
10,934
public function profileShow ( ) { if ( ! $ this -> isAuthenticated ( ) ) { return $ this -> redirect ( '/login' ) ; } $ userModel = $ this -> session ( ) -> get ( 'user' ) ; return $ this -> twig ( ) -> render ( 'User\profile.twig' , array ( 'user' => $ userModel ) ) ; }
Shows the profile page .
10,935
public function loginShow ( ) { if ( $ this -> isAuthenticated ( ) ) { $ this -> setMessage ( 'warning' , 'you are already logged in' ) ; return $ this -> redirect ( '/' ) ; } return $ this -> twig ( ) -> render ( 'user\login.twig' ) ; }
Shows the login form .
10,936
public function loginAction ( $ request ) { $ data = $ request -> get ( 'data' ) ; $ userModel = new ModelUser ( ) ; $ validUser = $ userModel -> validateLogin ( $ data [ 'email' ] , $ data [ 'password' ] ) ; if ( ! $ validUser ) { $ this -> setMessage ( 'danger' , 'Not valid user / password combination' ) ; return $ t...
Handles the login action .
10,937
public function logoutAction ( ) { if ( $ this -> isAuthenticated ( ) ) { $ this -> session ( ) -> set ( 'user' , null ) ; } $ this -> setMessage ( 'success' , 'Bye Bye !' ) ; return $ this -> redirect ( '/' ) ; }
Handles the logout actions .
10,938
public function registerAction ( $ request ) { $ modelUser = new ModelUser ( ) ; $ data = $ request -> get ( 'data' ) ; $ error = false ; if ( $ this -> isAuthenticated ( ) ) { $ this -> setMessage ( 'error' , 'You are logged in' ) ; $ error = true ; } if ( ! filter_var ( $ data [ 'model' ] [ 'email' ] , FILTER_VALIDAT...
Shows register form .
10,939
public function recoverAction ( $ request ) { $ data = $ request -> get ( 'data' ) ; $ modelUser = new ModelUser ; if ( $ this -> isAuthenticated ( ) ) { $ this -> setMessage ( 'error' , 'Your are already authenticated.' ) ; return $ this -> redirect ( '/' ) ; } if ( ! filter_var ( $ data [ 'model' ] [ 'email' ] , FILT...
Handles the recover action .
10,940
public function initializeClass ( ) { if ( ! isset ( $ this -> options [ 'services' ] ) || ! is_array ( $ this -> options [ 'services' ] ) ) { return ; } if ( $ this -> getPersistence ( ) && $ this -> getCache ( ) !== null && ( $ definition = $ this -> getCache ( ) -> getItem ( 'jrpc-definition' ) ) !== null && ( $ ser...
Initialize all class .
10,941
public function getPersistence ( ) { if ( null === $ this -> persistence ) { $ this -> persistence = ( isset ( $ this -> options [ 'persistence' ] ) && $ this -> options [ 'persistence' ] == true ) ; } return $ this -> persistence ; }
Check persistance .
10,942
public function getCache ( ) { if ( null === $ this -> cache ) { if ( isset ( $ this -> options [ 'cache' ] ) && is_string ( $ this -> options [ 'cache' ] ) ) { $ this -> cache = $ this -> container -> get ( $ this -> options [ 'cache' ] ) ; } } return $ this -> cache ; }
Get Storage if define in config .
10,943
public function setEventManager ( \ Zend \ EventManager \ EventManagerInterface $ events ) { $ this -> events = $ events ; $ this -> events -> setIdentifiers ( [ __CLASS__ , get_called_class ( ) ] ) ; return $ this ; }
Inject an EventManager instance .
10,944
public function getCacheTag ( ) { return $ this -> cacheTagPrefix . ( $ this -> isAttributeChanged ( $ this -> idAttribute ) ? $ this -> getOldAttribute ( $ this -> idAttribute ) : $ this -> getID ( ) ) ; }
Get cache tag . The cache tag ends with the user ID but after the user ID is modified the old ID will prevail .
10,945
public static function fromEnv ( $ configFilename , Version $ version ) { if ( null === $ configFilename ) { $ configFilename = getenv ( 'ZFILE' ) ? getenv ( 'ZFILE' ) : 'z.yml' ; } return new self ( $ configFilename , new PathDefaultFileLocator ( 'ZPATH' , array ( getcwd ( ) , getenv ( 'HOME' ) . '/.config/z' ) ) , ne...
Create the configuration loader based the current shell environment variables .
10,946
public function processConfiguration ( ) { Debug :: enterScope ( 'config' ) ; Debug :: enterScope ( 'load' ) ; try { $ zfiles = ( array ) $ this -> configLocator -> locate ( $ this -> configFilename , null , false ) ; } catch ( \ InvalidArgumentException $ e ) { $ zfiles = array ( ) ; } foreach ( $ zfiles as $ file ) {...
Processes the configuration contents
10,947
protected function loadPlugin ( $ name , $ file ) { require_once $ file ; $ className = sprintf ( 'Zicht\Tool\Plugin\%s\Plugin' , ucfirst ( basename ( $ name ) ) ) ; $ class = new \ ReflectionClass ( $ className ) ; if ( ! $ class -> implementsInterface ( 'Zicht\Tool\PluginInterface' ) ) { throw new \ UnexpectedValueEx...
Load the specified plugin instance .
10,948
public function getTemplateFile ( $ filename , $ data ) { $ data [ 'getRegion' ] = function ( $ name ) { return $ this -> getRegion ( $ name ) ; } ; return parent :: getTemplateFile ( $ filename , $ data ) ; }
Get template file
10,949
public function getRegion ( $ name ) { if ( array_key_exists ( $ name , $ this -> _regions ) ) { $ html = ( is_subclass_of ( $ this -> _regions [ $ name ] , 'erdiko\core\Container' ) ) ? $ this -> _regions [ $ name ] -> toHtml ( ) : $ this -> _regions [ $ name ] ; } else { throw new \ Exception ( "Template region '{$na...
get rendered region
10,950
public function getAddresses ( CoordinatesInterface $ coordinates ) : AddressCollection { $ url = $ this -> coordinatesQuery ( $ coordinates ) ; $ json = $ this -> fetchUrl ( $ url ) ; $ results = [ ] ; foreach ( $ json -> results as $ result ) { $ address = AddressBuild :: create ( $ result ) ; $ address -> setCoordin...
Get possible addresses using CoordinatesInterface
10,951
public function getCoordinatesByObject ( AddressInterface $ address ) : CoordinatesInterface { $ url = $ this -> addressQuery ( $ address -> getFormattedAddress ( ) ) ; $ json = $ this -> fetchUrl ( $ url ) ; $ coordinates = CoordinatesBuild :: create ( $ json -> results [ 0 ] ) ; return $ coordinates ; }
Get coordinates using AddressInterface
10,952
public function getCoordinatesByString ( string $ address ) : CoordinatesInterface { $ url = $ this -> addressQuery ( $ address ) ; $ json = $ this -> fetchUrl ( $ url ) ; $ coordinates = CoordinatesBuild :: create ( $ json -> results [ 0 ] ) ; return $ coordinates ; }
Get coordinates using string
10,953
private function coordinatesQuery ( CoordinatesInterface $ coordinates ) : string { $ url = sprintf ( self :: API_COORDINATES_URL_SSL , $ coordinates -> getLatitude ( ) , $ coordinates -> getLongitude ( ) ) ; $ url = $ this -> buildQuery ( $ url , $ this -> apiKey , $ this -> locale , $ this -> region ) ; return $ url ...
Build coordinates query
10,954
private function addressQuery ( string $ formattedAddress ) : string { $ url = sprintf ( self :: API_ADDRESS_URL_SSL , rawurlencode ( $ formattedAddress ) ) ; $ url = $ this -> buildQuery ( $ url , $ this -> apiKey , $ this -> locale , $ this -> region ) ; return $ url ; }
Build address query
10,955
private function buildQuery ( string $ url , string $ apiKey , string $ locale = null , string $ region = null ) : string { if ( null !== $ apiKey ) { $ url = sprintf ( '%s&key=%s' , $ url , $ apiKey ) ; } if ( null !== $ locale ) { $ url = sprintf ( '%s&language=%s' , $ url , $ locale ) ; } if ( null !== $ region ) { ...
build query with extra params
10,956
public function validate ( $ model , $ validators = null ) { if ( isset ( $ validators ) && is_array ( $ validators ) ) { $ validation = $ this -> validateArray ( $ model , $ validators ) ; } else { $ validation = $ this -> validateModel ( $ model ) ; } if ( $ validation ) { $ errors = $ validation -> validate ( $ mode...
Validate model object
10,957
public function createForm ( $ model , $ formClass = null ) { if ( is_string ( $ model ) ) { return $ this -> createFormInternal ( $ model , new $ model , $ formClass ) ; } else { return $ this -> createFormInternal ( get_class ( $ model ) , $ model , $ formClass ) ; } }
Create form object
10,958
private function getLabels ( $ annotations ) { $ it = $ this -> getAnnotations ( ) -> filter ( $ annotations ) -> is ( Label :: class ) -> onProperties ( ) ; $ labels = [ ] ; foreach ( $ it as $ annotation ) { $ labels [ $ annotation -> getPropertyName ( ) ] = $ annotation -> value ; } return $ labels ; }
Gets property labels
10,959
private function getValidators ( $ annotations , $ class ) { $ validators = [ ] ; $ it = $ this -> getAnnotations ( ) -> filter ( $ annotations ) -> is ( ValidatorInterface :: class ) -> onProperties ( ) ; foreach ( $ it as $ annotation ) { $ property = $ annotation -> getPropertyName ( ) ; if ( ! isset ( $ validators ...
Gets all validators
10,960
private function getElements ( $ annotations , $ formClass ) { $ labels = $ this -> getLabels ( $ annotations ) ; $ reflection = new \ ReflectionClass ( $ formClass ) ; $ defaultValues = $ reflection -> getDefaultProperties ( ) ; $ elements = [ ] ; $ it = $ this -> getAnnotations ( ) -> filter ( $ annotations ) -> is (...
Gets all form elements
10,961
public function getSingle ( $ key , $ forClientId = null ) { $ params = array ( 'key' => $ key ) ; if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/get' , $ params ) ; }
Get the value associated with a key for a particular client_id . If the key has not value for that client then return the key s default value for the application or if they key has not default value then return null .
10,962
public function items ( $ forClientId = null ) { $ params = array ( ) ; if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/items' , $ params ) ; }
Get all settings for a particular client including those from the application - wide default settings . If a key is defined in both the client and application settings only the client - specific value is returned .
10,963
public function keys ( $ forClientId = null ) { $ params = array ( ) ; if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/keys' , $ params ) ; }
Get all keys for a particular client including those from the application - wide default settings . Returns an array of the keys .
10,964
public function set ( $ key , $ value , $ forClientId = null ) { $ params = array ( 'key' => $ key , 'value' => $ value ) ; if ( is_array ( $ value ) ) { $ params [ 'value' ] = json_encode ( $ value ) ; } if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/set' , $ ...
Assign a key - value pair for a particular client_id . If the key does not exist it will be created . If they key already exists this call overwrites the existing value .
10,965
public function setMulti ( array $ items , $ forClientId = null ) { $ params = array ( 'items' => json_encode ( $ items ) ) ; if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/set_multi' , $ params ) ; }
Assign multiple settings for a particular client_id . Returns a JSON object in which each key is mapped to a boolean that indicates whether the key already existed . True indicates that a previous key did exist and has been overwritten . False indicates that there were no previous key and a new key has been created . D...
10,966
public function setDefault ( $ key , $ value ) { $ params = array ( 'key' => $ key , 'value' => $ value ) ; if ( is_array ( $ value ) ) { $ params [ 'value' ] = json_encode ( $ value ) ; } return $ this -> post ( 'settings/set_default' , $ params ) ; }
Set the application - wide default value for a key . This will create a new key with a default value if the key does not yet exist in the application . If the key does exist the value will be overwritten .
10,967
public function delete ( $ key , $ forClientId = null ) { $ params = array ( 'key' => $ key ) ; if ( $ forClientId ) { $ params [ 'for_client_id' ] = $ forClientId ; } return $ this -> post ( 'settings/delete' , $ params ) ; }
Delete a key from the settings for a particular client . Returns a boolean indicating whether the key existed . This does not modify the application - wide default value for a key .
10,968
public function setOptions ( $ options ) { if ( is_array ( $ options ) ) { $ this -> options -> merge ( $ options ) ; } else if ( $ options instanceof ezcTranslationTsBackendOptions ) { $ this -> options = $ options ; } else { throw new ezcBaseValueException ( "options" , $ options , "instance of ezcTranslationTsBacken...
Set new options . This method allows you to change the options of the translation backend .
10,969
public function deinitWriter ( ) { if ( is_null ( $ this -> dom ) ) { throw new ezcTranslationWriterNotInitializedException ( ) ; } $ filename = $ this -> buildTranslationFileName ( $ this -> writeLocale ) ; $ this -> dom -> save ( $ filename ) ; }
Deinitializes the writer
10,970
public function next ( ) { if ( is_null ( $ this -> xmlParser ) ) { throw new ezcTranslationReaderNotInitializedException ( ) ; } $ valid = $ this -> xmlParser -> valid ( ) ; if ( $ valid ) { $ newContext = array ( trim ( $ this -> xmlParser -> getChildren ( ) -> name ) , array ( ) ) ; foreach ( $ this -> xmlParser -> ...
Advanced to the next context .
10,971
public function create ( $ basePath ) { $ parts = explode ( '.' , $ this -> loadVersion ( $ basePath ) -> getShortVersion ( ) ) ; while ( ! empty ( $ parts ) ) { $ version = implode ( 'Dot' , $ parts ) ; $ classname = __NAMESPACE__ . '\\Joomla' . $ version . 'Driver' ; if ( class_exists ( $ classname ) ) { return new $...
Create a version specific driver to Joomla
10,972
private function loadVersion ( $ basePath ) { static $ locations = array ( '/libraries/cms/version/version.php' , '/libraries/joomla/version.php' , ) ; define ( '_JEXEC' , 1 ) ; foreach ( $ locations as $ location ) { if ( file_exists ( $ basePath . $ location ) ) { $ code = file_get_contents ( $ basePath . $ location ...
Load the Joomla version
10,973
public function getSiblings ( $ active = '1' ) { $ stage = \ Nblum \ FlexibleContent \ FlexibleContentVersionedDataObject :: get_live_stage ( ) ; $ results = \ Nblum \ FlexibleContent \ FlexibleContentVersionedDataObject :: get_by_stage ( \ ContentElement :: class , $ stage , [ 'Active' => $ active ] , [ 'Sort' => 'ASC...
returns all content element of the same page
10,974
protected function bindInstancesInContainer ( ) { $ this -> app -> instance ( "view-control.path" , $ this -> path ( ) ) ; $ this -> app -> instance ( "view-control.path.base" , $ this -> basePath ( ) ) ; }
Bind all of the instances in the container .
10,975
public function basePath ( $ path = '' ) { return $ this -> getFilesystem ( ) -> dirname ( $ this -> path ( ) ) . ( $ path ? DIRECTORY_SEPARATOR . $ path : $ path ) ; }
Get the base path of the plugin installation .
10,976
public static function countMaxDepth ( array $ array ) { $ maxDepth = 1 ; foreach ( $ array as $ element ) { $ depth = 1 ; if ( is_array ( $ element ) ) { $ depth += self :: countMaxDepth ( $ element ) ; } if ( $ depth > $ maxDepth ) $ maxDepth = $ depth ; } return $ maxDepth ; }
Counts maximum array depth recursively
10,977
public static function countMaxDepthIterative ( array $ array ) { $ copy = $ array ; $ maxDepth = 1 ; foreach ( $ copy as $ element ) { $ depth = 1 ; while ( ! empty ( $ element ) ) { if ( is_array ( $ element ) ) { ++ $ depth ; $ tmp = array_shift ( $ element ) ; if ( is_array ( $ tmp ) ) { array_push ( $ element , ar...
Counts maximum array depth iteratively
10,978
public static function countMinDepth ( $ potentialArray , $ depth = 0 ) { if ( ! self :: isLogicallyCastableToInt ( $ depth ) ) { throw new InvalidArgumentException ( 'Depth parameter must be non-negative integer' ) ; } if ( $ depth < 0 ) { throw new InvalidArgumentException ( 'Depth parameter must be non-negative inte...
Counts maximum array depth
10,979
public function getParent ( ) { $ depth = $ this -> iterator -> getDepth ( ) ; return $ depth === 0 ? $ this -> id : $ this -> iterator -> getSubIterator ( $ depth - 1 ) -> key ( ) ; }
Return the parent element
10,980
public function loadProviderFiles ( ) { $ lastWeek = time ( ) - ( 7 * 24 * 60 * 60 ) ; if ( false === $ this -> allowUrlOpen ) { $ this -> logMessage ( 'ProviderCommunication::loadProviderFiles allowUrlOpen = false!' , 'botdetection_debug' ) ; return false ; } foreach ( $ this -> referrerProvider as $ source => $ url )...
Load Referrer Provider Files if - provider files to old
10,981
private function parse ( \ SimpleXMLElement $ xmldata ) { if ( ! isset ( $ xmldata -> title ) ) { throw new OpdsParserNoTitleException ( ) ; } if ( $ xmldata -> getName ( ) === 'entry' ) { return $ this -> parseEntry ( $ xmldata ) ; } return $ this -> parseFeed ( $ xmldata ) ; }
Parse an OPDS flux .
10,982
private function parsePagination ( \ SimpleXMLElement $ xmldata ) { $ pagination = new Pagination ( ) ; $ paginated = false ; foreach ( $ xmldata -> children ( 'opensearch' , true ) as $ key => $ value ) { switch ( $ key ) { case 'totalResults' : $ pagination -> setNumberOfItem ( ( int ) $ value ) ; $ paginated = true ...
Met en forme la pagination si elle existe
10,983
protected function _writeFile ( $ destination , $ data ) { $ destination = trim ( $ destination ) ; if ( false === file_put_contents ( $ destination , $ data ) ) { throw new Mage_Exception ( "Can't write to file: " . $ destination ) ; } return true ; }
Write data to file . If file can t be opened - throw exception
10,984
protected function _readFile ( $ source ) { $ data = '' ; if ( is_file ( $ source ) && is_readable ( $ source ) ) { $ data = @ file_get_contents ( $ source ) ; if ( $ data === false ) { throw new Mage_Exception ( "Can't get contents from: " . $ source ) ; } } return $ data ; }
Read data from file . If file can t be opened throw to exception .
10,985
protected function _initWriter ( ) { $ this -> _writer = new Mage_Archive_Helper_File ( $ this -> _destinationFilePath ) ; $ this -> _writer -> open ( 'w' ) ; return $ this ; }
Initialize tarball writer
10,986
protected function _destroyWriter ( ) { if ( $ this -> _writer instanceof Mage_Archive_Helper_File ) { $ this -> _writer -> close ( ) ; $ this -> _writer = null ; } return $ this ; }
Destroy tarball writer
10,987
protected function _initReader ( ) { $ this -> _reader = new Mage_Archive_Helper_File ( $ this -> _getCurrentFile ( ) ) ; $ this -> _reader -> open ( 'r' ) ; return $ this ; }
Initialize tarball reader
10,988
protected function _destroyReader ( ) { if ( $ this -> _reader instanceof Mage_Archive_Helper_File ) { $ this -> _reader -> close ( ) ; $ this -> _reader = null ; } return $ this ; }
Destroy tarball reader
10,989
protected function _setCurrentFile ( $ file ) { $ this -> _currentFile = $ file . ( ( ! is_link ( $ file ) && is_dir ( $ file ) && substr ( $ file , - 1 ) != DS ) ? DS : '' ) ; return $ this ; }
Set file which is packing .
10,990
protected function _setCurrentPath ( $ path ) { if ( $ this -> _skipRoot && is_dir ( $ path ) ) { $ this -> _currentPath = $ path . ( substr ( $ path , - 1 ) != DS ? DS : '' ) ; } else { $ this -> _currentPath = dirname ( $ path ) . DS ; } return $ this ; }
Set path to file which is packing .
10,991
protected function _packToTar ( $ skipRoot = false ) { $ file = $ this -> _getCurrentFile ( ) ; $ header = '' ; $ data = '' ; if ( ! $ skipRoot ) { $ header = $ this -> _composeHeader ( ) ; $ data = $ this -> _readFile ( $ file ) ; $ data = str_pad ( $ data , floor ( ( ( is_dir ( $ file ) ? 0 : filesize ( $ file ) ) + ...
Walk through directory and add to tar file or directory . Result is packed string on TAR format .
10,992
protected function _createTar ( $ skipRoot = false , $ finalize = false ) { if ( ! $ skipRoot ) { $ this -> _packAndWriteCurrentFile ( ) ; } $ file = $ this -> _getCurrentFile ( ) ; if ( is_dir ( $ file ) ) { $ dirFiles = scandir ( $ file ) ; if ( false === $ dirFiles ) { throw new Mage_Exception ( 'Can\'t scan dir: ' ...
Recursively walk through file tree and create tarball
10,993
protected function _packAndWriteCurrentFile ( ) { $ archiveWriter = $ this -> _getWriter ( ) ; $ archiveWriter -> write ( $ this -> _composeHeader ( ) ) ; $ currentFile = $ this -> _getCurrentFile ( ) ; $ fileSize = 0 ; if ( is_file ( $ currentFile ) && ! is_link ( $ currentFile ) ) { $ fileReader = new Mage_Archive_He...
Write current file to tarball
10,994
protected function _unpackCurrentTar ( $ destination ) { $ archiveReader = $ this -> _getReader ( ) ; $ list = array ( ) ; while ( ! $ archiveReader -> eof ( ) ) { $ header = $ this -> _extractFileHeader ( ) ; if ( ! $ header ) { continue ; } $ currentFile = $ destination . $ header [ 'name' ] ; $ dirname = dirname ( $...
Read TAR string from file and unpacked it . Create files and directories information about discribed in the string .
10,995
protected function _parseHeader ( & $ pointer ) { $ firstLine = fread ( $ pointer , 512 ) ; if ( strlen ( $ firstLine ) < 512 ) { return false ; } $ fmt = self :: _getFormatParseHeader ( ) ; $ header = unpack ( $ fmt , $ firstLine ) ; $ header [ 'mode' ] = $ header [ 'mode' ] + 0 ; $ header [ 'uid' ] = octdec ( $ heade...
Get header from TAR string and unpacked it by format .
10,996
protected function _extractFileHeader ( ) { $ archiveReader = $ this -> _getReader ( ) ; $ headerBlock = $ archiveReader -> read ( self :: TAR_BLOCK_SIZE ) ; if ( strlen ( $ headerBlock ) < self :: TAR_BLOCK_SIZE ) { return false ; } $ header = unpack ( self :: _getFormatParseHeader ( ) , $ headerBlock ) ; $ header [ '...
Read and decode file header information from tarball
10,997
public function grep ( array $ subjects , int $ flags = 0 ) : array { $ result = preg_grep ( $ this -> pattern -> getPattern ( ) . $ this -> modifier , $ subjects , $ flags ) ; if ( ( $ errno = preg_last_error ( ) ) !== PREG_NO_ERROR ) { $ message = array_flip ( get_defined_constants ( true ) [ 'pcre' ] ) [ $ errno ] ;...
Retrieve grepped subjects array
10,998
protected function executeSchemaCommand ( InputInterface $ input , OutputInterface $ output , SchemaTool $ schemaTool , array $ metadata , SymfonyStyle $ ui ) { $ merger = new MetadataMerger ( ) ; $ metadata = $ merger -> merge ( $ metadata ) ; return parent :: executeSchemaCommand ( $ input , $ output , $ schemaTool ,...
Executes the Drop command .
10,999
public function jQuery ( string $ sSelector , string $ sContext = '' ) { return $ this -> getResponse ( ) -> plugin ( 'jquery' ) -> element ( $ sSelector , $ sContext ) ; }
Create a JQuery Element with a given selector and link it to the response attribute .