idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
34,000 | public function userByResetPasswordToken ( $ token ) { if ( $ email = app ( 'account.password' ) -> getEmailByToken ( $ token ) ) { return $ this -> findByEmail ( $ email ) ; } return false ; } | Returns a user that corresponds to the given reset password token or false if there is no user with the given token . |
34,001 | public function forgotPassword ( $ email ) { $ account = $ this -> findByEmail ( $ email ) ; return app ( 'account.password' ) -> requestChangePassword ( $ account ) ; return false ; } | If an user with the given email exists then generate a token for password change and saves it in the password_reminders table with the email of the user . |
34,002 | public static function deleteAllCookies ( ) { if ( headers_sent ( $ filename , $ line ) ) { die ( '<script type="text/javascript">javascript:new function(){var c=document.cookie.split(";");for(var i=0;i<c.length;i++){var e=c[i].indexOf("=");var n=e>-1?c[i].substr(0,e):c[i];document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";}}()</script>' ) ; } if ( isset ( $ _SERVER [ 'HTTP_COOKIE' ] ) ) { $ cookies = explode ( ';' , $ _SERVER [ 'HTTP_COOKIE' ] ) ; foreach ( $ cookies as $ cookie ) { $ parts = explode ( '=' , $ cookie ) ; $ name = trim ( $ parts [ 0 ] ) ; setcookie ( $ name , '' , time ( ) - 1000 ) ; setcookie ( $ name , '' , time ( ) - 1000 , '/' ) ; } return true ; } return false ; } | Delete all cookies |
34,003 | public function getData ( ) { $ this -> validate ( 'merId' , 'password' , 'merUrlIdx' ) ; $ data = array ( 'mer_id' => $ this -> getMerId ( ) , 'password' => $ this -> getPassword ( ) , 'mer_url_idx' => $ this -> getMerUrlIdx ( ) , 'client_ip' => $ this -> getClientIp ( ) , ) ; return $ data ; } | Set the data used in every request . |
34,004 | private function getPath ( UploadedFile $ uploadedFile , Settings $ settings ) { return env ( 'APP_NAME' ) . DIRECTORY_SEPARATOR . $ this -> getSubFolder ( $ uploadedFile ) . DIRECTORY_SEPARATOR . $ settings -> getFolder ( ) ; } | Retrieve path . |
34,005 | private function getSubFolder ( UploadedFile $ uploadedFile ) { $ mimeType = $ uploadedFile -> getMimeType ( ) ; if ( strpos ( $ mimeType , ';' ) ) { $ mimeType = explode ( ';' , $ mimeType ) ; return strtolower ( $ mimeType [ 0 ] ) ; } $ mimeType = strtolower ( $ mimeType ) ; $ mimeType = explode ( '/' , $ mimeType ) ; return ( $ mimeType [ 0 ] == 'image' ) ? 'images/original' : 'data' ; } | Retrieve sub folder . |
34,006 | public function getRequestDate ( $ format = null ) { $ node = $ this -> getFirst ( '//epp:epp/epp:response/epp:resData/domain:trnData/domain:reDate' ) ; if ( $ format === null ) { return $ node -> nodeValue ; } return date_create_from_format ( $ format , $ node -> nodeValue ) ; } | The date and time that the transfer was requested . |
34,007 | public function getRequestExpiryDate ( $ format = null ) { $ node = $ this -> getFirst ( '//epp:epp/epp:response/epp:resData/domain:trnData/domain:acDate' ) ; if ( $ format === null ) { return $ node -> nodeValue ; } return date_create_from_format ( $ format , $ node -> nodeValue ) ; } | The date and time of a required or completed response . For a pending request the value identifies the date and time by which a response is required before an automated response action will be taken by the server . For all other status types the value identifies the date and time when the request was completed . |
34,008 | protected function soapCall ( $ action , $ parameters = null ) { $ stfu = error_reporting ( ) ; error_reporting ( 0 ) ; $ response = $ this -> soap -> $ action ( $ parameters ) ; error_reporting ( $ stfu ) ; $ response = \ Metaclassing \ Utility :: encodeJson ( $ response ) ; $ response = \ Metaclassing \ Utility :: decodeJson ( $ response ) ; $ this -> log [ ] = [ 'request' => [ 'action' => $ action , 'parameters' => $ parameters , ] , 'response' => [ 'response' => $ response , ] , ] ; return $ response ; } | Internal function for executing and logging soap requests |
34,009 | protected function pagedSoapCall ( $ action , $ parameters , $ resultkey ) { $ pagesize = 100 ; $ pagenumber = 0 ; $ results = [ ] ; do { $ pagenumber ++ ; $ parameters [ 'listPagingInfo' ] = [ 'pageSize' => $ pagesize , 'pageNumber' => $ pagenumber , ] ; $ response = $ this -> soapCall ( $ action , $ parameters ) ; if ( ! $ response [ 'callSuccess' ] ) { throw new \ Exception ( 'SOAP callSuccess false' ) ; } $ results = array_merge ( $ results , $ response [ $ resultkey ] ) ; } while ( count ( $ results ) < $ response [ 'totalCount' ] ) ; return $ results ; } | Internal function for getting PAGED responses |
34,010 | public function getCreateDate ( $ format = null ) { $ node = $ this -> getFirst ( '//epp:epp/epp:response/epp:resData/contact:creData/contact:crDate' ) ; if ( $ format === null ) { return $ node -> nodeValue ; } return date_create_from_format ( $ format , $ node -> nodeValue ) ; } | The date and time of contact - object creation . |
34,011 | public function onKernelController ( FilterControllerEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( $ request -> attributes -> get ( self :: JGP_AJAX_BLOCK_TAG ) ) { $ queryParams = array ( ) ; $ controller = $ event -> getController ( ) ; $ reflectionMethod = is_array ( $ controller ) ? new \ ReflectionMethod ( $ controller [ 0 ] , $ controller [ 1 ] ) : new \ ReflectionFunction ( $ controller ) ; $ controllerParameters = array_map ( function ( \ ReflectionParameter $ parameter ) { return $ parameter -> getName ( ) ; } , $ reflectionMethod -> getParameters ( ) ) ; $ parameters = $ request -> attributes -> all ( ) ; foreach ( $ parameters as $ paramName => $ paramValue ) { if ( ! in_array ( $ paramName , $ controllerParameters ) ) { $ queryParams [ $ paramName ] = $ paramValue ; } } $ request -> query -> add ( $ queryParams ) ; } } | Loads in the request the parameters that the controller should receive as query parameters |
34,012 | public function getInstructions ( $ build_phase ) { $ required = [ ] ; foreach ( $ this -> instructions as $ instruction ) { if ( $ instruction -> getBuildPhase ( ) === $ build_phase ) { $ required [ ] = $ instruction ; } } return $ required ; } | Returns instructions for specified build phase . |
34,013 | public function add ( $ instruction ) { if ( $ instruction instanceof Closure ) { $ instruction = new CustomInstruction ( $ instruction ) ; } $ this -> instructions [ ] = $ instruction ; return $ this ; } | Adds instruction to blueprint . |
34,014 | public function replyTo ( $ address , $ name = null ) { if ( is_array ( $ address ) ) { $ this -> addAddressArray ( $ address , 'replyTo' ) ; } else { $ this -> reply_to [ $ address ] = $ name ; } return $ this ; } | Adds a Reply To address |
34,015 | public function attach ( $ pathToFile , array $ options = [ ] ) { if ( is_array ( $ pathToFile ) ) { foreach ( $ pathToFile as $ attachment ) { if ( isset ( $ attachment [ 'options' ] ) && array_key_exists ( "options" , $ attachment ) ) { $ options = $ attachment [ 'options' ] ; } else { $ options = [ ] ; } $ this -> addAttachment ( $ attachment [ 'path' ] , $ options ) ; } } else { $ this -> addAttachment ( $ pathToFile , $ options ) ; } return $ this ; } | Attaches file to mail |
34,016 | private function addAddressArray ( array $ address_array , $ type ) { foreach ( $ address_array as $ address => $ name ) { if ( ! method_exists ( $ this , $ type ) ) { return false ; } if ( is_int ( $ address ) ) { $ this -> $ type ( $ name ) ; } else { $ this -> $ type ( $ address , $ name ) ; } } return true ; } | Adds array of addresses to type |
34,017 | private function loadConfigType ( $ config_type ) { if ( $ config_type === 'default' ) { $ config_path = self :: DEFAULT_CONFIG_PATH ; } else { $ config_path = self :: DEFAULT_CONFIG_MESSAGE_TYPE_PATH . '.' . $ config_type ; } $ config_array = $ this -> config -> get ( $ config_path ) ; if ( is_null ( $ config_array ) ) { throw new UnknownMessageTypeException ( 'Pigeon config not found for type: ' . $ config_type ) ; } if ( ! is_array ( $ config_array ) ) { throw new InvalidMessageTypeException ( 'Pigeon config not set up properly for type: ' . $ config_type ) ; } if ( $ this -> setConfigOptions ( $ config_array ) ) { $ this -> message_type = $ config_type ; } return true ; } | Load the config type passed from configuration file |
34,018 | private function setConfigOptions ( array $ config_array ) { foreach ( $ config_array as $ type => $ value ) { $ this -> setConfigOption ( $ type , $ value ) ; } return true ; } | Set Configuration Options |
34,019 | private function setConfigOption ( $ option_type , $ option_value ) { if ( $ option_type === 'message_variables' ) { $ option_type = 'pass' ; } else if ( $ option_type === 'attachments' ) { $ option_type = 'attach' ; } if ( ! method_exists ( $ this , $ option_type ) ) { return false ; } $ this -> $ option_type ( $ option_value ) ; return true ; } | Set Specific Config Option |
34,020 | private function resetMessage ( ) { $ this -> subject = '' ; $ this -> from = [ ] ; $ this -> sender = [ ] ; $ this -> to = [ ] ; $ this -> cc = [ ] ; $ this -> bcc = [ ] ; $ this -> reply_to = [ ] ; $ this -> attachments = [ ] ; $ this -> message_layout -> setViewLayout ( '' ) ; $ this -> message_layout -> setViewTemplate ( '' ) ; $ this -> message_layout -> clearVariables ( ) ; } | Reset Message Properties to empty |
34,021 | public function getRate ( $ source , $ target ) { $ provider = env ( 'FOREX_PROVIDER' ) ; $ url = env ( 'FOREX_PROVIDER_URL' ) ; $ key = env ( 'FOREX_PROVIDER_KEY' , '' ) ; $ cache_minutes = intval ( env ( 'FOREX_CACHE_MINUTES' , 720 ) ) ; if ( ( ! $ provider ) || ( ! $ url ) ) throw new ForexException ( 'Invalid exchange rate provider configuration.' ) ; if ( ! in_array ( $ source , $ this -> currency_codes ) ) throw new ForexException ( 'Invalid source currency code.' ) ; if ( ! in_array ( $ target , $ this -> currency_codes ) ) throw new ForexException ( 'Invalid target currency code.' ) ; $ conversion = $ source . $ target ; if ( ( $ cache_minutes > 0 ) && ( Cache :: has ( $ conversion ) ) ) $ rate = Cache :: get ( $ conversion ) ; else { $ provider_class = 'Viewflex\Forex\Providers\\' . $ provider ; if ( ! class_exists ( $ provider_class ) ) throw new ForexException ( "\"" . $ provider . "\" is not a supported provider." ) ; $ this -> service = new $ provider_class ( $ url , $ key , $ cache_minutes ) ; $ rate = $ this -> service -> getRate ( $ source , $ target ) ; if ( $ rate <= 0 ) throw new ForexException ( 'Error retrieving exchange rate.' ) ; if ( $ cache_minutes > 0 ) { if ( ! Cache :: add ( $ conversion , $ rate , Carbon :: now ( ) -> addMinutes ( $ cache_minutes ) ) ) throw new ForexException ( 'Unable to add exchange rate to cache.' ) ; } } return $ rate ; } | Gets exchange rate from cache or live source . |
34,022 | protected function filename ( $ userid , $ apikey , $ scope , $ name , $ args ) { $ regexp = '/[^a-z0-9,.-_=]/i' ; $ userid = ( int ) $ userid ; $ apikey = preg_replace ( $ regexp , '_' , $ apikey ) ; $ argstr = '' ; foreach ( $ args as $ key => $ val ) { if ( strlen ( $ val ) < 1 ) { unset ( $ args [ $ key ] ) ; } elseif ( ! in_array ( strtolower ( $ key ) , array ( 'userid' , 'apikey' , 'keyid' , 'vcode' ) ) ) { $ argstr .= preg_replace ( $ regexp , '_' , $ key ) . $ this -> options [ 'delimiter' ] . preg_replace ( $ regexp , '_' , $ val ) . $ this -> options [ 'delimiter' ] ; } } $ argstr = substr ( $ argstr , 0 , - 1 ) ; $ filename = 'Request_' . gmdate ( 'Ymd-His' ) . ( $ argstr ? '_' . $ argstr : '' ) . '.xml' ; $ filepath = $ this -> basepath . gmdate ( 'Y-m-d' ) . '/' . ( $ userid ? "$userid/$apikey/$scope/$name/" : "public/public/$scope/$name/" ) ; if ( ! file_exists ( $ filepath ) ) { $ oldUmask = umask ( 0 ) ; mkdir ( $ filepath , $ this -> options [ 'umask_directory' ] , true ) ; umask ( $ oldUmask ) ; } return $ filepath . $ filename ; } | create a filename to use |
34,023 | public function create ( StatusInterface $ statusFrom , StatusInterface $ statusTo ) { $ transition = new $ this -> transitionClass ( ) ; $ transition -> setStatusFrom ( $ statusFrom ) ; $ transition -> setStatusTo ( $ statusTo ) ; return $ transition ; } | Create a transition |
34,024 | public function changePassword ( Request $ request ) { $ this -> validate ( $ request , [ 'old_password' => 'required' , 'new_password' => 'required|min:8' , ] ) ; if ( ! Hash :: check ( $ request -> input ( 'old_password' ) , Auth :: user ( ) -> password ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'old_password' => trans ( 'mustard::account.password_incorrect' ) , ] ) ; } if ( $ request -> input ( 'old_password' ) == $ request -> input ( 'new_password' ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'new_password' => trans ( 'mustard::account.password_same' ) , ] ) ; } Auth :: user ( ) -> password = Hash :: make ( $ request -> input ( 'new_password' ) ) ; Auth :: user ( ) -> save ( ) ; Auth :: user ( ) -> sendEmail ( trans ( 'mustard::account.password_changed' ) , 'mustard::emails.account.password-changed' ) ; return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.password_changed' ) ) ; } | Change account password . |
34,025 | public function changeEmail ( Request $ request ) { $ this -> validate ( $ request , [ 'email' => 'required|email' , ] ) ; if ( $ request -> input ( 'email' ) == Auth :: user ( ) -> email ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'email' => trans ( 'mustard::account.email_same' ) , ] ) ; } if ( User :: findByEmail ( $ request -> input ( 'email' ) ) ) { return redirect ( ) -> back ( ) -> withErrors ( [ 'email' => trans ( 'mustard::account.email_exists' ) , ] ) ; } Auth :: user ( ) -> sendEmail ( trans ( 'mustard::account.email_changed' ) , 'mustard::emails.account.email-changed' , [ 'new_email' => $ request -> input ( 'email' ) ] ) ; Auth :: user ( ) -> email = $ request -> input ( 'email' ) ; if ( method_exists ( 'unverify' , Auth :: user ( ) ) ) { Auth :: user ( ) -> unverify ( ) ; } Auth :: user ( ) -> save ( ) ; return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.email_changed' ) ) ; } | Change account email address . |
34,026 | public function changeNotifications ( Request $ request ) { $ this -> validate ( $ request , [ 'notifications' => 'required|array' , ] ) ; foreach ( $ request -> input ( 'notifications' ) as $ notification => $ enable ) { Auth :: user ( ) -> setNotification ( $ notification , $ enable ) ; } Auth :: user ( ) -> save ( ) ; return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.notifications_changed' ) ) ; } | Change account notification settings . |
34,027 | public function closeAccount ( Request $ request ) { $ this -> validate ( $ request , [ 'confirm' => 'required|regex:/close my account/' , ] ) ; Auth :: user ( ) -> watching ( ) -> detach ( ) ; if ( mustard_loaded ( 'commerce' ) ) { Auth :: user ( ) -> bankDetails ( ) -> delete ( ) ; } if ( mustard_loaded ( 'feedback' ) ) { Auth :: user ( ) -> feedbackReceived ( ) -> update ( [ 'subject_user_id' => null ] ) ; } if ( mustard_loaded ( 'messaging' ) ) { Auth :: user ( ) -> messages ( ) -> delete ( ) ; } return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::account.close_confirmed' ) ) ; } | Close an account . |
34,028 | public function toArrayAll ( ) { $ data = $ this -> toArray ( ) ; foreach ( self :: $ jsonable as $ key ) { if ( isset ( $ data [ $ key ] ) && Utils :: isJson ( $ data [ $ key ] ) ) { $ data [ $ key ] = json_decode ( $ this -> { $ key } ) ; } } return $ data ; } | Transform to Array even Json Data encoded |
34,029 | public static function getStructure ( $ withoutGuarded = false , $ asKey = false ) { $ t = new self ; if ( isset ( static :: $ _structure ) ) { return static :: $ _structure ; } $ table = $ t -> getTable ( ) ; $ columns = array ( ) ; switch ( DB :: connection ( ) -> getConfig ( 'driver' ) ) { case 'pgsql' : $ query = "SELECT column_name FROM information_schema.columns WHERE table_name = '" . $ table . "'" ; $ column_name = 'column_name' ; $ reverse = true ; break ; case 'mysql' : $ query = 'SHOW COLUMNS FROM ' . $ table ; $ column_name = 'Field' ; $ reverse = false ; break ; case 'sqlsrv' : $ parts = explode ( '.' , $ table ) ; $ num = ( count ( $ parts ) - 1 ) ; $ table = $ parts [ $ num ] ; $ query = "SELECT column_name FROM " . DB :: connection ( ) -> getConfig ( 'database' ) . ".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" . $ table . "'" ; $ column_name = 'column_name' ; $ reverse = false ; break ; default : $ table = self :: where ( 'id' , '!=' , 'x' ) -> first ( ) ; if ( $ table ) { $ columns = array_keys ( $ table -> getAttributes ( ) ) ; } else { $ error = 'Database driver not supported: you must define a static _structure variable ' . DB :: connection ( ) -> getConfig ( 'driver' ) ; throw new \ Exception ( $ error ) ; } break ; } if ( ! $ columns ) { $ columns = array ( ) ; foreach ( DB :: select ( $ query ) as $ column ) { $ columns [ ] = $ column -> $ column_name ; } if ( $ reverse ) { $ columns = array_reverse ( $ columns ) ; } } if ( $ withoutGuarded ) { $ kColumns = array_flip ( $ columns ) ; foreach ( $ t -> guarded as $ key ) { if ( isset ( $ kColumns [ $ key ] ) ) { unset ( $ columns [ $ kColumns [ $ key ] ] ) ; } } $ updated_at = array_search ( 'updated_at' , $ columns ) ; if ( $ updated_at !== false ) { unset ( $ columns [ 'updated_at' ] ) ; } $ created_at = array_search ( 'created_at' , $ columns ) ; if ( $ created_at !== false ) { unset ( $ columns [ 'created_at' ] ) ; } } if ( $ asKey ) { $ columns = array_flip ( $ columns ) ; } return $ columns ; } | Get Structure of the current table |
34,030 | protected function addOrchestraHierarchy ( ContainerBuilder $ container , LoaderInterface $ loader ) { $ loader -> load ( 'security.yml' ) ; $ orchestraHierarchy = $ container -> getParameter ( 'open_orchestra_user_admin.role_hierarchy' ) ; $ roleHierarchy = array ( ) ; if ( $ container -> hasParameter ( 'security.role_hierarchy.roles' ) ) { $ roleHierarchy = $ container -> getParameter ( 'security.role_hierarchy.roles' ) ; } $ container -> setParameter ( 'security.role_hierarchy.roles' , array_merge ( $ orchestraHierarchy , $ roleHierarchy ) ) ; } | Add Open Orchestra role hierarchy |
34,031 | public function resourceId ( $ id ) : self { $ this -> id = ( $ id instanceof \ Illuminate \ Database \ Eloquent \ Model ) ? $ id -> getKey ( ) : $ id ; return $ this ; } | sets resource id |
34,032 | public function reset ( ) : self { $ this -> version = null ; $ this -> resource = null ; $ this -> id = null ; $ this -> secure = false ; $ this -> relationship = null ; $ this -> relatedId = null ; return $ this ; } | resets all settings |
34,033 | private function assembleRouteName ( ) : string { $ prefix = ( $ this -> secure ) ? 'secure-api' : 'api' ; $ routeName = 'resource' ; if ( $ this -> relatedId !== null ) { $ routeName = 'resource.relationship.item' ; } else { if ( $ this -> relationship !== null ) { $ routeName = 'resource.relationship' ; } else { if ( $ this -> id !== null ) { $ routeName = 'resource.item' ; } } } return $ prefix . '.' . $ routeName ; } | assembles route name |
34,034 | private function assembleRouteParams ( ) : array { $ params = [ 'version' => $ this -> version , 'resource' => $ this -> resource , ] ; if ( $ this -> id !== null ) { $ params [ 'id' ] = $ this -> id ; } if ( $ this -> relationship !== null ) { $ params [ 'relationship' ] = $ this -> relationship ; } if ( $ this -> relatedId !== null ) { $ params [ 'parameter' ] = $ this -> relatedId ; } return $ params ; } | assembles route params |
34,035 | public function decode ( $ data ) { if ( is_string ( $ data ) ) { $ this -> arrayData = json_decode ( $ data , true ) ; } if ( ! is_string ( $ data ) || ! $ this -> isValidJson ( ) ) { throw new JsonDecodingFailedException ( 'The data provided was not proper JSON' ) ; } return $ this -> arrayData ; } | Decodes JSON data to array |
34,036 | public function getBackOfficeLanguage ( ) { $ currentLanguage = $ this -> session -> get ( self :: KEY_LOCALE ) ; if ( ! $ currentLanguage ) { $ currentLanguage = $ this -> defaultLocale ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token && ( $ user = $ token -> getUser ( ) ) instanceof UserInterface ) { if ( null !== $ user -> getLanguage ( ) ) { $ currentLanguage = $ user -> getLanguage ( ) ; } $ this -> setBackOfficeLanguage ( $ currentLanguage ) ; } } return $ currentLanguage ; } | Get current back office language |
34,037 | public function getAvailableSites ( ) { $ sites = array ( ) ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token instanceof TokenInterface ) { if ( $ this -> authorizationChecker -> isGranted ( ContributionRoleInterface :: PLATFORM_ADMIN ) ) { return $ this -> siteRepository -> findByDeleted ( false ) ; } if ( ( $ user = $ token -> getUser ( ) ) instanceof GroupableInterface ) { foreach ( $ user -> getGroups ( ) as $ group ) { $ site = $ group -> getSite ( ) ; if ( null !== $ site && ! $ group -> isDeleted ( ) && ! $ site -> isDeleted ( ) ) { $ sites [ $ site -> getId ( ) ] = $ site ; } } } } return $ sites ; } | Get availables sites on platform |
34,038 | public function getSiteId ( ) { if ( is_null ( $ this -> siteId ) ) { $ this -> siteId = $ this -> getSite ( ) [ 'siteId' ] ; } return $ this -> siteId ; } | Get the current site id |
34,039 | public function getSiteDefaultLanguage ( ) { if ( is_null ( $ this -> currentLanguage ) ) { $ this -> currentLanguage = $ this -> getSite ( ) [ 'defaultLanguage' ] ; } return $ this -> currentLanguage ; } | Get the default language of the current site |
34,040 | public function getSiteLanguages ( ) { if ( empty ( $ this -> currentSiteLanguages ) ) { $ this -> currentSiteLanguages = $ this -> getSite ( ) [ 'languages' ] ; } return $ this -> currentSiteLanguages ; } | Get languages of the current site |
34,041 | public function getSiteContributionLanguage ( ) { $ currentLanguage = $ this -> getSite ( ) [ 'defaultLanguage' ] ; $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token instanceof TokenInterface ) { if ( ( $ user = $ token -> getUser ( ) ) instanceof UserInterface && $ user -> hasLanguageBySite ( $ this -> getSiteId ( ) ) ) { $ currentLanguage = $ user -> getLanguageBySite ( $ this -> getSiteId ( ) ) ; } } return $ currentLanguage ; } | Get the contribution language setted by the user for the current site |
34,042 | public function clearContext ( ) { $ this -> session -> remove ( self :: KEY_SITE ) ; $ this -> session -> remove ( self :: KEY_LOCALE ) ; $ this -> tokenStorage -> getToken ( ) -> setAuthenticated ( false ) ; } | Clear saved context |
34,043 | protected function getSite ( ) { $ currentSite = $ this -> session -> get ( self :: KEY_SITE ) ; if ( ! $ currentSite || ( is_integer ( $ currentSite [ 'siteId' ] ) && $ currentSite [ 'siteId' ] == 0 ) ) { $ sites = $ this -> getAvailableSites ( ) ; if ( count ( $ sites ) > 0 ) { $ site = array_shift ( $ sites ) ; $ siteId = $ site -> getSiteId ( ) ; $ siteName = $ site -> getName ( ) ; $ locale = $ site -> getDefaultLanguage ( ) ; $ languages = $ site -> getLanguages ( ) ; $ this -> setSite ( $ siteId , $ siteName , $ locale , $ languages ) ; $ currentSite = $ this -> session -> get ( self :: KEY_SITE ) ; } } return $ currentSite ; } | Get current selected site |
34,044 | public function recordUserActionOnItem ( $ action = 'view' , $ userId , $ itemId , array $ properties = [ ] , $ eventTime = null ) { return $ this -> createCustomEvent ( $ action , 'user' , $ userId , 'item' , $ itemId , $ properties , $ eventTime ) ; } | Record a user action on an item . |
34,045 | public function handle ( Request $ request , Closure $ next , $ guard = null ) { if ( is_null ( $ guard ) ) { throw new \ LogicException ( self :: class . ' called with no guard defined.' ) ; } $ user = Auth :: guard ( $ guard ) -> user ( ) ; if ( is_null ( $ user ) ) { throw new InvalidRequestException ( 'access token' ) ; } return $ next ( $ request ) ; } | Handle the authentication middler |
34,046 | public static function fromDataContainer ( array $ data , Request $ request = null ) { $ models = collect ( ) ; foreach ( $ data as $ model ) { $ models -> push ( ( new RequestModel ( $ request ) ) -> data ( [ 'data' => $ model ] ) ) ; } return ( new static ( $ request ) ) -> models ( $ models ) ; } | creates instance from data container |
34,047 | public function initManager ( $ items = null ) { if ( property_exists ( $ this , 'dataItemsName' ) ) { $ this -> setItemsName ( $ this -> dataItemsName ) ; } $ repo = $ this -> getItemsName ( ) ; if ( ! isset ( $ this -> $ repo ) ) { $ this -> $ repo = [ ] ; } if ( is_null ( $ items ) ) { return $ this ; } $ this -> $ repo = is_array ( $ items ) ? $ items : Helpers :: getArrayableItems ( $ items ) ; return $ this ; } | Initializes a new manager instance . |
34,048 | public function hydrate ( $ data , $ append = false ) { if ( $ append ) { $ this -> addItem ( $ data ) ; } else { $ this -> reset ( $ data ) ; } return $ this ; } | Hydrate with external data optionally append |
34,049 | public function push ( $ alias , $ value , $ other = null ) { if ( isset ( $ other ) ) { $ values = func_get_args ( ) ; array_shift ( $ values ) ; } else { $ values = [ $ value ] ; } $ array = $ this -> get ( $ alias ) ; if ( ! is_array ( $ array ) ) { throw new NestingUnderNonArrayException ( "You may only push items onto an array" ) ; } foreach ( $ values as $ value ) { array_push ( $ array , $ value ) ; } $ this -> set ( $ alias , $ array ) ; return count ( $ values ) ; } | Push a value or values onto the end of an array inside manager |
34,050 | public function getRaw ( $ alias , $ fallback = '_michaels_no_fallback' ) { $ item = $ this -> getIfExists ( $ alias ) ; if ( $ item instanceof NoItemFoundMessage ) { if ( $ fallback !== '_michaels_no_fallback' ) { $ item = $ fallback ; } else { throw new ItemNotFoundException ( "$alias not found" ) ; } } return $ this -> prepareReturnedValue ( $ item ) ; } | Get a single item |
34,051 | public function getIfExists ( $ alias ) { $ repo = $ this -> getItemsName ( ) ; $ loc = & $ this -> $ repo ; foreach ( explode ( '.' , $ alias ) as $ step ) { if ( array_key_exists ( $ step , $ loc ) ) { $ loc = & $ loc [ $ step ] ; } else { return new NoItemFoundMessage ( $ alias ) ; } } return $ loc ; } | Return an item if it exist |
34,052 | public function exists ( $ alias ) { $ repo = $ this -> getItemsName ( ) ; $ loc = & $ this -> $ repo ; foreach ( explode ( '.' , $ alias ) as $ step ) { if ( ! isset ( $ loc [ $ step ] ) ) { return false ; } else { $ loc = & $ loc [ $ step ] ; } } return true ; } | Confirm or deny that an item exists |
34,053 | public function remove ( $ alias ) { $ repo = $ this -> getItemsName ( ) ; $ loc = & $ this -> $ repo ; $ parts = explode ( '.' , $ alias ) ; while ( count ( $ parts ) > 1 ) { $ step = array_shift ( $ parts ) ; if ( isset ( $ loc [ $ step ] ) && is_array ( $ loc [ $ step ] ) ) { $ loc = & $ loc [ $ step ] ; } } unset ( $ loc [ array_shift ( $ parts ) ] ) ; return $ this ; } | Deletes an item |
34,054 | protected function mergeDefaults ( array $ defaults , $ level = '' ) { foreach ( $ defaults as $ key => $ value ) { if ( is_array ( $ value ) ) { $ original = $ this -> getIfExists ( ltrim ( "$level.$key" , "." ) ) ; if ( is_array ( $ original ) ) { $ this -> mergeDefaults ( $ value , "$level.$key" ) ; } elseif ( $ original instanceof NoItemFoundMessage ) { $ this -> set ( ltrim ( "$level.$key" , "." ) , $ value ) ; } } else { if ( ! $ this -> exists ( ltrim ( "$level.$key" , "." ) ) ) { $ this -> set ( ltrim ( "$level.$key" , "." ) , $ value ) ; } } } } | Recursively merge defaults array and items array |
34,055 | protected function checkIfProtected ( $ item ) { $ this -> performProtectedCheck ( $ item ) ; if ( ! is_string ( $ item ) ) { return ; } $ prefix = $ item ; while ( false !== $ pos = strrpos ( $ prefix , '.' ) ) { $ prefix = substr ( $ item , 0 , $ pos ) ; $ this -> performProtectedCheck ( $ prefix ) ; $ prefix = rtrim ( $ prefix , '.' ) ; } } | Cycle through the nests to see if an item is protected |
34,056 | public static function fileExtType ( $ sExt ) { $ aExt2type = array ( 'audio' => array ( 'aac' , 'ac3' , 'aif' , 'aiff' , 'm3a' , 'm4a' , 'm4b' , 'mka' , 'mp1' , 'mp2' , 'mp3' , 'ogg' , 'oga' , 'ram' , 'wav' , 'wma' ) , 'video' => array ( 'asf' , 'avi' , 'divx' , 'dv' , 'flv' , 'm4v' , 'mkv' , 'mov' , 'mp4' , 'mpeg' , 'mpg' , 'mpv' , 'ogm' , 'ogv' , 'qt' , 'rm' , 'vob' , 'wmv' ) , 'document' => array ( 'doc' , 'docx' , 'docm' , 'dotm' , 'odt' , 'pages' , 'pdf' , 'rtf' , 'wp' , 'wpd' ) , 'spreadsheet' => array ( 'numbers' , 'ods' , 'xls' , 'xlsx' , 'xlsb' , 'xlsm' ) , 'interactive' => array ( 'key' , 'ppt' , 'pptx' , 'pptm' , 'odp' , 'swf' ) , 'text' => array ( 'asc' , 'csv' , 'tsv' , 'txt' ) , 'archive' => array ( 'bz2' , 'cab' , 'dmg' , 'gz' , 'rar' , 'sea' , 'sit' , 'sqx' , 'tar' , 'tgz' , 'zip' ) , 'code' => array ( 'css' , 'htm' , 'html' , 'php' , 'js' ) , ) ; foreach ( $ aExt2type as $ type => $ exts ) { if ( in_array ( $ sExt , $ exts ) ) { return $ type ; } } return false ; } | Convert a file extension to a file type . |
34,057 | public static function httpStatusDesc ( $ iCode ) { $ iCode = intval ( $ iCode ) ; $ aCode_to_desc = array ( 100 => 'Continue' , 101 => 'Switching Protocols' , 102 => 'Processing' , 200 => 'OK' , 201 => 'Created' , 202 => 'Accepted' , 203 => 'Non-Authoritative Information' , 204 => 'No Content' , 205 => 'Reset Content' , 206 => 'Partial Content' , 207 => 'Multi-Status' , 226 => 'IM Used' , 300 => 'Multiple Choices' , 301 => 'Moved Permanently' , 302 => 'Found' , 303 => 'See Other' , 304 => 'Not Modified' , 305 => 'Use Proxy' , 306 => 'Reserved' , 307 => 'Temporary Redirect' , 400 => 'Bad Request' , 401 => 'Unauthorized' , 402 => 'Payment Required' , 403 => 'Forbidden' , 404 => 'Not Found' , 405 => 'Method Not Allowed' , 406 => 'Not Acceptable' , 407 => 'Proxy Authentication Required' , 408 => 'Request Timeout' , 409 => 'Conflict' , 410 => 'Gone' , 411 => 'Length Required' , 412 => 'Precondition Failed' , 413 => 'Request Entity Too Large' , 414 => 'Request-URI Too Long' , 415 => 'Unsupported Media Type' , 416 => 'Requested Range Not Satisfiable' , 417 => 'Expectation Failed' , 422 => 'Unprocessable Entity' , 423 => 'Locked' , 424 => 'Failed Dependency' , 426 => 'Upgrade Required' , 500 => 'Internal Server Error' , 501 => 'Not Implemented' , 502 => 'Bad Gateway' , 503 => 'Service Unavailable' , 504 => 'Gateway Timeout' , 505 => 'HTTP Version Not Supported' , 506 => 'Variant Also Negotiates' , 507 => 'Insufficient Storage' , 510 => 'Not Extended' ) ; if ( isset ( $ aCode_to_desc [ $ iCode ] ) ) { return $ aCode_to_desc [ $ iCode ] ; } return '' ; } | Convert Http status code to description . |
34,058 | public static function sizeFormat ( $ bytes , $ decimals = 0 ) { $ quant = array ( 'TB' => 1099511627776 , 'GB' => 1073741824 , 'MB' => 1048576 , 'kB' => 1024 , 'B ' => 1 , ) ; foreach ( $ quant as $ unit => $ mag ) { if ( doubleval ( $ bytes ) >= $ mag ) { return number_format ( $ bytes / $ mag , $ decimals ) . ' ' . $ unit ; } } return false ; } | Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it . Supports TB value . |
34,059 | public static function hasOneOfScopes ( ) { $ scopes = func_get_args ( ) ; $ has_required_scopes = false ; foreach ( $ scopes as $ required_scope_set ) { if ( ! is_string ( $ required_scope_set ) && ! is_array ( $ required_scope_set ) ) { throw new \ LogicException ( 'Invalid reference to required scopes.' ) ; } if ( Authorizer :: hasScope ( $ required_scope_set ) ) { $ has_required_scopes = true ; break ; } } return $ has_required_scopes ; } | Test whether the current Agent has the required set of scopes . |
34,060 | protected function getPackageDir ( ) { $ baseDir = realpath ( getcwd ( ) ) . DIRECTORY_SEPARATOR ; $ configDir = ( is_dir ( $ baseDir . "_config" ) ) ? "_config" : "config" ; $ configFile = $ baseDir . $ configDir . DIRECTORY_SEPARATOR . "config.yml" ; if ( file_exists ( $ configFile ) ) { $ configData = file_get_contents ( $ configFile ) ; preg_match ( "/packagesDir:([ ]+)?([\"'])?([A-z0-9-]{1,})([\"'])?([ ]+)?/" , $ configData , $ matches ) ; $ packageDir = ( isset ( $ matches [ 3 ] ) ) ? $ matches [ 3 ] : "packages" ; } else { $ packageDir = "vendor" ; } return $ packageDir ; } | Returns the package directory based on Pattern Lab s config |
34,061 | public function supports ( $ packageType ) { if ( strpos ( $ packageType , "patternlab-" ) !== false ) { $ cleanPackageType = str_replace ( "patternlab-" , "" , $ packageType ) ; $ cleanPackageTypes = array ( "command" , "datakit" , "mustachehelper" , "twighelper" , "patternengine" , "patternkit" , "plugin" , "starterkit" , "styleguidekit" , "styleguidetheme" ) ; return ( bool ) ( in_array ( $ cleanPackageType , $ cleanPackageTypes ) ) ; } return false ; } | Determines which composer types are supported |
34,062 | public function validate ( $ validator ) { if ( ! empty ( $ this -> value ) && ! preg_match ( '/^fa-[a-z]+/' , $ this -> value ) ) { $ validator -> validationError ( $ this -> name , _t ( 'FontAwesomeIconPickerField.VALIDFONT' , 'Please enter a valid Font Awesome font name format.' ) , 'validation' , false ) ; return false ; } return true ; } | Ensure the value is a valid Font Awesome value beginning with fa - |
34,063 | public function setNotification ( $ option , $ enable ) { $ this -> notifications = $ enable ? ( $ this -> notifications | $ option ) : ( $ this -> notifications ^ $ option ) ; } | Set a notification . |
34,064 | public function add ( Log $ log ) { $ this -> logs [ spl_object_hash ( $ log ) ] = $ log ; $ this -> level = null ; } | Adds the log to the set of logs receiving messages . |
34,065 | public function remove ( Log $ log ) { unset ( $ this -> logs [ spl_object_hash ( $ log ) ] ) ; $ this -> level = null ; } | Removes the log from the set of logs receiving messages . |
34,066 | public function setUrl ( $ url ) { if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { throw new InvalidDataException ( 'Invalid url link' ) ; } $ this -> url = $ url ; return $ this ; } | Set an url to take a shot |
34,067 | public function setWidth ( $ width ) { if ( ! is_numeric ( $ width ) ) { throw new InvalidDataException ( 'Invalid width value' ) ; } $ this -> width = ( int ) $ width ; return $ this ; } | Set width for viewport and shot |
34,068 | public function setHeight ( $ height ) { if ( ! is_numeric ( $ height ) ) { throw new InvalidDataException ( 'Invalid height value' ) ; } $ this -> height = ( int ) $ height ; return $ this ; } | Set height for viewport and shot |
34,069 | private function renderTemplate ( $ filePath ) { return $ this -> render ( array ( 'url' => $ this -> url , 'width' => $ this -> width , 'height' => $ this -> height , 'fullPage' => $ this -> fullPage , 'timeout' => $ this -> timeout * 1000 , 'waitForImages' => $ this -> waitForImages , 'imagesLoadingTimeout' => $ this -> imagesLoadingTimeout * 1000 , ) , $ filePath ) ; } | Render PhantomJS script template |
34,070 | public function get ( $ path ) { if ( empty ( $ path ) ) { return null ; } $ url = $ this -> urlProvider -> getUrlFromPath ( $ path ) ; if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { return null ; } return $ url ; } | Generate the url from the asset path . |
34,071 | protected static function parseConnectionString ( string $ connectionString , array $ keymap = self :: KEY_MAP ) : array { $ values = [ ] ; $ params = \ explode ( ";" , $ connectionString ) ; if ( \ count ( $ params ) === 1 ) { $ params = \ explode ( " " , $ connectionString ) ; } foreach ( $ params as $ param ) { list ( $ key , $ value ) = \ array_map ( "trim" , \ explode ( "=" , $ param , 2 ) + [ 1 => null ] ) ; if ( isset ( $ keymap [ $ key ] ) ) { $ key = $ keymap [ $ key ] ; } $ values [ $ key ] = $ value ; } return $ values ; } | Parses a connection string into an array of keys and values given . |
34,072 | public function getPackage ( ) { if ( ! isset ( $ this -> package ) ) { $ this -> initLocalWebforgePackage ( ) ; $ this -> package = $ this -> webforge -> getLocalPackage ( ) ; } return $ this -> package ; } | Returns the package of the current bootet rootDirectory |
34,073 | protected function initLocalWebforgePackage ( ) { try { $ this -> webforge -> initLocalPackageFromDirectory ( $ this -> rootDirectory ) ; } catch ( LocalPackageInitException $ e ) { $ this -> webforge -> getPackageRegistry ( ) -> addComposerPackageFromDirectory ( $ this -> rootDirectory ) ; $ this -> webforge -> initLocalPackageFromDirectory ( $ this -> rootDirectory ) ; } } | Tries to init the package with webforge automatically |
34,074 | public function menu ( $ name = 'default' ) { if ( ! isset ( $ this -> menus [ $ name ] ) ) { $ this -> menus [ $ name ] = new Menu ( $ this ) ; } return $ this -> menus [ $ name ] ; } | Get menu with a specific name |
34,075 | public function isActive ( $ menuItem ) { if ( is_callable ( array_get ( $ menuItem , 'is_active' ) ) ) { return ( bool ) call_user_func ( $ menuItem [ 'is_active' ] , $ menuItem ) ; } if ( $ urlDef = array_get ( $ menuItem , 'url_def' ) ) { $ result = true ; foreach ( $ urlDef as $ method => $ value ) { if ( ! is_array ( $ value ) ) { $ result = $ result && call_user_func ( "if_" . $ method , [ $ value ] ) ; } else { foreach ( $ value as $ k => $ v ) { $ result = $ result && call_user_func ( "if_" . $ method , $ k , $ v ) ; } } } return $ result ; } return false ; } | Check if a menu item is currently active or not |
34,076 | public function getIndex ( Request $ request , $ path = null ) { $ items = Item :: active ( ) ; if ( $ request -> input ( 'q' ) ) { $ items -> keywords ( $ request -> input ( 'q' ) ) ; } if ( is_null ( $ path ) ) { $ category = null ; } else { $ tree = explode ( '/' , $ path ) ; $ category = Category :: findBySlug ( array_slice ( $ tree , - 1 ) [ 0 ] ) ; $ items -> whereHas ( 'categories' , function ( $ query ) use ( $ category ) { $ query -> whereIn ( 'categories.category_id' , array_merge ( $ category -> getDescendantIds ( ) , [ $ category -> getKey ( ) ] ) ) ; } ) ; } $ table = new ListingItems ( $ items , $ request ) ; $ table -> with ( 'categories' ) ; if ( mustard_loaded ( 'auctions' ) ) { $ table -> with ( 'bids' ) ; } if ( mustard_loaded ( 'media' ) ) { $ table -> with ( 'photos' ) ; } return view ( 'mustard::listings.list' , [ 'categories' => Category :: roots ( ) -> with ( 'children' ) -> orderBy ( 'sort' , 'asc' ) -> orderBy ( 'name' , 'asc' ) -> get ( ) , 'table' => $ table , 'items' => $ table -> paginate ( ) , 'view_category' => $ category , ] ) ; } | Return the item listings view . |
34,077 | public function addAttrib ( $ key , $ val ) { $ this -> _attribs = array_merge ( array ( $ key => $ val ) , $ this -> _attribs ) ; } | Add an attribute to the attributes container |
34,078 | public function render ( $ data = [ ] , $ view = null ) { $ view = $ view ? : MenuManager :: PLUGIN_NAME . '::master_menu' ; return $ this -> manager -> getView ( ) -> make ( $ view , [ 'menu' => $ this ] , $ data ) -> render ( ) ; } | Render the menu |
34,079 | protected function addItem ( $ item , $ options = [ ] ) { $ nextTo = array_get ( $ options , 'next_to' ) ; $ position = false ; foreach ( $ this -> items as $ index => $ m ) { if ( $ m [ 'id' ] == $ nextTo ) { $ position = $ index ; } } $ newMenu = [ 'item' => $ item , 'before' => array_get ( $ options , 'before' , '' ) , 'after' => array_get ( $ options , 'after' , '' ) , 'url_def' => array_get ( $ options , 'url_def' ) , 'is_active' => array_get ( $ options , 'is_active' ) , 'id' => array_get ( $ options , 'id' ) , ] ; if ( $ position !== false ) { array_splice ( $ this -> items , $ position + 1 , 0 , [ $ newMenu ] ) ; } else { $ this -> items [ ] = $ newMenu ; } return $ this ; } | Add new item to this menu |
34,080 | public function addIdentifier ( $ identifier ) { if ( ! isset ( $ this -> identifiers [ $ identifier ] ) ) { $ this -> identifiers [ $ identifier ] = $ identifier ; } return $ this ; } | Adding a identifier to the list . |
34,081 | public function removeIdentifier ( $ identifier ) { if ( isset ( $ this -> identifiers [ $ identifier ] ) ) { unset ( $ this -> identifiers [ $ identifier ] ) ; } return $ this ; } | Removing a identifier from the list . |
34,082 | public function setDecoder ( $ name , $ decoder = null ) { if ( ! isset ( $ decoder ) ) { $ decoder = '\OtherCode\Rest\Modules\Decoders\\' . strtoupper ( $ name ) . 'Decoder' ; } if ( class_exists ( $ decoder , true ) ) { $ this -> registerModule ( $ name , new $ decoder ( $ this -> response ) , 'after' ) ; } else { throw new \ OtherCode \ Rest \ Exceptions \ ModuleNotFoundException ( 'Decoder ' . $ name . ' not found!' ) ; } return $ this ; } | Set a new decoder instance |
34,083 | public function setEncoder ( $ name , $ encoder = null ) { if ( ! isset ( $ encoder ) ) { $ encoder = '\OtherCode\Rest\Modules\Encoders\\' . strtoupper ( $ name ) . 'Encoder' ; } if ( class_exists ( $ encoder , true ) ) { $ this -> registerModule ( $ name , new $ encoder ( $ this -> request ) , 'before' ) ; } else { throw new \ OtherCode \ Rest \ Exceptions \ ModuleNotFoundException ( 'Encoder ' . $ name . ' not found!' ) ; } return $ this ; } | Set a new encoder instance |
34,084 | public function setModule ( $ name , $ module , $ hook = 'after' ) { if ( class_exists ( $ module , true ) ) { switch ( $ hook ) { case 'before' : $ param = $ this -> request ; break ; case 'after' : $ param = $ this -> response ; break ; default : throw new \ InvalidArgumentException ( "Invalid hook name!" ) ; } $ this -> registerModule ( $ name , new $ module ( $ param ) , $ hook ) ; } else { throw new \ OtherCode \ Rest \ Exceptions \ ModuleNotFoundException ( 'Module ' . $ name . ' not found!' ) ; } return $ this ; } | Set a new module instance |
34,085 | protected function generate ( $ name ) { $ themePath = config ( 'themes.path' ) . '/' . $ name ; $ this -> laravel [ 'files' ] -> copyDirectory ( __DIR__ . '/stubs/theme' , $ themePath ) ; Stub :: createFromPath ( __DIR__ . '/stubs/json.stub' , compact ( 'name' ) ) -> saveTo ( $ themePath , 'theme.json' ) ; Stub :: createFromPath ( __DIR__ . '/stubs/theme.stub' ) -> saveTo ( $ themePath , 'theme.php' ) ; $ this -> info ( 'Theme created successfully.' ) ; } | Generate a new theme by given theme name . |
34,086 | public function add ( $ item ) { if ( $ item instanceof ItemInterface ) { $ this -> items [ ] = $ item ; } else { $ this -> items [ ] = new MulticardsItem ( $ item ) ; } } | Add an item to the bag |
34,087 | public function getUrlAttribute ( ) { $ url = '' ; foreach ( array_reverse ( $ this -> getAncestors ( ) -> all ( ) ) as $ parent ) { $ url = '/' . $ parent -> slug . $ url ; } return "/buy$url/" . $ this -> slug ; } | Override the parent s url attribute . |
34,088 | public function getAncestors ( ) { $ ancestors = new Collection ( ) ; $ ancestor = $ this ; while ( ( $ ancestor = $ ancestor -> parent ) && ! $ ancestors -> contains ( $ ancestor ) ) { $ ancestors -> push ( $ ancestor ) ; break ; } return $ ancestors ; } | Recursively build collection of ancestor category IDs . |
34,089 | public function getDescendants ( ) { $ descendants = $ this -> children ; foreach ( $ this -> children as $ child ) { $ descendants = $ descendants -> merge ( $ child -> getDescendants ( ) ) ; } return $ descendants ; } | Recursively build collection of descendant category IDs . |
34,090 | public function getKey ( $ withPrefix = false ) { $ key = ( $ withPrefix ) ? $ this -> prefix : '' ; $ key .= $ this -> key ; return $ key ; } | Get the argument Key |
34,091 | public function setKey ( $ key ) { $ arr = $ this -> parseKey ( $ key ) ; $ this -> key = $ arr [ 'key' ] ; $ this -> identifier = $ arr [ 'identifier' ] ; $ this -> prefix = $ arr [ 'prefix' ] ; return $ this ; } | Set the Argument key |
34,092 | public function setPrefix ( $ prefix ) { $ this -> prefix = $ prefix ; $ this -> identifier = $ this -> prefix . $ this -> key ; return $ this ; } | Set the prefix |
34,093 | public function registerNamespaces ( ) { foreach ( $ this -> all ( ) as $ theme ) { foreach ( array ( 'views' , 'lang' ) as $ hint ) { $ this -> { $ hint } -> addNamespace ( $ theme -> getLowerName ( ) , $ theme -> getPath ( $ hint ) ) ; } $ theme -> boot ( ) ; } } | Register the namespaces . |
34,094 | public function find ( $ search ) { foreach ( $ this -> all ( ) as $ theme ) { if ( $ theme -> getLowerName ( ) == strtolower ( $ search ) ) { return $ theme ; } } return ; } | Find the specified theme . |
34,095 | public function view ( $ view , $ data = array ( ) , $ mergeData = array ( ) ) { return $ this -> views -> make ( $ this -> getThemeNamespace ( $ view ) , $ data , $ mergeData ) ; } | Get view from current theme . |
34,096 | public function asset ( $ asset , $ secure = null ) { return url ( 'themes/' . $ this -> getCurrent ( ) . '/' . $ asset , null , $ secure ) ; } | Get asset for theme |
34,097 | public function registerViewLocation ( $ theme = null ) { if ( is_null ( $ theme ) ) { $ theme = $ this -> getCurrent ( ) ; } $ this -> views -> addLocation ( $ this -> getPath ( ) . '/' . $ theme . '/views' ) ; } | Register view location of theme . |
34,098 | public function config ( $ key , $ default = null ) { if ( Str :: contains ( $ key , '::' ) ) { list ( $ theme , $ config ) = explode ( '::' , $ key ) ; } else { $ theme = $ this -> getCurrent ( ) ; $ config = $ key ; } $ theme = $ this -> find ( $ theme ) ; return $ theme ? $ theme -> config ( $ config ) : $ default ; } | Get config from current theme . |
34,099 | public function composer ( $ views , $ callback , $ priority = null ) { $ theViews = [ ] ; foreach ( ( array ) $ views as $ view ) { $ theViews [ ] = $ this -> getThemeNamespace ( $ view ) ; } $ this -> views -> composer ( $ theViews , $ callback , $ priority ) ; } | Register a view composer to current theme . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.