idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
6,700
|
public static function copy ( $ names , $ from , & $ to ) { if ( is_array ( $ from ) && is_array ( $ to ) ) { foreach ( $ names as $ key ) { if ( isset ( $ from [ $ key ] ) && ! isset ( $ to [ $ key ] ) ) { $ to [ $ key ] = static :: getValue ( $ from , $ key ) ; } } } return $ to ; }
|
Copies the values from one option array to another .
|
6,701
|
public static function move ( $ names , & $ from , & $ to ) { if ( is_array ( $ from ) && is_array ( $ to ) ) { foreach ( $ names as $ key ) { if ( isset ( $ from [ $ key ] ) && ! isset ( $ to [ $ key ] ) ) { $ to [ $ key ] = static :: getValue ( $ from , $ key ) ; $ moved [ $ key ] = static :: removeValue ( $ from , $ key ) ; } } } return $ moved ; }
|
Moves the item values from one array to another .
|
6,702
|
public static function addValue ( $ key , $ value , & $ array , $ glue = ' ' ) { if ( isset ( $ array [ $ key ] ) ) { if ( ! is_array ( $ array [ $ key ] ) ) $ array [ $ key ] = explode ( $ glue , $ array [ $ key ] ) ; $ array [ $ key ] [ ] = $ value ; $ array [ $ key ] = array_unique ( $ array [ $ key ] ) ; $ array [ $ key ] = implode ( $ glue , $ array [ $ key ] ) ; } else $ array [ $ key ] = $ value ; return $ array ; }
|
Adds a new option to the given array . If the key does not exists it will create one if it exists it will append the value and also makes sure the uniqueness of them .
|
6,703
|
public static function getValue ( $ array , $ key , $ default = null ) { if ( $ key instanceof \ Closure ) { return $ key ( $ array , $ default ) ; } elseif ( is_array ( $ array ) ) { return isset ( $ array [ $ key ] ) || array_key_exists ( $ key , $ array ) ? $ array [ $ key ] : $ default ; } else { return $ array -> $ key ; } }
|
Retrieves the value of an array element or object property with the given key or property name . If the key does not exist in the array the default value will be returned instead .
|
6,704
|
public static function removeValue ( & $ array , $ key , $ default = null ) { if ( is_array ( $ array ) ) { $ value = static :: getValue ( $ array , $ key , $ default ) ; unset ( $ array [ $ key ] ) ; return static :: value ( $ value ) ; } return self :: value ( $ default ) ; }
|
Removes an item from the given options and returns the value .
|
6,705
|
private function addLogs ( ) { $ createdBy = new GeneratorField ( ) ; $ createdBy -> name = 'created_by' ; $ createdBy -> parseDBType ( 'integer' ) ; $ createdBy -> parseOptions ( 'if,n' ) ; $ this -> fields [ ] = $ createdBy ; $ updatedBy = new GeneratorField ( ) ; $ updatedBy -> name = 'updated_by' ; $ updatedBy -> parseDBType ( 'integer' ) ; $ updatedBy -> parseOptions ( 'if,n' ) ; $ this -> fields [ ] = $ updatedBy ; }
|
added by dandisy
|
6,706
|
public function output ( $ flags = 0x00003 ) { if ( ( $ flags & self :: OUTPUT_HEADER ) == self :: OUTPUT_HEADER ) { $ this -> sendHeaders ( ) ; } if ( $ this -> outputClosure instanceof \ Closure ) { $ c = $ this -> outputClosure ; $ c ( ) ; return ; } if ( ( $ flags & self :: OUTPUT_BODY ) == self :: OUTPUT_BODY ) { print $ this -> body ; } }
|
Sendet die Headers und gibt den Body aus
|
6,707
|
public function finishView ( FormView $ view , FormInterface $ form , array $ options ) { $ data = $ form -> getData ( ) ; if ( $ data instanceof InsertPagePagePart ) { $ this -> validateParentPage ( ) ; $ reflections = [ ] ; $ nodeFormView = $ view -> children [ 'node' ] ; foreach ( $ nodeFormView -> vars [ 'choices' ] as $ choice ) { $ currentData = $ choice -> data ; $ entityCls = $ currentData -> getRefEntityName ( ) ; if ( ! array_key_exists ( $ entityCls , $ reflections ) ) { $ reflections [ $ entityCls ] = new \ ReflectionClass ( $ entityCls ) ; } if ( ! $ reflections [ $ entityCls ] -> implementsInterface ( InsertablePageInterface :: class ) ) { $ choice -> attr [ 'disabled' ] = 'disabled' ; } } } }
|
We want to set disable the parent page to prevent infinity insert cycle . If it is an edit page we can disable this from form s data .
|
6,708
|
protected function validateParentPage ( ) { $ request = $ this -> requestStack -> getMasterRequest ( ) ; if ( $ request -> query -> has ( 'pageid' ) && $ request -> query -> has ( 'pageclassname' ) ) { $ repo = $ this -> doctrine -> getManager ( ) -> getRepository ( 'KunstmaanNodeBundle:Node' ) ; $ node = $ repo -> getNodeForIdAndEntityname ( $ request -> query -> get ( 'pageid' ) , $ request -> query -> get ( 'pageclassname' ) ) ; $ pageReflection = new \ ReflectionClass ( $ node -> getRefEntityName ( ) ) ; if ( $ pageReflection -> implementsInterface ( InsertablePageInterface :: class ) ) { $ currentContext = $ this -> requestStack -> getMasterRequest ( ) -> get ( 'context' ) ; $ page = $ pageReflection -> newInstanceWithoutConstructor ( ) ; $ pagePartConfigs = $ this -> pagePartConfigReader -> getPagePartAdminConfigurators ( $ page ) ; foreach ( $ pagePartConfigs as $ config ) { if ( $ config -> getContext ( ) === $ currentContext ) { foreach ( $ config -> getPossiblePagePartTypes ( ) as $ pagePartType ) { if ( $ pagePartType [ 'class' ] === InsertPagePagePart :: class ) { throw new \ LogicException ( sprintf ( 'The %s page must not allow %s as possible page part, because it implements %s! You must modify the "%s" context.' , $ pageReflection -> getName ( ) , InsertPagePagePart :: class , InsertablePageInterface :: class , $ currentContext ) ) ; } } } } } } }
|
Check if the page part is insertable into the current page .
|
6,709
|
public function repos ( $ language = null , $ private = null , $ organization = null , $ type = null , $ imported = null ) { return $ this -> request ( sprintf ( 'github?lang=%s&private=%b&org_name=%s&org_type=%s&page=%d&only_imported=%b' , $ language , $ private , $ organization , $ type , 1 , $ imported ) ) ; }
|
lists your s github repos .
|
6,710
|
public function import ( $ repository , $ branch = null , $ file = null ) { return $ this -> request ( sprintf ( 'github/%s?branch=%s&file=%s' , $ this -> transform ( $ repository ) , $ branch , $ file ) , 'POST' ) ; }
|
imports project file from github .
|
6,711
|
public function getClassFromUse ( $ coverClassName , $ usedClasses ) { if ( false === is_array ( $ usedClasses ) ) { return $ coverClassName ; } foreach ( $ usedClasses as $ use ) { $ this -> getClassNameFromClassFQN ( $ use ) ; if ( $ coverClassName === $ this -> getClassNameFromClassFQN ( $ use ) ) { return $ use ; } } return $ coverClassName ; }
|
check for className in use statements return className on missing use statement
|
6,712
|
public function getUsedClassesInClass ( $ classFile ) { $ useResult = array ( ) ; $ content = $ this -> getFileContent ( $ classFile ) ; if ( preg_match_all ( '/(use\s+)(.*)(;)/' , $ content , $ useResult ) && 4 === count ( $ useResult ) ) { return ( $ useResult [ 2 ] ) ; } return null ; }
|
return all in file use statement defined classes
|
6,713
|
public function set ( string $ hash , string $ content ) : void { $ this -> saveContent ( $ hash , $ content ) ; }
|
Sets content into the registry .
|
6,714
|
public static function create ( $ host , $ port , $ password ) { $ connection = ConnectionFactory :: create ( $ host , $ port , $ password ) ; return new Messenger ( $ connection ) ; }
|
Create a new RconMessenger
|
6,715
|
public function get ( $ name , $ default = null , $ file = null ) { $ configVal = null ; if ( is_array ( $ this -> config ) ) { if ( $ file === null ) { if ( count ( array_column ( $ this -> config , $ name ) ) > 0 ) { $ configVal = array_column ( $ this -> config , $ name ) [ 0 ] ; } else { $ configVal = array_column ( $ this -> config , $ name ) ; } } else { if ( count ( array_column ( $ this -> config -> $ file , $ name ) ) > 0 ) { $ configVal = array_column ( $ this -> config -> $ file , $ name ) [ 0 ] ; } else { $ configVal = array_column ( $ this -> config -> $ file , $ name ) ; } } } if ( empty ( $ configVal ) ) { return $ default ; } return $ configVal ; }
|
Gets a config value from the config array .
|
6,716
|
public function getCMSFields ( ) { $ fields = parent :: getCMSFields ( ) ; $ fields -> removeByName ( 'Sort' ) ; $ fields -> removeByName ( 'ParentID' ) ; $ fields -> addFieldToTab ( 'Root.Main' , new TextField ( 'Name' , _t ( 'ExternalContentSource.NAME' , 'Name' ) ) ) ; $ fields -> addFieldToTab ( 'Root.Main' , new CheckboxField ( "ShowContentInMenu" , _t ( 'ExternalContentSource.SHOW_IN_MENUS' , 'Show Content in Menus' ) ) ) ; return $ fields ; }
|
Child classes should provide connection details to the external content source
|
6,717
|
public function stageChildren ( $ showAll = false ) { if ( ! $ this -> ID ) { return DataObject :: get ( 'ExternalContentSource' ) ; } $ children = new ArrayList ( ) ; return $ children ; }
|
Override to return the top level content items from the remote content source .
|
6,718
|
private static function core ( $ word , $ iteration ) { $ word = self :: rotate ( $ word ) ; for ( $ i = 0 ; $ i < 4 ; ++ $ i ) $ word [ $ i ] = self :: $ sbox [ $ word [ $ i ] ] ; $ word [ 0 ] = $ word [ 0 ] ^ self :: $ Rcon [ $ iteration ] ; return $ word ; }
|
Key Schedule Core
|
6,719
|
private static function createRoundKey ( $ expandedKey , $ roundKeyPointer ) { $ roundKey = array ( ) ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) for ( $ j = 0 ; $ j < 4 ; $ j ++ ) $ roundKey [ $ j * 4 + $ i ] = $ expandedKey [ $ roundKeyPointer + $ i * 4 + $ j ] ; return $ roundKey ; }
|
position within the expanded key .
|
6,720
|
private static function round ( $ state , $ roundKey ) { $ state = self :: subBytes ( $ state , false ) ; $ state = self :: shiftRows ( $ state , false ) ; $ state = self :: mixColumns ( $ state , false ) ; $ state = self :: addRoundKey ( $ state , $ roundKey ) ; return $ state ; }
|
applies the 4 operations of the forward round in sequence
|
6,721
|
private static function invRound ( $ state , $ roundKey ) { $ state = self :: shiftRows ( $ state , true ) ; $ state = self :: subBytes ( $ state , true ) ; $ state = self :: addRoundKey ( $ state , $ roundKey ) ; $ state = self :: mixColumns ( $ state , true ) ; return $ state ; }
|
applies the 4 operations of the inverse round in sequence
|
6,722
|
private static function encryptBlock ( $ input , $ key , $ size ) { $ output = array ( ) ; $ block = array ( ) ; $ nbrRounds = self :: numberOfRounds ( $ size ) ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) for ( $ j = 0 ; $ j < 4 ; $ j ++ ) $ block [ ( $ i + ( $ j * 4 ) ) ] = $ input [ ( $ i * 4 ) + $ j ] ; $ expandedKey = self :: expandKey ( $ key , $ size ) ; $ block = self :: main ( $ block , $ expandedKey , $ nbrRounds ) ; for ( $ k = 0 ; $ k < 4 ; $ k ++ ) for ( $ l = 0 ; $ l < 4 ; $ l ++ ) $ output [ ( $ k * 4 ) + $ l ] = $ block [ ( $ k + ( $ l * 4 ) ) ] ; return $ output ; }
|
encrypts a 128 bit input block against the given key of size specified
|
6,723
|
private static function decryptBlock ( $ input , $ key , $ size ) { $ output = array ( ) ; $ block = array ( ) ; $ nbrRounds = self :: numberOfRounds ( $ size ) ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) for ( $ j = 0 ; $ j < 4 ; $ j ++ ) $ block [ ( $ i + ( $ j * 4 ) ) ] = $ input [ ( $ i * 4 ) + $ j ] ; $ expandedKey = self :: expandKey ( $ key , $ size ) ; $ block = self :: invMain ( $ block , $ expandedKey , $ nbrRounds ) ; for ( $ k = 0 ; $ k < 4 ; $ k ++ ) for ( $ l = 0 ; $ l < 4 ; $ l ++ ) $ output [ ( $ k * 4 ) + $ l ] = $ block [ ( $ k + ( $ l * 4 ) ) ] ; return $ output ; }
|
decrypts a 128 bit input block against the given key of size specified
|
6,724
|
private static function getPaddedBlock ( $ bytesIn , $ start , $ end , $ mode ) { if ( $ end - $ start > 16 ) $ end = $ start + 16 ; $ xarray = array_slice ( $ bytesIn , $ start , $ end - $ start ) ; $ cpad = 16 - count ( $ xarray ) ; while ( count ( $ xarray ) < 16 ) { array_push ( $ xarray , $ cpad ) ; } return $ xarray ; }
|
gets a properly padded block
|
6,725
|
public function refund ( $ guid , Amount $ refundAmount ) { return new Transaction ( $ this -> client -> post ( 'transactions/' . $ guid . '/refunds' , [ "amount" => $ refundAmount ] ) ) ; }
|
Refunds a previously initiated and closed and captured transaction .
|
6,726
|
protected function prepare_query ( ) { $ this -> query -> where ( $ this -> foreign_key , $ this -> local_model -> { $ this -> local_key } ) -> limit ( 1 ) ; }
|
Prepare the query object
|
6,727
|
public function hook ( $ event , callable $ callback , $ priority = 10 ) { $ this -> app -> hook ( $ event , $ callback , $ priority ) ; }
|
Hook an event
|
6,728
|
public function applyChain ( $ name , $ hookArg = null ) { $ hooks = $ this -> app -> getHooks ( ) ; if ( ! isset ( $ hooks [ $ name ] ) ) { $ hooks [ $ name ] = array ( array ( ) ) ; } if ( ! empty ( $ hooks [ $ name ] ) ) { if ( count ( $ hooks [ $ name ] ) > 1 ) { ksort ( $ hooks [ $ name ] ) ; } foreach ( $ hooks [ $ name ] as $ priority ) { if ( ! empty ( $ priority ) ) { foreach ( $ priority as $ callable ) { $ value = call_user_func ( $ callable , $ hookArg ) ; if ( $ value !== null ) { return $ value ; } } } } } }
|
Trigger a chained hook - The first callback to return a non - null value will be returned
|
6,729
|
public function actionClear ( ) { OAuth2AuthorizationCode :: deleteAll ( [ '<' , 'expires' , time ( ) ] ) ; OAuth2RefreshToken :: deleteAll ( [ '<' , 'expires' , time ( ) ] ) ; OAuth2AccessToken :: deleteAll ( [ '<' , 'expires' , time ( ) ] ) ; }
|
Clean up expired token
|
6,730
|
function UpdateCookies ( $ cookies ) { if ( sizeof ( $ this -> cookies ) == 0 ) { if ( sizeof ( $ cookies ) > 0 ) { $ this -> debug ( 'Setting new cookie(s)' ) ; $ this -> cookies = $ cookies ; } return TRUE ; } if ( sizeof ( $ cookies ) == 0 ) { return TRUE ; } foreach ( $ cookies as $ newCookie ) { if ( ! is_array ( $ newCookie ) ) { continue ; } if ( ( ! isset ( $ newCookie [ 'name' ] ) ) || ( ! isset ( $ newCookie [ 'value' ] ) ) ) { continue ; } $ newName = $ newCookie [ 'name' ] ; $ found = FALSE ; for ( $ i = 0 ; $ i < count ( $ this -> cookies ) ; $ i ++ ) { $ cookie = $ this -> cookies [ $ i ] ; if ( ! is_array ( $ cookie ) ) { continue ; } if ( ! isset ( $ cookie [ 'name' ] ) ) { continue ; } if ( $ newName != $ cookie [ 'name' ] ) { continue ; } $ newDomain = isset ( $ newCookie [ 'domain' ] ) ? $ newCookie [ 'domain' ] : 'NODOMAIN' ; $ domain = isset ( $ cookie [ 'domain' ] ) ? $ cookie [ 'domain' ] : 'NODOMAIN' ; if ( $ newDomain != $ domain ) { continue ; } $ newPath = isset ( $ newCookie [ 'path' ] ) ? $ newCookie [ 'path' ] : 'NOPATH' ; $ path = isset ( $ cookie [ 'path' ] ) ? $ cookie [ 'path' ] : 'NOPATH' ; if ( $ newPath != $ path ) { continue ; } $ this -> cookies [ $ i ] = $ newCookie ; $ found = TRUE ; $ this -> debug ( 'Update cookie ' . $ newName . '=' . $ newCookie [ 'value' ] ) ; break ; } if ( ! $ found ) { $ this -> debug ( 'Add cookie ' . $ newName . '=' . $ newCookie [ 'value' ] ) ; $ this -> cookies [ ] = $ newCookie ; } } return TRUE ; }
|
updates the current cookies with a new set
|
6,731
|
public function getNotifications ( ) { if ( $ this instanceof RESTUser ) { return $ this -> hasMany ( RESTDatabaseNotification :: class , [ 'notifiable_id' => 'id' ] ) -> onCondition ( [ 'notifiable_class' => self :: class ] ) -> addOrderBy ( [ 'created_at' => SORT_DESC ] ) ; } else { return $ this -> hasMany ( DatabaseNotification :: class , [ 'notifiable_id' => 'id' ] ) -> onCondition ( [ 'notifiable_class' => self :: class ] ) -> addOrderBy ( [ 'created_at' => SORT_DESC ] ) ; } }
|
Get the entity s notifications .
|
6,732
|
protected function arrayDot ( $ array , $ prepend = null ) { if ( function_exists ( 'array_dot' ) ) { return array_dot ( $ array ) ; } $ results = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ results = array_merge ( $ results , $ this -> arrayDot ( $ value , $ prepend . $ key . '.' ) ) ; } else { $ results [ $ prepend . $ key ] = $ value ; } } return $ results ; }
|
Flatten a multi - dimensional associative array with dots . From Laravel framework .
|
6,733
|
public function requireDefaultRecords ( ) { parent :: requireDefaultRecords ( ) ; if ( defined ( 'CREATE_GEODISTANCE_UDF' ) && GEOFORM_CREATE_GEODISTANCE_UDF ) { if ( ! defined ( 'CreateGeodistanceOnce' ) ) { define ( 'CreateGeodistanceOnce' , true ) ; $ q1 = "DROP FUNCTION IF EXISTS geodistance;" ; $ q2 = "CREATE FUNCTION `geodistance`(lat1 DOUBLE, lng1 DOUBLE, lat2 DOUBLE, lng2 DOUBLE) RETURNS double NO SQLBEGINDECLARE radius DOUBLE;DECLARE distance DOUBLE;DECLARE vara DOUBLE;DECLARE varb DOUBLE;DECLARE varc DOUBLE;SET lat1 = RADIANS(lat1);SET lng1 = RADIANS(lng1);SET lat2 = RADIANS(lat2);SET lng2 = RADIANS(lng2);SET radius = 6371.0;SET varb = SIN((lat2 - lat1) / 2.0);SET varc = SIN((lng2 - lng1) / 2.0);SET vara = SQRT((varb * varb) + (COS(lat1) * COS(lat2) * (varc * varc)));SET distance = radius * (2.0 * ASIN(CASE WHEN 1.0 < vara THEN 1.0 ELSE vara END));RETURN distance;END" ; DB :: query ( $ q1 ) ; DB :: query ( $ q2 ) ; DB :: alteration_message ( 'MySQL geodistance function created' , 'created' ) ; } } }
|
Set Default Frontend group for new members
|
6,734
|
public function set ( array $ rules ) { $ this -> items = array_merge ( $ this -> items , $ this -> parseRules ( $ rules ) ) ; return $ this ; }
|
Set multiple rules .
|
6,735
|
protected function parseAttributeFilters ( array & $ parsedRules , $ attribute , $ filters ) { foreach ( explode ( '|' , $ filters ) as $ filter ) { $ parsedFilter = $ this -> parseRule ( $ filter ) ; if ( ! empty ( $ parsedFilter ) ) { $ parsedRules [ $ attribute ] [ ] = $ parsedFilter ; } } }
|
Parse attribute s filters .
|
6,736
|
private function registerJsonHandler ( Whoops $ whoops , $ config ) : void { if ( empty ( $ config [ 'json_exceptions' ] [ 'display' ] ) ) { return ; } $ handler = new JsonResponseHandler ( ) ; if ( ! empty ( $ config [ 'json_exceptions' ] [ 'show_trace' ] ) ) { $ handler -> addTraceToOutput ( true ) ; } if ( ! empty ( $ config [ 'json_exceptions' ] [ 'ajax_only' ] ) ) { if ( \ method_exists ( WhoopsUtil :: class , 'isAjaxRequest' ) ) { if ( ! WhoopsUtil :: isAjaxRequest ( ) ) { return ; } } elseif ( \ method_exists ( $ handler , 'onlyForAjaxRequests' ) ) { $ handler -> onlyForAjaxRequests ( true ) ; } } $ whoops -> pushHandler ( $ handler ) ; }
|
If configuration indicates a JsonResponseHandler configure and register it .
|
6,737
|
public function hydrate ( array $ properties ) { foreach ( $ properties as $ prop => $ val ) { if ( property_exists ( $ this , $ prop ) ) { $ this -> { $ prop } = $ val ; } } return $ this ; }
|
Hydrate an entity with properites
|
6,738
|
public function from ( $ table , $ alias = null ) { $ this -> _table = ( string ) $ table ; $ this -> asAlias ( $ alias ) ; return $ this ; }
|
Set the table to join against .
|
6,739
|
public function on ( $ foreignKey , $ key = null ) { if ( is_array ( $ foreignKey ) ) { $ this -> _conditions = array_replace ( $ this -> _conditions , $ foreignKey ) ; } else { $ this -> _conditions [ $ foreignKey ] = $ key ; } return $ this ; }
|
Set the conditions to join on .
|
6,740
|
public function getViewHelperConfig ( ) { return [ 'aliases' => [ 'losrecaptcha/recaptcha' => Form \ View \ Helper \ Captcha \ ReCaptcha :: class , 'losrecaptcha/invisible' => Form \ View \ Helper \ Captcha \ Invisible :: class , ] , 'factories' => [ Form \ View \ Helper \ Captcha \ ReCaptcha :: class => InvokableFactory :: class , Form \ View \ Helper \ Captcha \ Invisible :: class => InvokableFactory :: class , ] , ] ; }
|
Return zend - view helper configuration .
|
6,741
|
public static function fromSchema ( $ schema , $ preFilter = array ( ) , $ postFilter = array ( ) ) { $ rules = array ( ) ; foreach ( $ preFilter as $ key => $ filter ) { $ filter = explode ( '|' , $ filter ) ; foreach ( $ filter as $ f ) { $ rules [ $ key ] [ ] = trim ( $ f ) ; } } foreach ( $ schema as $ k => $ field ) { if ( is_null ( $ field ) ) { continue ; } $ rules [ $ k ] = array ( 'label' => $ field [ 'label' ] , 'filter' => $ field -> filter ( ) , ) ; } foreach ( $ postFilter as $ key => $ filter ) { $ filter = explode ( '|' , $ filter ) ; foreach ( $ filter as $ f ) { $ rules [ $ key ] [ 'filter' ] [ ] = trim ( $ f ) ; } } return new static ( $ rules ) ; }
|
Static method to create instance of filter from database schema configuration .
|
6,742
|
public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof RemoteHistoryContaoQuery ) { return $ criteria ; } $ query = new RemoteHistoryContaoQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; }
|
Returns a new RemoteHistoryContaoQuery object .
|
6,743
|
public function filterByRemoteAppId ( $ remoteAppId = null , $ comparison = null ) { if ( is_array ( $ remoteAppId ) ) { $ useMinMax = false ; if ( isset ( $ remoteAppId [ 'min' ] ) ) { $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: REMOTE_APP_ID , $ remoteAppId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ remoteAppId [ 'max' ] ) ) { $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: REMOTE_APP_ID , $ remoteAppId [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: REMOTE_APP_ID , $ remoteAppId , $ comparison ) ; }
|
Filter the query on the remote_app_id column
|
6,744
|
public function filterByApiversion ( $ apiversion = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiversion ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiversion ) ) { $ apiversion = str_replace ( '*' , '%' , $ apiversion ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: APIVERSION , $ apiversion , $ comparison ) ; }
|
Filter the query on the apiVersion column
|
6,745
|
public function filterByConfigDisplayerrors ( $ configDisplayerrors = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configDisplayerrors ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configDisplayerrors ) ) { $ configDisplayerrors = str_replace ( '*' , '%' , $ configDisplayerrors ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_DISPLAYERRORS , $ configDisplayerrors , $ comparison ) ; }
|
Filter the query on the config_displayErrors column
|
6,746
|
public function filterByConfigBypasscache ( $ configBypasscache = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configBypasscache ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configBypasscache ) ) { $ configBypasscache = str_replace ( '*' , '%' , $ configBypasscache ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_BYPASSCACHE , $ configBypasscache , $ comparison ) ; }
|
Filter the query on the config_bypassCache column
|
6,747
|
public function filterByConfigMinifymarkup ( $ configMinifymarkup = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configMinifymarkup ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configMinifymarkup ) ) { $ configMinifymarkup = str_replace ( '*' , '%' , $ configMinifymarkup ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_MINIFYMARKUP , $ configMinifymarkup , $ comparison ) ; }
|
Filter the query on the config_minifyMarkup column
|
6,748
|
public function filterByConfigDebugmode ( $ configDebugmode = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configDebugmode ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configDebugmode ) ) { $ configDebugmode = str_replace ( '*' , '%' , $ configDebugmode ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_DEBUGMODE , $ configDebugmode , $ comparison ) ; }
|
Filter the query on the config_debugMode column
|
6,749
|
public function filterByConfigMaintenancemode ( $ configMaintenancemode = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configMaintenancemode ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configMaintenancemode ) ) { $ configMaintenancemode = str_replace ( '*' , '%' , $ configMaintenancemode ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_MAINTENANCEMODE , $ configMaintenancemode , $ comparison ) ; }
|
Filter the query on the config_maintenanceMode column
|
6,750
|
public function filterByConfigGzipscripts ( $ configGzipscripts = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configGzipscripts ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configGzipscripts ) ) { $ configGzipscripts = str_replace ( '*' , '%' , $ configGzipscripts ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_GZIPSCRIPTS , $ configGzipscripts , $ comparison ) ; }
|
Filter the query on the config_gzipScripts column
|
6,751
|
public function filterByConfigRewriteurl ( $ configRewriteurl = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configRewriteurl ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configRewriteurl ) ) { $ configRewriteurl = str_replace ( '*' , '%' , $ configRewriteurl ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_REWRITEURL , $ configRewriteurl , $ comparison ) ; }
|
Filter the query on the config_rewriteURL column
|
6,752
|
public function filterByConfigAdminemail ( $ configAdminemail = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configAdminemail ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configAdminemail ) ) { $ configAdminemail = str_replace ( '*' , '%' , $ configAdminemail ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_ADMINEMAIL , $ configAdminemail , $ comparison ) ; }
|
Filter the query on the config_adminEmail column
|
6,753
|
public function filterByConfigCachemode ( $ configCachemode = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ configCachemode ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ configCachemode ) ) { $ configCachemode = str_replace ( '*' , '%' , $ configCachemode ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: CONFIG_CACHEMODE , $ configCachemode , $ comparison ) ; }
|
Filter the query on the config_cacheMode column
|
6,754
|
public function filterByStatuscode ( $ statuscode = null , $ comparison = null ) { if ( is_array ( $ statuscode ) ) { $ useMinMax = false ; if ( isset ( $ statuscode [ 'min' ] ) ) { $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: STATUSCODE , $ statuscode [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ statuscode [ 'max' ] ) ) { $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: STATUSCODE , $ statuscode [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: STATUSCODE , $ statuscode , $ comparison ) ; }
|
Filter the query on the statuscode column
|
6,755
|
public function filterByExtensions ( $ extensions = null , $ comparison = null ) { if ( is_object ( $ extensions ) ) { $ extensions = serialize ( $ extensions ) ; } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: EXTENSIONS , $ extensions , $ comparison ) ; }
|
Filter the query on the extensions column
|
6,756
|
public function filterByLog ( $ log = null , $ comparison = null ) { if ( is_object ( $ log ) ) { $ log = serialize ( $ log ) ; } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: LOG , $ log , $ comparison ) ; }
|
Filter the query on the log column
|
6,757
|
public function filterByPHP ( $ pHP = null , $ comparison = null ) { if ( is_object ( $ pHP ) ) { $ pHP = serialize ( $ pHP ) ; } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: PHP , $ pHP , $ comparison ) ; }
|
Filter the query on the php column
|
6,758
|
public function filterByMySQL ( $ mySQL = null , $ comparison = null ) { if ( is_object ( $ mySQL ) ) { $ mySQL = serialize ( $ mySQL ) ; } return $ this -> addUsingAlias ( RemoteHistoryContaoPeer :: MYSQL , $ mySQL , $ comparison ) ; }
|
Filter the query on the mysql column
|
6,759
|
public function useRemoteAppQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinRemoteApp ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'RemoteApp' , '\Slashworks\AppBundle\Model\RemoteAppQuery' ) ; }
|
Use the RemoteApp relation RemoteApp object
|
6,760
|
public function compare ( $ another ) { if ( $ another instanceof Collection ) { $ another = $ another -> toArray ( ) ; } $ me = $ this -> toArray ( ) ; if ( $ me == $ another ) { return 0 ; } else { return 1 ; } }
|
Perform comparison between this implementation and another implementation of \ Norm \ Type \ Collection or an array .
|
6,761
|
public function getWhereClause ( Builder $ objBuilder , $ blnProcessOnce = false ) { if ( $ blnProcessOnce && $ this -> blnProcessed ) { return null ; } $ this -> blnProcessed = true ; try { $ objConditionBuilder = new PartialBuilder ( $ objBuilder ) ; $ this -> updateQueryBuilder ( $ objConditionBuilder ) ; return $ objConditionBuilder -> getWhereStatement ( ) ; } catch ( Caller $ objExc ) { $ objExc -> incrementOffset ( ) ; $ objExc -> incrementOffset ( ) ; throw $ objExc ; } }
|
Used internally by QCubed Query to get an individual where clause for a given condition Mostly used for conditional joins .
|
6,762
|
public function buildForm ( FormBuilderInterface $ builder , array $ options ) { if ( $ this -> getParent ( ) === 'hidden' ) { $ builder -> addModelTransformer ( $ this -> transformer ) ; } }
|
add a data transformer if user can reach only one center
|
6,763
|
private function prepareReachableCenterByUser ( ) { $ groupCenters = $ this -> user -> getGroupCenters ( ) ; foreach ( $ groupCenters as $ groupCenter ) { $ center = $ groupCenter -> getCenter ( ) ; if ( ! array_key_exists ( $ center -> getId ( ) , $ this -> reachableCenters ) ) { $ this -> reachableCenters [ $ center -> getId ( ) ] = $ center ; } } }
|
populate reachableCenters as an associative array where keys are center . id and value are center entities .
|
6,764
|
public function extractTo ( WebforgeDir $ dir = NULL ) { if ( ! isset ( $ dir ) ) $ dir = $ this -> rar -> getDirectory ( ) ; else $ dir -> create ( ) ; $ this -> exec ( 'x' , array ( 'y' ) , ( string ) $ dir ) ; return $ this ; }
|
Entpackt alle Dateien des Archives in ein Verzeichnis
|
6,765
|
function copy ( $ name , $ new_name , $ update = false ) { $ new_name = preg_replace ( '/([^a-zA-Z0-9_])/' , '_' , $ new_name ) ; $ result = array ( ) ; $ result [ 'status' ] = false ; if ( $ name && $ new_name ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( 'count(*)' ) -> from ( '#__jfusion' ) -> where ( 'original_name IS NULL' ) -> where ( 'name LIKE ' . $ db -> quote ( $ name ) ) ; $ db -> setQuery ( $ query ) ; $ record = $ db -> loadResult ( ) ; $ query = $ db -> getQuery ( true ) -> select ( 'id' ) -> from ( '#__jfusion' ) -> where ( 'name = ' . $ db -> quote ( $ new_name ) ) ; $ db -> setQuery ( $ query ) ; $ exsist = $ db -> loadResult ( ) ; if ( $ exsist ) { throw new RuntimeException ( $ new_name . ' ' . Text :: _ ( 'ALREADY_IN_USE' ) ) ; } else if ( $ record ) { $ JFusionPlugin = Factory :: getAdmin ( $ name ) ; if ( $ JFusionPlugin -> multiInstance ( ) ) { $ db = Factory :: getDBO ( ) ; if ( ! $ update ) { $ query = $ db -> getQuery ( true ) -> select ( '*' ) -> from ( '#__jfusion' ) -> where ( 'name = ' . $ db -> quote ( $ name ) ) ; $ db -> setQuery ( $ query ) ; $ plugin_entry = $ db -> loadObject ( ) ; $ plugin_entry -> name = $ new_name ; $ plugin_entry -> id = null ; if ( empty ( $ plugin_entry -> original_name ) ) { $ plugin_entry -> original_name = $ name ; } $ db -> insertObject ( '#__jfusion' , $ plugin_entry , 'id' ) ; } $ result [ 'message' ] = $ new_name . ': ' . Text :: _ ( 'PLUGIN' ) . ' ' . $ name . ' ' . Text :: _ ( 'COPY' ) . ' ' . Text :: _ ( 'SUCCESS' ) ; $ result [ 'status' ] = true ; } else { throw new RuntimeException ( Text :: _ ( 'CANT_COPY' ) ) ; } } else { throw new RuntimeException ( Text :: _ ( 'INVALID_SELECTED' ) ) ; } } else { throw new RuntimeException ( Text :: _ ( 'NONE_SELECTED' ) ) ; } return $ result ; }
|
handles copying JFusion plugins
|
6,766
|
function getManifest ( $ dir ) { $ file = $ dir . '/jfusion.xml' ; $ this -> installer -> setPath ( 'manifest' , $ file ) ; $ xml = JFusionFramework :: getXml ( $ file ) ; if ( ! ( $ xml instanceof SimpleXMLElement ) || ( $ xml -> getName ( ) != 'extension' ) ) { unset ( $ xml ) ; $ xml = null ; } else { $ type = $ this -> getAttribute ( $ xml , 'type' ) ; if ( $ type !== 'jfusion' ) { unset ( $ xml ) ; $ xml = null ; } } return $ xml ; }
|
load manifest file with installation information
|
6,767
|
function getFiles ( $ folder , $ name ) { $ filesArray = array ( ) ; $ files = Folder :: files ( $ folder , null , false , true ) ; $ path = JFusionFramework :: getPluginPath ( $ name ) ; foreach ( $ files as $ file ) { $ file = str_replace ( $ path . '/' , '' , $ file ) ; $ file = str_replace ( $ path . '\\' , '' , $ file ) ; $ data = file_get_contents ( $ file ) ; $ filesArray [ ] = array ( 'name' => $ file , 'data' => $ data ) ; } $ folders = Folder :: folders ( $ folder , null , false , true ) ; if ( ! empty ( $ folders ) ) { foreach ( $ folders as $ f ) { $ filesArray = array_merge ( $ filesArray , $ this -> getFiles ( $ f , $ name ) ) ; } } return $ filesArray ; }
|
get files function
|
6,768
|
public function addAssignment ( AssignmentElement $ element ) { $ element -> setContainer ( $ this ) ; $ this -> getAssignments ( ) -> attach ( $ element ) ; return $ this ; }
|
Add assignment to the markup .
|
6,769
|
public function getAssignmentsByName ( $ name ) { $ result = [ ] ; foreach ( $ this -> getAssignments ( ) as $ assignment ) { if ( $ assignment -> getName ( ) === $ name ) { $ result [ ] = $ assignment ; } } return $ result ; }
|
Return markup assignments list of a specific name .
|
6,770
|
public static function literal ( $ mixColValue ) { if ( is_null ( $ mixColValue ) ) { return 'null' ; } elseif ( is_integer ( $ mixColValue ) ) { return $ mixColValue ; } elseif ( is_bool ( $ mixColValue ) ) { return ( $ mixColValue ? 'true' : 'false' ) ; } elseif ( is_float ( $ mixColValue ) ) { return "(float)$mixColValue" ; } elseif ( is_object ( $ mixColValue ) ) { return "t('" . $ mixColValue -> _toString ( ) . "')" ; } else { return "t('" . str_replace ( "'" , "\\'" , $ mixColValue ) . "')" ; } }
|
Returns the string that will be used to represent the literal value given when codegenning a type table
|
6,771
|
private function writeFinalCheckResults ( CoverFishResult $ coverFishResult ) { if ( false === $ this -> scanFailure ) { $ this -> writeFileResult ( self :: FILE_PASS , null ) ; } else { $ this -> writeFileResult ( self :: FILE_FAILURE , $ coverFishResult -> getFailureStream ( ) ) ; } $ this -> jsonResults [ ] = $ this -> jsonResult ; }
|
write single file check result
|
6,772
|
private function writeJsonFailureStream ( CoverFishResult $ coverFishResult , CoverFishPHPUnitTest $ unitTest , CoverFishMessageError $ mappingError , $ coverLine ) { $ this -> jsonResult [ 'errorCount' ] = $ coverFishResult -> getFailureCount ( ) ; $ this -> jsonResult [ 'errorMessage' ] = $ mappingError -> getMessageTitle ( ) ; $ this -> jsonResult [ 'errorCode' ] = $ mappingError -> getMessageCode ( ) ; $ this -> jsonResult [ 'cover' ] = $ coverLine ; $ this -> jsonResult [ 'method' ] = $ unitTest -> getSignature ( ) ; $ this -> jsonResult [ 'line' ] = $ unitTest -> getLine ( ) ; $ this -> jsonResult [ 'file' ] = $ unitTest -> getFile ( ) ; }
|
write single json error line
|
6,773
|
protected function getMacroLineInfo ( $ failureCount , CoverFishPHPUnitTest $ unitTest ) { $ lineInfoMacro = '%sError #%s in method "%s" (L:~%s)' ; if ( $ this -> outputLevel > 1 ) { $ lineInfoMacro = '%sError #%s in method "%s", Line ~%s' ; } return sprintf ( $ lineInfoMacro , $ this -> setIndent ( self :: MACRO_CONFIG_DETAIL_LINE_INDENT ) , ( false === $ this -> preventAnsiColors ) ? Color :: tplWhiteColor ( $ failureCount ) : $ failureCount , ( false === $ this -> preventAnsiColors ) ? Color :: tplWhiteColor ( $ unitTest -> getSignature ( ) ) : $ unitTest -> getSignature ( ) , ( false === $ this -> preventAnsiColors ) ? Color :: tplWhiteColor ( $ unitTest -> getLine ( ) ) : $ unitTest -> getLine ( ) , PHP_EOL ) ; }
|
message block macro line 01 message title
|
6,774
|
protected function getMacroCoverErrorMessage ( CoverFishMessageError $ mappingError ) { $ lineMessageMacro = '%s%s: %s ' ; if ( $ this -> outputLevel > 1 ) { $ lineMessageMacro = '%s%s: %s (ErrorCode: %s)' ; } return sprintf ( $ lineMessageMacro , $ this -> setIndent ( self :: MACRO_CONFIG_DETAIL_LINE_INDENT ) , ( false === $ this -> preventAnsiColors ) ? Color :: tplDarkGrayColor ( 'Message' ) : 'Message' , $ mappingError -> getMessageTitle ( ) , $ mappingError -> getMessageCode ( ) ) ; }
|
message block macro line 04 error message
|
6,775
|
public static function convertHashMap ( \ stdClass $ object , $ quote = self :: QUOTE_SINGLE ) { $ hash = '{' ; $ vars = get_object_vars ( $ object ) ; if ( count ( $ vars ) > 0 ) { foreach ( $ vars as $ key => $ value ) { $ hash .= sprintf ( '"%s": %s,' , $ key , self :: convertValue ( $ value , $ quote ) ) ; } $ hash = mb_substr ( $ hash , 0 , - 1 ) ; } $ hash .= '}' ; return $ hash ; }
|
Wandelt ein Object in ein Javascript Object - Literal um
|
6,776
|
public static function requireLoad ( Array $ requirements , Array $ alias , $ jsCode ) { return sprintf ( "requireLoad([%s], function (main%s) { // main is unshifted automatically\n %s\n});" , self :: buildRequirements ( $ requirements ) , count ( $ alias ) > 0 ? ', ' . implode ( ', ' , $ alias ) : '' , self :: convertJSCode ( $ jsCode ) ) ; }
|
This function loads inline script in blocking mode
|
6,777
|
public static function bootLoad ( Array $ requirements , $ alias = array ( ) , $ jsCode ) { return self :: requirejs ( 'boot' , 'boot' , sprintf ( "boot.getLoader().onRequire([%s], function (%s) {\n %s\n });" , self :: buildRequirements ( $ requirements ) , implode ( ', ' , $ alias ) , self :: convertJSCode ( $ jsCode ) ) ) ; }
|
This function loads inline script in an HTML - page
|
6,778
|
protected function appendScopeChoices ( FormBuilderInterface $ builder , Role $ role , Center $ center , User $ user , AuthorizationHelper $ authorizationHelper , TranslatableStringHelper $ translatableStringHelper , ObjectManager $ om , $ name = 'scope' ) { $ reachableScopes = $ authorizationHelper -> getReachableScopes ( $ user , $ role , $ center ) ; $ choices = array ( ) ; foreach ( $ reachableScopes as $ scope ) { $ choices [ $ scope -> getId ( ) ] = $ translatableStringHelper -> localize ( $ scope -> getName ( ) ) ; } $ dataTransformer = new ScopeTransformer ( $ om ) ; $ builder -> addEventListener ( FormEvents :: PRE_SET_DATA , function ( FormEvent $ event ) use ( $ choices , $ name , $ dataTransformer , $ builder ) { $ form = $ event -> getForm ( ) ; $ form -> add ( $ builder -> create ( $ name , 'choice' , array ( 'choices' => $ choices , 'auto_initialize' => false ) ) -> addModelTransformer ( $ dataTransformer ) -> getForm ( ) ) ; } ) ; }
|
Append a scope choice field with the scopes reachable by given user for the given role and center .
|
6,779
|
public function hasProfile ( $ profiles ) : bool { $ profiles = ( array ) $ profiles ; return count ( array_intersect ( $ this -> profiles -> pluck ( 'code' ) -> toArray ( ) , $ profiles ) ) > 0 ; }
|
Matches at least one user profile .
|
6,780
|
public function hasAllProfiles ( $ profiles ) : bool { $ profiles = ( array ) $ profiles ; return count ( array_intersect ( $ this -> profiles -> pluck ( 'code' ) -> toArray ( ) , $ profiles ) ) == count ( $ profiles ) ; }
|
Matches ALL user profiles .
|
6,781
|
public function assignProfiles ( $ profiles ) : void { $ profiles = ( array ) $ profiles ; foreach ( $ profiles as $ profile ) { $ electedProfile = Profile :: where ( 'code' , $ profile ) -> first ( ) ; if ( ! is_null ( $ electedProfile ) && ! $ this -> hasProfile ( $ profile ) ) { $ this -> assignRole ( Role :: find ( [ $ electedProfile -> role_id ] ) -> first ( ) -> name ) ; $ this -> givePermissionTo ( Permission :: find ( [ $ electedProfile -> permission_id ] ) -> first ( ) -> name ) ; $ this -> profiles ( ) -> save ( $ electedProfile ) ; } } }
|
Assigns profiles to the current model .
|
6,782
|
public function getContent ( string $ contentType = null ) : string { switch ( $ contentType ) { case 'application/vnd.transitive.document+json' : return $ this -> route -> getDocument ( ) ; break ; case 'application/vnd.transitive.document+xml' : return $ this -> route -> getDocument ( ) -> asXML ( 'document' ) ; break ; case 'application/vnd.transitive.document+yaml' : return $ this -> route -> getDocument ( ) -> asYAML ( ) ; break ; case 'application/vnd.transitive.head+json' : return $ this -> route -> getHead ( ) -> asJson ( ) ; break ; case 'application/vnd.transitive.head+xml' : return $ this -> route -> getHead ( ) -> asXML ( 'head' ) ; break ; case 'application/vnd.transitive.head+yaml' : return $ this -> route -> getHead ( ) -> asYAML ( ) ; break ; case 'application/vnd.transitive.content+xhtml' : case 'application/vnd.transitive.content+html' : return $ this -> route -> getContent ( ) ; break ; case 'application/vnd.transitive.content+json' : return $ this -> route -> getContent ( ) -> asJson ( ) ; break ; case 'application/vnd.transitive.content+xml' : return $ this -> route -> getContent ( ) -> asXML ( 'content' ) ; break ; case 'application/vnd.transitive.content+yaml' : return $ this -> route -> getContent ( ) -> asYAML ( ) ; break ; case 'text/plain' : return $ this -> layout -> getContent ( ) -> asString ( ) ; break ; case 'application/json' : if ( $ this -> route -> hasContent ( 'application/json' ) ) return $ this -> route -> getContentByType ( 'application/json' ) -> asJson ( ) ; elseif ( 404 != http_response_code ( ) ) { http_response_code ( 404 ) ; $ _SERVER [ 'REDIRECT_STATUS' ] = 404 ; return '' ; } break ; case 'application/xml' : if ( $ this -> route -> hasContent ( 'application/xml' ) ) return $ this -> route -> getContentByType ( 'application/xml' ) -> asJson ( ) ; elseif ( 404 != http_response_code ( ) ) { http_response_code ( 404 ) ; $ _SERVER [ 'REDIRECT_STATUS' ] = 404 ; return '' ; } break ; default : return $ this -> layout -> getView ( ) ; } }
|
Return processed content from current route .
|
6,783
|
protected function computeType ( ) { if ( interface_exists ( $ this -> class , false ) ) { $ this -> type = 'Interface' ; return ; } if ( trait_exists ( $ this -> class , false ) ) { $ this -> type = 'Trait' ; return ; } $ this -> type = 'Class' ; }
|
Determine the type of class
|
6,784
|
public static function doSelectOne ( Criteria $ criteria , PropelPDO $ con = null ) { $ critcopy = clone $ criteria ; $ critcopy -> setLimit ( 1 ) ; $ objects = ApiLogPeer :: doSelect ( $ critcopy , $ con ) ; if ( $ objects ) { return $ objects [ 0 ] ; } return null ; }
|
Selects one object from the DB .
|
6,785
|
public static function doSelect ( Criteria $ criteria , PropelPDO $ con = null ) { return ApiLogPeer :: populateObjects ( ApiLogPeer :: doSelectStmt ( $ criteria , $ con ) ) ; }
|
Selects several row from the DB .
|
6,786
|
public function getDefaultPassword ( ) : ? PasswordBroker { $ manager = Password :: getFacadeRoot ( ) ; if ( isset ( $ manager ) ) { return $ manager -> broker ( ) ; } return $ manager ; }
|
Get a default password value if any is available
|
6,787
|
public function html ( ) { if ( ! $ this -> isMorphed ( ) ) $ this -> morph ( ) ; $ html = NULL ; foreach ( $ this -> elements as $ el ) { $ html .= $ el -> html ( ) . "\n" ; } return $ html ; }
|
Wenn noch nicht gemorphed wird das getan
|
6,788
|
public function set ( Mod $ mod ) : void { $ this -> loadMods ( ) ; $ this -> mods [ $ mod -> getName ( ) ] = $ mod ; }
|
Sets a mod into the registry .
|
6,789
|
public function get ( string $ modName ) : ? Mod { $ this -> loadMods ( ) ; return $ this -> mods [ $ modName ] ?? null ; }
|
Returns a mod from the registry .
|
6,790
|
public function saveMods ( ) : void { $ mods = [ ] ; foreach ( $ this -> mods as $ mod ) { $ mods [ ] = $ mod -> writeData ( ) ; } $ this -> saveContent ( self :: HASH_FILE_MODS , $ this -> encodeContent ( $ mods ) ) ; }
|
Saves the currently known mod to the adapter .
|
6,791
|
protected function loadMods ( ) : void { if ( ! $ this -> isLoaded ) { $ this -> mods = [ ] ; foreach ( $ this -> decodeContent ( ( string ) $ this -> loadContent ( self :: HASH_FILE_MODS ) ) as $ modData ) { if ( is_array ( $ modData ) ) { $ mod = new Mod ( ) ; $ mod -> readData ( new DataContainer ( $ modData ) ) ; $ this -> mods [ $ mod -> getName ( ) ] = $ mod ; } } $ this -> isLoaded = true ; } }
|
Loads the mods from the file .
|
6,792
|
public static function toRoman ( $ num ) { $ conv = array ( 10 => array ( 'X' , 'C' , 'M' ) , 5 => array ( 'V' , 'L' , 'D' ) , 1 => array ( 'I' , 'X' , 'C' ) ) ; $ roman = '' ; if ( $ num < 0 ) { return '' ; } $ num = ( int ) $ num ; $ digit = ( int ) ( $ num / 1000 ) ; $ num -= $ digit * 1000 ; while ( $ digit > 0 ) { $ roman .= 'M' ; $ digit -- ; } for ( $ i = 2 ; $ i >= 0 ; $ i -- ) { $ power = pow ( 10 , $ i ) ; $ digit = ( int ) ( $ num / $ power ) ; $ num -= $ digit * $ power ; if ( ( $ digit == 9 ) || ( $ digit == 4 ) ) { $ roman .= $ conv [ 1 ] [ $ i ] . $ conv [ $ digit + 1 ] [ $ i ] ; } else { if ( $ digit >= 5 ) { $ roman .= $ conv [ 5 ] [ $ i ] ; $ digit -= 5 ; } while ( $ digit > 0 ) { $ roman .= $ conv [ 1 ] [ $ i ] ; $ digit -- ; } } } return $ roman ; }
|
Converts a number to its roman numeral representation
|
6,793
|
public function register ( ) { if ( ! $ this -> options -> exists ( ) ) { $ this -> reset ( ) ; } if ( $ this -> page -> get_slug ( ) == filter_input ( INPUT_GET , 'page' ) ) { $ this -> preprocess ( ) ; } $ this -> page -> register ( ) ; $ this -> set_global_variable ( ) ; $ this -> do_action ( 'afw_options_init' ) ; }
|
Register the options page .
|
6,794
|
private function create_page ( ) { $ self = $ this ; $ page = new \ Amarkal \ Extensions \ WordPress \ Admin \ AdminPage ( array ( 'title' => $ this -> config -> sidebar_title , 'icon' => $ this -> config -> sidebar_icon , 'class' => $ this -> config -> sidebar_icon_class , 'style' => $ this -> config -> sidebar_icon_style ) ) ; foreach ( $ this -> config -> sections as $ section ) { $ page -> add_page ( array ( 'title' => $ section -> title , 'capability' => 'manage_options' , 'content' => function ( ) use ( $ self ) { $ self -> render ( ) ; } ) ) ; } return $ page ; }
|
Create a new AdminPage .
|
6,795
|
private function render ( ) { $ this -> do_action ( 'afw_options_pre_render' ) ; $ layout = new Layout \ Layout ( $ this -> config ) ; $ layout -> render ( true ) ; add_filter ( 'admin_footer_text' , array ( __CLASS__ , 'footer_credits' ) ) ; $ this -> do_action ( 'afw_options_post_render' ) ; }
|
Internally used to render the page . Called by AdminPage to generate the admin page s content .
|
6,796
|
private function preprocess ( ) { $ this -> do_action ( 'afw_options_pre_process' ) ; Notifier :: reset ( ) ; State :: set ( 'errors' , array ( ) ) ; $ this -> update ( ) ; $ this -> do_action ( 'afw_options_post_process' ) ; }
|
Internally used to update the options page s components .
|
6,797
|
private function set_errors ( $ errors ) { if ( count ( $ errors ) == 0 ) { return ; } $ errors_array = array ( ) ; foreach ( $ this -> config -> get_sections ( ) as $ section ) { foreach ( $ section -> get_fields ( ) as $ component ) { if ( $ component instanceof \ Amarkal \ UI \ ValidatableComponentInterface && $ errors [ $ component -> get_name ( ) ] ) { $ errors_array [ ] = array ( 'section' => $ section -> get_slug ( ) , 'message' => $ errors [ $ component -> get_name ( ) ] ) ; } } } State :: set ( 'errors' , $ errors_array ) ; }
|
Set the state with the given errors .
|
6,798
|
private function set_global_variable ( ) { $ var_name = "" ; if ( null != $ this -> config -> global_variable ) { $ var_name = $ this -> config -> global_variable ; } else { $ var_name = $ this -> page -> get_slug ( ) . '_options' ; } $ GLOBALS [ $ var_name ] = $ this -> options -> get ( ) ; }
|
Set a global variable containing the option values to be used throughout the program .
|
6,799
|
public function filter ( $ field , $ filter , array $ options = [ ] ) { if ( ! in_array ( $ filter , [ self :: HTML , self :: NEWLINES , self :: WHITESPACE , self :: XSS ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Filter %s does not exist' , $ filter ) ) ; } $ this -> _filters [ $ field ] [ $ filter ] = $ options ; return $ this ; }
|
Define a filter for a specific field .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.