idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
15,600
public function createEmailList ( $ emailList ) { $ entry = $ this -> newEmailListEntry ( ) ; $ list = $ this -> newEmailList ( ) ; $ list -> name = $ emailList ; $ entry -> emailList = $ list ; return $ this -> insertEmailList ( $ entry ) ; }
Create a new email list .
15,601
public function retrieveEmailLists ( $ recipient ) { $ query = $ this -> newEmailListQuery ( ) ; $ query -> recipient = $ recipient ; return $ this -> getEmailListFeed ( $ query ) ; }
Retrieve all email lists associated with a recipient .
15,602
public function retrievePageOfEmailLists ( $ startNickname = null ) { $ query = $ this -> newEmailListQuery ( ) ; $ query -> setStartEmailListName ( $ startNickname ) ; return $ this -> getEmailListFeed ( $ query ) ; }
Retrieve a page of email lists in alphabetical order starting with the provided email list .
15,603
public function addRecipientToEmailList ( $ recipientAddress , $ emailList ) { $ entry = $ this -> newEmailListRecipientEntry ( ) ; $ who = $ this -> newWho ( ) ; $ who -> email = $ recipientAddress ; $ entry -> who = $ who ; $ address = $ this -> getBaseUrl ( ) . self :: APPS_EMAIL_LIST_PATH . '/' . $ emailList . self...
Add a specified recipient to an existing emailList .
15,604
public function retrievePageOfRecipients ( $ emailList , $ startRecipient = null ) { $ query = $ this -> newEmailListRecipientQuery ( ) ; $ query -> setEmailListName ( $ emailList ) ; $ query -> setStartRecipient ( $ startRecipient ) ; return $ this -> getEmailListRecipientFeed ( $ query ) ; }
Retrieve a page of email list recipients in alphabetical order starting with the provided email list recipient .
15,605
public function removeRecipientFromEmailList ( $ recipientAddress , $ emailList ) { $ this -> delete ( $ this -> getBaseUrl ( ) . self :: APPS_EMAIL_LIST_PATH . '/' . $ emailList . self :: APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/' . $ recipientAddress ) ; }
Remove a specified recipient from an email list .
15,606
protected function getPropertyValueFromObject ( ClassMetadata $ meta , $ propertyName , $ object ) { $ refl = $ meta -> getReflectionClass ( ) ; $ prop = $ refl -> getProperty ( $ propertyName ) ; $ prop -> setAccessible ( true ) ; $ value = $ prop -> getValue ( $ object ) ; return $ value ; }
Returns value of the entity s property
15,607
protected function prepareRoutes ( ) { $ this -> dispatcher = \ FastRoute \ simpleDispatcher ( function ( \ FastRoute \ RouteCollector $ collector ) { $ router = new RouteCollection ( $ this , $ collector , '' , [ ] , '' ) ; $ router -> group ( [ 'middlewares' => [ 'api' ] ] , function ( RouteCollection $ router ) { $ ...
Carregar e preparar rotas .
15,608
public function route ( $ name ) { if ( array_key_exists ( $ name , $ this -> allNames ) ) { return $ this -> allNames [ $ name ] ; } return null ; }
Find a route by name .
15,609
public function setNames ( $ old , $ name , Route $ route ) { if ( ( ! is_null ( $ old ) ) && ( isset ( $ this -> allNames [ $ old ] ) ) ) { unset ( $ this -> allNames [ $ old ] ) ; } if ( ! is_null ( $ name ) ) { $ this -> allNames [ $ name ] = $ route ; } }
Set name .
15,610
public function render ( $ view = null ) { if ( $ this -> config [ 'auto_hide' ] === true AND $ this -> total_pages <= 1 ) { return '' ; } if ( $ view === null ) { $ view = $ this -> config [ 'view' ] ; } $ tpl = \ Meerkat \ Twig \ Twig :: from_template ( $ view ) ; return $ tpl -> set ( get_object_vars ( $ this ) ) ->...
Renders the pagination links .
15,611
public function getBoard ( $ name ) { $ byName = Models \ Board :: search ( ) -> where ( 'name' , $ name ) -> execOne ( ) ; $ bySlug = Models \ Board :: getBySlug ( $ name ) ; return $ bySlug instanceof Models \ Board ? $ bySlug : $ byName ; }
Get Board by Name or Slug .
15,612
public function getData ( bool $ asObject = false ) { $ data = $ this -> data [ 'data' ] ?? $ this -> data ; return $ asObject && $ data !== null ? ( object ) $ data : $ data ; }
Returns the value of the data key in the response if available else it returns the parsed response .
15,613
public function getErrors ( bool $ asObject = false ) { $ errors = $ this -> data [ 'errors' ] ?? [ ] ; return $ asObject ? ( object ) $ errors : $ errors ; }
Returns the errors in the response if any .
15,614
public function dumpRequest ( ) : array { if ( empty ( $ this -> request ) ) { return [ 'http_status' => $ this -> httpStatus , 'response' => $ this -> data ] ; } $ this -> request -> getBody ( ) -> rewind ( ) ; $ size = $ this -> request -> getBody ( ) -> getSize ( ) ? : 1024 ; $ bodyParams = json_decode ( $ this -> r...
Returns a summary of the request . This will usually be available in the case of a failure .
15,615
public function children ( $ lang = '' , $ alias = '' ) { $ collname = $ this -> collectionName ; $ bitems = $ collname :: GetInstance ( ) ; $ children = $ bitems -> itemsFilter ( array ( 'parent' => $ this -> id ) ) ; if ( empty ( $ alias ) ) { return $ children ; } foreach ( $ children as $ ch ) { $ chalias = $ ch ->...
Get children items by alias .
15,616
protected function getfieldsvalues ( & $ qr_fields , & $ qr_values ) { $ qr_fields = array ( ) ; $ qr_values = array ( ) ; parent :: getfieldsvalues ( $ qr_fields , $ qr_values ) ; $ parent = $ this -> getparent ( ) ; if ( empty ( $ parent ) ) { $ collectionName = $ this -> collectionName ; $ collection = $ collectionN...
Get fields values
15,617
public static function setDbType ( $ dbType ) { $ dbTypeCast = ( string ) $ dbType ; if ( array_search ( $ dbTypeCast , self :: $ dbList ) === false ) { throw new DBException ( 'Illegal database type provided to DB Service' ) ; } self :: $ dbType = $ dbTypeCast ; }
Static function to set the db type
15,618
public static function sanitizeDbParameters ( $ dbParams ) { switch ( self :: getDbType ( ) ) { case 'mysql' : if ( empty ( $ dbParams [ 'unix_socket' ] ) ) { unset ( $ dbParams [ 'unix_socket' ] ) ; } if ( empty ( $ dbParams [ 'charset' ] ) ) { unset ( $ dbParams [ 'charset' ] ) ; } break ; case 'sqlite' : if ( empty ...
Sanitize the database parameters provided
15,619
public static function connectDb ( ) { if ( ! isset ( self :: $ dbLink ) ) { $ dbParams = self :: getDatabaseParameters ( ) ; self :: validateDbParameters ( $ dbParams ) ; $ dbParamsSan = self :: sanitizeDbParameters ( $ dbParams ) ; $ config = new Configuration ( ) ; self :: $ dbLink = DriverManager :: getConnection (...
Create a database connection or return singleton connection using environment settings
15,620
public static function connectDbNew ( $ dbParams ) { self :: validateDbParameters ( $ dbParams ) ; $ dbParamsSan = self :: sanitizeDbParameters ( $ dbParams ) ; $ config = new Configuration ( ) ; return DriverManager :: getConnection ( $ dbParamsSan , $ config ) ; }
For new connections that are building transactions
15,621
public static function closeDbConnection ( ) { if ( isset ( self :: $ dbLink ) ) { $ dbConn = self :: $ dbLink ; $ dbConn -> close ( ) ; self :: $ dbLink = null ; } return null ; }
Closes the static db connection
15,622
protected function loadConfigs ( array $ config , ContainerBuilder $ container ) { foreach ( $ config [ 'configs' ] as $ name => $ arguments ) { if ( ! $ arguments [ 'enabled' ] ) { continue ; } $ id = 'integrated_channel.config.memory.' . $ name ; if ( $ container -> hasDefinition ( $ id ) ) { continue ; } do { $ id_o...
Process the adaptor config configuration .
15,623
protected function getUserId ( UserInterface $ user ) { $ class = $ this -> container -> getParameter ( 'tree_house.keystone.model.user.class' ) ; $ meta = $ this -> getDoctrine ( ) -> getManagerForClass ( $ class ) -> getClassMetadata ( $ class ) ; $ ids = $ meta -> getIdentifierValues ( $ user ) ; if ( sizeof ( $ ids...
Returns the user identifier . If this is a single identifier that value is returned . Otherwise all the identifiers are returned as an array .
15,624
protected function _getField ( ) { $ fields = [ ] ; $ fieldsData = $ this -> _entity -> fields ( ) ; if ( ! preg_match ( '#\.#isU' , $ this -> _field ) ) { if ( isset ( $ fieldsData [ $ this -> _field ] ) ) { $ fields = [ $ fieldsData [ $ this -> _field ] -> value ] ; } else { throw new MissingEntityException ( 'The fi...
Before validating the field we need to get the correct field from the current Entity or a linked Entity
15,625
private function _getForeignKeyFieldValue ( $ field ) { $ fields = null ; if ( gettype ( $ field -> value ) != 'object' ) { if ( is_array ( $ field -> value ) ) { $ fields = $ field -> value ; } else { $ fields = [ $ field -> value ] ; } } else if ( get_class ( $ field -> value ) != 'System\Collection\Collection' ) { $...
The method _getField return the value of each field in the Entity . This method is used to factorize the source code
15,626
public function equal ( $ equal , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: EQUAL , 'value' => $ equal , 'message' => $ error ] ) ; } return $ this ; }
the field must be equal to
15,627
public function different ( $ different , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: DIFFERENT , 'value' => $ different , 'message' => $ error ] ) ; } return $ this ; }
the field must be different from
15,628
public function moreThan ( $ moreThan , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: MORETHAN , 'value' => $ moreThan , 'message' => $ error ] ) ; } return $ this ; }
the field value must be more than
15,629
public function lessThan ( $ lessThan , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: LESSTHAN , 'value' => $ lessThan , 'message' => $ error ] ) ; } return $ this ; }
the field value must be less than
15,630
public function between ( $ between , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: BETWEEN , 'value' => $ between , 'message' => $ error ] ) ; } return $ this ; }
the field value must be between
15,631
public function in ( $ in , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: IN , 'value' => $ in , 'message' => $ error ] ) ; } return $ this ; }
the field value must be in
15,632
public function notIn ( $ notIn , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: NOTIN , 'value' => $ notIn , 'message' => $ error ] ) ; } return $ this ; }
the field value must not be in
15,633
public function length ( $ length , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: LENGTH , 'value' => $ length , 'message' => $ error ] ) ; } return $ this ; }
the field size must be
15,634
public function lengthMin ( $ lengthMin , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: LENGTHMIN , 'value' => $ lengthMin , 'message' => $ error ] ) ; } return $ this ; }
the field size must more than
15,635
public function mail ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: MAIL , 'message' => $ error ] ) ; } return $ this ; }
the field must be an email address
15,636
public function int ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: INT , 'message' => $ error ] ) ; } return $ this ; }
the field must be an int
15,637
public function float ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: FLOAT , 'message' => $ error ] ) ; } return $ this ; }
the field must be a float
15,638
public function alpha ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: ALPHA , 'message' => $ error ] ) ; } return $ this ; }
the field must contains only letters
15,639
public function alphaNum ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: ALPHANUM , 'message' => $ error ] ) ; } return $ this ; }
the field must contain only letters and numerics
15,640
public function alphaDash ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: ALPHADASH , 'message' => $ error ] ) ; } return $ this ; }
the field must contain only letters numerics ans underscore
15,641
public function ip ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: IP , 'message' => $ error ] ) ; } return $ this ; }
the field must be an ip
15,642
public function sql ( $ sql , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: SQL , 'value' => $ sql , 'message' => $ error ] ) ; } return $ this ; }
the field must valid the query
15,643
public function count ( $ count , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: COUNT , 'value' => $ count , 'message' => $ error ] ) ; } return $ this ; }
When the field value is an array it must contain N lines
15,644
public function countMin ( $ countMin , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: COUNTIN , 'value' => $ countMin , 'message' => $ error ] ) ; } return $ this ; }
When the field value is an array it must contain at least N lines
15,645
public function countMax ( $ countMax , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: COUNTMAX , 'value' => $ countMax , 'message' => $ error ] ) ; } return $ this ; }
When the field value is an array it must contain less than N + 1 lines
15,646
public function countIn ( $ countIn , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: COUNTIN , 'value' => $ countIn , 'message' => $ error ] ) ; } return $ this ; }
When the field value is an array its value must be in
15,647
public function countBetween ( $ countBetween , $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: COUNTBETWEEN , 'value' => $ countBetween , 'message' => $ error ] ) ; } return $ this ; }
When the field value is an array its value must be between
15,648
public function exist ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: EXIST , 'message' => $ error ] ) ; } return $ this ; }
The field must exist
15,649
public function notExist ( $ error ) { if ( $ this -> _exist ) { array_push ( $ this -> _constraints , [ 'type' => self :: NOTEXIST , 'message' => $ error ] ) ; } return $ this ; }
The field must not exist
15,650
public function listAction ( ) { if ( false === $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_ADMIN' ) ) throw new AccessDeniedException ( ) ; $ source = new Entity ( $ this -> get ( 'asf_website.config.manager' ) -> getClassName ( ) ) ; $ tableAlias = $ source -> getTableAlias ( ) ; $ source ...
List all website config
15,651
public function editAction ( Request $ request , $ id = null ) { if ( false === $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_ADMIN' ) ) throw new AccessDeniedException ( ) ; $ formFactory = $ this -> get ( 'asf_website.form.factory.config' ) ; $ configManager = $ this -> get ( 'asf_website.co...
Add or edit a website config
15,652
public function deleteAction ( $ id ) { if ( false === $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_ADMIN' ) ) throw new AccessDeniedException ( ) ; $ config = $ this -> get ( 'asf_website.config.manager' ) -> getRepository ( ) -> findOneBy ( array ( 'id' => $ id ) ) ; try { $ this -> get ( '...
Delete a website config
15,653
public function prosesLogin ( UserFormLoginRequest $ request ) { $ users = User :: where ( 'email' , $ request -> get ( 'username' ) ) -> where ( 'password' , $ request -> get ( 'password' ) ) -> get ( ) ; if ( $ users -> count ( ) > 0 ) { Auth :: login ( $ users -> first ( ) ) ; return redirect ( ) -> intended ( ) ; r...
This method uses to check the user credential
15,654
public function get ( string $ className , ... $ constructorArguments ) { if ( ! isset ( $ this -> container [ $ className ] ) ) { $ instance = $ this -> createWithArguments ( $ className , $ constructorArguments , $ implementationClassName ) ; $ this -> container [ $ className ] = $ instance ; if ( $ implementationCla...
Retrieve the class from the container or creates a new instance
15,655
private function createWithArguments ( string $ className , array $ constructorArguments , & $ implementationClassName = null ) { if ( interface_exists ( $ className ) ) { $ className = $ implementationClassName = $ this -> getClassForInterface ( $ className ) ; } if ( ! class_exists ( $ className ) ) { throw ClassDoes...
Returns a new instance of the given class
15,656
private function getClassForInterface ( string $ interfaceName ) { $ implementationName = '' ; if ( strtolower ( substr ( $ interfaceName , - 9 ) ) === 'interface' ) { $ implementationName = substr ( $ interfaceName , 0 , - 9 ) ; } if ( ! class_exists ( $ implementationName ) ) { throw NoImplementationForInterfaceExcep...
Try to find the class name for the given interface
15,657
function map ( $ view_content , $ view_params = array ( ) ) { $ rules = ViewUtility :: find_rules ( $ view_content , '{{' , '}}' ) ; foreach ( $ rules as $ rule ) { $ rule_code = str_replace ( '{{' , '' , $ rule ) ; $ rule_code = str_replace ( '}}' , '' , $ rule_code ) ; $ rule_code = trim ( $ rule_code ) ; $ rule_code...
Map php functions and variables
15,658
protected function renderXmlHttpException ( $ e ) { $ data = [ 'message' => $ e -> getMessage ( ) , ] ; if ( $ e instanceof HttpException ) { return new JsonResponse ( $ data , $ e -> getStatusCode ( ) ) ; } return new JsonResponse ( $ data , 500 ) ; }
Renders an exception from ajax requests .
15,659
protected function renderDebugXmlHttpException ( $ e ) { $ data = [ 'message' => $ e -> getMessage ( ) , 'trace' => $ e -> getTrace ( ) , ] ; if ( $ e instanceof HttpException ) { return new JsonResponse ( $ data , $ e -> getStatusCode ( ) ) ; } return new JsonResponse ( $ data , 500 ) ; }
Renders an exception from ajax requests Only use this in debug mode .
15,660
private function getElementsToProcess ( ) : array { $ result = [ ] ; foreach ( get_object_vars ( $ this ) as $ element ) { if ( $ element instanceof FormElementInterface ) { $ result [ ] = $ element ; } } $ result = array_merge ( $ result , $ this -> extraElements ) ; return $ result ; }
Returns the elements to process .
15,661
protected function imports ( $ object ) { $ newImport = new $ object ( ) ; $ importName = get_class ( $ newImport ) ; $ importFunctions = get_class_methods ( $ newImport ) ; array_push ( $ this -> imported , array ( $ importName , $ newImport ) ) ; foreach ( $ importFunctions as $ key => $ functionName ) { $ this -> im...
Imports a plugin
15,662
public function initValue ( $ value ) { try { $ value = Json :: decode ( $ value ) ; } catch ( \ Exception $ e ) { $ value = [ ] ; } return $ value ; }
Conversion property value received from the database
15,663
public function beforeSaveValue ( $ value ) { try { $ value = Json :: encode ( $ value ) ; } catch ( \ Exception $ e ) { $ value = "{}" ; } return $ value ; }
Converting the property value before saving to database
15,664
protected function setLoggers ( ) { if ( $ loggers = $ this -> hasLoggerConfig ( ) ) { foreach ( $ loggers as $ channel => $ logger ) { $ loggerChannel = $ this -> getChannelName ( $ logger , $ channel ) ; $ loggerName = $ this -> getLoggerIdentified ( $ logger , $ loggerChannel ) ; $ this -> container [ $ loggerName ]...
Crea los loggers en el container
15,665
protected function buildHandlers ( array $ config ) : array { $ handlers = [ ] ; foreach ( $ config as $ handler ) { $ level = constant ( '\Mostofreddy\Loggy\Logger::' . strtoupper ( $ handler [ 'level' ] ) ) ; $ handlerObj = '\Mostofreddy\Loggy\Handler\\' . ucfirst ( $ handler [ 'handler' ] ) ; $ handlers [ ] = ( new ...
Instancia los handlers del logger
15,666
public function GetFileType ( $ dataPost ) { $ templateTypeKey = "templateType" ; if ( ! array_key_exists ( $ templateTypeKey , $ dataPost ) ) { throw new \ Exception ( "The POST data doesn't contain the value $templateTypeKey. See dump" . var_dump ( $ dataPost ) , 0 , null ) ; } $ this -> templateType = $ dataPost [ $...
Get the file type in the POST request .
15,667
public function help ( ) { $ this -> showHeader ( ) ; echo "ufw - Helper to uFw framework\n\nOptions:\n" ; foreach ( self :: HELP [ 'options' ] as $ helpOption => $ helpDescription ) { echo "\n $helpOption \t " . ( $ helpDescription [ 'summary' ] ?? "" ) ; if ( array_key_exists ( 'examples' , $ helpDescription ) ) { ...
Shows the help options
15,668
public function run ( ) { if ( Console :: getArg ( '--create' ) ) { $ this -> createProject ( Console :: getArg ( '--create' ) ) ; return ; } elseif ( Console :: getArg ( '--init' ) ) { $ this -> initProject ( ) ; return ; } elseif ( Console :: getArg ( '--run' ) ) { $ this -> runAction ( Console :: getArg ( '--run' ) ...
Inspect the command line arguments and execute it .
15,669
protected function initProject ( ) { $ this -> showHeader ( ) ; Utils :: getInstance ( ) -> createDirectory ( [ 'apps' , 'bootstrap' , 'config' , 'public' , 'tmp/tpl_compile' , 'plugins' ] ) ; foreach ( self :: FILES_BASE as $ pathname => $ contents ) { Utils :: getInstance ( ) -> createFile ( $ pathname , $ contents )...
Initialize the current workspace
15,670
protected function createProject ( $ projectName = 'myProj' ) { $ this -> showHeader ( ) ; Console :: stdout ( "Creating $projectName \n" ) ; Utils :: getInstance ( ) -> createDirectory ( "./apps/" . $ projectName , [ 'src' , 'routes' , 'config' , 'public' , 'doc' , 'templates' ] ) ; echo "\n" ; foreach ( self :: FILES...
Create a new project workspace and initialize it .
15,671
protected function performRunAction ( ) { require __DIR__ . "/../../../../../vendor/autoload.php" ; $ request = \ harpya \ ufw \ Request :: of ( ) ; $ appFolder = __DIR__ . '/../../../../../apps/' ; $ appFolder = '../apps/' ; $ app = \ harpya \ ufw \ ApplicationCli :: getInstance ( [ Application :: DEF_APPS_PATH => $ a...
Emulate the same as what the web server do to fulfill a request .
15,672
public static function fill ( array $ data , COCEntity & $ entity ) { $ vars = get_object_vars ( $ entity ) ; foreach ( $ vars as $ var => $ _ ) { if ( array_key_exists ( $ var , $ data ) ) { $ entity -> { $ var } = $ data [ $ var ] ; } } }
Fills the data from an array into the given class
15,673
public function isAllowed ( $ resource , $ privilege = null , $ role = null ) { return $ this -> getPermissionsModel ( ) -> isAllowed ( $ resource , $ privilege , $ role ) ; }
Is a permission allowed or not
15,674
private function getContentFromRequest ( Request $ request ) : array { $ data = json_decode ( $ request -> getContent ( ) , true ) ; foreach ( $ data as $ key => $ value ) { if ( $ value === null || $ value === '' ) { unset ( $ data [ $ key ] ) ; } } return $ data ; }
Returns an array of data from the request body and omits null values .
15,675
protected function initPaths ( array $ exclude_dirs = [ ] ) { $ apps_dir = $ this -> core -> config -> get ( 'Core' , 'dir.apps' ) ; $ apps_url = $ this -> core -> config -> get ( 'Core' , 'url.apps' ) ; $ dir = $ this -> getDir ( ) ; $ scanned_directory = array_diff ( scandir ( $ dir ) , array ( '..' , '.' ) ) ; $ thi...
Initializes the apps paths by creating the paths and writing them into the apps config .
15,676
protected function initPermissions ( ) { if ( isset ( $ this -> settings ) && $ this -> settings -> exists ( 'permissions' ) && ! self :: $ init_stages [ $ this -> name ] [ 'permissions' ] ) { $ permissions = [ 'admin' ] ; if ( $ this -> settings -> exists ( 'config' ) ) { $ permissions [ ] = 'config' ; } $ permissions...
Inits apps permissions by addind default values for admin and for config if confix exists
15,677
private function MVCFactory ( string $ name , string $ type , $ arguments = null ) { if ( ! in_array ( $ this -> name , self :: $ init_done ) ) { if ( ! $ this -> core -> router -> isAjax ( ) ) { $ this -> initCss ( ) ; $ this -> initJs ( ) ; } self :: $ init_done [ ] = $ this -> name ; } $ string = new CamelCase ( $ n...
Hidden method to factory mvc components like models views or controllers
15,678
private function getComponentsName ( ) : string { $ dt = debug_backtrace ( ) ; $ parts = array_reverse ( explode ( '\\' , $ dt [ 2 ] [ 'class' ] ) ) ; $ strip = [ 'Controller' , 'Model' , 'View' ] ; return str_replace ( $ strip , '' , $ parts [ 0 ] ) ; }
Autodiscovery of the components name
15,679
public function getModel ( string $ name = '' ) { if ( empty ( $ name ) ) { $ name = $ this -> getComponentsName ( ) ; } $ model = $ this -> MVCFactory ( $ name , 'Model' ) ; return $ model ; }
Creates an app related model object form this or a different app
15,680
public function getController ( string $ name = '' ) { if ( empty ( $ name ) ) { $ name = $ this -> getComponentsName ( ) ; } $ controller = $ this -> MVCFactory ( $ name , 'Controller' ) ; return $ controller ; }
Creates an app related controller object
15,681
public function getView ( string $ name = '' ) { if ( empty ( $ name ) ) { $ name = $ this -> getComponentsName ( ) ; } $ view = $ this -> MVCFactory ( $ name , 'View' ) ; return $ view ; }
Creates an app related view object
15,682
public function getName ( bool $ uncamelize = false ) { if ( $ uncamelize == true ) { $ string = new CamelCase ( $ this -> name ) ; return $ string -> uncamelize ( ) ; } else { return $ this -> name ; } }
Returns the name of this app .
15,683
public function url ( string $ name , array $ params = [ ] ) : string { return $ this -> core -> router -> generate ( $ name , $ params ) ; }
Generates an url by it s name
15,684
protected function _setTransition ( $ transition ) { $ this -> transition = ( $ transition === null ) ? null : $ this -> _normalizeStringable ( $ transition ) ; }
Sets the transition for with this instance .
15,685
function convertTimeZone ( $ date , $ to_tz , $ from_tz = null ) { throw new RuntimeException ( 'Not implemented!' ) ; if ( $ to_tz instanceof DateTimeZone ) { $ to_tz = $ to_tz -> getName ( ) ; } if ( $ from_tz instanceof DateTimeZone ) { $ from_tz = $ from_tz -> getName ( ) ; } return "NEW_TIME($date, '$from_tz', '$t...
Returns SQL which converts the date value to its value in the target timezone
15,686
public function resolve ( $ curl , $ response ) { $ http_status = curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; if ( curl_errno ( $ curl ) ) { $ this -> fill ( false , $ http_status , curl_error ( $ curl ) , [ ] ) ; } else { if ( $ http_status == 200 ) { $ res = json_decode ( EncryptAes :: dencrypt ( $ response ) ) ; ...
Handle the curl response
15,687
public function fill ( $ success , $ statusCode , $ statusText , $ response ) { $ this -> success = $ success ; $ this -> statusCode = $ statusCode ; $ this -> statusText = $ statusText ; $ this -> response = $ response ; }
Fill the CurlResponse attributes
15,688
public function comparePasswords ( $ password ) { $ passwordSalted = $ this -> saltPassword ( $ password ) ; if ( password_verify ( $ passwordSalted , $ this -> privateKey ) ) { return true ; } return false ; }
Compares the given password from the login form with the saved one .
15,689
protected function encodePassword ( $ password ) { $ passwordSalted = $ this -> saltPassword ( $ password ) ; $ passwordEncoded = password_hash ( $ passwordSalted , PASSWORD_DEFAULT ) ; return $ passwordEncoded ; }
Encodes the given plain password
15,690
protected function saltPassword ( $ password ) { if ( isset ( $ this -> metaData [ 'salt' ] ) ) { $ salt = $ this -> metaData [ 'salt' ] ; } else { $ salt = $ this -> generateSalt ( ) ; } return $ salt . $ password ; }
Returns the salted password
15,691
public function getDbConnectionCmd ( ) { $ dbParams = $ this -> getDbConnectionParams ( ) ; $ dbConnectionCmd = 'mysql -u ' . $ dbParams [ 'user' ] . ' -h ' . $ dbParams [ 'host' ] . ' -P ' . $ dbParams [ 'port' ] ; if ( strlen ( $ dbParams [ 'password' ] ) > 0 ) { $ dbConnectionCmd .= ' -p"' . $ dbParams [ 'password' ...
Returns the mysql connection command
15,692
public function isAllowed ( RoleInterface $ role , ResourceInterface $ resource , PermissionInterface $ permission , array $ params = array ( ) ) { $ roleId = spl_object_hash ( $ role ) ; $ resourceId = spl_object_hash ( $ resource ) ; $ permissionId = spl_object_hash ( $ permission ) ; if ( isset ( $ this -> logger ) ...
Check access right to the specified permission of the specified resource for the specified role .
15,693
protected function searchParentRoleACEs ( $ roleId , $ resourceId , $ permissionId , array $ params = array ( ) , $ level = 0 ) { $ allowedAny = null ; if ( isset ( $ this -> rolesParents [ $ roleId ] ) && isset ( $ this -> resources [ $ resourceId ] ) && isset ( $ this -> permissions [ $ permissionId ] ) ) { if ( isse...
Search ACEs associated with parent roles of specified role for pemissions granted to the specified resource .
15,694
protected function searchParentResourceACEs ( $ roleId , $ resourceId , $ permissionId , array $ params = array ( ) , $ level = 0 ) { $ allowedAny = null ; if ( isset ( $ this -> resourcesParents [ $ resourceId ] ) && isset ( $ this -> roles [ $ roleId ] ) && isset ( $ this -> permissions [ $ permissionId ] ) ) { if ( ...
Search ACEs associated with parent resources of specified resource for pemissions granted for the specified role .
15,695
protected function searchACEs ( $ roleId , $ resourceId , $ permissionId , array $ params = array ( ) , $ level = 0 ) { if ( ! isset ( $ this -> ACEs [ $ roleId ] [ $ resourceId ] [ $ permissionId ] ) ) { return null ; } else { $ allowedAny = null ; foreach ( $ this -> ACEs [ $ roleId ] [ $ resourceId ] [ $ permissionI...
Search ACEs associated with specified role resource and permission .
15,696
protected function getFlashMessengerHelper ( ) { if ( $ this -> flashMessengerHelper ) { return $ this -> flashMessengerHelper ; } if ( method_exists ( $ this -> view , 'plugin' ) ) { $ this -> flashMessengerHelper = $ this -> view -> plugin ( FlashMessengerHelper :: class ) ; } if ( ! $ this -> flashMessengerHelper in...
Retrieve the FlashMessenger helper
15,697
protected function trigger ( $ event ) { $ arguments = func_get_args ( ) ; array_shift ( $ arguments ) ; if ( isset ( $ this -> events [ $ event ] ) ) { foreach ( $ this -> events [ $ event ] as $ call ) { call_user_func_array ( $ call , $ arguments ) ; } } foreach ( $ this -> observing as $ observer ) { $ observer -> ...
Trigger an event possibly with parameters .
15,698
public function on ( $ event , callable $ callback ) { if ( ! isset ( $ this -> events [ $ event ] ) ) { $ this -> events [ $ event ] = array ( ) ; } $ this -> events [ $ event ] [ ] = $ callback ; }
Listen to specific events
15,699
public function get ( $ property , $ default = null ) { if ( is_array ( $ property ) ) { $ values = array ( ) ; foreach ( $ property as $ key => $ prop ) { if ( isset ( $ this -> $ prop ) ) { $ values [ $ prop ] = $ this -> $ prop ; } } return ( ! empty ( $ values ) ) ? $ values : $ default ; } if ( isset ( $ this -> $...
Get a protected object property