idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
18,900 | public function send ( IMail $ mail ) : void { $ emailContent = $ this -> mailService -> getContent ( $ mail ) ; $ this -> phpMailer -> SMTPDebug = 0 ; $ this -> phpMailer -> isSMTP ( ) ; $ this -> phpMailer -> Host = $ this -> host ; $ this -> phpMailer -> SMTPAuth = true ; $ this -> phpMailer -> Username = $ this -> ... | Send created IMail entity . |
18,901 | public static function set ( $ pKey , $ pValue ) { if ( array_key_exists ( $ pKey , self :: $ _registry ) ) { throw new Exception ( "The registry key '$pKey' already exists" ) ; } return self :: $ _registry [ $ pKey ] = $ pValue ; } | Add an entrey to the registry . |
18,902 | public static function get ( $ pKey ) { if ( array_key_exists ( $ pKey , self :: $ _registry ) ) { return self :: $ _registry [ $ pKey ] ; } return NULL ; } | Get a value from the registry . |
18,903 | public static function remove ( $ pKey ) { if ( ! array_key_exists ( $ pKey , self :: $ _registry ) ) { throw new Exception ( "The registry key '$pKey' doesn't exist" ) ; } if ( is_object ( self :: $ _registry [ $ pKey ] ) and method_exists ( self :: $ _registry [ $ pKey ] , '__destruct' ) ) { self :: $ _registry [ $ p... | Remove an entry from the registry . |
18,904 | private function initRolesForClass ( $ access ) { $ auth = Yii :: $ app -> authManager ; $ descriptions = $ access -> descriptions ( ) ; foreach ( $ descriptions as $ permissionName => $ description ) { $ permission = $ auth -> getPermission ( $ permissionName ) ; if ( ! $ permission ) { $ permission = $ auth -> create... | init roles for extension class |
18,905 | public function initRolesAndActions ( ) { $ classes = $ this -> loadClasses ( ) ; foreach ( $ classes as $ item ) { $ this -> initRolesForClass ( $ item ) ; } } | Collecting and initialising roles over all app |
18,906 | public function setAdminRole ( $ user ) { $ classes = $ this -> loadClasses ( ) ; $ auth = Yii :: $ app -> authManager ; $ auth -> revokeAll ( $ user -> id ) ; foreach ( $ classes as $ item ) { foreach ( $ item -> adminRoles ( ) as $ role ) { $ auth -> assign ( $ auth -> getRole ( $ role ) , $ user -> id ) ; } } } | Set admin roles to user |
18,907 | public function showAction ( Request $ request , $ siteId , $ nodeId , $ blockId ) { try { $ block = $ this -> get ( 'open_orchestra_model.repository.block' ) -> findById ( $ blockId ) ; $ response = $ this -> get ( 'open_orchestra_display.display_block_manager' ) -> show ( $ block ) ; $ this -> tagResponse ( $ block ,... | Display the response linked to a block |
18,908 | public function execute ( ) { $ config = $ this -> getConfiguration ( ) ; $ code = '' ; $ code .= $ this -> generateContainerInitializationCode ( $ config ) ; $ code .= $ this -> generateFactoriesInitializationCode ( $ config ) ; return $ code ; } | Generates configuration cache code |
18,909 | public function getData ( ) { if ( $ this -> vars [ 'compound' ] && $ this -> vars [ 'value' ] !== null ) { return array_map ( function ( DataViewView $ view ) { return $ view -> getData ( ) ; } , $ this -> children ) ; } return $ this -> vars [ 'value' ] ; } | This is the method that will actually fetch the data off the view object |
18,910 | public function getMenu ( $ menuName ) { $ menu = $ this -> getMenuObject ( $ menuName ) ; if ( $ menu ) { return $ menu ; } else { return $ this -> add ( $ menuName ) ; } } | Get a menu you have created . |
18,911 | public function render ( $ menuName ) { $ this -> updateActive ( ) ; $ menu = $ this -> getMenuObject ( $ menuName ) ; if ( ! $ menu ) { throw new \ Exception ( "Menu {$menuName} not found." ) ; } return $ menu ; } | Update the active and order values and then return the object . |
18,912 | private function updateActive ( ) { $ this -> each ( function ( $ item ) { if ( isset ( $ item -> links ) ) { $ this -> makeActive ( $ item ) ; } } ) ; } | Use the active param and set the link to active |
18,913 | private function makeActive ( $ item , $ parent = null ) { $ item -> links -> each ( function ( $ link ) use ( $ item , $ parent ) { if ( $ link -> slug == $ this -> active ) { $ this -> makeParentActive ( $ parent ) ; $ this -> makeParentActive ( $ item ) ; $ link -> setActive ( true ) ; } if ( isset ( $ link -> links... | Loop through the links and check for active . Sets the item and it s parents as active when told to . |
18,914 | private function makeParentActive ( $ parent ) { if ( ! is_null ( $ parent ) && method_exists ( $ parent , 'activeParentage' ) && $ parent -> activeParentage ( ) ) { $ parent -> setActive ( true ) ; } } | Set the parent item as active if able to do so . |
18,915 | public function resolve ( $ closure ) { if ( is_array ( $ closure ) ) { $ reflection = new \ ReflectionMethod ( $ closure [ 0 ] , $ closure [ 1 ] ) ; } else { $ reflection = new \ ReflectionFunction ( $ closure ) ; } $ arguments = $ reflection -> getParameters ( ) ; $ arguments = array_map ( function ( $ argument ) { r... | Resolve the closure and do the magic here |
18,916 | public function getFullSlug ( ) : string { $ categories = Category :: with ( 'ancestors' ) -> ancestorsAndSelf ( $ this -> category -> id ) ; $ slug = "" ; foreach ( $ categories as $ category ) { $ translation = $ category -> translations -> where ( 'locale' , $ this -> locale ) -> first ( ) ; $ slug .= $ translation ... | Get full slug of the category |
18,917 | public function getDsn ( ) : string { $ _dsn = $ this -> driver . ':host=' . $ this -> host . ';port=' . $ this -> port . ';dbname=' . $ this -> schema . ';charset=' . $ this -> charset ; $ this -> setDsn ( $ _dsn ) ; return $ this -> pdo_dsn ; } | Get DSN - Return the default formatted DSN |
18,918 | private function addInterfaceProvider ( $ interface , Reference $ reference ) { if ( empty ( $ this -> interfaceProviders [ $ interface ] ) ) { $ this -> interfaceProviders [ $ interface ] = [ ] ; } $ this -> interfaceProviders [ $ interface ] [ ] = $ reference ; } | Add an interface provider to the list |
18,919 | private function addClassProvider ( $ class , Reference $ reference ) { if ( empty ( $ this -> classProviders [ $ class ] ) ) { $ this -> classProviders [ $ class ] = [ ] ; } $ this -> classProviders [ $ class ] [ ] = $ reference ; } | Add a class provider to the list |
18,920 | private function getProvider ( $ identifier ) { if ( isset ( $ this -> interfaceProviders [ $ identifier ] ) ) { $ this -> assertSingleInterfaceProvider ( $ identifier ) ; return reset ( $ this -> interfaceProviders [ $ identifier ] ) ; } elseif ( isset ( $ this -> classProviders [ $ identifier ] ) ) { $ this -> assert... | Get a provider for an identifier using this method when there are multiple providers for an identifier will cause an exception to be thrown |
18,921 | private function getProviders ( $ identifier ) { if ( isset ( $ this -> interfaceProviders [ $ identifier ] ) ) { return $ this -> interfaceProviders [ $ identifier ] ; } elseif ( isset ( $ this -> classProviders [ $ identifier ] ) ) { return $ this -> classProviders [ $ identifier ] ; } else { return [ ] ; } } | Get all providers for a specified identifier |
18,922 | private function isMethodIncluded ( $ methodName , $ attr ) { if ( empty ( $ attr [ self :: CONFIG_INCLUDE ] ) || ! is_array ( $ attr [ self :: CONFIG_INCLUDE ] ) ) { return true ; } return in_array ( $ methodName , $ attr [ self :: CONFIG_INCLUDE ] ) ; } | Checks if a method is in the include list |
18,923 | private function isMethodExcluded ( $ methodName , $ attr ) { if ( empty ( $ attr [ self :: CONFIG_EXCLUDE ] ) || ! is_array ( $ attr [ self :: CONFIG_EXCLUDE ] ) ) { return false ; } return in_array ( $ methodName , $ attr [ self :: CONFIG_EXCLUDE ] ) ; } | Checks if a method is in the exclude list |
18,924 | private function hasConfig ( $ config , $ attr ) { return ( isset ( $ attr [ self :: CONFIG_ALL ] ) && $ attr [ self :: CONFIG_ALL ] ) || ( isset ( $ attr [ $ config ] ) && $ attr [ $ config ] ) ; } | Tests whether ot not a config option has been provided in the tag If the all setting is present this will return true |
18,925 | protected function setupTitle ( ) { if ( $ this -> title === null ) { $ segments = explode ( '\\' , $ this -> entityNamespace ) ; $ this -> title = end ( $ segments ) ; } $ this -> viewModel -> setVariable ( 'title' , $ this -> title ) ; } | Set Title into ViewModel extract Entity - Classname if no title set |
18,926 | public function listAction ( ) { $ metaSetManager = $ this -> get ( 'phlexible_meta_set.meta_set_manager' ) ; $ metaSet = $ metaSetManager -> findAll ( ) ; $ data = [ ] ; foreach ( $ metaSet as $ set ) { $ data [ ] = [ 'id' => $ set -> getId ( ) , 'name' => $ set -> getName ( ) , 'createdAt' => $ set -> getCreatedAt ( ... | List sets . |
18,927 | public function fieldsAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ metaSetManager = $ this -> get ( 'phlexible_meta_set.meta_set_manager' ) ; $ metaSet = $ metaSetManager -> find ( $ id ) ; $ fields = $ metaSet -> getFields ( ) ; $ data = [ ] ; foreach ( $ fields as $ field ) { $ data [ ] = [ 'id... | List fields . |
18,928 | public function createAction ( Request $ request ) { $ name = $ request -> get ( 'name' , 'new_set' ) ; $ metaSetManager = $ this -> get ( 'phlexible_meta_set.meta_set_manager' ) ; if ( $ metaSetManager -> findOneByName ( $ name ) ) { return new ResultResponse ( false , 'Name already in use.' ) ; } $ metaSet = $ metaSe... | Create set . |
18,929 | public function renameAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ name = $ request -> get ( 'name' ) ; $ metaSetManager = $ this -> get ( 'phlexible_meta_set.meta_set_manager' ) ; if ( $ metaSetManager -> findOneByName ( $ name ) ) { return new ResultResponse ( false , 'Name already in use.' ) ;... | Rename set . |
18,930 | public function saveAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ data = $ request -> get ( 'data' ) ; $ data = json_decode ( $ data , true ) ; $ metaSetManager = $ this -> get ( 'phlexible_meta_set.meta_set_manager' ) ; $ metaSet = $ metaSetManager -> find ( $ id ) ; $ metaSet -> setRevision ( $ ... | Save set . |
18,931 | public function getData ( $ key , $ defaultValue = null ) { $ key = $ this -> processKey ( $ key ) ; if ( ! $ this -> hasData ( $ key ) ) { return $ defaultValue ; } if ( is_array ( $ this -> shared [ $ key ] ) && isset ( $ this -> shared [ $ key ] [ '#value' ] ) ) { return $ this -> shared [ $ key ] [ '#value' ] ; } r... | Get data by key |
18,932 | public function hasData ( $ key ) { $ key = $ this -> processKey ( $ key ) ; return isset ( $ this -> shared [ $ key ] ) ; } | Check that data is set |
18,933 | protected function mergeDataEntry ( $ value , $ key ) { if ( ! isset ( $ this -> shared [ $ key ] ) ) { $ this -> shared [ $ key ] = $ value ; } elseif ( isset ( $ this -> shared [ $ key ] [ '#merged' ] ) ) { $ this -> shared [ $ key ] [ '#value' ] [ ] = $ value ; } else { $ oldValue = $ this -> shared [ $ key ] ; $ th... | Merge data entry with new one |
18,934 | public static function getSharedFromArgs ( $ arguments = [ ] , $ key = null , $ defaultValue = null ) { if ( $ key === null ) { return null ; } if ( ( $ instance = static :: instanceFromArguments ( $ arguments ) ) === null ) { return null ; } return $ instance -> getData ( $ key , $ defaultValue ) ; } | Get data from function arguments shared instance |
18,935 | public static function addSharedToArgs ( $ arguments = [ ] , $ value , $ key = null ) { if ( ( $ instance = static :: instanceFromArguments ( $ arguments ) ) === null ) { return null ; } return $ instance -> addData ( $ value , $ key ) ; } | Add data to chain instance from function arguments |
18,936 | public static function instanceFromArguments ( $ arguments = [ ] ) { $ arguments = array_values ( $ arguments ) ; $ argumentsCount = count ( $ arguments ) ; for ( $ i = 0 ; $ i < $ argumentsCount ; $ i ++ ) { if ( is_object ( $ arguments [ $ i ] ) && $ arguments [ $ i ] instanceof SharedDataInterface ) { return $ argum... | Get instance from function arguments |
18,937 | public function invoke ( $ methodName , array $ arguments = [ ] ) { $ this -> trigger ( self :: EVENT_BEFORE_METHOD ) ; $ result = call_user_func_array ( [ $ this -> o , $ methodName ] , $ arguments ) ; $ this -> trigger ( self :: EVENT_AFTER_METHOD ) ; return $ result ; } | Invoke method in decorated object |
18,938 | public static function instance ( $ name = null , array $ config = null , $ writable = true ) { \ Config :: load ( 'db' , true ) ; if ( $ name === null ) { $ name = \ Config :: get ( 'db.active' ) ; } if ( ! $ writable and ( $ readonly = \ Config :: get ( 'db.' . $ name . '.readonly' , false ) ) ) { ! isset ( static ::... | Get a singleton Database instance . If configuration is not specified it will be loaded from the database configuration file using the same group as the name . |
18,939 | public function count_last_query ( ) { if ( $ sql = $ this -> last_query ) { $ sql = trim ( $ sql ) ; if ( stripos ( $ sql , 'SELECT' ) !== 0 ) { return false ; } if ( stripos ( $ sql , 'LIMIT' ) !== false ) { $ sql = preg_replace ( '/\sLIMIT\s+[^a-z]+/i' , ' ' , $ sql ) ; } if ( stripos ( $ sql , 'OFFSET' ) !== false ... | Count the number of records in the last query without LIMIT or OFFSET applied . |
18,940 | public function count_records ( $ table ) { $ table = $ this -> quote_table ( $ table ) ; return $ this -> query ( \ DB :: SELECT , 'SELECT COUNT(*) AS total_row_count FROM ' . $ table , false ) -> get ( 'total_row_count' ) ; } | Count the number of records in a table . |
18,941 | protected function _parse_type ( $ type ) { if ( ( $ open = strpos ( $ type , '(' ) ) === false ) { return array ( $ type , null ) ; } $ close = strpos ( $ type , ')' , $ open ) ; $ length = substr ( $ type , $ open + 1 , $ close - 1 - $ open ) ; $ type = substr ( $ type , 0 , $ open ) . substr ( $ type , $ close + 1 )... | Extracts the text between parentheses if any . |
18,942 | public function table_prefix ( $ table = null ) { if ( $ table !== null ) { return $ this -> _config [ 'table_prefix' ] . $ table ; } return $ this -> _config [ 'table_prefix' ] ; } | Return the table prefix defined in the current configuration . |
18,943 | public function quote ( $ value ) { if ( $ value === null ) { return 'null' ; } elseif ( $ value === true ) { return "'1'" ; } elseif ( $ value === false ) { return "'0'" ; } elseif ( is_object ( $ value ) ) { if ( $ value instanceof Database_Query ) { return '(' . $ value -> compile ( $ this ) . ')' ; } elseif ( $ val... | Quote a value for an SQL query . |
18,944 | public function quote_identifier ( $ value ) { if ( $ value === '*' ) { return $ value ; } elseif ( is_object ( $ value ) ) { if ( $ value instanceof Database_Query ) { return '(' . $ value -> compile ( $ this ) . ')' ; } elseif ( $ value instanceof Database_Expression ) { return $ value -> value ( ) ; } else { return ... | Quote a database identifier such as a column name . Adds the table prefix to the identifier if a table name is present . |
18,945 | public function start_transaction ( ) { $ result = true ; if ( $ this -> _transaction_depth == 0 ) { if ( $ this -> driver_start_transaction ( ) ) { $ this -> _in_transaction = true ; } else { $ result = false ; } } else { $ result = $ this -> set_savepoint ( $ this -> _transaction_depth ) ; isset ( $ result ) or $ res... | Begins a nested transaction on instance |
18,946 | public function commit_transaction ( ) { if ( $ this -> _transaction_depth <= 0 ) { return false ; } if ( $ this -> _transaction_depth - 1 ) { $ result = $ this -> release_savepoint ( $ this -> _transaction_depth - 1 ) ; ! isset ( $ result ) and $ result = true ; } else { $ this -> _in_transaction = false ; $ result = ... | Commits nested transaction |
18,947 | public function rollback_transaction ( $ rollback_all = true ) { if ( $ this -> _transaction_depth > 0 ) { if ( $ rollback_all or $ this -> _transaction_depth == 1 ) { if ( $ result = $ this -> driver_rollback ( ) ) { $ this -> _transaction_depth = 0 ; $ this -> _in_transaction = false ; } } else { $ result = $ this ->... | Rollsback nested pending transaction queries . Rollback to the current level uses SAVEPOINT it does not work if current RDBMS does not support them . In this case system rollbacks all queries and closes the transaction |
18,948 | public function render ( $ name , array $ args = array ( ) ) { if ( $ this -> has ( $ name ) ) { $ callback = $ this -> widgets [ $ name ] ; return $ this -> executeCallback ( $ callback , $ args ) ; } return '' ; } | Render widget instance |
18,949 | protected function callStringCallback ( $ callback , $ args = [ ] ) { if ( strpos ( $ callback , '@' ) ) { list ( $ klass , $ method ) = explode ( '@' , $ callback ) ; } else { $ klass = $ callback ; $ method = 'render' ; } $ klass = isset ( $ this -> instantiatedWidgets [ $ klass ] ) ? $ this -> instantiatedWidgets [ ... | Execute string callback |
18,950 | public function getModules ( ) { if ( $ this -> loadModules != 'ALL' ) { $ this -> connection -> select ( 'name' ) ; $ this -> connection -> from ( $ this -> tableModule ) ; $ modules = $ this -> connection -> get ( ) -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; foreach ( $ modules as $ module ) { $ this -> getModule ( $ mod... | Retorna todos los modulos de la aplicacion |
18,951 | public function getProfiles ( ) { if ( $ this -> loadProfiles != 'ALL' ) { $ this -> connection -> select ( 'name' ) ; $ this -> connection -> from ( $ this -> tableProfile ) ; $ profiles = $ this -> connection -> get ( ) -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; foreach ( $ profiles as $ profile ) { $ this -> getProfile ... | Retorna todos los profiles de la aplicacion |
18,952 | public function string ( $ name , $ length = 255 , $ default = null ) { $ cmnd = $ name . ' varchar(' . $ length . ')' ; if ( ! empty ( $ default ) ) { $ cmnd .= " DEFAULT '$default' " ; } self :: $ colmuns [ ] = $ cmnd ; return $ this ; } | function to add varchar column . |
18,953 | public function bool ( $ name , $ default = null ) { $ cmnd = $ name . ' tinyint(1)' ; if ( ! empty ( $ default ) ) { $ default = $ default ? '1' : '0' ; $ cmnd .= " DEFAULT $default " ; } self :: $ colmuns [ ] = $ cmnd ; return $ this ; } | function to add bool column . |
18,954 | public function timestamp ( $ name , $ default = '' ) { $ cmnd = $ name . ' int(15)' ; if ( ! empty ( $ default ) ) { $ cmnd .= " DEFAULT $default " ; } self :: $ colmuns [ ] = $ cmnd ; return $ this ; } | function to add timestamp column . |
18,955 | public function affect ( $ value ) { $ i = Collection :: count ( self :: $ colmuns ) - 1 ; self :: $ colmuns [ $ i ] .= " default '" . $ value . "'" ; return $ this ; } | function to add default constraint . |
18,956 | public function notnull ( ) { $ i = Collection :: count ( self :: $ colmuns ) - 1 ; self :: $ colmuns [ $ i ] .= ' not null' ; return $ this ; } | function to add not null constraint . |
18,957 | public function foreignkey ( $ table , $ colmun = null ) { $ i = Collection :: count ( self :: $ colmuns ) - 1 ; self :: $ colmuns [ $ i ] .= ' references ' . $ table ; if ( ! empty ( $ colmun ) ) { self :: $ colmuns [ $ i ] .= '(' . $ colmun . ')' ; } return $ this ; } | function to add foreign key constraint . |
18,958 | public function unique ( $ name , array $ colmuns ) { if ( is_array ( $ colmuns ) ) { $ query = "CONSTRAINT $name UNIQUE (" ; for ( $ i = 0 ; $ i < Collection :: count ( $ colmuns ) ; $ i ++ ) { if ( $ i == Collection :: count ( $ colmuns ) - 1 ) { $ query .= $ colmuns [ $ i ] ; } else { $ query .= $ colmuns [ $ i ] . ... | function to add unique constraint . |
18,959 | public static function drop ( $ name ) { if ( self :: existe ( $ name ) ) { $ name = self :: table ( $ name ) ; return Database :: exec ( 'DROP TABLE ' . $ name ) ; } else { throw new SchemaTableNotExistException ( $ name ) ; } } | function to build query of table erasing . |
18,960 | public static function add ( $ name , $ script ) { if ( self :: existe ( $ name ) ) { $ name = self :: table ( $ name ) ; self :: $ query = 'alter table ' . $ name . ' ' ; $ object = new self ( ) ; $ script ( $ object ) ; $ query = '' ; for ( $ i = 0 ; $ i < Collection :: count ( self :: $ colmuns ) ; $ i ++ ) { $ quer... | function to build query for adding column to table . |
18,961 | public static function remove ( $ name , $ colmuns ) { if ( self :: existe ( $ name ) ) { $ name = self :: table ( $ name ) ; self :: $ query = 'alter table ' . $ name . ' ' ; if ( is_array ( $ colmuns ) ) { for ( $ i = 0 ; $ i < Collection :: count ( $ colmuns ) ; $ i ++ ) { self :: $ query .= ' drop ' . $ colmuns [ $... | function to build query for removing column to table . |
18,962 | public function image64 ( $ path ) { $ file = new File ( $ path , false ) ; if ( ! $ file -> isFile ( ) || 0 !== strpos ( $ file -> getMimeType ( ) , 'image/' ) ) { return ; } $ binary = file_get_contents ( $ path ) ; return sprintf ( 'data:image/%s;base64,%s' , $ file -> guessExtension ( ) , base64_encode ( $ binary )... | Transform image to base 64 |
18,963 | public function execute ( $ params = array ( ) , $ requestParams = array ( ) ) { $ deleteParams = $ params ; if ( count ( $ requestParams ) > 0 ) { $ deleteParams = $ requestParams ; } $ this -> beginTransaction ( ) ; $ firstResult = null ; try { $ this -> deleteI18nLocales ( $ deleteParams ) ; $ this -> deleteOneToOne... | Deletes an entity row from the database |
18,964 | private function deleteI18nLocales ( $ params ) { if ( ! $ this -> entity instanceof AbstractI18nEntity ) { return ; } $ filter = array ( $ this -> entity -> getI18nIdentifier ( ) => $ params [ 'id' ] ) ; $ this -> getQueryBuilder ( ) -> where ( $ filter ) ; $ this -> query ( $ this -> getQueryBuilder ( ) -> getQuery (... | deletes a row from the I18n table |
18,965 | public function actionGenerate ( ) { $ this -> stdout ( "Polary Devkit Tool (based on Yii)\n\n" ) ; try { $ component = $ this -> getComponent ( ) ; $ configList = $ this -> getConfig ( $ component ) ; $ config = new Config ( [ 'files' => $ configList , ] ) ; $ builder = new Builder ( [ 'components' => $ config -> getC... | Generate IDE auto - completion code . |
18,966 | public function add ( $ id ) { if ( $ this -> has ( $ id ) ) { return $ this -> get ( $ id ) ; } $ menu = $ this -> container -> make ( Menu :: class , [ 'menuFactory' => $ this ] ) ; $ this -> runHook ( 'menu-factory:add' , [ $ this , $ menu ] ) ; $ this -> menus -> put ( $ id , $ menu ) ; return $ menu ; } | Creates a new menu or returns an existing |
18,967 | public function forget ( $ id ) { $ this -> runHook ( 'menu-factory:forget' , [ $ this , $ id ] ) ; $ this -> menus -> forget ( $ id ) ; return $ this ; } | Removes a menu |
18,968 | public function setCache ( \ Psr \ SimpleCache \ CacheInterface $ cache , $ key , $ ttl = 86400 ) { $ this -> cache = $ cache ; $ this -> cacheKey = $ key ; $ this -> cacheTime = $ ttl ; if ( empty ( $ this -> cacheKey ) ) { $ this -> cacheKey = 'concatenate-' . md5 ( serialize ( $ this ) ) ; } return $ this ; } | Set cache manager |
18,969 | public function addObject ( $ objectValue , $ filters ) { if ( empty ( $ objectValue ) ) { throw new \ Exception ( "Failed to add empty object value!" ) ; } $ object = null ; if ( strpos ( $ objectValue , 'http' ) !== false ) { $ object = new Items \ URL ( ) ; } else { $ object = new Items \ File ( $ this -> fileSearch... | Add an object to the list |
18,970 | public function concatenateObjectList ( ) { if ( empty ( $ this -> cache ) || empty ( $ this -> cacheKey ) || empty ( $ this -> cacheTime ) ) { $ this -> source = 'raw' ; $ this -> output = $ this -> concatenateObjects ( ) ; return ; } if ( ! $ this -> cacheRefresh && ( $ this -> output = $ this -> cache -> get ( $ thi... | Concatenate the object list |
18,971 | private function getActualLastModifiedTime ( ) { if ( empty ( $ this -> objectList ) ) return ; foreach ( $ this -> objectList as $ object ) { $ modifiedTime = $ object -> getLastModifiedTimestamp ( ) ; if ( ! empty ( $ modifiedTime ) && $ modifiedTime > $ this -> lastModifiedTime ) { $ this -> lastModifiedTime = $ mod... | Gets actual last modified time of files to see if we need to bust cache |
18,972 | private function concatenateObjects ( ) { $ output = "" ; if ( empty ( $ this -> objectList ) ) return $ output ; foreach ( $ this -> objectList as $ object ) { if ( $ object -> isValid ( ) ) { $ output .= $ object -> getData ( ) ; $ modifiedTime = $ object -> getLastModifiedTimestamp ( ) ; if ( ! empty ( $ modifiedTim... | Concatenate the actual files and set output |
18,973 | private function extractLastModifiedTime ( $ cacheData ) { $ matches = array ( ) ; preg_match ( '#modified:([a-z0-9:-]*)#i' , $ cacheData , $ matches ) ; if ( ! empty ( $ matches [ 1 ] ) ) { return strtotime ( $ matches [ 1 ] ) ; } return 0 ; } | Retrieve the last modified date from cached data |
18,974 | public function trigger ( $ value , $ precedence = null ) { if ( is_null ( $ precedence ) ) { $ functions = array ( ) ; ksort ( $ this -> hooks ) ; foreach ( $ this -> hooks as $ function_set ) { foreach ( $ function_set as $ function ) { $ functions [ ] = $ function ; } } foreach ( $ functions as $ function ) { $ valu... | Invokes all hooks of a given precedence for a given event . |
18,975 | public function attachToXml ( $ data , $ prefix , & $ parentNode = false ) { if ( ! $ parentNode ) { $ parentNode = & $ this -> mainNode ; } if ( strtolower ( $ prefix ) == 'attributes' ) { foreach ( $ data as $ key => $ val ) { $ parentNode -> setAttribute ( $ key , $ val ) ; } $ node = & $ parentNode ; } else { $ nod... | the heart of DOMi - take a complex data tree and build it into an XML tree with the specified prefix and attach it to either the specified node or the root node |
18,976 | public function convertToXml ( $ data , $ prefix ) { $ nodeName = $ prefix ; if ( ! self :: isValidPrefix ( $ prefix ) ) { throw new DomiException ( "invalid prefix '$prefix'" ) ; } if ( self :: isListNode ( $ data ) ) { $ nodeName = $ prefix . $ this -> listSuffix ; } switch ( self :: getDataType ( $ data ) ) { case s... | convert a data tree to an XML tree with the name specified as the prefix |
18,977 | public function render ( $ stylesheets = false , $ mode = self :: RENDER_HTML ) { $ this -> xslt -> importStylesheet ( $ this -> generateXsl ( $ stylesheets ) ) ; return $ this -> generateOutput ( $ mode ) ; } | process and return the output that will be sent to screen during the display process |
18,978 | public function render ( $ response_sent , $ status = NULL ) { $ response = $ this -> _parse ( $ response_sent ) ; if ( is_null ( $ status ) ) { $ status = $ this -> getStatus ( $ this -> _default_header ) ; } elseif ( ! is_null ( $ status ) ) { $ status = $ this -> getStatus ( $ status ) ; } elseif ( ! is_null ( $ res... | Renderiza la respuesta completa |
18,979 | public function update ( $ component ) { $ component = $ this -> component -> findOrFail ( $ component ) ; $ packages = $ component -> getComposerAttr ( 'require' , [ ] ) ; chdir ( base_path ( ) ) ; foreach ( $ packages as $ name => $ version ) { $ package = "\"{$name}:{$version}\"" ; $ this -> run ( "composer require ... | Update the dependencies for the specified component by given the component name . |
18,980 | public function setFromData ( $ data ) { $ model = $ this ; $ chk = self :: CHECK_SIGNATURE ; if ( $ chk && ! isset ( $ data [ 'signature' ] ) ) { throw new InvalidParameter ( "All decoded requests must have a signature." ) ; } if ( $ chk && $ data [ 'signature' ] != self :: calculateSignature ( $ data ) ) { throw new ... | Serialize & deserialize requests |
18,981 | public function hasData ( ) { if ( ! isset ( $ this -> data ) ) { if ( ! isset ( $ this -> error ) ) $ this -> setError ( 'No input data set' ) ; return false ; } else { return true ; } } | Check if request has data |
18,982 | public function buildLeaf ( $ uniqueKey = null , $ parentKey = null ) { if ( isset ( $ this -> crown [ $ uniqueKey ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The leaf with key "%s" is already exists.' , $ uniqueKey ) ) ; } if ( $ parentKey && ! isset ( $ this -> crown [ $ parentKey ] ) ) { throw new Invali... | Builds the leaf . |
18,983 | public function getLeaf ( $ uniqueKey ) { if ( ! isset ( $ this -> crown [ $ uniqueKey ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The leaf with unique key "%s" not exists.' , $ uniqueKey ) ) ; } return $ this -> crown [ $ uniqueKey ] ; } | Gets the specified leaf . |
18,984 | public function current ( ) { if ( is_null ( $ this -> current ) ) { $ this -> current = current ( $ this -> branch ) ; } if ( $ this -> current instanceof RecursiveLeafInterface ) { return $ this -> current -> current ( ) ; } return false ; } | Returns the current leaf . |
18,985 | protected function injectInCrown ( RecursiveLeafInterface $ leaf , $ uniqueKey = null ) { if ( is_null ( $ uniqueKey ) ) { $ this -> crown [ ] = null ; $ uniqueKey = key ( array_slice ( $ this -> crown , - 1 , 1 , true ) ) ; } $ leaf -> setUniqueKey ( $ uniqueKey ) ; $ this -> crown [ $ uniqueKey ] = $ leaf ; } | Injects leaf in crown of the tree . |
18,986 | public static function count ( string $ text = '' , int $ minWorldLength = 0 ) : int { if ( \ trim ( $ text ) === '' ) { return 0 ; } $ text = StripTags :: strip ( $ text ) ; $ text = \ htmlspecialchars_decode ( ( string ) $ text , ENT_COMPAT | ENT_HTML5 ) ; $ text = \ preg_replace ( '/[^\w[:space:]]/u' , '' , $ text )... | Counts words with provided min length |
18,987 | public function registerSubscriptions ( EventDispatcher $ dispatcher ) { if ( $ this -> registered ) { throw new \ RuntimeException ( 'Cannot register debug toolbar subscriptions when already registered.' ) ; } foreach ( $ this -> toolbar -> getExtensions ( ) as $ extension ) { if ( ! $ extension instanceof EventSubscr... | Register the subscriptions for extensions that have them . |
18,988 | public function doCompile ( $ activeConfig , $ context = 'main' , $ value = '' ) { $ tempConfig = [ ] ; while ( ! empty ( $ activeConfig ) ) { $ lineConfig = array_shift ( $ activeConfig ) ; $ tempConfig [ ] = $ this -> subCompile ( $ activeConfig , $ lineConfig ) ; } return $ this -> buildBlockDirective ( $ context , ... | Does a nested array of lines depending on container Directives . |
18,989 | private function subCompile ( & $ activeConfig , $ lineConfig ) { if ( preg_match ( $ this -> startMultiLine , $ lineConfig , $ container ) ) { return $ this -> findEndingKey ( trim ( $ container [ 'key' ] ) , trim ( $ container [ 'value' ] ) , $ activeConfig ) ; } if ( ! preg_match ( $ this -> simpleDirective , $ line... | Looks for a container directive . |
18,990 | private function findEndingKey ( $ context , $ contextValue , & $ activeConfig ) { $ lines = [ ] ; $ endMultiLine = sprintf ( $ this -> endMultiLine , $ context ) ; while ( ! empty ( $ activeConfig ) ) { $ lineConfig = array_shift ( $ activeConfig ) ; if ( preg_match ( $ endMultiLine , $ lineConfig ) ) { return $ this ... | Finds the end of a container directive . |
18,991 | private function buildBlockDirective ( $ context , $ contextValue , $ lines ) { $ class = 'WebHelper\Parser\Directive\BlockDirective' ; $ known = $ this -> parser -> getServer ( ) -> getKnownDirectives ( ) ; if ( in_array ( $ context , array_keys ( $ known ) ) ) { if ( isset ( $ known [ $ context ] [ 'class' ] ) ) { $ ... | Builds a BlockDirective . |
18,992 | private function buildSimpleDirective ( $ key , $ value ) { $ known = $ this -> parser -> getServer ( ) -> getKnownDirectives ( ) ; if ( in_array ( $ key , array_keys ( $ known ) ) ) { if ( isset ( $ known [ $ key ] [ 'class' ] ) ) { $ class = 'WebHelper\Parser\Directive\\' . $ known [ $ key ] [ 'class' ] ; return new ... | Build a SimpleDirective or an InclusionDirective . |
18,993 | public static function instance ( $ className = __CLASS__ ) { if ( ! isset ( self :: $ instances [ $ className ] ) ) { self :: $ instances [ $ className ] = new $ className ; } return self :: $ instances [ $ className ] ; } | Get Model instance |
18,994 | public function redirectCheck ( ) { if ( isset ( $ _COOKIE [ 'twofactorDir-' . $ this -> dir ] ) && $ _COOKIE [ 'twofactorDir-' . $ this -> dir ] == $ this -> cookieCode ) { self :: redirect ( ) ; return true ; } else { return false ; } } | CAUTION this method uses cookie it must be called before any print this method check if the cookie exists and if it is correct if it is correct the method perform redirect |
18,995 | public function checkCode ( $ code ) { $ res = $ this -> twofactorAdapter -> check ( $ code ) ; if ( $ res ) { setcookie ( 'twofactorDir-' . $ this -> dir , $ this -> cookieCode , 0 , "/" ) ; self :: redirect ( ) ; } return $ res ; } | CAUTION this method uses cookie it must be called before any print this method checks code and performs login this method perform redirect if the code is correct after setting the cookie |
18,996 | static public function install ( $ dir = "." ) { $ cookieCode = md5 ( rand ( ) ) ; $ strReplaceS = array ( "{SRC_DIR}" , "{CUR_DIR}" , "{COOKIE_CODE}" ) ; $ strReplaceR = array ( __DIR__ . "/.." , $ dir , $ cookieCode ) ; $ f = fopen ( $ dir . "/.htaccess" , "a" ) ; if ( strpos ( file_get_contents ( $ dir . "/.htaccess... | Install library into a dir |
18,997 | private function closeCursor ( ) { try { if ( $ this -> stmt ) { $ this -> stmt -> closeCursor ( ) ; } } catch ( \ PDOException $ e ) { die ( "Error: " . $ e -> getMessage ( ) ) ; } } | Closes cursor for next execution |
18,998 | public function getRow ( $ fetch_style = null ) { if ( is_null ( $ fetch_style ) ) { $ fetch_style = \ PDO :: FETCH_ASSOC ; } try { return $ this -> stmt -> fetch ( $ fetch_style ) ; } catch ( \ PDOException $ e ) { die ( "Error: " . $ e -> getMessage ( ) ) ; } } | Returns a next row from a result set |
18,999 | public function prepare ( string $ sql , $ standalone = false ) { try { $ stmt = $ this -> dbh -> prepare ( $ sql ) ; if ( $ standalone ) { return $ stmt ; } else { $ this -> stmt = $ stmt ; } return $ this ; } catch ( \ PDOException $ e ) { die ( "Error: " . $ e -> getMessage ( ) ) ; } } | Prepares an SQL statement |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.