idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
18,400 | public function load ( $ class ) { if ( $ class [ 0 ] == '\\' ) $ class = substr ( $ class , 1 ) ; $ class = str_replace ( array ( '\\' , '_' ) , DIRECTORY_SEPARATOR , $ class ) . '.php' ; foreach ( $ this -> directories as $ directory ) { if ( file_exists ( $ path = $ directory . DIRECTORY_SEPARATOR . $ class ) ) { re... | Search and load a specific class . Used for auto - loader . |
18,401 | private function execute ( $ regex , $ data ) { $ matches = [ ] ; preg_match ( $ regex , ( string ) $ data , $ matches ) ; return $ matches ; } | Ejecuta la comprobacion por medio de regex y devuelve lo se pudo capturar . |
18,402 | public function writeUInt8 ( int $ value ) : self { $ this -> bytes .= Writer :: bit8 ( $ value ) ; return $ this ; } | Write an unsigned 8 bit integer . |
18,403 | public function writeUInt16 ( int $ value ) : self { $ this -> bytes .= Writer :: bit16 ( $ value ) ; return $ this ; } | Write an unsigned 16 bit integer . |
18,404 | public function writeUInt32 ( int $ value ) : self { $ this -> bytes .= Writer :: bit32 ( $ value ) ; return $ this ; } | Write an unsigned 32 bit integer . |
18,405 | public function actionIndex ( $ page = 1 ) { $ this -> trigger ( self :: EVENT_BEFORE_RECENT_SHOW ) ; $ data [ 'page' ] = ( int ) $ page ; $ data [ 'route' ] = '/' . $ this -> getRoute ( ) ; $ finder = new VideoFinder ( ) ; $ data [ 'videos' ] = $ finder -> getNewVideos ( $ page ) ; $ data [ 'total_items' ] = $ finder ... | Lists all Videos models . |
18,406 | protected function bindParameters ( \ PDOStatement $ statement , array $ parameters , $ prefix = '' ) { foreach ( $ parameters as $ key => $ value ) { if ( is_array ( $ value ) ) { $ statement = $ this -> bindParameters ( $ statement , $ value , $ prefix . $ key ) ; } else { switch ( true ) { case is_int ( $ value ) : ... | Bind the parameters to the statement |
18,407 | protected function readOne ( $ query , $ parameters ) { $ statement = $ this -> execute ( $ query , $ parameters ) ; $ rowCount = $ statement -> rowCount ( ) ; if ( $ rowCount > 1 ) { throw new MultipleRowFoundException ( 'Multiple row found for query: ' . $ query ) ; } if ( $ rowCount === 0 ) { throw new RowNotFoundEx... | Return the statement checked that the result contains only 1 row |
18,408 | private function processWithKey ( array $ rows , $ keyField ) { if ( empty ( $ rows ) ) { return [ ] ; } $ first = reset ( $ rows ) ; if ( ! isset ( $ first -> $ keyField ) ) { throw new FieldNotFoundException ( $ keyField . ' field not found in result of the query' ) ; } $ result = [ ] ; foreach ( $ rows as $ row ) { ... | Process the queried rows into an array which has the keyField keys |
18,409 | public static function run ( $ value , string $ type = null ) { switch ( $ type ) { case 'int' : $ regexp = self :: compileRegexp ( self :: INT ) ; break ; case 'float' : $ regexp = self :: compileRegexp ( self :: FLOAT ) ; break ; case 'text' : $ value = self :: fixQuotes ( $ value ) ; $ regexp = self :: compileRegexp... | Cleanup the value |
18,410 | public function execute ( Pygmentize $ pygmentize , array $ options ) { $ cmd = sprintf ( '-f %s -l %s -O encoding=%s %s %s' , $ pygmentize -> getFormat ( ) , $ pygmentize -> getLexer ( ) , mb_detect_encoding ( file_get_contents ( $ pygmentize -> getSubject ( ) ) ) , $ this -> generateOptions ( $ options ) , $ pygmenti... | execute a call to pygmentize binary |
18,411 | public function executeCommand ( $ command ) { $ cmd = sprintf ( '%s %s' , $ this -> binaryPath , $ command ) ; $ p = new Process ( $ cmd ) ; $ p -> run ( ) ; if ( $ p -> isSuccessful ( ) ) { return $ p -> getOutput ( ) ; } else { throw new \ RuntimeException ( sprintf ( 'pygmentize failed with the error: %s' , $ p -> ... | executes a command |
18,412 | public function guessLexer ( $ filename ) { $ cmd = sprintf ( '%s -N %s' , $ this -> binaryPath , $ filename ) ; $ p = new Process ( $ cmd ) ; $ p -> run ( ) ; $ output = trim ( $ p -> getOutput ( ) ) ; if ( 'text' === $ output ) { $ output = $ this -> guessFromExtension ( $ filename ) ; } if ( 'text' === $ output ) { ... | guess the lexer from the filename |
18,413 | private function guessFromContent ( $ filename ) { $ output = 'text' ; if ( ! is_file ( $ filename ) ) { return $ output ; } if ( $ fileContents = file_get_contents ( $ filename ) ) { if ( 1 === preg_match ( '/<?xml.*?>/' , $ fileContents ) ) { $ output = 'xml' ; } } return $ output ; } | try to guess lexer from the file content by searching some text |
18,414 | public function generateCollections ( ) { $ collections = $ this -> collections ; $ this -> collections = [ ] ; foreach ( $ collections as $ category => $ detail ) { foreach ( $ detail [ 'class' ] as $ class ) { if ( ! in_array ( ILinkCollection :: class , class_implements ( $ class ) ) ) { throw new \ LogicException (... | Vygeneruje seznam kolekci dle vsech nakonfigurovanich Collection Collection musi implementovat \ Grapesc \ GrapeFluid \ LinkCollector \ ILinkCollection |
18,415 | public function exceptionHandler ( $ exception ) { try { $ debug = Factory :: load ( 'Debug' ) ; $ debug -> errorhandler ( $ exception ) ; } catch ( \ Exception $ e ) { echo "<pre>$exception</pre>\n\n" ; echo "<pre>The Debug class threw an exception:\n$e</pre>" ; } } | Will be set by the Constructor as global exception handler . |
18,416 | public static function getConstList ( ) : array { if ( static :: $ constList === null ) { $ reflection = new ReflectionClass ( get_called_class ( ) ) ; static :: $ constList = array_values ( $ reflection -> getConstants ( ) ) ; } return static :: $ constList ; } | Gets all possible values as an array . |
18,417 | public static function setForcedScheme ( $ scheme = null ) { if ( ! is_string ( $ scheme ) && ! is_null ( $ scheme ) ) { throw new InvalidArgumentException ( sprintf ( 'Invalid scheme provided; must be an string or a null, "%s" received.' , is_object ( $ scheme ) ? get_class ( $ scheme ) : gettype ( $ scheme ) ) ) ; } ... | Sets the Uri scheme for forced usage . |
18,418 | public static function retrieve ( array $ server = null ) { if ( empty ( $ server ) ) { $ server = $ _SERVER ; } $ scheme = 'http' ; if ( isset ( $ server [ 'HTTPS' ] ) && 'off' != $ server [ 'HTTPS' ] ) { $ scheme = 'https' ; } return $ scheme ; } | Retrieves the Uri scheme using incoming data ignores a forced scheme . If unable to retrieve the scheme returns http . |
18,419 | public function execute ( Framework $ framework , WebRequest $ request , Response $ response ) { $ title = $ this -> translate ( 'Activate account' , '\\Zepi\\Web\\AccessControl' ) ; $ this -> setTitle ( $ title ) ; $ uuid = $ request -> getRouteParam ( 'uuid' ) ; $ activationToken = $ request -> getRouteParam ( 'token... | Deletes a cluster in the database |
18,420 | protected function activateUser ( $ uuid , $ activationToken ) { if ( ! $ this -> userManager -> hasUserForUuid ( $ uuid ) ) { return array ( 'result' => false , 'message' => $ this -> translate ( 'Account with the given UUID does not exist.' , '\\Zepi\\Web\\AccessControl' ) ) ; } $ user = $ this -> userManager -> getU... | Activates the user or returns an error message |
18,421 | public static function setApplicationConnection ( Application $ application = null , $ connName ) { if ( is_null ( $ application ) ) { throw new \ InvalidArgumentException ( 'Application instance needed!' ) ; } $ helperSet = $ application -> getHelperSet ( ) ; $ doctrine = $ helperSet -> get ( 'doctrine' ) ; $ connecti... | Convenience method to push the helper sets of a given connection into the application . |
18,422 | protected function fetchURL ( $ URL ) { $ cookieHeader = [ ] ; if ( $ this -> cookie ) { $ cookieHeader [ ] = 'Cookie: ' . $ this -> cookie . ';' ; } $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ URL ) ; curl_setopt ( $ curl , CURLOPT_HEADER , 1 ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , 1 ) ... | Returns the content loaded from the given URL . Uses curl to fetch the cookie from the response and insert it into requests if available . |
18,423 | public static function escapeShellArg ( $ arg , $ escapeFor = NULL ) { $ escaped = \ Symfony \ Component \ Process \ ProcessUtils :: escapeArgument ( $ arg ) ; return Preg :: replace ( $ escaped , '~(?<!\\\\)\\\\"$~' , '\\\\\\"' ) ; } | This escapes shell arguments on windows correctly |
18,424 | public function after ( $ response ) { if ( ! $ response instanceof Response ) { $ response = \ Response :: forge ( $ response , $ this -> response_status ) ; } return $ response ; } | This method gets called after the action is called |
18,425 | public function askYesNo ( string $ prompt ) { $ prompt .= ' (y/n): ' ; $ result = null ; $ result = $ this -> askUntillValid ( $ prompt , function ( $ answer ) { $ answer = strtolower ( $ answer ) ; return $ answer === 'y' || $ answer === 'n' ; } ) ; return $ result === 'y' ; } | Prompt user to supply either a yes or no answer |
18,426 | public function askUntillValid ( string $ prompt , callable $ validationCallback ) { $ result = null ; while ( $ validationCallback ( $ result ) !== true ) { $ result = $ this -> readLine ( "$prompt" ) ; } return $ result ; } | Prompt user for input untill the given input returns true from the validation callback function . |
18,427 | private function readline ( string $ prompt ) { if ( PHP_OS == 'WINNT' ) { echo $ prompt ; $ line = stream_get_line ( STDIN , 1024 , PHP_EOL ) ; } else { $ line = readline ( $ prompt ) ; } return $ line ; } | Get user input from commandline |
18,428 | public function getSystemId ( ) { if ( ! is_null ( $ this -> _systemId ) ) { return $ this -> _systemId ; } preg_match ( '/' . ucfirst ( $ this -> moduleType ) . '([A-Za-z]+)\\\Module/' , get_class ( $ this ) , $ matches ) ; if ( ! isset ( $ matches [ 1 ] ) ) { throw new Exception ( get_class ( $ this ) . " is not set ... | Get system . |
18,429 | function mergeWith ( $ data = [ ] ) { if ( is_array ( $ data ) || is_object ( $ data ) ) foreach ( $ data as $ key => $ value ) { $ this -> __data -> { $ key } = $ value ; } return $ this ; } | Adds data to storage |
18,430 | static protected function parseRule ( $ rule ) { switch ( gettype ( $ rule ) ) { case 'string' : $ type = $ rule ; $ target = null ; $ types = [ ] ; break ; case 'array' : $ type = isset ( $ rule [ 'type' ] ) ? $ rule [ 'type' ] : [ ] ; $ target = isset ( $ rule [ 'target' ] ) ? $ rule [ 'target' ] : [ ] ; $ types = is... | Standartise type target and types |
18,431 | protected function parseType ( array $ input ) { extract ( $ input ) ; switch ( $ type ) { case 'array' : if ( ! is_array ( $ this -> { $ key } ) ) return false ; break ; case 'int' : case 'integer' : if ( ! is_int ( $ this -> { $ key } ) ) return false ; break ; case 'or' : $ valid = false ; foreach ( $ types as $ _ty... | Checks if field match type |
18,432 | public static function cacheAllConfigsFile ( $ application = null ) { if ( empty ( $ application ) ) { $ application = Yii :: $ app ; } $ appKey = UniApplication :: appKey ( $ application ) ; $ cacheKey = static :: $ confFileCacheKey . '/' . $ appKey ; if ( $ application -> cache instanceof Cache && ! empty ( static ::... | Save all configs together in cache |
18,433 | protected function addError ( $ message , $ code = null ) { $ this -> adapter -> add ( $ message , $ code , 'error' ) ; return $ this ; } | add error into container |
18,434 | protected function addWarning ( $ message , $ code = null ) { $ this -> adapter -> add ( $ message , $ code , 'success' ) ; return $ this ; } | add warning into container |
18,435 | protected function addInfo ( $ message , $ code = null ) { $ this -> adapter -> add ( $ message , $ code , 'info' ) ; return $ this ; } | add info into container |
18,436 | protected function addSuccess ( $ message , $ code = null ) { $ this -> adapter -> add ( $ message , $ code , 'success' ) ; return $ this ; } | add success into container |
18,437 | protected function getDaemonOptions ( ) { return [ [ 'daemon' , null , InputOption :: VALUE_NONE , 'Run the command in daemon mode' ] , [ 'sleep' , null , InputOption :: VALUE_OPTIONAL , 'Number of seconds to sleep when no job is available' , 3 ] , [ 'memory' , null , InputOption :: VALUE_OPTIONAL , 'The memory limit i... | Get the console daemon options . |
18,438 | public function loadScanned ( ) { if ( $ this -> app -> environment ( 'local' ) && $ this -> app [ 'config' ] -> get ( 'assets.generate_when_local' , false ) ) { $ this -> scanDirectories ( ) ; } $ scans = $ this -> getDirectories ( ) ; if ( ! empty ( $ scans ) && $ this -> getScanner ( ) -> isScanned ( ) ) { $ this ->... | Load the scanned assets . |
18,439 | private function AddValueField ( ) { $ name = 'Value' ; $ field = new Fields \ Textarea ( $ name , $ this -> textarea -> GetValue ( ) ) ; $ this -> AddField ( $ field ) ; } | Adds the value field |
18,440 | protected function SaveElement ( ) { $ this -> textarea -> SetLabel ( $ this -> Value ( 'Label' ) ) ; $ this -> textarea -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> textarea -> SetValue ( $ this -> Value ( 'Value' ) ) ; $ this -> textarea -> SetPattern ( $ this -> Value ( 'Pattern' ) ) ; $ this -> textarea ->... | Attaches the basic properties to the textarea element |
18,441 | protected function next ( ) { $ promiseOrValue = array_shift ( $ this -> queue ) ; $ promise = resolve ( $ promiseOrValue ) ; $ this -> cancellationQueue -> enqueue ( $ promise ) ; return $ promise ; } | Get next promise from queue |
18,442 | protected function createRejectFunction ( $ reject ) { $ this -> reject = function ( $ reason ) use ( & $ reject ) { $ cancelQueue = $ this -> cancellationQueue ; $ cancelQueue ( ) ; return isset ( $ reject ) ? $ reject ( $ reason ) : null ; } ; } | Create reject function with cancellation queue |
18,443 | public static function validateCache ( $ file , $ cacheTTL , $ cacheForever ) { $ currentTime = time ( ) ; $ expireTime = $ cacheTTL * 60 * 60 ; $ fileTime = filemtime ( $ file ) ; return ( $ currentTime - $ expireTime < $ fileTime ) or $ cacheForever ; } | Check if a given cache entry is still valid . Will always return true if permanent caching has been set on . |
18,444 | public function findOrCreateBranch ( RepositoryInterface $ repository , $ branchName ) { try { return $ this -> findOneBy ( [ 'name' => $ branchName , 'repository' => $ repository ] , false ) ; } catch ( NoResultException $ e ) { $ branch = new Branch ( ) ; $ branch -> setName ( $ branchName ) -> setRepository ( $ repo... | Tries to find a branch by repository and branch name and throws exception if is not able to do so . |
18,445 | public function findDataByTypesAndNames ( array $ namesByTypes , array $ modCombinationIds = [ ] ) : array { $ columns = [ 'i.id AS id' , 'IDENTITY(i.file) AS hash' , 'i.type AS type' , 'i.name AS name' , 'mc.order AS order' ] ; $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> sele... | Finds the data of the specified entities . |
18,446 | public function findDataByHashes ( array $ hashes , array $ modCombinationIds = [ ] ) : array { $ result = [ ] ; if ( count ( $ hashes ) > 0 ) { $ columns = [ 'i.id AS id' , 'IDENTITY(i.file) AS hash' , 'i.type AS type' , 'i.name AS name' , 'mc.order AS order' ] ; $ queryBuilder = $ this -> entityManager -> createQuery... | Finds the data of the icons with the specified hashes . |
18,447 | protected function mapIconDataResult ( array $ iconData ) : array { $ result = [ ] ; foreach ( $ iconData as $ data ) { $ result [ ] = IconData :: createFromArray ( $ data ) ; } return $ result ; } | Maps the query result to instances of IconData . |
18,448 | public function filter ( callable $ predicate ) : self { if ( $ this -> isPresent ( ) && $ predicate ( $ this -> value ) ) { return $ this ; } return self :: $ null ; } | returns result when value is present and fulfills the predicate |
18,449 | public function map ( callable $ mapper ) : self { if ( $ this -> isPresent ( ) ) { return new self ( $ mapper ( $ this -> value ) ) ; } return self :: $ null ; } | maps the value using mapper into a different result |
18,450 | public function whenEmpty ( $ other ) : self { if ( ! $ this -> isEmpty ( $ this -> value ) ) { return $ this ; } return self :: of ( $ other ) ; } | returns the result if value is not empty or result of other |
18,451 | public function applyWhenEmpty ( callable $ other ) : self { if ( ! $ this -> isEmpty ( $ this -> value ) ) { return $ this ; } return self :: of ( $ other ( ) ) ; } | returns the result if value is not empty or the result of applied other |
18,452 | public function getEntity ( $ plugin ) { $ plugin = Inflector :: camelize ( $ plugin ) ; $ slug = Str :: low ( $ plugin ) ; $ entity = $ this -> _controller -> Extensions -> findBySlug ( $ slug ) -> first ( ) ; if ( $ entity === null ) { $ entity = $ this -> _controller -> Extensions -> newEntity ( [ 'params' => [ ] , ... | Get current plugin entity . |
18,453 | protected function afterRender ( ) { $ this -> logger -> debug ( 'application.afterRender.start' ) ; $ manager = $ this -> getEventManager ( ) ; $ manager -> notify ( \ FreeFW \ Constants :: EVENT_AFTER_RENDER ) ; $ this -> logger -> debug ( 'application.afterRender.end' ) ; return $ this ; } | Event de fin |
18,454 | public function listAction ( ) { $ lockManager = $ this -> get ( 'phlexible_element.element_lock_manager' ) ; $ userManager = $ this -> get ( 'phlexible_user.user_manager' ) ; $ locks = $ lockManager -> findAll ( ) ; $ data = [ ] ; foreach ( $ locks as $ lock ) { $ username = '(unknown user)' ; $ user = $ userManager -... | List locks . |
18,455 | public function deleteAction ( $ id ) { $ lockManager = $ this -> get ( 'phlexible_element.element_lock_manager' ) ; $ lock = $ lockManager -> find ( $ id ) ; $ lockManager -> deleteLock ( $ lock ) ; return new ResultResponse ( true , 'Lock released.' ) ; } | Delete lock . |
18,456 | public function deletemyAction ( ) { $ uid = $ this -> getUser ( ) -> getId ( ) ; $ lockManager = $ this -> get ( 'phlexible_element.element_lock_manager' ) ; $ myLocks = $ lockManager -> findBy ( [ 'userId' => $ uid ] ) ; foreach ( $ myLocks as $ lock ) { $ lockManager -> deleteLock ( $ lock ) ; } return new ResultRes... | Delete my locks . |
18,457 | public function lockAction ( Request $ request ) { $ eid = ( int ) $ request -> get ( 'eid' ) ; $ language = $ request -> get ( 'language' ) ; $ elementService = $ this -> get ( 'phlexible_element.element_service' ) ; $ lockManager = $ this -> get ( 'phlexible_element.element_lock_manager' ) ; $ element = $ elementServ... | Lock element . |
18,458 | public function index ( ) { if ( ! $ this -> request -> isPOST ( ) ) { if ( class_exists ( 'ErrorPage' ) ) { $ response = ErrorPage :: response_for ( 404 ) ; if ( ! empty ( $ response ) ) { return parent :: httpError ( 404 , $ response ) ; } } return parent :: httpError ( 404 ) ; } if ( self :: config ( ) -> check_user... | Handles incoming requests to the kapost service |
18,459 | public function preview ( ) { $ auth = $ this -> request -> getVar ( 'auth' ) ; $ token = KapostPreviewToken :: get ( ) -> filter ( 'Code' , Convert :: raw2sql ( $ auth ) ) -> first ( ) ; if ( ! empty ( $ token ) && $ token !== false && $ token -> exists ( ) && time ( ) - strtotime ( $ token -> Created ) < self :: conf... | Handles rendering of the preview for an object |
18,460 | protected function authenticate ( $ username , $ password ) { $ authenticator = $ this -> config ( ) -> authenticator_class ; $ member = $ authenticator :: authenticate ( array ( $ this -> config ( ) -> authenticator_username_field => $ username , 'Password' => $ password ) ) ; return ( ! empty ( $ member ) && $ member... | Checks the authentication of the api request |
18,461 | protected function getUsersBlogs ( $ app_id ) { if ( SiteConfig :: has_extension ( 'SiteConfigSubsites' ) ) { $ response = array ( ) ; Subsite :: disable_subsite_filter ( ) ; $ subsites = Subsite :: get ( ) ; foreach ( $ subsites as $ subsite ) { $ response [ ] = array ( 'blogid' => $ subsite -> ID , 'blogname' => $ su... | Gets the site config or subsites for the current site |
18,462 | protected function getCategories ( $ blog_id ) { $ categories = array ( ) ; if ( class_exists ( 'SiteTree' ) ) { $ pageClasses = ClassInfo :: subclassesFor ( 'SiteTree' ) ; foreach ( $ pageClasses as $ class ) { if ( $ class != 'SiteTree' ) { $ categories [ ] = array ( 'categoryId' => 'ss_' . strtolower ( $ class ) , '... | Gets the categories |
18,463 | protected function getPreview ( $ blog_id , $ content , $ content_id ) { $ results = $ this -> extend ( 'getPreview' , $ blog_id , $ content , $ content_id ) ; if ( $ results && is_array ( $ results ) ) { $ results = array_filter ( $ results , function ( $ v ) { return ! is_null ( $ v ) ; } ) ; if ( count ( $ results )... | Handles rendering of the preview |
18,464 | final protected function struct_to_assoc ( $ struct ) { $ result = array ( ) ; foreach ( $ struct as $ item ) { if ( array_key_exists ( 'key' , $ item ) && array_key_exists ( 'value' , $ item ) ) { if ( array_key_exists ( $ item [ 'key' ] , $ result ) ) { user_error ( 'Duplicate key detected in struct entry, content ov... | Converts a struct to an associtive array based on the key value pair in the struct |
18,465 | private function mergeResultArray ( $ leftArray , $ rightArray ) { foreach ( $ rightArray as $ key => $ value ) { if ( is_array ( $ value ) && array_key_exists ( $ key , $ leftArray ) ) { $ leftArray [ $ key ] = array_merge ( $ leftArray [ $ key ] , $ value ) ; } else { $ leftArray [ $ key ] = $ value ; } } return $ le... | Merges two arrays overwriting the keys in the left array with the right array recurrsivly . Meaning that if a value in the right array is it self an array and the key exists in the left array it recurses into it . |
18,466 | public static function find_file_by_url ( $ url ) { $ url = Director :: makeRelative ( $ url ) ; if ( $ url ) { $ file = File :: get ( ) -> filter ( 'Filename' , Convert :: raw2sql ( $ url ) ) -> first ( ) ; if ( ! empty ( $ file ) && $ file !== false && $ file -> ID > 0 ) { return $ file ; } } return false ; } | Finds a file record based on the url of the file this is needed because Kapost doesn t seem to send anything back other than the url in the cms |
18,467 | protected function generateErrorResponse ( PhpXmlRpc \ Server $ server , PhpXmlRpc \ Response $ r ) { $ this -> response -> addHeader ( 'Content-Type' , $ r -> content_type ) ; $ this -> response -> addHeader ( 'Vary' , 'Accept-Charset' ) ; $ payload = '<?xml version="1.0"?>' ; if ( empty ( $ r -> payload ) ) { $ r -> ... | Takes the xmlrpc object and generates the response to be set back |
18,468 | public static function instance ( $ instance = null ) { $ class = get_called_class ( ) ; if ( static :: exists ( $ instance ) ) { $ instance = static :: $ _instances [ $ class ] [ $ instance ] ; } else { $ instance = false ; } return $ instance ; } | Return an instance or false |
18,469 | public static function delete ( $ instance ) { $ class = get_called_class ( ) ; if ( $ instance === true ) { static :: $ _instances [ $ class ] = array ( ) ; return true ; } elseif ( static :: exists ( $ instance ) ) { unset ( static :: $ _instances [ $ class ] [ $ instance ] ) ; return true ; } return false ; } | Deletes an instance if exists |
18,470 | public function showAction ( ShopSetting $ shopSetting ) { $ editForm = $ this -> createForm ( new ShopSettingType ( ) , $ shopSetting , array ( 'action' => $ this -> generateUrl ( 'admin_amulen_shop_setting_update' , array ( 'id' => $ shopSetting -> getid ( ) ) ) , 'method' => 'PUT' , ) ) ; $ deleteForm = $ this -> cr... | Finds and displays a ShopSetting entity . |
18,471 | public function newAction ( ) { $ shopSetting = new ShopSetting ( ) ; $ form = $ this -> createForm ( new ShopSettingType ( ) , $ shopSetting ) ; return array ( 'shopSetting' => $ shopSetting , 'form' => $ form -> createView ( ) , ) ; } | Displays a form to create a new ShopSetting entity . |
18,472 | public function createAction ( Request $ request ) { $ shopSetting = new ShopSetting ( ) ; $ form = $ this -> createForm ( new ShopSettingType ( ) , $ shopSetting ) ; if ( $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ shopSetting ) ; $ ... | Creates a new ShopSetting entity . |
18,473 | public function updateAction ( ShopSetting $ shopSetting , Request $ request ) { $ editForm = $ this -> createForm ( new ShopSettingType ( ) , $ shopSetting , array ( 'action' => $ this -> generateUrl ( 'admin_amulen_shop_setting_update' , array ( 'id' => $ shopSetting -> getid ( ) ) ) , 'method' => 'PUT' , ) ) ; if ( ... | Edits an existing ShopSetting entity . |
18,474 | public function getTopLevelBlocks ( ) { $ ret = array ( ) ; foreach ( $ this -> blockManifest as $ block ) { if ( ! $ block -> getParent ( ) ) { $ ret [ ] = $ block ; } } return $ ret ; } | Gets all the blocks at the top level |
18,475 | public function addChild ( $ index ) { foreach ( $ this -> children as $ child ) { if ( $ child -> getID ( ) == $ index ) return ; } $ this -> children [ ] = $ this -> reflector -> getBlockByID ( $ index ) ; } | Adds a child block to this block |
18,476 | public function getChildByName ( $ name ) { foreach ( $ this -> getChildren ( ) as $ child ) { if ( $ child -> getName ( ) == $ name ) return $ child ; } return false ; } | Gets a child block by name |
18,477 | public function getRelativeOffset ( ) { if ( $ this -> getParent ( ) ) { return $ this -> id - $ this -> getParent ( ) -> getID ( ) ; } return $ this -> id ; } | Gets the offset relative to the parent block |
18,478 | public function setAdapterType ( $ type ) { $ adapter_type = '\Library\Reporter\Adapter\\' . ucfirst ( $ type ) ; if ( class_exists ( $ adapter_type ) ) { $ this -> setAdapter ( new $ adapter_type ) ; } else { throw new \ RuntimeException ( sprintf ( 'Reporter adapter for type "%s" doesn\'t exist!' , $ adapter_type ) )... | Set the adapter type to use |
18,479 | public function setAdapter ( AbstractAdapter $ adapter ) { $ cls = get_class ( $ adapter ) ; foreach ( self :: $ default_masks as $ _mask ) { if ( null === @ constant ( $ cls . '::mask_' . $ _mask ) ) { throw new \ LogicException ( sprintf ( 'Reporter adapter "%s" must define a mask named "%s"!' , $ cls , $ _mask ) ) ;... | Set the adapter |
18,480 | public function setOutput ( $ output ) { if ( $ this -> getFlag ( ) & self :: OUTPUT_APPEND ) { $ this -> output .= $ output ; } elseif ( $ this -> getFlag ( ) & self :: OUTPUT_BY_LINE ) { $ this -> output = $ output ; } return $ this ; } | Set some content |
18,481 | public function write ( $ content , $ tag_type = 'default' , $ args = null ) { if ( is_null ( $ args ) ) $ args = array ( ) ; if ( ! is_array ( $ args ) ) $ args = array ( $ args ) ; $ output = $ this -> getAdapter ( ) -> renderTag ( $ content , $ tag_type , $ args ) ; echo PHP_EOL . $ output . PHP_EOL ; } | Display on screen a content with a specific tag mask |
18,482 | public function renderMulti ( $ content , $ tag_type = 'default' , array $ multi = array ( ) , $ args = null , $ placeholder_mask = '@%s@' ) { if ( is_null ( $ args ) ) $ args = array ( ) ; if ( ! is_array ( $ args ) ) $ args = array ( $ args ) ; $ placeholders_table = array ( ) ; foreach ( $ multi as $ item => $ item_... | Render a content with a specific tag mask and some placeholders |
18,483 | public function update ( \ SplSubject $ subject ) { if ( $ subject -> getAction ( ) === 'ctrlRouterLink_exec_execRoute' ) { $ this -> obtainCtrlRouterInfos ( $ subject ) ; if ( $ this -> ctrlRouterInfos -> isFound === true && $ this -> ctrlRouterInfos -> forWho === $ this -> execRouteSystemName ) { $ this -> run ( ) ; ... | Observer update method |
18,484 | protected function run ( ) { if ( PHP_SAPI === 'cli' ) { return ; } if ( $ this -> ctrlRouterInfos -> target === null ) { return ; } $ this -> module -> monolog -> getLogger ( ) -> debug ( 'Execute current route.' , [ 'target' => $ this -> ctrlRouterInfos -> target ] ) ; $ useClass = $ this -> config -> getValue ( 'use... | Run controller system if application is not run in cli mode |
18,485 | protected function runObject ( ) { $ targetInfos = $ this -> ctrlRouterInfos -> target ; if ( ! is_array ( $ targetInfos ) || ( is_array ( $ targetInfos ) && count ( $ targetInfos ) !== 2 ) ) { throw new Exception ( 'The route target should be an array with the class name ' . '(first value) and the method name (second ... | Call controller when is an object . |
18,486 | protected function runProcedural ( ) { $ routerLinker = $ this -> ctrlRouterInfos ; $ runFct = function ( ) use ( $ routerLinker ) { $ controllerFile = ( string ) $ routerLinker -> target ; if ( ! file_exists ( CTRL_DIR . $ controllerFile ) ) { throw new Exception ( 'Controller file ' . $ controllerFile . ' not found.'... | Call controler when is a procedural file |
18,487 | private function setCurrentProfile ( string $ name ) : self { if ( ! $ this -> mapOfProfiles -> hasKey ( $ name ) ) { throw UndefinedProfileException :: forProfile ( $ name ) ; } $ this -> resolver = null ; $ this -> currentProfile = $ name ; return $ this ; } | Asigna el perfil |
18,488 | private function getResolver ( ) : OptionsResolver { if ( ! is_null ( $ this -> resolver ) ) { return $ this -> resolver ; } $ this -> resolver = $ this -> buildResolver ( ) ; return $ this -> resolver ; } | Devuelve el optionsResolver si no existe lo crea y configura |
18,489 | private function buildResolver ( ) : OptionsResolver { $ resolver = new OptionsResolver ( ) ; $ profile = $ this -> mapOfProfiles -> get ( $ this -> currentProfile ) ; call_user_func ( $ profile , $ resolver ) ; return $ resolver ; } | Devuelve un objeto OptionResolver configurado el perfil actual |
18,490 | public function validateInstance ( ) { $ instanceName = MoufManager :: getMoufManager ( ) -> findInstanceName ( $ this ) ; if ( ! file_exists ( ROOT_PATH . $ this -> i18nMessagePath . "message.php" ) ) { return new MoufValidatorResult ( MoufValidatorResult :: ERROR , "<b>Fine: </b>Unable to find default translation fil... | Runs the validation of the instance . Returns a MoufValidatorResult explaining the result . |
18,491 | public function forceLanguage ( $ language ) { $ changeLanguage = false ; if ( $ language === null ) { $ language = $ this -> language ; $ this -> initLanguage ( ) ; if ( $ this -> language != $ language ) { $ changeLanguage = true ; } } elseif ( $ this -> language != $ language ) { $ this -> language = $ language ; $ ... | Use this function to force the language . Don t forget to call this function with null to restore default parameters . Return true if the language change else the language is the same this function return false |
18,492 | public function loadAllMessages ( ) { $ files = glob ( ROOT_PATH . $ this -> i18nMessagePath . 'message*.php' ) ; $ defaultFound = false ; foreach ( $ files as $ file ) { $ base = basename ( $ file ) ; if ( $ base == "message.php" ) { $ messageFile = new FineMessageLanguage ( ) ; $ messageFile -> loadAllFile ( ROOT_PAT... | Load all messages |
18,493 | public function getAllMessages ( $ language = null ) { $ this -> loadAllMessages ( ) ; $ msgs = array ( ) ; $ keys = $ this -> getAllKeys ( ) ; $ languages = $ this -> getSupportedLanguages ( ) ; foreach ( $ keys as $ key ) { $ msgs [ $ key ] = $ this -> getMessageForAllLanguages ( $ key , $ language ) ; } ksort ( $ ms... | Loads and returns all the messages with languages in a big array . |
18,494 | public function getMessageForAllLanguages ( $ key , $ lang = null ) { if ( ! $ this -> messages ) { $ this -> loadAllMessages ( ) ; } $ messageArray = array ( ) ; foreach ( $ this -> messages as $ language => $ messageLanguage ) { if ( is_null ( $ lang ) || $ lang == "" ) $ messageArray [ $ language ] = $ messageLangua... | Get the message for language . |
18,495 | public function getAllKeys ( ) { $ all_messages = array ( ) ; foreach ( $ this -> messages as $ language => $ message ) { $ all_messages = array_merge ( $ all_messages , $ message -> getAllMessages ( ) ) ; } return array_keys ( $ all_messages ) ; } | Returns the list of all keys that have been defined in all language files . loadAllMessages must have been called first . |
18,496 | public function createLanguageFile ( $ language ) { if ( $ language == "default" ) { $ file = ROOT_PATH . $ this -> i18nMessagePath . "message.php" ; } else { $ file = ROOT_PATH . $ this -> i18nMessagePath . "message_" . $ language . ".php" ; } if ( ! is_writable ( $ file ) ) { if ( ! file_exists ( $ file ) ) { $ dir =... | Creates the file for specified language . If the file already exists the function does nothing . |
18,497 | public function setMessage ( $ key , $ value , $ language ) { $ messageFile = $ this -> getMessageLanguageForLanguage ( $ language ) ; $ messageFile -> setMessage ( $ key , $ value ) ; $ messageFile -> save ( ) ; } | Sets and saves a new message translation . |
18,498 | public function setMessages ( array $ messages , $ language ) { $ messageFile = $ this -> getMessageLanguageForLanguage ( $ language ) ; $ messageFile -> setMessages ( $ messages ) ; $ messageFile -> save ( ) ; } | Sets and saves many messages at once for a given language . |
18,499 | public function deleteMessage ( $ key , $ language ) { $ messageFile = $ this -> getMessageLanguageForLanguage ( $ language ) ; $ messageFile -> deleteMessage ( $ key ) ; $ messageFile -> save ( ) ; } | Deletes a message translation . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.