idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
59,000 | final public function logWarn ( $ msg_code , $ data = array ( ) ) { self :: write ( self :: compileMessage ( self :: $ warn_msg [ $ msg_code ] , $ data ) , PEL_WARNING ) ; } | Metodo que permite escribir un log de Advertencia . |
59,001 | public function session ( ) { if ( ! ( $ this -> session instanceof Session ) ) { $ this -> session = Session :: singleton ( $ this -> sessionID ) ; } return $ this -> session ; } | Return user session |
59,002 | public function setSessionData ( ) { $ arr = $ this -> toArray ( ) ; $ arr [ 'login_timestamp' ] = $ this -> loginTimestamp ; $ arr [ 'last_action' ] = $ this -> lastAction ; $ this -> session ( ) -> set ( get_called_class ( ) , serialize ( $ arr ) ) ; } | Set user data in a session |
59,003 | public function updateLastAction ( ) { $ arr = $ this -> getSessionData ( ) ; $ this -> lastAction = time ( ) ; $ arr [ 'last_action' ] = $ this -> lastAction ; $ this -> session ( ) -> set ( get_called_class ( ) , serialize ( $ arr ) ) ; } | Update the last action time to the current time |
59,004 | public function initSession ( ) { $ session = $ this -> getSessionData ( ) ; if ( $ this -> checkSession ( $ session ) !== TRUE ) { return $ this -> Logout ( 'invalid_session' ) ; } $ this -> fromSessionData ( ) ; if ( ! $ this -> Read ( ) ) { return $ this -> Logout ( 'user_read_error' ) ; } $ this -> reset ( 'passwor... | Initialise a user session and check it is valid |
59,005 | public function validSession ( ) { $ session = $ this -> getSessionData ( ) ; if ( $ this -> checkSession ( $ session ) !== TRUE ) { $ this -> loggedIn = FALSE ; return FALSE ; } if ( $ session [ 'active' ] !== $ this -> iget ( 'active' ) || ! $ this -> iget ( 'active' ) ) { $ this -> loggedIn = FALSE ; return FALSE ; ... | Whether the user has a valid session |
59,006 | public function checkSession ( $ session = FALSE ) { if ( $ session === FALSE ) { $ session = $ this -> getSessionData ( ) ; } if ( ! Parser :: _ak ( $ session , 'id' , FALSE ) ) { return 'no_id' ; } if ( ! Parser :: _ak ( $ session , 'email' , FALSE ) ) { return 'no_email' ; } if ( ! Parser :: _ak ( $ session , 'login... | Check that a session is valid |
59,007 | public function Logout ( $ reason = FALSE ) { $ this -> loggedIn = FALSE ; $ this -> session ( ) -> Destroy ( ) ; $ this -> _sessionData = FALSE ; $ this -> session ( ) -> Create ( ) ; $ this -> session ( ) -> Refresh ( ) ; if ( $ reason !== FALSE ) { $ this -> session ( ) -> set ( 'requested_url' , $ _SERVER [ 'REQUES... | Logout the user return string Reason |
59,008 | public static function _Authenticate ( $ email , $ password ) { $ user = static :: _readFromEmail ( $ email ) ; if ( ! $ user ) { return FALSE ; } return $ user -> checkPassword ( $ password ) ; } | Authenticate and attempt to login a user |
59,009 | public function setValue ( $ value ) { $ this -> value = $ value ; if ( $ value instanceof ValueAwareInterface ) { $ this -> value = $ value -> getFormValue ( ) ; } return $ this ; } | Sets the value or content of the element |
59,010 | protected function getRenderer ( ) { if ( null === $ this -> renderer ) { $ this -> setRenderer ( new $ this -> rendererClass ( ) ) ; } return $ this -> renderer ; } | Gets the HTML renderer for this element |
59,011 | public static function getAllGroupCompanies ( $ ccgr_id ) { $ sql = " SELECT ccmp_id, ccmp_name FROM ccxg_company_x_group INNER JOIN ccmp_company ON ccxg_ccmp_id = ccmp_id WHERE ccxg_ccgr_id = :ccgr_... | get all syscomanies array without access control |
59,012 | public function setLayout ( $ layout = null ) { if ( null !== $ layout && ! is_string ( $ layout ) && ! ( $ layout instanceof ViewModel ) ) { throw new InvalidArgumentException ( 'Invalid value supplied for setLayout.' . 'Expected null, string, or Zend\View\Model\ViewModel.' ) ; } if ( null === $ layout && empty ( $ th... | Set the layout . |
59,013 | protected function manipulateBody ( $ body , $ mimeType = null ) { if ( $ body instanceof ViewModel ) { $ body = $ this -> viewRenderer -> render ( $ body ) ; $ detectedMimeType = 'text/html' ; } elseif ( null === $ body ) { $ detectedMimeType = 'text/plain' ; $ body = '' ; } if ( null !== ( $ layout = $ this -> getLay... | Manipulate the body based on configuration options . |
59,014 | protected function renderTextBody ( $ body ) { $ body = html_entity_decode ( trim ( strip_tags ( preg_replace ( '/<(head|title|style|script)[^>]*>.*?<\/\\1>/s' , '' , $ body ) ) ) , ENT_QUOTES ) ; if ( empty ( $ body ) ) { $ body = 'To view this email, open it an email client that supports HTML.' ; } return $ body ; } | Strip html tags and render a text - only version . |
59,015 | public function compose ( $ body = null , $ mimeType = null ) { if ( null !== $ body && ! is_string ( $ body ) && ! ( $ body instanceof ViewModel ) ) { throw new InvalidArgumentException ( 'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.' ) ; } $ body = $ this -> manipulateBody (... | Compose a new message . |
59,016 | private function generateRoutes ( $ directory ) { $ dirPath = $ directory . 'app/routes/' ; if ( ! file_exists ( $ dirPath ) ) return ; $ iterator = Finder :: create ( ) -> files ( ) -> ignoreDotFiles ( true ) -> sortByName ( ) -> in ( $ dirPath ) ; $ files = iterator_to_array ( $ iterator , true ) ; $ finalContent = '... | Generating final routes file for package |
59,017 | protected function createInstance ( Connection $ connection , string $ type ) : ConstraintInterface { $ driver = $ connection -> driver ( ) ; if ( ! isset ( $ this -> registry [ $ driver ] [ $ type ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "'%s' constraint is not supported by '%s' driver" ) ) ; } $ class... | Create instance for the given connection |
59,018 | public function get ( Connection $ connection , string $ type ) : ConstraintInterface { $ driver = $ connection -> driver ( ) ; if ( isset ( $ this -> instances [ $ driver ] [ $ type ] ) ) { return $ this -> instances [ $ driver ] [ $ type ] ; } return $ this -> instances [ $ driver ] [ $ type ] = $ this -> createInsta... | Get constraint type handler for driver |
59,019 | public function getAll ( Connection $ connection ) : array { foreach ( $ this -> registry as $ types ) { foreach ( array_keys ( $ types ) as $ type ) { $ this -> get ( $ connection , $ type ) ; } } return $ this -> instances [ $ connection -> driver ( ) ] ; } | Get all defined handlers |
59,020 | public function getHtml128 ( $ string , $ pixelPerByte = 2 , $ height = 30 ) { $ generator = new BarcodeGeneratorHTML ( ) ; return $ generator -> getBarcode ( $ string , BarcodeGeneratorHTML :: TYPE_CODE_128 , $ pixelPerByte , $ height ) ; } | Get HTML as CODE - 128 |
59,021 | public function getHtmlEan13 ( $ string , $ pixelPerByte = 2 , $ height = 30 ) { $ generator = new BarcodeGeneratorHTML ( ) ; return $ generator -> getBarcode ( $ string , BarcodeGeneratorHTML :: TYPE_EAN_13 , $ pixelPerByte , $ height ) ; } | Get HTML as EAN - 13 |
59,022 | public function getHtmlUpcA ( $ string , $ pixelPerByte = 2 , $ height = 30 ) { $ generator = new BarcodeGeneratorHTML ( ) ; return $ generator -> getBarcode ( $ string , BarcodeGeneratorHTML :: TYPE_UPC_A , $ pixelPerByte , $ height ) ; } | Get HTML as UPC |
59,023 | private function _parseTokenFromRequest ( ) { if ( $ this -> _c_parsedToken ) return $ this -> _c_parsedToken ; $ this -> _c_parsedToken = $ r = $ this -> assertion -> parseTokenStrFromRequest ( new ServerRequestBridgeInPsr ( $ this -> request ( ) ) ) ; return $ r ; } | Parse Token From Request |
59,024 | public function resolve ( ) { if ( $ this -> sourceFile instanceof UploadedFile ) { $ extension = $ this -> sourceFile -> guessExtension ( ) ; $ name = preg_filter ( '/^php(.+)/' , '$1' , $ this -> sourceFile -> getBasename ( ) ) ; $ this -> originalName = $ this -> sourceFile -> getClientOriginalName ( ) ; } else { $ ... | Override to handle upload before normal creation . |
59,025 | public function getSqlName ( string $ table , string $ name ) : string { return $ table . '_' . $ this -> getType ( ) . '_' . $ name ; } | Get SQL constraint name |
59,026 | public function getKeyStr ( $ hash = true ) { $ key = $ this -> key . self :: $ INDEX_SEPERATOR . $ this -> groupId . self :: $ TAG_SEPERATOR . implode ( self :: $ TAG_SEPERATOR , $ this -> gatherTags ( ) ) ; if ( $ hash ) { $ key = md5 ( $ key ) ; } return $ key ; } | calculate composite key |
59,027 | public function createConfiguration ( $ prefix , $ resourceName , $ resourceClass , array $ templateList , $ eventClass = null , $ parentId = null ) { return new Configuration ( $ prefix , $ resourceName , $ resourceClass , $ templateList , $ eventClass , $ parentId ) ; } | Creates and register a configuration |
59,028 | public function index ( ) { $ isAppInstalled = $ this -> Installer -> isAppInstalled ( ) ; $ isAppReadyInstall = $ this -> InstallerCheck -> isAppReadyToInstall ( ) ; $ phpVesion = $ this -> InstallerCheck -> checkPhpVersion ( ) ; $ phpModules = $ this -> InstallerCheck -> checkPhpExtensions ( ) ; $ filesWritable = $ t... | Action index . Used to view state of installation for application . |
59,029 | public function getUserFromToken ( $ token ) { $ expiration = U :: unixToDb ( time ( ) - UserLink :: $ forgotLinkTimeframe ) ; $ link = UserLink :: where ( 'link' , $ token ) -> where ( 'type' , UserLink :: FORGOT_PASSWORD ) -> where ( 'created_at' , $ expiration , '>' ) -> first ( ) ; if ( ! $ link ) { throw new AuthE... | Looks up a user from a given forgot token . |
59,030 | public function buildLink ( $ userId , $ ip , $ userAgent ) { $ link = new UserLink ( ) ; $ link -> user_id = $ userId ; $ link -> type = UserLink :: FORGOT_PASSWORD ; try { $ link -> save ( ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Could not create reset password link for user # $userId: " . $ e -> ge... | Builds a reset password link . |
59,031 | public static function fetchArguments ( $ _class = null , $ _method = null , $ args = null ) { if ( empty ( $ _class ) || empty ( $ _method ) ) { return null ; } $ args_def = array ( ) ; if ( ! empty ( $ args ) ) { $ analyze = new ReflectionMethod ( $ _class , $ _method ) ; foreach ( $ analyze -> getParameters ( ) as $... | Launch a class s method fetching arguments |
59,032 | public static function generateList ( $ region = DateTimeZone :: ALL ) { $ regions = array ( DateTimeZone :: AFRICA , DateTimeZone :: AMERICA , DateTimeZone :: ANTARCTICA , DateTimeZone :: ASIA , DateTimeZone :: ATLANTIC , DateTimeZone :: AUSTRALIA , DateTimeZone :: EUROPE , DateTimeZone :: INDIAN , DateTimeZone :: PAC... | Generate Time Zone List . |
59,033 | public function render ( $ context = [ ] ) { if ( $ this -> getElement ( ) -> hasAttribute ( 'value' ) ) { $ this -> getElement ( ) -> getAttributes ( ) -> remove ( 'value' ) ; } return parent :: render ( $ context ) ; } | Overrides to remove the unnecessary value attribute |
59,034 | public function clearType ( $ typeKey ) { if ( isset ( $ this -> models [ $ typeKey ] ) ) { unset ( $ this -> models [ $ typeKey ] ) ; } return $ this ; } | Clears all models in the memory cache for a specific type . |
59,035 | public function push ( Model $ model ) { $ this -> models [ $ model -> getType ( ) ] [ $ model -> getId ( ) ] = $ model ; return $ this ; } | Pushes a model into the memory cache . |
59,036 | public function remove ( $ typeKey , $ identifier ) { if ( isset ( $ this -> models [ $ typeKey ] [ $ identifier ] ) ) { unset ( $ this -> models [ $ typeKey ] [ $ identifier ] ) ; } return $ this ; } | Removes a model from the memory cache based on type and identifier . |
59,037 | public function get ( $ typeKey , $ identifier ) { $ map = $ this -> getAllForType ( $ typeKey ) ; if ( isset ( $ map [ $ identifier ] ) ) { return $ map [ $ identifier ] ; } return null ; } | Gets a model from the memory cache based on type and identifier . |
59,038 | public function createContent ( Location $ location = null , Campaign $ campaign = null ) { $ connection = $ this -> getRestApiConnectionByLocation ( $ location ) ; $ remoteContentTypes = $ connection -> getContentTypes ( ) ; foreach ( $ remoteContentTypes as $ remoteContentType ) { $ id = $ location -> getId ( ) . '-'... | When a new Activity is being created this handler method will be called to retrieve a new Content object for the Activity . |
59,039 | public function setPadding ( $ padding = 0 ) { $ padding = $ this -> parseSizes ( $ padding ) ; foreach ( $ padding as $ side => $ value ) { if ( ! is_int ( $ value ) || $ value < 0 ) { throw new InvalidArgumentException ( sprintf ( 'Invalid %s padding: "%s". Must be a positive integer value.' , $ side , $ value ) ) ; ... | Sets style padding . |
59,040 | public function setMargin ( $ margin = 0 ) { $ margin = $ this -> parseSizes ( $ margin ) ; foreach ( $ margin as $ side => $ value ) { if ( ! is_int ( $ value ) || $ value < 0 ) { throw new InvalidArgumentException ( sprintf ( 'Invalid %s margin: "%s". Must be a positive integer value.' , $ side , $ value ) ) ; } $ th... | Sets style margin . |
59,041 | public static function quickValidate ( ? string $ value , array $ constraints = [ ] ) { $ validator = new static ( 'quickValidate function' , InputFieldTypes :: PASSED , [ ] , $ value , null ) ; if ( is_array ( $ constraints ) && count ( $ constraints ) > 0 ) { foreach ( $ constraints as $ constraint ) { if ( is_array ... | Validates input as a one - off . Allows quick and dirty validation . Returns null if the value is not valid . |
59,042 | public function addConstraint ( Constraint $ constraint ) : void { $ constraint -> setValidator ( $ this ) ; array_push ( $ this -> constraints , $ constraint ) ; } | Add a constraint to the validator |
59,043 | public function reportError ( string $ error_message ) : void { $ error_message = sprintf ( $ error_message , $ this -> field_name ) ; if ( null != $ this -> validation_set ) { $ this -> validation_set -> addValidationError ( new ValidationError ( $ this -> field_name , $ error_message ) ) ; } } | Report the error message to validation set |
59,044 | public function validate ( ) : void { $ this -> value = null ; $ value = $ this -> filter ( $ this -> raw_value ) ; if ( true === $ this -> checkValidity ( $ value ) ) { $ this -> is_valid = true ; } else { $ this -> is_valid = false ; $ this -> reportError ( $ this -> error_message ) ; $ error_message = sprintf ( $ th... | Do the validation . This process starts by filtering the value then checks the validity and finally checks the constraints . |
59,045 | public function getAssignments ( $ userId ) { if ( empty ( $ userId ) ) { return [ ] ; } $ roles = $ this -> allRoleNamesByUserId ( $ userId ) ; return AssignmentHelper :: forge ( $ userId , $ roles ) ; } | Returns all role assignment information for the specified user . |
59,046 | public function revoke ( $ role , $ userId ) { $ userId = $ this -> getId ( $ userId ) ; $ entity = \ App :: $ domain -> account -> login -> oneById ( $ userId ) ; $ this -> model -> deleteAll ( [ 'user_id' => $ userId , 'item_name' => $ role ] ) ; } | Revokes a role from a user . |
59,047 | private function getPageMap ( string $ sourceLanguage , string $ targetLanguage ) : PageMap { if ( ! array_key_exists ( $ key = $ sourceLanguage . '->' . $ targetLanguage , $ this -> pageMaps ) ) { return $ this -> pageMaps [ $ key ] = new PageMap ( $ sourceLanguage , $ targetLanguage , $ this -> database , $ this -> l... | Retrieve pageMap . |
59,048 | private function getArticleMap ( string $ sourceLanguage , string $ targetLanguage ) : ArticleMap { if ( ! array_key_exists ( $ key = $ sourceLanguage . '->' . $ targetLanguage , $ this -> articleMaps ) ) { return $ this -> articleMaps [ $ key ] = new ArticleMap ( $ this -> getPageMap ( $ sourceLanguage , $ targetLangu... | Retrieve article map . |
59,049 | private function getArticleContentMap ( string $ sourceLanguage , string $ targetLanguage ) : ArticleContentMap { if ( ! array_key_exists ( $ key = $ sourceLanguage . '->' . $ targetLanguage , $ this -> articleContentMaps ) ) { return $ this -> articleContentMaps [ $ key ] = new ArticleContentMap ( $ this -> getArticle... | Retrieve article content map . |
59,050 | public function getValue ( ) { $ terms = $ this -> base [ 'value' ] ; if ( is_array ( $ terms ) ) { $ ret = array ( ) ; foreach ( $ terms as $ t ) { $ ret [ ] = $ this -> termFactory -> create ( $ t , $ this -> taxonomy ( ) ) ; } return $ ret ; } elseif ( is_object ( $ terms ) ) { return $ this -> termFactory -> create... | Get Term or array of Terms . |
59,051 | public function taxonomy ( ) { if ( $ this -> _taxonomy === null ) { $ this -> _taxonomy = $ this -> taxonomyFactory -> create ( $ this -> base [ 'taxonomy' ] ) ; } return $ this -> _taxonomy ; } | Get Term Taxonomy . |
59,052 | final public function getWriteMode ( ) { switch ( $ this -> getDataMode ( ) ) { case Configuration :: DATA_MODE_WIPE : case Configuration :: DATA_MODE_PROGRESSIVE : $ this -> setWriteMode ( static :: WRITE_MODE_INSERT ) ; break ; default : $ this -> setWriteMode ( static :: WRITE_MODE_UPSERT ) ; } return $ this -> writ... | Returns the current write mode |
59,053 | final public function batchUpdate ( $ scn , array $ criteria , array $ update ) { return $ this -> getCollectionForModel ( $ scn ) -> update ( $ criteria , $ update , [ 'multiple' => true ] ) ; } | Performs a batch update |
59,054 | final protected function doUpsert ( $ scn , array $ kvs ) { $ upsertKey = isset ( $ kvs [ 'external' ] ) ? 'external' : 'legacy' ; $ upsertNs = 'legacy' === $ upsertKey ? 'source' : 'namespace' ; $ upsertId = 'legacy' === $ upsertKey ? 'id' : 'identifier' ; $ update = [ '$set' => $ kvs ] ; if ( ! isset ( $ kvs [ $ upse... | Handles a single document upsert |
59,055 | final protected function setWriteMode ( $ mode ) { if ( ! in_array ( $ mode , [ static :: WRITE_MODE_INSERT , static :: WRITE_MODE_UPSERT , static :: WRITE_MODE_UPDATE ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Passed write mode "%s" is invalid!' , $ mode ) ) ; } $ this -> writeMode = $ mode ; } | Sets the current write mode |
59,056 | public function onKernelController ( FilterControllerEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ route = $ this -> routes -> get ( $ request -> attributes -> get ( '_route' ) ) ; if ( $ route && $ route -> hasContent ( ) ) { $ this -> populateContent ( $ route , $ request ) ; } } | Handler Kernel Controller events |
59,057 | public function fields ( $ value = null ) { if ( null === $ value ) { return $ this -> fields ; } $ this -> fields = $ value ; return $ this ; } | Fields getter and setter . |
59,058 | public function field ( string $ name , Syntax $ value = null ) { if ( $ value === null ) { $ names = explode ( '.' , $ name ) ; $ syntax = $ this ; foreach ( $ names as $ field ) { while ( method_exists ( $ syntax , 'syntax' ) ) { $ syntax = $ syntax -> syntax ( ) ; } if ( $ syntax instanceof ObjectSyntax && array_key... | Setter and getter of a specific field . |
59,059 | protected function clearValues ( ) { $ this -> values = [ ] ; foreach ( $ this -> fields as $ name => $ syntax ) { $ this -> values [ $ name ] = ( object ) [ 'value' => null , 'error' => static :: MISSING_FIELD ] ; } } | Clears the parsed values . |
59,060 | public function dump ( $ value ) : string { $ value = ( array ) $ value ; $ result = [ ] ; $ current = '' ; $ missingField = false ; try { foreach ( $ this -> fields as $ name => $ syntax ) { $ current = $ name ; if ( ! array_key_exists ( $ name , $ value ) ) { $ missingField = true ; break ; } $ result [ ] = $ syntax ... | Transforms an object to a string based on the fields or throws a DumpException . |
59,061 | public function setOptions ( $ options ) { if ( ! is_array ( $ options ) && ! $ options instanceof \ Traversable ) { throw new \ InvalidArgumentException ( sprintf ( 'Parameter provided to %s must be an array or Traversable' , __METHOD__ ) ) ; } foreach ( $ options as $ key => $ value ) { $ this -> setOption ( $ key , ... | Set service options from array or traversable object |
59,062 | public function getOptions ( ) { if ( ! $ this -> options ) { if ( isset ( $ this -> optionsClass ) ) { $ this -> options = new $ this -> optionsClass ( array ( ) ) ; } else { $ this -> options = new Options ( array ( ) ) ; } } return $ this -> options ; } | Retrieve service options |
59,063 | public function getOption ( $ key , $ default = null ) { if ( $ this -> hasOption ( $ key ) ) { return $ this -> getOptions ( ) -> __get ( $ key ) ; } return $ default ; } | Retrieve a single option |
59,064 | public function setConfig ( $ config ) { if ( is_string ( $ config ) ) { if ( file_exists ( $ config ) ) { $ config = \ Zend \ Config \ Factory :: fromFile ( $ config ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Unable to read configurations from file %s' , $ config ) ) ; } } if ( ! is_array ( $ confi... | Set options as config file array or traversable object |
59,065 | protected function normalize_path ( $ path ) { $ path = str_replace ( '\\' , '/' , $ path ) ; $ path = preg_replace ( '|/+|' , '/' , $ path ) ; return rtrim ( $ path , '/' ) ; } | Normalize a path . |
59,066 | protected function get_file ( $ file ) { $ path_parts = $ this -> parse_path ( $ file ) ; if ( '' === $ path_parts [ 0 ] ) { $ file = $ this -> root ; unset ( $ path_parts [ 0 ] ) ; } else { $ file = $ this -> cwd ; } foreach ( $ path_parts as $ part ) { if ( '' === $ part ) { continue ; } if ( 'dir' !== $ file -> type... | Get the data for a file . |
59,067 | protected function get_default_atts ( $ atts ) { if ( false === isset ( $ atts [ 'type' ] ) ) { $ atts [ 'type' ] = 'file' ; } if ( 'file' === $ atts [ 'type' ] ) { $ defaults = array ( 'contents' => '' , 'mode' => 0644 , 'size' => 0 , ) ; } elseif ( 'dir' === $ atts [ 'type' ] ) { $ defaults = array ( 'contents' => ne... | Get the default attributes for a file . |
59,068 | public function add_file ( $ file , array $ atts = array ( ) ) { $ parent = $ this -> get_file ( dirname ( $ file ) ) ; $ filename = basename ( $ file ) ; if ( false === $ parent || true === isset ( $ parent -> contents -> $ filename ) ) { return false ; } $ parent -> contents -> $ filename = $ this -> get_default_atts... | Create a file or directory . |
59,069 | public function mkdir_p ( $ file , array $ atts = array ( ) ) { $ dir_levels = $ this -> parse_path ( $ file ) ; $ path = '' ; $ atts [ 'type' ] = 'dir' ; foreach ( $ dir_levels as $ level ) { $ path .= '/' . $ level ; if ( $ this -> exists ( $ path ) ) { continue ; } if ( ! $ this -> add_file ( $ path , $ atts ) ) { r... | Create a deep directory . |
59,070 | public function get_file_attr ( $ file , $ attr , $ type = null ) { $ file_atts = $ this -> get_file ( $ file ) ; if ( false === $ file_atts || false === isset ( $ file_atts -> $ attr ) ) { return false ; } if ( isset ( $ type ) && $ type !== $ file_atts -> type ) { return false ; } return $ file_atts -> $ attr ; } | Get a piece of information about a file . |
59,071 | public function set_file_attr ( $ file , $ attr , $ value , $ recursive = false ) { $ file_atts = $ this -> get_file ( $ file ) ; if ( false === $ file_atts ) { return false ; } if ( 'contents' === $ attr ) { if ( 'file' === $ file_atts -> type ) { $ file_atts -> size = mb_strlen ( $ value , '8bit' ) ; } else { return ... | Set the value of file attribute . |
59,072 | protected function set_file_attr_recursive ( $ file , $ attr , $ value ) { if ( 'dir' === $ file -> type ) { foreach ( $ file -> contents as $ sub => $ atts ) { $ this -> set_file_attr_recursive ( $ atts , $ attr , $ value ) ; } } $ file -> $ attr = $ value ; } | Set the value of file attribute recursively . |
59,073 | public function set_cwd ( $ cwd ) { $ file = $ this -> get_file ( $ cwd ) ; if ( false === $ file || 'dir' !== $ file -> type ) { return false ; } $ this -> cwd = $ this -> normalize_path ( $ cwd ) ; if ( empty ( $ this -> cwd ) ) { $ this -> cwd = '/' ; } return true ; } | Set the current working directory . |
59,074 | public function copy ( $ source , $ destination ) { $ source = $ this -> get_file ( $ source ) ; if ( false === $ source ) { return false ; } $ destination_parent = $ this -> get_file ( dirname ( $ destination ) ) ; $ filename = basename ( $ destination ) ; if ( false === $ destination_parent ) { return false ; } $ des... | Copy a file or directory . |
59,075 | public function move ( $ source , $ destination ) { if ( false === $ this -> copy ( $ source , $ destination ) ) { return false ; } $ this -> delete ( $ source ) ; return true ; } | Move a file or directory . |
59,076 | public function run ( ) { $ this -> make ( 'Sun\Bootstrap\Provider' ) -> registerRoute ( ) ; $ this -> route -> register ( ) ; $ httpMethod = $ this -> make ( 'Sun\Contracts\Http\Request' ) -> method ( ) ; $ uri = $ this -> make ( 'Sun\Contracts\Routing\UrlGenerator' ) -> getUri ( ) ; $ data = $ this -> route -> dispat... | To run application |
59,077 | public function base_path ( $ path = null ) { return empty ( $ path ) ? $ this -> path : $ this -> path . $ path ; } | To get application base directory path |
59,078 | public function app_path ( $ path = null ) { return empty ( $ path ) ? $ this -> base_path ( ) . DIRECTORY_SEPARATOR . 'app' : $ this -> base_path ( ) . 'app' . $ path ; } | To get application app directory path |
59,079 | public function loadAlien ( ) { $ alien = $ this -> config -> getAlien ( ) ; foreach ( $ alien as $ alias => $ namespace ) { class_alias ( $ namespace , $ alias ) ; } } | To load alien |
59,080 | public function getNamespace ( ) { if ( ! is_null ( $ this -> appNamespace ) ) { return $ this -> appNamespace ; } $ composer = json_decode ( file_get_contents ( base_path ( ) . '/composer.json' ) ) ; foreach ( $ composer -> autoload -> { "psr-4" } as $ namespace => $ path ) { if ( realpath ( app_path ( ) ) === realpat... | To get application namespace |
59,081 | protected function bootstrap ( ) { $ this -> make ( 'Sun\Bootstrap\Application' ) -> bootstrap ( ) ; $ this -> make ( 'Sun\Bootstrap\HandleExceptions' ) -> bootstrap ( ) ; $ this -> make ( 'Sun\Bootstrap\Route' ) -> bootstrap ( ) ; $ this -> make ( 'Sun\Bootstrap\Provider' ) -> bootstrap ( ) ; $ this -> route = $ this ... | Bootstrap application required class |
59,082 | protected function registerBindings ( ) { $ binding = config ( 'binding' ) ? : [ ] ; foreach ( $ binding as $ contract => $ implementation ) { $ this -> bind ( $ contract , $ implementation ) ; } } | To register all bindings |
59,083 | public function config ( $ location ) { $ keys = explode ( '.' , $ location ) ; $ filename = 'get' . strtoupper ( array_shift ( $ keys ) ) ; $ location = implode ( '.' , $ keys ) ; if ( empty ( $ location ) ) { return $ this -> config -> { $ filename } ( ) ; } return $ this -> config -> { $ filename } ( $ location ) ; ... | To get configuration |
59,084 | public function registerHook ( IHookProvider $ prov , $ moduleName , $ loadBefore = null ) { $ found = false ; if ( is_a ( $ prov , '\\pff\\Iface\\IBeforeHook' ) ) { $ found = $ this -> addHook ( $ this -> _beforeController , $ prov , $ moduleName , $ loadBefore ) ; } if ( is_a ( $ prov , '\\pff\\Iface\\IAfterHook' ) )... | Registers a hook provider |
59,085 | public function renderResourceButton ( $ resource , $ action = 'view' , array $ options = [ ] , array $ attributes = [ ] ) { if ( $ this -> helper -> isGranted ( $ resource , $ action ) ) { $ options = array_merge ( $ this -> getButtonOptions ( $ action ) , $ options ) ; $ label = null ; if ( array_key_exists ( 'label'... | Renders a resource action button . |
59,086 | function isPlainText ( $ s ) { $ arrfailAt = array ( "*" , "fonttbl" , "colortbl" , "datastore" , "themedata" ) ; for ( $ i = 0 ; $ i < count ( $ arrfailAt ) ; $ i ++ ) { if ( ! empty ( $ s [ $ arrfailAt [ $ i ] ] ) ) { return false ; } } return true ; } | For example there may be a description of font or color palette etc . |
59,087 | public function actions ( $ actions ) { $ substitutes = $ this -> config ( 'substitutes' ) ; foreach ( $ actions as $ name => $ config ) { if ( array_key_exists ( $ name , $ substitutes ) ) { $ actions [ $ name ] [ 'title' ] = '<i class="' . $ substitutes [ $ name ] . '"></i>' ; } } return $ actions ; } | This method replaces a string by an action icon . Mainly used for action icons |
59,088 | public function allowMethod ( string $ method ) : Route { if ( ! in_array ( $ method , self :: $ supportedMethods ) ) { throw new UnsupportedMethodException ( $ method ) ; } $ this -> methods [ ] = $ method ; return $ this ; } | Allows an HTTP method . |
59,089 | public function allowMethods ( array $ methods = [ ] ) : Route { $ this -> methods = [ ] ; foreach ( $ methods as $ method ) { $ this -> allowMethod ( $ method ) ; } return $ this ; } | Allows a list of HTTP methods . |
59,090 | public function getName ( ) : string { if ( $ this -> name === null ) { $ this -> name = $ this -> path ; } return $ this -> name ; } | Returns the name of the route . |
59,091 | public function getFilesPath ( ) { $ repo = $ this -> getServiceContainer ( ) -> getResourceRepository ( ) ; if ( ! $ repo -> contains ( $ this -> getFilesPuliPath ( ) ) ) { $ dir = new Directory ( $ repo -> get ( '/files' ) -> getFilesystemPath ( ) ) ; $ path = $ dir -> toPath ( ) -> append ( 'managed/' . $ this -> mo... | Returns the path for managed files for this module |
59,092 | public function getFilesUrl ( $ suffix = '' ) { $ generator = $ this -> getServiceContainer ( ) -> getUrlGenerator ( ) ; return $ generator -> generateUrl ( $ this -> getFilesPuliPath ( ) . '/' . $ suffix ) ; } | Returns the url for a managed file |
59,093 | public function getPreferences ( ) { if ( $ this -> preferences === null ) { $ this -> preferences = $ this -> service -> getPreferenceLoader ( ) -> getModulePreferences ( $ this -> model -> getId ( ) ) ; } return $ this -> preferences ; } | Returns the module s preferences |
59,094 | public function getActionModel ( $ actionName ) { if ( isset ( $ this -> actions [ $ actionName ] ) ) { return $ this -> actions [ $ actionName ] [ 'model' ] ; } return mull ; } | Returns the model for the given action name |
59,095 | public function loadAction ( $ nameOrAction , $ format = null ) { $ model = null ; if ( $ nameOrAction instanceof Action ) { $ model = $ nameOrAction ; $ actionName = $ nameOrAction -> getName ( ) ; } else { $ actionName = $ nameOrAction ; } if ( ! isset ( $ this -> actions [ $ actionName ] ) ) { throw new ModuleExcept... | Loads the given action |
59,096 | public function hasPermission ( $ action , User $ user = null ) { return $ this -> getServiceContainer ( ) -> getFirewall ( ) -> hasPermission ( $ this -> getName ( ) , $ action , $ user ) ; } | Shortcut for getting permission on the given action in this module |
59,097 | protected function getMasterConnection ( ) { $ db_config = $ this -> containers [ 'config' ] -> get ( 'mysql' ) ; $ master_db_config = $ db_config [ 'master' ] ; $ this -> _master_db = isset ( $ master_db_config [ 'dbname' ] ) ? $ master_db_config [ 'dbname' ] : '' ; $ this -> _master_host = isset ( $ master_db_config ... | Establish master node mysql connection |
59,098 | protected function getSlaveConnection ( $ server_hosts = [ ] ) { $ db_config = $ this -> containers [ 'config' ] -> get ( 'mysql' ) ; $ slave_config = $ db_config [ 'slaves' ] ; if ( ! $ server_hosts ) { foreach ( $ slave_config as $ key => $ config ) { $ server_hosts [ $ key ] = $ config [ 'host' ] ; } } if ( $ server... | Establish slave node mysql connection |
59,099 | protected function getExtraConnection ( $ conn ) { $ dbConfigs = $ this -> containers [ 'config' ] -> get ( 'mysql' ) ; $ dbConfig = $ dbConfigs [ $ conn ] ; $ this -> extraConfigs [ $ conn ] [ '_db' ] = $ dbConfig [ 'dbname' ] ?? '' ; $ this -> extraConfigs [ $ conn ] [ '_host' ] = $ dbConfig [ 'host' ] ?? '' ; $ this... | Establish extra mysql connection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.