idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
7,500 | public function getAll ( $ lang = "" ) { $ classNameArr = explode ( "\\" , get_class ( $ this ) ) ; $ className = "App\\Models\\" . str_replace ( "Controller" , "" , $ classNameArr [ 4 ] ) ; $ rowsPerPage = $ className :: $ rowsPerPage ; $ class = new $ className ( ) ; $ obj = DB :: table ( $ class -> table ) ; if ( is... | Returns the list of specific model . |
7,501 | public function single ( $ lang , $ view , $ id ) { $ classNameArr = explode ( "\\" , get_class ( $ this ) ) ; $ className = str_replace ( "Controller" , "" , $ classNameArr [ 4 ] ) ; $ key = $ view ; if ( $ className === "PostType" ) { if ( strpos ( $ key , 'category' ) !== false ) { $ className = 'Categories' ; $ key... | Return views for a specific model LIKE update reset password etc . |
7,502 | public function getAllWithoutPagination ( $ lang = "" ) { $ classNameArr = explode ( "\\" , get_class ( $ this ) ) ; $ className = "App\\Models\\" . str_replace ( "Controller" , "" , $ classNameArr [ 4 ] ) ; $ class = new $ className ( ) ; return $ class -> all ( ) ; } | Used as API to get list of all rows without using pagination . returns array of all rows in database . |
7,503 | public function generateSlug ( $ title , $ tableName , $ primaryKey , $ languageSlug = '' , $ id = 0 , $ translatable = false , $ hasVirtualSlug = false , $ delimiter = "-" ) { $ count = 0 ; $ found = true ; $ originalSlug = str_slug ( $ title , $ delimiter ) ; while ( $ found ) { if ( $ count != 0 ) { $ slug = $ origi... | This function creates the slug for a row of a model and makes sure that slugs it is not being used from a other post . |
7,504 | protected function response ( $ message , $ code = 200 , $ itemID = null , $ redirectToView = '' , $ redirectUrl = '' , $ returnInputErrors = false , $ errorsList = [ ] , $ noty = [ ] ) { if ( $ returnInputErrors ) { return response ( ) -> json ( array ( 'code' => 400 , 'id' => $ itemID , 'errors' => $ errorsList , 'me... | Handle ajax responses ( mainly used by view vue js . |
7,505 | public static function getPdoParamName ( $ columnName ) { if ( isset ( self :: $ pdoParamAliasesUsed [ $ columnName ] ) ) { self :: $ pdoParamAliasesUsed [ $ columnName ] ++ ; return $ columnName . self :: $ pdoParamAliasesUsed [ $ columnName ] ; } else { self :: $ pdoParamAliasesUsed [ $ columnName ] = 1 ; return $ co... | Returns a guaranteed unique parameter name for the column |
7,506 | public static function getDefaultConnection ( ) { if ( self :: $ defaultConnection === null ) { $ databaseSettings = StemSettings :: singleton ( ) ; self :: $ defaultConnection = static :: getConnection ( $ databaseSettings ) ; if ( $ databaseSettings -> stickyWriteConnection ) { self :: $ readOnlyConnection = self :: ... | Return s the default connection . |
7,507 | public static function executeStatement ( $ statement , $ namedParameters = [ ] , $ connection = null , & $ insertedId = null ) { if ( $ connection === null ) { $ connection = static :: getDefaultConnection ( ) ; } self :: $ secondLastStatement = self :: $ lastStatement ; self :: $ lastStatement = $ statement ; self ::... | Executes the statement with any supplied named parameters on the connection provided . |
7,508 | public static function returnSingleValue ( $ statement , $ namedParameters = [ ] , $ connection = null ) { $ statement = self :: executeStatement ( $ statement , $ namedParameters , $ connection !== null ? $ connection : static :: getReadOnlyConnection ( ) ) ; return $ statement -> fetchColumn ( 0 ) ; } | Executes the statement and returns the first column of the first row . |
7,509 | public static function returnFirstRow ( $ statement , $ namedParameters = [ ] , $ connection = null ) { $ statement = self :: executeStatement ( $ statement , $ namedParameters , $ connection !== null ? $ connection : static :: getReadOnlyConnection ( ) ) ; return $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ; } | Returns the first row of results from the statement |
7,510 | public function parse ( string $ input ) { $ ts = $ this -> lexer -> tokenize ( $ input ) ; $ parseResult = $ this -> parseImplementation ( $ ts ) ; if ( $ ts -> hasPendingTokens ( ) ) { throw new SyntaxErrorException ( 'There are tokens not processed.' ) ; } return $ parseResult ; } | Parse a given input |
7,511 | public static function current ( string $ column = '' ) { if ( isset ( self :: $ current -> $ column ) ) { return self :: $ current -> $ column ; } return self :: $ current ; } | Get information of current language . |
7,512 | public static function setCurrent ( string $ languageSlug ) { $ languageData = self :: findBySlug ( $ languageSlug ) ; if ( $ languageData ) { App :: setLocale ( $ languageSlug ) ; Carbon :: setLocale ( $ languageSlug ) ; self :: $ current = $ languageData ; } else { self :: $ current = self :: $ default ; \ Request ::... | Set current language across all the environment . |
7,513 | public static function setFromURL ( Request $ request ) { if ( ! \ Request :: route ( 'lang' ) ) { $ detectLanguageFromRequest = \ App \ Models \ Language :: detectLanguageFromRequest ( $ request ) ; if ( $ detectLanguageFromRequest ) { $ request -> route ( ) -> setParameter ( 'lang' , $ detectLanguageFromRequest ) ; r... | Detect language form url and set it as route parameter . |
7,514 | public static function printLanguages ( $ customView = '' , $ ulClass = '' ) { return new HtmlString ( view ( ) -> make ( ( $ customView ? $ customView : "vendor.languages.default" ) , [ 'languages' => Language :: all ( ) , 'ulClass' => $ ulClass , ] ) -> render ( ) ) ; } | Print list of languages . |
7,515 | public static function getLabels ( ) { if ( ! file_exists ( accioPath ( 'resources/lang/' . App :: getLocale ( ) ) ) ) { return json_encode ( [ ] ) ; } $ translationFiles = File :: files ( accioPath ( 'resources/lang/' . App :: getLocale ( ) ) ) ; $ labels = [ ] ; foreach ( $ translationFiles as $ file ) { $ fileName =... | Get all the labels of the current language and store them in array by directory name . |
7,516 | public static function checkBySlug ( string $ slug ) { if ( Language :: all ( ) -> where ( 'slug' , $ slug ) -> count ( ) ) { return true ; } return false ; } | Checks if language exists by using slug as search . |
7,517 | public static function filterRows ( $ rows , $ withPagination = true , $ justForInTable = false , $ filterColumns = array ( ) ) { $ filteredList = array ( ) ; $ temporaryList = array ( ) ; $ language = App :: getLocale ( ) ; if ( $ withPagination ) { if ( ! is_array ( $ rows ) ) { $ rows = $ rows -> toArray ( ) ; } $ l... | Filter json arrays by current language . |
7,518 | public static function translateList ( $ items , $ languageSlug = '' ) { if ( $ items ) { if ( is_a ( $ items , 'Illuminate\Database\Eloquent\Collection' ) ) { $ translatedItems = $ items -> map ( function ( $ post ) use ( $ languageSlug ) { foreach ( $ post -> getAttributes ( ) as $ key => $ value ) { $ post -> $ key ... | Translate language fields from a list of objects . |
7,519 | public static function detectLanguageFromRequest ( Request $ request ) { $ splitURL = explode ( "/" , $ request -> path ( ) ) ; if ( isset ( $ splitURL [ 0 ] ) ) { if ( self :: findBySlug ( $ splitURL [ 0 ] ) ) { return $ splitURL [ 0 ] ; } } return false ; } | Detect language slug from a request |
7,520 | public static function setLangAttribute ( $ request ) { $ languageSlug = self :: setFromURL ( $ request ) ; if ( ! $ languageSlug ) { $ languageSlug = App :: getLocale ( ) ; } if ( config ( 'project.multilanguage' ) ) { if ( ! isInAdmin ( ) ) { if ( config ( 'project.hideDefaultLanguageInURL' ) && $ languageSlug == Lan... | Set route lang attribute to all route request . |
7,521 | public static function getISOBySlug ( $ slug ) { $ data = collect ( self :: ISOlist ( ) ) ; return $ data -> where ( 'slug' , $ slug ) -> first ( ) ; } | Get a ISO language by it slug . |
7,522 | public static function getISOByName ( $ name ) { $ data = collect ( self :: ISOlist ( ) ) ; return $ data -> where ( 'name' , $ name ) -> first ( ) ; } | Get a ISO language by it name . |
7,523 | private function getNettePresenterFactory ( ) : Nette \ DI \ Definitions \ ServiceDefinition { $ applicationExtension = $ this -> compiler -> getExtensions ( Nette \ Bridges \ ApplicationDI \ ApplicationExtension :: class ) ; if ( $ applicationExtension === [ ] ) { throw new \ LogicException ( 'ApplicationExtension not... | Make sure that ApplicationExtension is loaded before us and return its PresenterFactory definition . |
7,524 | private function isValidResult ( $ number , $ min , $ max ) { return is_int ( $ number ) && $ number >= $ min && $ number <= $ max ; } | Tells if the generated number is a valid result . |
7,525 | protected function getTagAttributes ( ) { $ stream = $ this -> parser -> getStream ( ) ; $ attributes = [ ] ; $ lineno = $ stream -> getCurrent ( ) -> getLine ( ) ; $ name = $ stream -> getSourceContext ( ) -> getName ( ) ; if ( ! $ stream -> test ( Token :: BLOCK_END_TYPE ) ) { do { $ this -> validateAttributeType ( $... | Gets the attributes of the twig tag . |
7,526 | protected function validateAttributeType ( TokenStream $ stream , $ type , array $ allowed ) : void { $ valid = false ; foreach ( $ allowed as $ aType ) { if ( $ stream -> test ( \ constant ( Token :: class . '::' . $ aType . '_TYPE' ) ) ) { $ valid = true ; break ; } } if ( ! $ valid ) { $ message = 'The attribute %s ... | Validate the current attribute type . |
7,527 | protected function validateAttributeOperator ( TokenStream $ stream , $ attr ) : void { if ( ! $ stream -> test ( Token :: OPERATOR_TYPE , '=' ) ) { throw new SyntaxError ( sprintf ( 'The attribute "%s" must be followed by "=" operator' , $ attr ) , $ stream -> getCurrent ( ) -> getLine ( ) , $ stream -> getSourceConte... | Validate the current attribute operator . |
7,528 | protected function formatAttributes ( array $ attributes , $ lineno , $ name ) { try { $ processor = new Processor ( ) ; return $ processor -> process ( $ this -> getAttributeNodeConfig ( ) , [ $ attributes ] ) ; } catch ( \ Exception $ e ) { throw new SyntaxError ( $ this -> getFormattedMessageException ( $ e ) , $ li... | Validate and format all attributes . |
7,529 | protected function getFormattedMessageException ( \ Exception $ exception ) { if ( $ exception instanceof InvalidTypeException ) { $ attribute = $ this -> getExceptionAttribute ( $ exception -> getMessage ( ) ) ; $ attribute = substr ( $ attribute , strrpos ( $ attribute , '.' ) + 1 ) ; $ message = sprintf ( 'Invalid t... | Get the formatted message excpetion of the attributes validation and formatting . |
7,530 | protected function getExceptionAttribute ( $ message ) { $ message = substr ( $ message , strpos ( $ message , '"' ) + 1 ) ; return substr ( $ message , 0 , strpos ( $ message , '"' ) ) ; } | Get the attribute name in the message of config exception . |
7,531 | public function sendCalendar ( $ externalCoverageId , $ location ) { $ client = $ this -> httpClient ; $ request = $ client -> post ( [ self :: ENTRY_POINT . '/{coverage}/' . self :: EXPORT_API , [ 'coverage' => $ externalCoverageId ] ] , [ 'Content-Type => multipart/form-data' ] , null , [ 'exceptions' => false ] ) ; ... | Post a calendar to tartare |
7,532 | public function setCurrent ( $ locale ) { $ localeIdentifier = null ; if ( $ locale instanceof LocaleInterface ) { $ localeIdentifier = $ locale -> getId ( ) ; } else { $ localeIdentifier = $ locale ; } $ this -> current = $ this -> getLocale ( $ localeIdentifier ) ; } | Set current locale by locale object or ID . |
7,533 | public function getActiveLocales ( ) { $ activeLocales = array ( ) ; $ locales = $ this -> getLocales ( ) ; foreach ( $ locales as $ id => $ locale ) { if ( $ locale -> isActive ( ) ) { $ activeLocales [ $ id ] = $ locale ; } } return $ activeLocales ; } | Get list of active locale objects |
7,534 | public function detect ( Request $ request , Response $ response = null ) { $ localeId = null ; foreach ( $ this -> detectors as $ detector ) { $ localeId = $ detector -> detect ( $ request ) ; if ( ! empty ( $ localeId ) ) { if ( $ this -> hasLocale ( $ localeId ) && ( $ this -> processInactive || $ this -> isActive (... | Detects current locale |
7,535 | public function isActive ( $ localeId ) { $ locale = $ this -> getLocale ( $ localeId , false ) ; if ( $ locale instanceof LocaleInterface ) { return $ locale -> isActive ( ) ; } return false ; } | Check is locale specified by id active |
7,536 | public function getSize ( ) { $ size = $ this -> stream -> getSize ( ) ; if ( $ size === null ) { $ pos = $ this -> stream -> tell ( ) ; $ this -> stream -> seek ( 0 , SEEK_END ) ; $ size = $ this -> stream -> tell ( ) ; $ this -> stream -> seek ( $ pos ) ; } if ( $ this -> limit === - 1 ) { return $ size - $ this -> o... | Returns the size of the limited subset of data or null if the wrapped stream returns null for getSize . |
7,537 | public function eof ( ) { $ size = $ this -> limit ; if ( $ size === - 1 ) { $ size = $ this -> getSize ( ) ; } return ( $ this -> position >= $ size ) ; } | Returns true if the current read position is at the end of the limited stream |
7,538 | public function seek ( $ offset , $ whence = SEEK_SET ) { $ pos = $ offset ; switch ( $ whence ) { case SEEK_CUR : $ pos = $ this -> position + $ offset ; break ; case SEEK_END : $ pos = $ this -> limit + $ offset ; break ; default : break ; } $ this -> doSeek ( $ pos ) ; } | Seeks to the passed position within the confines of the limited stream s bounds . |
7,539 | public function findOneByName ( $ name ) { $ qb = $ this -> getQueryBuilder ( ) ; return $ qb -> andWhere ( $ qb -> expr ( ) -> eq ( 'b.name' , ':name' ) ) -> andWhere ( $ qb -> expr ( ) -> isNull ( 'b.row' ) ) -> getQuery ( ) -> useQueryCache ( true ) -> setParameter ( 'name' , $ name ) -> getOneOrNullResult ( ) ; } | Finds the block by name |
7,540 | public function setRightValue ( $ right ) { $ this -> right = $ right ; if ( isset ( $ this -> nestedSetNode ) ) { $ this -> nestedSetNode -> setRightValue ( $ right ) ; } return $ this ; } | Set right value |
7,541 | public function setLevel ( $ level ) { $ this -> level = $ level ; if ( isset ( $ this -> nestedSetNode ) ) { $ this -> nestedSetNode -> setLevel ( $ level ) ; } return $ this ; } | Set depth level |
7,542 | public function moveLeftValue ( $ diff ) { $ this -> left += $ diff ; if ( isset ( $ this -> nestedSetNode ) ) { $ this -> nestedSetNode -> moveLeftValue ( $ diff ) ; } return $ this ; } | Move left value by the difference |
7,543 | public function moveRightValue ( $ diff ) { $ this -> right += $ diff ; if ( isset ( $ this -> nestedSetNode ) ) { $ this -> nestedSetNode -> moveRightValue ( $ diff ) ; } return $ this ; } | Move right value by the difference |
7,544 | public function moveLevel ( $ diff ) { $ this -> level += $ diff ; if ( isset ( $ this -> nestedSetNode ) ) { $ this -> nestedSetNode -> moveLevel ( $ diff ) ; } return $ this ; } | Move depth level by the difference |
7,545 | public function publish ( $ src , $ dstDir ) { $ r = true ; foreach ( glob ( $ src . '/*' ) as $ file ) { $ dst = $ dstDir . '/' . basename ( $ file ) ; if ( ! $ this -> copy ( $ file , $ dst ) ) $ r = false ; } return $ r ; } | Publish assets from a directory to another . |
7,546 | public function publishMigrations ( $ src , $ dstDir , $ migrate ) { $ r = true ; foreach ( glob ( $ src . '/*' ) as $ file ) { if ( basename ( $ file ) === 'migrations.json' ) continue ; $ dst = $ dstDir . '/' . basename ( $ file ) ; $ this -> copy ( $ file , $ dst ) ; } if ( ! $ r ) { $ this -> output -> writeln ( '<... | Publish migration files . |
7,547 | public function getRequestHeaders ( ) : array { $ headers = clone $ this -> headers ( ) ; if ( ! $ headers -> headerExists ( 'Content-type' ) ) { if ( $ contentType = $ this -> getContentType ( ) ) { if ( ( $ charset = $ this -> getCharset ( ) ) && ( stripos ( $ contentType , 'charset=' ) === false ) ) { $ contentType ... | Get headers prepared for request with Content - type assigned if it was not already set |
7,548 | public function getRequestData ( ) : string { $ requestData = $ this -> getData ( ) ; $ requestData = is_array ( $ requestData ) ? $ this -> httpBuildQuery ( $ requestData ) : ( string ) $ requestData ; return $ requestData ; } | Get previously set data encoded for request |
7,549 | public function setMethod ( string $ method ) : RequestContext { $ method = strtoupper ( $ method ) ; if ( ! in_array ( $ method , self :: $ availableMethods ) ) { throw new RequestContextException ( 'Supplied HTTP method is not supported' ) ; } $ this -> method = $ method ; return $ this ; } | Override default HTTP method |
7,550 | public function setUrl ( string $ url ) : RequestContext { $ this -> assertValidUrl ( $ url ) ; $ this -> url = $ url ; return $ this ; } | Set URL string |
7,551 | public function getRequestUrl ( ) : string { $ url = $ this -> getUrl ( ) ; if ( $ this -> getRequestParameters ( ) ) { $ url = $ this -> attachQueryToUrl ( $ url , $ this -> httpBuildQuery ( $ this -> getRequestParameters ( ) ) ) ; } return $ url ; } | Get URL string with request parameters applied |
7,552 | public function setCurlOption ( int $ optionName , $ optionValue ) : RequestContext { if ( @ curl_setopt ( curl_init ( ) , $ optionName , $ optionValue ) ) { $ this -> curlOptions [ $ optionName ] = $ optionValue ; } else { throw new RequestContextException ( "Curl option is invalid: '$optionName' => " . var_export ( $... | Set a single CURL option for context |
7,553 | public function setCurlOptions ( array $ curlOptions = [ ] ) : RequestContext { $ this -> curlOptions = [ ] ; foreach ( $ curlOptions as $ name => $ value ) { $ this -> setCurlOption ( $ name , $ value ) ; } return $ this ; } | Set an array of CURL options for context . Please note that old options would be removed or overwritten |
7,554 | public function setResponseContextClass ( string $ responseContextClass ) : RequestContext { if ( ! is_a ( $ responseContextClass , ResponseContextAbstract :: class , true ) ) { throw new RequestContextException ( sprintf ( "Class %s must have %s as one of its parents" , $ responseContextClass , ResponseContextAbstract... | Sets desired type of response context |
7,555 | private function assertValidUrl ( string $ url ) : void { if ( ! ( filter_var ( $ url , FILTER_VALIDATE_URL ) || filter_var ( $ url , FILTER_VALIDATE_IP ) ) ) { throw new RequestContextException ( "Failed to set invalid URL: $url" ) ; } } | Throw exception on invalid URL |
7,556 | public function commit ( string $ container , string $ repo , string $ tag , string $ comment , string $ author , bool $ pause , string $ changes , array $ request_body ) { $ data = [ 'container' => $ container , 'repo' => $ repo , 'tag' => $ tag , 'comment' => $ comment , 'author' => $ author , 'pause' => $ pause , 'c... | Create a new image from a container . |
7,557 | public function export ( string $ name ) { $ url = self :: $ base_url . '/' . $ name . '/get' ; return self :: $ curl -> get ( $ url ) ; } | Get a tarball containing all images and metadata for a repository . |
7,558 | public function exports ( array $ names ) { $ url = self :: $ base_url . '/get?' . http_build_query ( [ 'names' => $ names ] ) ; return self :: $ curl -> get ( $ url ) ; } | Get a tarball containing all images and metadata for several image repositories . |
7,559 | public function load ( bool $ quiet = false , string $ tar ) { $ url = self :: $ base_url . '/load?' . http_build_query ( [ 'quiet' => $ quiet ] ) ; return self :: $ curl -> post ( $ url , $ tar ) ; } | Load a set of images and tags into a repository . |
7,560 | function attachAndRenderSet ( array $ components ) { $ this -> attach ( $ components ) ; foreach ( $ components as $ c ) $ c -> run ( ) ; } | Renders a set of components as if they are children of this component . |
7,561 | function preRun ( ) { $ firstRendering = ! $ this -> renderCount ++ ; if ( $ this -> isVisible ( ) ) { if ( $ firstRendering ) { $ this -> applyPresetsOnSelf ( ) ; $ this -> setupFirstRun ( ) ; } else $ this -> setupRepeatedRun ( ) ; $ this -> databind ( ) ; if ( $ firstRendering ) { $ this -> createView ( ) ; $ this -... | Performs all setup required for rendering the component . |
7,562 | final function run ( $ onlyContent = false ) { if ( ! $ this -> context ) throw new ComponentException ( $ this , self :: ERR_NO_CONTEXT ) ; if ( $ this -> isVisible ( ) ) { $ this -> preRun ( ) ; $ this -> preRender ( ) ; if ( $ onlyContent ) $ this -> runChildren ( ) ; else $ this -> render ( ) ; $ this -> postRender... | Renders the component . |
7,563 | protected function getDefaultInputDefinition ( ) { $ definition = parent :: getDefaultInputDefinition ( ) ; $ definition -> addOption ( new InputOption ( '--env' , null , InputOption :: VALUE_OPTIONAL , 'The environment the console should run under.' ) ) ; return $ definition ; } | Return the default input definition . |
7,564 | public function setGroups ( $ groups = null ) { if ( ! is_array ( $ groups ) && $ groups !== null ) $ groups = [ $ groups ] ; $ this -> groups = $ groups ; return $ this ; } | Set the groups . |
7,565 | public function belongsToGroups ( array $ groups , Validator $ validator ) { if ( $ this -> groups === null ) return $ validator -> belongsToGroups ( $ groups ) ; else { foreach ( $ groups as $ group ) { if ( in_array ( $ group , $ this -> groups ) ) return true ; } return false ; } } | Check if the validator belongs to some groups . |
7,566 | private function pageChange ( Page $ master , $ force = false ) { $ pageLocalizationEntity = PageLocalization :: CN ( ) ; $ dql = "SELECT l FROM $pageLocalizationEntity l JOIN l.master m WHERE m.left >= :left AND m.right <= :right ORDER BY l.locale, m.left" ; $ pageLocalizations = $ this -> em -> createQuery (... | Called when page structure is changed |
7,567 | private function pageLocalizationChange ( PageLocalization $ localization , $ force = false ) { $ master = $ localization -> getMaster ( ) ; $ pageLocalizationEntity = PageLocalization :: CN ( ) ; $ dql = "SELECT l FROM $pageLocalizationEntity l JOIN l.master m WHERE m.left >= :left AND m.right <= :right AND l... | Recurse path regeneration for the localization and all its descendants |
7,568 | protected function checkForDuplicates ( PageLocalization $ pageData , Path $ newPath ) { $ page = $ pageData -> getMaster ( ) ; $ locale = $ pageData -> getLocale ( ) ; $ repo = $ this -> em -> getRepository ( PageLocalizationPath :: CN ( ) ) ; $ newPathString = $ newPath -> getFullPath ( ) ; $ criteria = array ( 'loca... | Throws exception if page duplicate is found |
7,569 | protected function findPagePath ( PageLocalization $ pageData ) { $ active = true ; $ limited = false ; $ inSitemap = true ; $ path = new Path ( ) ; if ( ! $ pageData -> isActive ( ) ) { $ active = false ; } if ( ! $ pageData -> isVisibleInSitemap ( ) ) { $ inSitemap = false ; } $ pathPart = $ pageData -> getPathPart (... | Loads page path |
7,570 | public function printSearchForm ( $ customView = '' , $ formClass = "" ) { return new HtmlString ( view ( ) -> make ( ( $ customView ? $ customView : "vendor.search.default" ) , [ 'keyword' => $ this -> getKeyword ( ) , 'formClass' => $ formClass ] ) -> render ( ) ) ; } | Get a search form |
7,571 | public function searchByTerm ( $ table , $ searchTerm , $ limit , $ searchInAllColumns = true , $ columns = array ( ) , $ excludeColumns = array ( ) , $ orderBy = 'created_at' , $ orderType = 'DESC' , $ joins = array ( ) , $ conditions = array ( ) ) { $ langSlug = App :: getLocale ( ) ; if ( $ searchInAllColumns && ! $... | Search data by a term |
7,572 | public function media ( $ searchTerm , $ fromDate = '' , $ toDate = '' , $ mediaType = '' , $ orderBy = "created_at" , $ orderType = 'DESC' , $ page = 1 ) { $ queryObject = DB :: table ( "media" ) ; if ( $ searchTerm != "" ) { $ queryObject -> where ( function ( $ query ) use ( $ searchTerm ) { $ query -> orWhere ( 'fi... | Search media filse |
7,573 | public function getFolderName ( ) { $ return = array ( $ this -> getWidth ( ) , 'x' , $ this -> getHeight ( ) ) ; if ( $ this -> isCropped ( ) ) { if ( $ this -> isCropVariant ( ) ) { $ return [ ] = 'c' ; $ return [ ] = intval ( $ this -> getCropSourceWidth ( ) ) ; $ return [ ] = 'x' ; $ return [ ] = intval ( $ this ->... | Get size folder name as WxH formatted string |
7,574 | public function update ( UpdateGroupPost $ request , $ id ) { $ model = ( new Services \ GroupsService ) -> dataUpdate ( $ id , $ request -> all ( ) ) ; return back ( ) -> with ( 'success' , 'Grupo atualizado com sucesso' ) ; } | Atualiza o registro especificado no banco de dados . |
7,575 | public function destroy ( Request $ request , $ id ) { $ deleted = ( new Services \ GroupsService ) -> dataDelete ( $ id , $ request -> all ( ) ) ; return response ( ) -> json ( [ 'deleted' => $ deleted ] ) ; } | Remove o registro especificado do banco de dados . |
7,576 | public function restore ( Request $ request , $ id ) { $ restored = ( new Services \ GroupsService ) -> dataRestore ( $ id , $ request -> all ( ) ) ; return response ( ) -> json ( [ 'restored' => $ restored ] ) ; } | Restaura o registro especificado removendo - o da lixeira . |
7,577 | public function unregister ( array $ page_templates ) { $ unregisterConfig = $ this -> config -> getSubConfig ( self :: UNREGISTER ) ; return array_diff_key ( $ page_templates , array_flip ( $ unregisterConfig -> getArrayCopy ( ) ) ) ; } | Unregister page templates for given keys . |
7,578 | protected function parseAmountDecimalSeparator ( $ amount ) { $ decimal_separator_counts = [ ] ; foreach ( $ this -> decimalSeparators as $ decimal_separator ) { $ decimal_separator_counts [ $ decimal_separator ] = \ mb_substr_count ( $ amount , $ decimal_separator ) ; } $ decimal_separator_counts_filtered = array_filt... | Parses an amount s decimal separator . |
7,579 | protected function parseAmountNegativeFormat ( $ amount ) { $ amount = preg_replace ( '/^\((.*?)\)$/' , '-\\1' , $ amount ) ; $ amount = preg_replace ( '/^(.*?)-$/' , '-\\1' , $ amount ) ; $ amount = preg_replace ( '/--/' , '' , $ amount ) ; return $ amount ; } | Parses a negative amount . |
7,580 | public function getData ( NodeInterface $ node = null , array $ arguments ) { $ data = [ ] ; foreach ( $ this -> parseListOfIcons ( ) as $ iconName ) { $ data [ 'fa-' . $ iconName ] = [ 'label' => $ iconName , 'icon' => 'fa fa-' . $ iconName , ] ; } return $ data ; } | Get icons list compiled from FontAwesome variables list |
7,581 | protected function parseListOfIcons ( ) { $ cache = $ this -> cacheManager -> getCache ( 'Default' ) ; $ cacheId = 'FontIconDataSource_parseListOfIcons' ; if ( ! ( $ icons = $ cache -> get ( $ cacheId ) ) ) { $ icons = [ ] ; foreach ( file ( self :: $ iconsListFilePath ) as $ content ) { if ( preg_match ( '#fa-var-([-_... | Parse list of icons and get pure icon names . |
7,582 | public function getTimetableHtml ( $ args ) { $ args [ '_controller' ] = 'CanalTPMttBundle:Timetable:view' ; $ subRequest = $ this -> co -> get ( 'request' ) -> duplicate ( array ( ) , null , $ args ) ; $ subRequest -> headers -> remove ( 'X-Requested-With' ) ; return $ this -> co -> get ( 'http_kernel' ) -> handle ( $... | We use http kernel to forward would take more time using curl |
7,583 | public function apply ( ) { if ( $ this -> config -> hasKey ( self :: UNREGISTER ) ) { add_action ( 'widgets_init' , [ $ this , 'unregister' ] , 15 ) ; } if ( $ this -> config -> hasKey ( self :: REGISTER ) ) { add_action ( 'widgets_init' , [ $ this , 'register' ] , 15 ) ; } } | Apply widget registrations and unregistrations . |
7,584 | public function unregister ( ) { $ unregisterConfig = $ this -> config -> getSubConfig ( self :: UNREGISTER ) ; array_map ( 'unregister_widget' , $ unregisterConfig -> getArrayCopy ( ) ) ; } | Unregister widgets . |
7,585 | public function log ( $ level , $ message , array $ context = array ( ) ) { $ logging = \ Plop \ Plop :: getInstance ( ) ; $ factory = $ logging -> getRecordFactory ( ) ; try { $ logging -> setRecordFactory ( static :: $ factory ) ; $ logging -> $ level ( $ message , $ context ) ; } catch ( Exception $ e ) { } $ loggin... | Log some message . |
7,586 | public function requireAsset ( $ asset , $ type = null ) { return null !== $ this -> manager && $ this -> manager -> has ( $ asset , $ type ) ? $ this -> manager -> getPath ( $ asset , $ type ) : $ asset ; } | Get the target path of the require asset . |
7,587 | public function applicationsListAction ( ) { $ manager = $ this -> getPageApplicationManager ( ) ; $ responseData = array ( ) ; foreach ( $ manager -> getAllApplications ( ) as $ application ) { $ responseData [ ] = array ( 'id' => $ application -> getId ( ) , 'title' => $ application -> getTitle ( ) , 'icon' => $ appl... | Responds with Page Apps configuration |
7,588 | public function moveAction ( ) { $ this -> isPostRequest ( ) ; $ localization = $ this -> getPageLocalization ( ) ; $ page = $ localization -> getMaster ( ) ; $ input = $ this -> getRequestInput ( ) ; $ this -> lockNestedSet ( $ page ) ; try { if ( $ input -> has ( 'reference_id' ) ) { $ sibling = $ this -> getPageByRe... | Handles Page move request . |
7,589 | private function loadSitemapTree ( $ entity ) { $ em = $ this -> getEntityManager ( ) ; $ input = $ this -> getRequestInput ( ) ; $ localeId = $ this -> getCurrentLocale ( ) -> getId ( ) ; $ levels = null ; $ parentId = null ; if ( $ input -> has ( 'parent_id' ) ) { $ parentId = $ input -> get ( 'parent_id' ) ; if ( em... | Get list of pages converted to array |
7,590 | public function getParentCategory ( ) { $ parentCategory = null ; $ currentCategory = $ this -> getCurrentCategory ( ) ; if ( null !== $ currentCategory ) { $ parentCategoryId = $ currentCategory -> getParentId ( ) ; $ parentCategory = $ this -> _categoryRepository -> get ( $ parentCategoryId , $ this -> _storeManager ... | get the parent category of the current category |
7,591 | public function isProductNew ( $ product ) { $ newsFromDate = $ product -> getNewsFromDate ( ) ; $ newsToDate = $ product -> getNewsToDate ( ) ; if ( ! $ newsFromDate && ! $ newsToDate ) { return false ; } return $ this -> localeDate -> isScopeDateInInterval ( $ product -> getStore ( ) , $ newsFromDate , $ newsToDate )... | Return true if product is new false otherwise |
7,592 | private function getSalePercentage ( $ product ) { $ specialPrice = $ product -> getSpecialPrice ( ) ; $ originalPrice = $ product -> getPrice ( ) ; $ specialfromdate = $ product -> getSpecialFromDate ( ) ; $ specialtodate = $ product -> getSpecialToDate ( ) ; $ today = time ( ) ; $ salePercent = 0 ; $ productLabel = '... | Return percentage off the original price on Sale products |
7,593 | public function getProductLabels ( $ product ) { $ html = '' ; if ( $ this -> isProductOnSale ( $ product ) ) { if ( $ this -> isShowPercentage ( ) && $ this -> getSalePercentage ( $ product ) > 0 ) { $ html .= '<span class="sale-label sale-value">' . $ this -> getSalePercentage ( $ product ) . '%</span>' ; } else { $ ... | Return product labels template |
7,594 | public function createDefaultThumbs ( $ image = null , $ app = 'default' ) { if ( ! $ image ) { $ image = $ this ; } if ( $ image -> hasImageExtension ( ) ) { foreach ( config ( 'media.default_thumb_size' ) as $ thumKey => $ thumValue ) { if ( $ thumKey == "default" || $ thumKey == $ app ) { foreach ( $ thumValue as $ ... | Create default thumbs . |
7,595 | public function thumb ( $ width , $ height = null , $ imageObj = null , array $ options = [ ] ) { if ( ! $ imageObj ) { $ imageObj = $ this ; } $ thumbDirectory = $ width . ( $ height ? 'x' . $ height : "" ) ; $ thumbPath = $ imageObj -> fileDirectory . '/' . $ thumbDirectory . '/' . $ imageObj -> filename ; $ thumbUrl... | Get thumb by image and size . If requested thumb does not exist it automatically creates it . |
7,596 | public function hasImageExtension ( $ extension = null ) { if ( ! $ extension && $ this -> extension ) { $ extension = $ this -> extension ; } if ( ! $ extension ) { throw new \ Exception ( "No extension given" ) ; } if ( array_intersect ( [ strtolower ( $ extension ) , strtoupper ( $ extension ) ] , config ( 'media.im... | Check if an extension is image . |
7,597 | private function isAllowedExtension ( $ extension = null ) { if ( ! $ extension && $ this -> extension ) { $ extension = $ this -> extension ; } if ( ! $ extension ) { throw new \ Exception ( "No extension given" ) ; } if ( array_intersect ( [ strtolower ( $ extension ) , strtoupper ( $ extension ) ] , self :: allowedE... | Check if an extension is allowed to be uploaded . |
7,598 | public function optimize ( string $ pathToImage , string $ pathToOutput = null ) { if ( config ( 'media.optimize_image' ) ) { ImageOptimizer :: optimize ( $ pathToImage , $ pathToOutput ) ; } return $ this ; } | Compress & optimize an image . |
7,599 | public function getHttpResponseHeaders ( $ rawHeaders ) { if ( is_array ( $ rawHeaders ) ) { return $ this -> parseArrayHeaders ( $ rawHeaders ) ; } return $ this -> parseStringHeaders ( $ rawHeaders ) ; } | Parse out headers from raw headers |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.