idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
57,200 | public function handleRequest ( $ request ) { list ( $ route , $ params ) = $ request -> resolve ( ) ; $ this -> requestedRoute = $ route ; $ result = $ this -> runAction ( $ route , $ params ) ; if ( $ result instanceof Response ) { return $ result ; } else { $ response = $ this -> getResponse ( ) ; $ response -> exit... | Handles the specified request . |
57,201 | public function getAllByNode ( PuppetDbModel \ NodeInterface $ node ) { $ environment = $ this -> environmentService -> getByNode ( $ node ) ; $ revision = $ environment -> getCurrentRevision ( ) ; $ groups [ $ environment -> getNormalizedName ( ) ] = $ revision -> getGroupsMatchingHostname ( $ node -> getName ( ) ) ; ... | Get all groups assigned to specified node group by environment name . |
57,202 | private function getResources ( ) { $ resources = [ ] ; foreach ( $ this -> getClassAnnotations ( ) as $ annotation ) { if ( 0 === strpos ( $ annotation , "resource" ) ) { $ resources [ ] = explode ( ' ' , $ annotation ) [ 1 ] ; } } return $ resources ; } | list of files to load as configuration . should be set to empty list if none needed |
57,203 | public function deleteImageByName ( $ filename ) { $ destinationPath = $ this -> getDestinationPath ( ) ; $ images = $ this -> getImages ( ) ; foreach ( $ images as $ key => $ image ) { if ( $ image -> file == $ filename ) { foreach ( $ image -> set as $ imageSetFilename ) { $ destination = $ destinationPath . '/' . $ ... | Delete image by name |
57,204 | public function generateNewId ( $ table ) { if ( ! isset ( $ this -> idCounterByTable [ $ table ] ) ) { $ this -> idCounterByTable [ $ table ] = $ this -> getSQLBuilder ( ) -> select ( $ table ) -> field ( 'id' ) -> orderDesc ( 'id' ) -> limit ( 0 , 1 ) -> fetchResult ( ) ; } for ( $ i = 0 ; $ i < 50 ; $ i ++ ) { $ thi... | Generate new id for insert |
57,205 | public function readAction ( ) { $ result = parent :: readAction ( ) ; if ( ! is_array ( $ result ) ) { return $ result ; } $ em = $ this -> getEntityManager ( ) ; $ status = $ this -> getFieldsConfig ( ) -> getConfigItem ( 'status' ) ; $ statuses = $ status [ 'dataSource' ] -> getData ( ) ; $ entity = $ em -> find ( $... | View user page |
57,206 | public function usePreviewTables ( $ bEnabled ) { if ( ! empty ( $ bEnabled ) ) { $ this -> isPreviewMode = true ; $ this -> table = NAILS_DB_PREFIX . 'blog_post_preview' ; $ this -> tableAlias = 'bp' ; $ this -> tableCat = NAILS_DB_PREFIX . 'blog_post_preview_category' ; $ this -> tableCatPrefix = 'bpc' ; $ this -> ta... | Sets the table names to use either the normal tables or the preview tables . |
57,207 | private function validateSlug ( $ sSlug , $ sTitle , $ iId = null ) { if ( $ this -> isPreviewMode ) { return 'slug' ; } if ( empty ( $ sSlug ) ) { $ sSlug = $ this -> generateSlug ( $ sTitle ) ; } else { $ oDb = Factory :: service ( 'Database' ) ; if ( ! empty ( $ iId ) ) { $ oDb -> where ( 'id !=' , $ iId ) ; } $ oDb... | Validates a slug if supplied generates one from the title if not |
57,208 | public function getById ( $ id , $ data = null ) { $ data = $ this -> includeEverything ( $ data ) ; return parent :: getById ( $ id , $ data ) ; } | Fetch a pst by it s ID |
57,209 | public function getBySlug ( $ id , $ data = null ) { $ data = $ this -> includeEverything ( $ data ) ; return parent :: getBySlug ( $ id , $ data ) ; } | Fetch a post by it s slug |
57,210 | protected function getCountCommon ( $ data = [ ] ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( [ $ this -> tableAlias . '.id' , $ this -> tableAlias . '.blog_id' , 'b.label blog_label' , $ this -> tableAlias . '.slug' , $ this -> tableAlias . '.title' , $ this -> tableAlias . '.image_id' , $ this ->... | Applies common conditionals |
57,211 | protected function includeEverything ( $ data ) { if ( is_null ( $ data ) ) { $ data = [ ] ; } if ( ! isset ( $ data [ 'include_body' ] ) ) { $ data [ 'include_body' ] = true ; } if ( ! isset ( $ data [ 'include_categories' ] ) ) { $ data [ 'include_categories' ] = true ; } if ( ! isset ( $ data [ 'include_tags' ] ) ) ... | Sets the data array to include everything |
57,212 | public function getWithCategory ( $ categoryIdSlug , $ page = null , $ perPage = null , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> join ( $ this -> tableCat . ' ' . $ this -> tableCatPrefix , $ this -> tableCatPrefix . '.post_id = ' . $ this -> tableAlias . '.id' )... | Gets posts which are in a particular category |
57,213 | public function countWithCategory ( $ categoryIdSlug , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> join ( $ this -> tableCat . ' ' . $ this -> tableCatPrefix , $ this -> tableCatPrefix . '.post_id = ' . $ this -> tableAlias . '.id' ) ; $ oDb -> join ( NAILS_DB_PREFI... | Count the number of posts in a particular category |
57,214 | public function getWithTag ( $ tagIdSlug , $ page = null , $ perPage = null , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> join ( $ this -> tableTag . ' ' . $ this -> tableTagPrefix , $ this -> tableTagPrefix . '.post_id = ' . $ this -> tableAlias . '.id' ) ; $ oDb -... | Gets posts which are in a particular tag |
57,215 | public function countWithTag ( $ tagIdSlug , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> join ( $ this -> tableTag . ' ' . $ this -> tableTagPrefix , $ this -> tableTagPrefix . '.post_id = ' . $ this -> tableAlias . '.id' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'blog_... | Count the number of posts in a particular tag |
57,216 | public function getWithAssociation ( $ associationIndex , $ associatedId ) { $ oConfig = Factory :: service ( 'Config' ) ; $ oConfig -> load ( 'blog/blog' ) ; $ associations = $ oConfig -> item ( 'blog_post_associations' ) ; if ( ! isset ( $ associations [ $ associationIndex ] ) ) { return [ ] ; } $ oDb = Factory :: se... | Get posts with a particular association |
57,217 | public function addHit ( $ id , $ data = [ ] ) { if ( ! $ id ) { $ this -> setError ( 'Post ID is required.' ) ; return false ; } $ oDate = Factory :: factory ( 'DateTime' ) ; $ hitData = [ ] ; $ hitData [ 'post_id' ] = $ id ; $ hitData [ 'user_id' ] = empty ( $ data [ 'user_id' ] ) ? null : $ data [ 'user_id' ] ; $ hi... | Add a hit to a post |
57,218 | public function getTypes ( ) { $ oDb = Factory :: service ( 'Database' ) ; $ oResult = $ oDb -> query ( 'SHOW COLUMNS FROM `' . $ this -> table . '` LIKE "type"' ) -> row ( ) ; $ sTypes = $ oResult -> Type ; $ sTypes = preg_replace ( '/enum\((.*)\)/' , '$1' , $ sTypes ) ; $ sTypes = str_replace ( "'" , '' , $ sTypes ) ... | Parses the type column and returns an array of potential post types |
57,219 | public function formatUrl ( $ slug , $ blogId ) { $ this -> load -> model ( 'blog/blog_model' ) ; return $ this -> blog_model -> getBlogUrl ( $ blogId ) . '/' . $ slug ; } | Format a posts s URL |
57,220 | public function extractYoutubeId ( $ sUrl ) { preg_match ( '/^https?\:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\-]+)$/' , $ sUrl , $ aMatches ) ; if ( ! empty ( $ aMatches [ 1 ] ) ) { return $ aMatches [ 1 ] ; } else { preg_match ( '/^https?\:\/\/youtu\.be\/([a-zA-Z0-9_\-]+)$/' , $ sUrl , $ aMatches ) ; if ( ! empty... | Extracts the ID from a YouTube URL |
57,221 | public function queue ( ) { $ from = $ this -> fromEmail ; $ to = $ this -> toEmail ; $ name = $ this -> toName ; $ subject = $ this -> subject ; $ this -> beauty -> queue ( $ this -> view , $ this -> datas , function ( $ message ) use ( $ from , $ to , $ name , $ subject ) { $ message -> from ( $ from ) -> to ( $ to ,... | send queue mail |
57,222 | public function handlerOptions ( ) { $ this -> fromEmail = config ( 'mail.from.address' ) ; $ this -> toEmail = config ( 'laravel-modules-base.developer_mail' ) ; $ this -> toName = config ( 'laravel-modules-base.developer_name' ) ; $ this -> subject = trans ( 'laravel-modules-base::admin.email.error.subject' ) ; $ thi... | exception handler set options |
57,223 | public function move ( FilesystemFolder $ destination ) { if ( $ this -> alreadyUploaded ) { return parent :: move ( $ destination ) ; } $ oldpath = $ this -> folder -> getPath ( ) . $ this -> filename ; $ filename = self :: sanitizeFilename ( $ this -> originalName , $ destination ) ; $ newpath = $ destination -> getP... | performs an initial move of an uploaded file from its temporary folder to a destination folder and renames it to the original filename once completed a flag is set and subsequent moves are redirected to the parent method |
57,224 | protected function getFieldNameForDisplay ( $ details ) { $ tableUniqueId = $ details [ 'TABLE_SCHEMA' ] . '.' . $ details [ 'TABLE_NAME' ] ; if ( $ details [ 'COLUMN_COMMENT' ] != '' ) { return $ details [ 'COLUMN_COMMENT' ] ; } elseif ( isset ( $ this -> advCache [ 'tableStructureLocales' ] [ $ tableUniqueId ] [ $ de... | Returns the name of a field for displaying |
57,225 | protected function getFieldOutputTextFK ( $ foreignKeysArray , $ value , $ iar ) { $ query = $ this -> sQueryGenericSelectKeyValue ( [ '`' . $ value [ 'COLUMN_NAME' ] . '`' , $ foreignKeysArray [ $ value [ 'COLUMN_NAME' ] ] [ 2 ] , $ foreignKeysArray [ $ value [ 'COLUMN_NAME' ] ] [ 0 ] ] ) ; $ inAdtnl = [ 'size' => 1 ]... | Prepares the output of text fields defined w . FKs |
57,226 | protected function getRowDataFromTable ( $ tableName , $ filtersArray ) { $ query = $ this -> sQueryRowsFromTable ( [ $ tableName , $ this -> setArrayToFilterValues ( $ filtersArray ) ] ) ; $ rawData = $ this -> setMySQLquery2Server ( $ query , 'array_pairs_key_value' ) [ 'result' ] ; if ( ! is_null ( $ rawData ) ) { $... | Reads data from table into REQUEST super global |
57,227 | private function setArrayToFilterValues ( $ entryArray , $ referenceTable = '' ) { $ filters = [ ] ; $ refTable = $ this -> correctTableWithQuotesAsFieldPrefix ( $ referenceTable ) ; foreach ( $ entryArray as $ key => $ value ) { if ( is_array ( $ value ) ) { $ filters [ ] = $ this -> setArrayLineArrayToFilter ( $ key ... | Transforms an array into usable filters |
57,228 | public static function asciify ( string $ input , string $ language = 'en' , bool $ removeUnsupported = true ) : string { $ output = S :: toAscii ( $ input , $ language , $ removeUnsupported ) ; return $ output ; } | Returns an ASCII version of the input . |
57,229 | public static function camelize ( string $ input , string $ separator = '_' , bool $ capitalizeFirstCharacter = false ) : string { $ output = $ input ; if ( ctype_upper ( $ output ) ) { $ output = mb_strtolower ( $ output ) ; } if ( strpos ( $ output , $ separator ) || strpos ( $ output , ' ' ) ) { $ output = mb_strtol... | Camelizes an input . |
57,230 | public function secureHtml ( $ data ) : ? string { return ( Any :: isArray ( $ data ) ? $ this -> purifier -> purifyArray ( $ data ) : $ this -> purifier -> purify ( $ data ) ) ; } | Secure html code |
57,231 | public function strip_tags ( $ html , $ escapeQuotes = true ) { if ( Any :: isArray ( $ html ) ) { foreach ( $ html as $ key => $ value ) { $ html [ $ key ] = $ this -> strip_tags ( $ value , $ escapeQuotes ) ; } return $ html ; } $ text = strip_tags ( $ html ) ; if ( $ escapeQuotes ) { $ text = $ this -> escapeQuotes ... | String html tags and escape quotes |
57,232 | public function strip_php_tags ( $ data ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> strip_php_tags ( $ value ) ; } return $ data ; } return addslashes ( htmlspecialchars ( strip_tags ( $ data ) ) ) ; } | Strip php tags and notations in string . |
57,233 | public function setFamily ( \ Librinfo \ VarietiesBundle \ Entity \ Family $ family = null ) { $ this -> family = $ family ; return $ this ; } | Set family . |
57,234 | public function addSpeciese ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ species ) { $ species -> setGenus ( $ this ) ; $ this -> specieses -> add ( $ species ) ; return $ this ; } | Alias for addSpecies . |
57,235 | public function removeSpecies ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ species ) { return $ this -> specieses -> removeElement ( $ species ) ; } | Remove speciese . |
57,236 | protected function resolveClassMethodDependencies ( array $ parameters , $ instance , $ method ) { if ( ! method_exists ( $ instance , $ method ) ) return $ parameters ; return $ this -> resolveMethodDependencies ( $ parameters , new ReflectionMethod ( $ instance , $ method ) ) ; } | Resolve the object method s type - hinted dependencies . |
57,237 | public function setURL ( URL $ url ) { $ this -> domain = $ url -> host ; $ this -> path = $ url -> path ; $ this -> secure = $ url -> secure ; return $ this ; } | Set the domain and path using a URL |
57,238 | public function setExpiresIn ( DateInterval $ interval ) { $ this -> expires = new DateTime ( ) ; $ this -> expires -> add ( $ interval ) ; return $ this ; } | Set expiry date by a DateInterval relative to the current time |
57,239 | protected function getClassExtends ( ) { $ parentPlaceholderClass = sprintf ( "\\%s\\%s" , $ this -> options [ 'entityPlaceholder' ] , $ this -> pgClass -> getParent ( ) -> getEntityName ( ) ) ; $ this -> class -> addExtends ( $ parentPlaceholderClass ) ; } | Get class extends |
57,240 | public static function encode ( $ array ) { $ array = static :: asArray ( $ array ) ; if ( is_array ( $ array ) && count ( $ array ) < 1 ) { return "" ; } try { $ string = serialize ( $ array ) ; } catch ( \ Exception $ e ) { throw new PhpException ( "Serialize Error: " . $ e -> getMessage ( ) ) ; } return $ string ; } | Convert an array to a php serialized string . |
57,241 | public static function decode ( $ string ) { if ( ! $ string ) { return new ArrayObject ( ) ; } try { $ array = unserialize ( $ string ) ; } catch ( \ Exception $ e ) { throw new PhpException ( "Serialize Error: " . $ e -> getMessage ( ) ) ; } if ( ! is_array ( $ array ) ) { $ array = [ ] ; } return ArrayObject :: make... | Convert a php serialized string to an array . |
57,242 | static function ModuleUrl ( BackendModule $ module , array $ args = array ( ) ) { $ allArgs = array ( 'module' => ClassFinder :: ModuleType ( $ module ) ) + $ args ; return 'index.php?' . http_build_query ( $ allArgs ) ; } | Gets the url for a module |
57,243 | static function AjaxUrl ( ModuleBase $ module , array $ args = array ( ) ) { $ allArgs = array ( 'module' => ClassFinder :: ModuleType ( $ module ) ) + $ args ; $ guard = new UserGuard ( ) ; $ user = $ guard -> GetUser ( ) ; if ( ! $ user ) { throw new \ Exception ( 'Security breach on ajax url: no backend user logged ... | Returns the url to ab ajax module whose content is rendered as is |
57,244 | static function ContentTreeUrl ( Content $ content ) { $ args = array ( ) ; $ pageContent = $ content -> GetPageContent ( ) ; if ( $ pageContent ) { $ args [ 'page' ] = $ pageContent -> GetPage ( ) -> GetID ( ) ; $ args [ 'area' ] = $ pageContent -> GetArea ( ) -> GetID ( ) ; return self :: ModuleUrl ( new \ Phine \ Bu... | Gets the url of the content tree for a content element |
57,245 | public function setRelation ( $ relation , $ value ) { $ this -> checkInitRelations ( ) ; $ this -> relations [ $ relation ] = $ value ; return $ this ; } | Set the specific relationship in the model . |
57,246 | protected function doExecute ( \ Closure $ cb ) { try { return $ cb ( $ this -> manager ) ; } catch ( \ Exception $ e ) { throw Exception \ Translator \ Doctrine :: translate ( $ e ) ; } } | Executes something in the context of the entityManager . |
57,247 | protected function doExecuteInRepository ( \ Closure $ cb ) { try { return $ cb ( $ this -> repository ) ; } catch ( \ Exception $ e ) { throw Exception \ Translator \ Doctrine :: translate ( $ e ) ; } } | Executes something in the context of the entityRepository . |
57,248 | public function saveAs ( $ name ) { $ this -> section_data [ $ name ] = ob_get_clean ( ) ; $ this -> ob_level -- ; if ( $ this -> ob_level ) { echo $ this -> section_data [ $ name ] ; } } | end capture with name . |
57,249 | public function warm ( ) { $ warmed = [ ] ; if ( false === $ this -> mf -> hasCache ( ) ) { return $ warmed ; } $ this -> clear ( ) ; foreach ( $ this -> mf -> getAllTypeNames ( ) as $ type ) { $ metadata = $ this -> mf -> getMetadataForType ( $ type ) ; $ warmed [ ] = $ type ; } return $ warmed ; } | Warms up all metadata objects into the cache . |
57,250 | public function clear ( ) { $ cleared = [ ] ; if ( false === $ this -> mf -> hasCache ( ) ) { return $ cleared ; } $ this -> mf -> enableCache ( false ) ; foreach ( $ this -> mf -> getAllTypeNames ( ) as $ type ) { $ metadata = $ this -> mf -> getMetadataForType ( $ type ) ; $ this -> mf -> getCache ( ) -> evictMetadat... | Clears all metadata objects from the cache . |
57,251 | public function setName ( $ name = false ) { if ( $ name === false || empty ( $ name ) ) { $ this -> name = \ Nuki \ Handlers \ Core \ Assist :: randomString ( ) ; return ; } $ this -> name = $ name ; } | Set file name if name not give it will be generated |
57,252 | protected function init ( ) { $ this -> prependOptions ( [ 'path' => './cache' , 'formatAliases' => [ ] , 'format' => 'json' ] ) ; $ this -> _path = $ this -> getOption ( 'path' ) ; $ this -> _formatFactory = new Factory ( __NAMESPACE__ . '\\File\\FormatBase' , [ 'json' => __NAMESPACE__ . '\\File\\Format\\Json' , 'seri... | Initializes the file cache adapter |
57,253 | public function exists ( $ key ) { $ path = $ this -> getKeyPath ( $ key ) ; if ( ! file_exists ( $ path ) || empty ( $ this -> _lifeTimes [ $ key ] ) ) return false ; if ( time ( ) - filemtime ( $ path ) > $ this -> _lifeTimes [ $ key ] ) return false ; return true ; } | Checks if the given cache key has an existing cache file that didn t exceed the given life - time |
57,254 | public function set ( $ key , $ value , $ lifeTime ) { $ path = $ this -> getKeyPath ( $ key ) ; $ dir = dirname ( $ path ) ; if ( ! is_dir ( $ dir ) ) mkdir ( $ dir , 0777 , true ) ; $ this -> _lifeTimes [ $ key ] = intval ( $ lifeTime ) ; $ this -> _format -> save ( $ this -> _lifeTimePath , $ this -> _lifeTimes ) ; ... | Sets the value of an cache item to the given value |
57,255 | public function renderBlock ( OutputBuffer $ out , $ name ) { if ( array_key_exists ( $ name , $ this -> blocks ) ) { $ pblock = $ this -> outerContext -> set ( '@block' , $ name ) ; $ pout = $ this -> outerContext -> set ( '@out' , $ out ) ; $ pthis = $ this -> outerContext -> set ( '@this' , $ this ) ; try { $ this -... | Render contents of block taking blocks from the decorator into consideration . |
57,256 | public function renderParentBlock ( OutputBuffer $ out , $ name ) { $ method = 'block_' . $ name ; if ( method_exists ( $ this , $ method ) ) { return $ this -> $ method ( $ out ) ; } return parent :: renderParentBlock ( $ out , $ name ) ; } | Render contents of a block in the parent view taking block from the decorator into consideration . |
57,257 | private function load ( $ env = 'local' , $ file = 'config' ) { $ path = BASE_PATH . ( $ file === '.env' ? '' : '/config' ) ; $ configPath = "{$path}/{$file}.yml" ; $ envConfigPath = "{$path}/{$file}_{$env}.yml" ; if ( ! file_exists ( $ configPath ) ) { throw new \ Exception ( "Config file not found at \"{$configPath}\... | Loads and parses the config file |
57,258 | public function build ( array $ config ) { $ contentCss = [ '/css/admin-helper.css' , '/bundles/ekynacore/css/tinymce-content.css' , 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' , ] ; if ( 0 < strlen ( $ config [ 'ui' ] [ 'google_font_url' ] ) ... | Builds the tinymce configuration . |
57,259 | protected function changeCurrentId ( $ newId ) { if ( ! preg_match ( '/^[-,a-zA-Z0-9]{1,128}$/' , $ newId ) ) { throw new InvalidArgumentException ( 'Invalid Session ID String' ) ; } if ( session_id ( $ newId ) === false ) { throw new SessionRuntimeException ( 'session_id Failed' ) ; } return true ; } | Set session id |
57,260 | public static function getInstance ( ) { if ( ! isset ( self :: $ instance ) ) { self :: $ instance = new self ; } self :: $ instance -> startSession ( ) ; return self :: $ instance ; } | Returns THE instance of Session . The session is automatically initialized if it wasn t . |
57,261 | public function destroy ( ) { if ( $ this -> sessionState == self :: SESSION_STARTED ) { $ _SESSION = array ( ) ; $ this -> sessionState = ! session_destroy ( ) ; unset ( $ _SESSION ) ; return ! $ this -> sessionState ; } return FALSE ; } | Destroys the current session . |
57,262 | public static function generateByPropertyClosure ( $ property , $ direction = SORT_ASC ) { if ( $ direction === SORT_DESC ) { $ aLTb = 1 ; $ aGTb = - 1 ; } else { $ aLTb = - 1 ; $ aGTb = 1 ; } return function ( \ Bond \ Entity \ Base $ a , \ Bond \ Entity \ Base $ b ) use ( $ property , $ aLTb , $ aGTb ) { $ propertyA ... | Generate a sort by property callback |
57,263 | function Save ( ) { $ this -> contentRights -> Save ( ) ; if ( ! $ this -> rights ) { $ this -> rights = new BackendPageRights ( ) ; } $ this -> rights -> SetCreateIn ( $ this -> Value ( 'CreateIn' ) ) ; $ this -> rights -> SetEdit ( $ this -> Value ( 'Edit' ) ) ; $ this -> rights -> SetMove ( $ this -> Value ( 'Move' ... | Saves the page rights |
57,264 | protected function getErrorsFromForm ( FormInterface $ form ) { $ errors = [ ] ; if ( $ form -> getErrors ( ) -> count ( ) === 0 && $ form -> isRoot ( ) && ! $ form -> isValid ( ) ) { $ errors [ "_self" ] = "Empty post data" ; } foreach ( $ form -> getErrors ( ) as $ error ) { $ key = $ error -> getOrigin ( ) -> getNam... | Build inheritance form errors |
57,265 | public function loadConfiguration ( ConfigurationLoader $ loader , array $ params = [ ] ) { try { $ data = $ loader -> findLoader ( $ this -> source ) -> load ( $ this -> source , $ params ) ; return new Configuration ( $ this -> createBase ( $ data ) ) ; } catch ( \ Exception $ e ) { throw new ConfigurationLoadingExce... | Load configuration data from the source . |
57,266 | public function getPermalink ( ItemInterface $ item ) { if ( $ item -> getPath ( ItemInterface :: SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT ) === '' ) { return new Permalink ( '' , '' ) ; } $ placeholders = $ this -> getPlacehoders ( $ item ) ; $ permalinkStyle = $ this -> getPermalinkAttribute ( $ item ) ; $ noHtmlExtensio... | Gets a permalink . This method uses the SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT of Item path . |
57,267 | public function reportCount ( $ count ) { $ statName = $ this -> prefix . $ this -> statNames ; if ( $ this -> isProduction ) { stathat_ez_count ( $ this -> ezkey , $ statName , $ count ) ; } } | Reports a count to the StatHat API . |
57,268 | public function reportValue ( $ value ) { $ statName = $ this -> prefix . $ this -> statNames ; if ( $ this -> isProduction ) { stathat_ez_value ( $ this -> ezkey , $ statName , $ value ) ; } } | Reports a value to the StatHat API . |
57,269 | public static function subscribe ( string $ hook , callable $ callback , int $ precedence = 0 ) { $ parts = explode ( "." , $ hook ) ; if ( count ( $ parts ) < 2 ) throw new InvalidArgumentException ( "Hook name must consist of at least two parts" ) ; if ( $ hook === Hook :: SHUTDOWN_HOOK ) self :: registerShutdownHook... | Subscribe to a hook . |
57,270 | public static function unsubscribe ( string $ hook , int $ hook_reference ) { $ parts = explode ( "." , $ hook ) ; if ( count ( $ parts ) < 2 ) throw new InvalidArgumentException ( "Hook name must consist of at least two parts" ) ; if ( ! isset ( self :: $ hooks [ $ hook ] ) ) throw new InvalidArgumentException ( "Hook... | Unsubscribe from a hook . |
57,271 | public static function execute ( string $ hook , $ params ) { if ( ! ( $ params instanceof Dictionary ) ) $ params = TypedDictionary :: wrap ( $ params ) ; if ( isset ( self :: $ in_progress [ $ hook ] ) ) throw new RecursionException ( "Recursion in hooks is not supported" ) ; self :: $ in_progress [ $ hook ] = true ;... | Call the specified hook with the provided parameters . |
57,272 | public static function getSubscribers ( string $ hook ) { if ( ! isset ( self :: $ hooks [ $ hook ] ) ) return array ( ) ; $ subs = [ ] ; foreach ( self :: $ hooks [ $ hook ] as $ h ) $ subs [ ] = $ h [ 'callback' ] ; return $ subs ; } | Return the subscribers for the hook . |
57,273 | public static function getExecuteCount ( string $ hook ) { return isset ( self :: $ counters [ $ hook ] ) ? self :: $ counters [ $ hook ] : 0 ; } | Return the amount of times the hook has been executed |
57,274 | public static function resetHook ( string $ hook ) { if ( isset ( self :: $ hooks [ $ hook ] ) ) unset ( self :: $ hooks [ $ hook ] ) ; if ( isset ( self :: $ counters [ $ hook ] ) ) unset ( self :: $ counters [ $ hook ] ) ; if ( isset ( self :: $ paused [ $ hook ] ) ) unset ( self :: $ paused [ $ hook ] ) ; } | Forget about a hook entirely . This will remove all subscribers reset the counter to 0 and remove the paused state for the hook . |
57,275 | public static function getRegisteredHooks ( ) { $ subscribed = array_keys ( self :: $ hooks ) ; $ called = array_keys ( self :: $ counters ) ; $ all = array_merge ( $ subscribed , $ called ) ; return array_unique ( $ all ) ; } | Get all hooks that either have subscribers or have been executed |
57,276 | public function personalAction ( AuthorizationCheckerInterface $ auth , Request $ request ) : Response { return new Response ( $ this -> templating -> render ( '@BkstgSchedule/Calendar/personal.html.twig' ) ) ; } | Show a calendar for a user . |
57,277 | private function prepareResult ( array $ events , Production $ production = null ) : array { $ result = [ 'success' => 1 , 'result' => [ ] , ] ; $ schedules = [ ] ; foreach ( $ events as $ event ) { $ event_production = ( null !== $ production ) ? $ production : $ event -> getGroups ( ) [ 0 ] ; if ( null === $ schedule... | Helper function to prepare results for the calendar . |
57,278 | public function actionAdd ( ) { $ model = new CartForm ( ) ; $ post = \ Yii :: $ app -> request -> post ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> validate ( ) ) { $ additionalProductForm = [ ] ; $ productAdditionalProducts = ProductAdditionalProduct :: find ( ) -> where ( [ ... | Adds product to cart |
57,279 | public function actionShow ( ) { $ this -> registerStaticSeoData ( ) ; $ cart = \ Yii :: $ app -> cart ; $ items = $ cart -> getOrderItems ( ) ; if ( empty ( $ items ) ) { return $ this -> render ( 'empty-cart' ) ; } else { if ( \ Yii :: $ app -> user -> isGuest ) { $ user = new User ( ) ; $ profile = new Profile ( ) ;... | Renders cart view with all order products . |
57,280 | public function actionRemove ( int $ productId , int $ combinationId = null ) { \ Yii :: $ app -> cart -> removeItem ( $ productId , $ combinationId ) ; return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } | Removes product from cart |
57,281 | public function actionClear ( ) { \ Yii :: $ app -> cart -> clearCart ( ) ; return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } | Removes all products from cart |
57,282 | public static function timingSafeEquals ( $ safe , $ user ) { if ( function_exists ( 'hash_equals' ) ) { return hash_equals ( ( string ) $ safe , ( string ) $ user ) ; } $ safe .= chr ( 0 ) ; $ user .= chr ( 0 ) ; $ safeLen = strlen ( $ safe ) ; $ userLen = strlen ( $ user ) ; $ result = $ safeLen - $ userLen ; for ( $... | Perform a timing - safe string comparison . |
57,283 | function loadTasks ( string $ namespace , $ tasks ) { if ( ! is_array ( $ tasks ) ) $ tasks = [ $ tasks ] ; foreach ( $ tasks as & $ task ) { $ class_name = $ namespace . $ task ; if ( ! is_subclass_of ( $ class_name , '\\Acast\\CronService\\TaskInterface' ) ) { Console :: warning ( "Invalid class \"$task\"." ) ; conti... | Load tasks by namespace and class name . |
57,284 | protected function addTask ( TaskInterface $ instance ) { $ this -> _task_list [ ] = $ instance ; $ this -> _cron -> add ( $ instance -> name , $ instance -> time , [ $ instance , 'execute' ] , $ instance -> params , $ instance -> persistent ) ; } | Add a task to cron service . |
57,285 | function destroy ( ) { foreach ( $ this -> _task_list as $ task ) $ task -> destroy ( ) ; Cron :: destroy ( $ this -> _name ) ; } | Destroy cron service . |
57,286 | protected function add ( ModelObject $ obj ) { $ this -> getErrors ( ) -> validateModelObject ( $ obj ) ; if ( $ this -> dao -> slugExists ( $ obj -> Slug ) ) $ this -> errors -> reject ( "The slug for this " . get_class ( $ obj ) . " record is already in use." ) ; } | Validates the model object and ensures that slug doesn t exist anywhere . |
57,287 | protected function edit ( ModelObject $ obj ) { if ( $ obj -> { $ obj -> getPrimaryKey ( ) } == null ) $ this -> errors -> reject ( "{$obj->getPrimaryKey()} is required to edit." ) -> throwOnError ( ) ; if ( $ this -> dao -> getByID ( $ obj -> { $ obj -> getPrimaryKey ( ) } ) == false ) $ this -> getErrors ( ) -> rejec... | Ensures we have a valid model object and that it s slug is not in conflict then validates the object |
57,288 | protected function delete ( $ slug ) { if ( $ this -> dao -> getBySlug ( $ slug ) == false ) $ this -> getErrors ( ) -> reject ( 'Record not found for slug:' . $ slug ) ; } | Ensures that the record exists for the given slug |
57,289 | public function readLine ( $ endOfLine = Server :: EOL ) { $ this -> ensureConnected ( ) ; $ buffer = '' ; do { $ buffer .= $ this -> read ( self :: MAX_SINGLE_RESPONSE_LENGTH ) ; $ eolPosition = strpos ( $ buffer , $ endOfLine ) ; } while ( $ eolPosition === false ) ; $ this -> readBuffer = substr ( $ buffer , $ eolPo... | Reads data from the connected socket in chunks of MAX_SINGLE_RESPONSE_LENGTH |
57,290 | public function getCacheManager ( $ key ) { return array_key_exists ( $ key , $ this -> cacheManagers ) ? $ this -> cacheManagers [ $ key ] : null ; } | Get CacheManager . |
57,291 | public function get ( callable $ codeBlock = null ) { if ( is_callable ( $ codeBlock ) ) { return call_user_func ( $ codeBlock , $ this -> value ) ; } else { return $ this -> value ; } } | Returns the monad s value and applies an optional code - block before returning it . |
57,292 | public function bind ( callable $ codeBlock ) { if ( $ this -> value === null ) { return new None ; } else { return static :: unit ( call_user_func ( $ codeBlock , $ this -> value ) ) ; } } | Runs the given code - block on the monad s value if the value isn t null . |
57,293 | public function createResourceTimelineEntry ( EntityPublishedEvent $ event ) : void { $ resource = $ event -> getObject ( ) ; if ( ! $ resource instanceof Resource ) { return ; } $ author = $ this -> user_provider -> loadUserByUsername ( $ resource -> getAuthor ( ) ) ; $ resource_component = $ this -> action_manager ->... | Create the resource timeline entry . |
57,294 | public function validateUser ( $ attribute , $ params ) { if ( ! $ this -> hasErrors ( ) ) { $ user = $ this -> user ; if ( ! isset ( $ user ) ) { $ this -> addError ( $ attribute , Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: ERROR_USER_NOT_EXIST ) ) ; } else { if ( ! $ this -> hasErrors ( ) && ! $ user -... | Check whether valid user already exist and available for SNS login . |
57,295 | public function login ( ) { if ( $ this -> validate ( ) ) { $ user = $ this -> getUser ( ) ; $ user -> lastLoginAt = DateUtil :: getDateTime ( ) ; $ user -> save ( ) ; return Yii :: $ app -> user -> login ( $ user , false ) ; } return false ; } | Logs in the user . |
57,296 | public function __isset ( string $ prop ) : bool { $ annotations = $ this -> __ornamentalize ( ) ; foreach ( $ annotations [ 'methods' ] as $ name => $ anns ) { if ( isset ( $ anns [ 'get' ] ) && $ anns [ 'get' ] == $ prop ) { return true ; } } return property_exists ( $ this -> __state , $ prop ) && ! is_null ( $ this... | Check if a property is defined . Note that this will return true for protected properties . |
57,297 | public static function create ( ) : self { return new self ( new ClosureContainer ( [ 'rollerworks_search.condition_exporter.json' => function ( ) { return new Exporter \ JsonExporter ( ) ; } , 'rollerworks_search.condition_exporter.string_query' => function ( ) { return new Exporter \ StringQueryExporter ( ) ; } , 'ro... | Create a new ConditionExporterLoader with the build - in ConditionExporters loadable . |
57,298 | private function loadTrustedProxies ( ) { $ proxies = App :: $ Properties -> get ( 'trustedProxy' ) ; if ( ! $ proxies || Str :: likeEmpty ( $ proxies ) ) { return ; } $ pList = explode ( ',' , $ proxies ) ; $ resultList = [ ] ; foreach ( $ pList as $ proxy ) { $ resultList [ ] = trim ( $ proxy ) ; } self :: setTrusted... | Set trusted proxies from configs |
57,299 | public function getPathInfo ( ) { $ route = $ this -> languageInPath ? Str :: sub ( parent :: getPathInfo ( ) , Str :: length ( $ this -> language ) + 1 ) : parent :: getPathInfo ( ) ; if ( ! Str :: startsWith ( '/' , $ route ) ) { $ route = '/' . $ route ; } return $ route ; } | Get pathway as string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.