idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
57,900 | private function parseResponseHeaders ( $ raw_response_headers ) { $ response_header_array = explode ( "\r\n\r\n" , $ raw_response_headers ) ; $ response_header = '' ; for ( $ i = count ( $ response_header_array ) - 1 ; $ i >= 0 ; $ i -- ) { if ( stripos ( $ response_header_array [ $ i ] , 'HTTP/' ) === 0 ) { $ respons... | Parse Response Headers |
57,901 | public static function array_flatten_multidim ( $ array , $ prefix = false ) { $ return = array ( ) ; if ( is_array ( $ array ) || is_object ( $ array ) ) { if ( empty ( $ array ) ) { $ return [ $ prefix ] = '' ; } else { foreach ( $ array as $ key => $ value ) { if ( is_scalar ( $ value ) ) { if ( $ prefix ) { $ retur... | Array Flatten Multidim |
57,902 | public function buildCommand ( ) { $ command = $ this -> getCommand ( ) ; $ output = $ this -> output !== null ? $ this -> output : $ this -> getDefaultOutput ( ) ; return $ command . ' > ' . $ output . ' 2>&1' ; } | build the exec command |
57,903 | public function isDue ( ) { $ date = Carbon :: now ( ) ; if ( $ this -> timezone ) { $ date -> setTimezone ( $ this -> timezone ) ; } $ response = CronExpression :: factory ( $ this -> getPatternString ( ) ) -> isDue ( $ date -> toDateTimeString ( ) ) ; return $ response && $ this -> resolveWhen ( ) ; } | check the event for call |
57,904 | private function runClosureTask ( ) { if ( $ this -> before !== null ) { $ this -> resolveBeforeCallbacks ( ) ; } call_user_func ( $ this -> command ) ; if ( $ this -> after !== null ) { $ this -> resolveAfterCallbacks ( ) ; } } | run the closure |
57,905 | private function runExecTask ( ) { chdir ( $ this -> resolveBasePath ( ) ) ; $ process = new Process ( $ this -> getCommand ( ) ) ; $ process -> run ( ) ; } | run the exec task |
57,906 | protected static function handleUniqueColumns ( ) { $ class = get_called_class ( ) ; if ( self :: testClassForUniqueId ( $ class ) == true ) { $ class :: creating ( function ( $ object ) use ( $ class ) { $ object -> { $ object -> primaryKey } = $ class :: findExistingReferences ( $ class , $ object -> primaryKey ) ; }... | Make sure that any unique column is given a unique string . |
57,907 | public function uploadFile ( ) { if ( ! isset ( Yii :: app ( ) -> params [ 'ciims_plugins' ] [ 'upload' ] ) ) { Yii :: import ( 'cii.utilities.CiiFileUploader' ) ; $ className = 'CiiFileUploader' ; } else $ className = Yii :: app ( ) -> params [ 'ciims_plugins' ] [ 'upload' ] [ 'class' ] ; $ config = isset ( Yii :: app... | Handles all uploads |
57,908 | private function _handleResourceUpload ( $ value ) { if ( Cii :: get ( $ this -> _result , 'success' , false ) == true ) { $ meta = ContentMetadata :: model ( ) -> findbyAttributes ( array ( 'content_id' => $ this -> _id , 'key' => $ this -> _result [ 'filename' ] ) ) ; if ( $ meta == NULL ) $ meta = new ContentMetadat... | Generic function to handle all resource uploads |
57,909 | private function _promote ( $ key = NULL ) { $ promotedKey = 'blog-image' ; if ( $ this -> _id == NULL || $ key == NULL ) return false ; $ model = ContentMetadata :: model ( ) -> findByAttributes ( array ( 'content_id' => $ this -> _id , 'key' => $ key ) ) ; if ( $ model -> key == $ promotedKey ) return true ; $ model2... | Promotes an image to blog - image |
57,910 | public function login ( $ provider , Request $ request ) { $ user = $ this -> authenticateUser -> authenticate ( $ provider , $ request -> has ( 'code' ) ) ; auth ( ) -> login ( $ user , true ) ; return redirect ( ) -> intended ( route ( 'core::home' ) ) ; } | log a user using socialite |
57,911 | public function setupUser ( Event $ event , $ user ) { $ UsersGroups = TableRegistry :: get ( 'Wasabi/Core.UsersGroups' ) ; $ user [ 'group_id' ] = $ UsersGroups -> getGroupIds ( $ user [ 'id' ] ) ; $ user [ 'password_hashed' ] = $ UsersGroups -> Users -> get ( $ user [ 'id' ] , [ 'fields' => [ 'password' ] ] ) -> get ... | Setup the group ids and set the password of the logged in users to store it in the session . Reset failed login attempts . |
57,912 | public function onFailedLogin ( Event $ event , $ clientIp , $ loginField , $ loginFieldValue ) { $ recognitionTime = Wasabi :: setting ( 'Core.Auth.failed_login_recognition_time' ) ; $ maxLoginAttempts = Wasabi :: setting ( 'Core.Auth.max_login_attempts' ) ; $ past = ( new \ DateTime ( ) ) -> modify ( '-' . $ recognit... | On a failed login attempt increase the failed login attempt of the corresponding user and update the last failed login attempt datetime . |
57,913 | public function actionCreate ( ) { $ form = new DomainForm ( ) ; if ( $ form -> load ( Yii :: $ app -> request -> post ( ) ) && $ form -> validate ( ) ) { try { $ model = $ this -> service -> create ( $ form ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> id ] ) ; } catch ( \ DomainException $ e ) { Yii :... | Creates a new Domain model . If creation is successful the browser will be redirected to the view page . |
57,914 | public function beforeUpdate ( ) { $ this -> owner -> setAttribute ( $ this -> imageAttribute , $ this -> owner -> getOldAttribute ( $ this -> imageAttribute ) ) ; } | Before update action |
57,915 | public function getImagePath ( ) { if ( $ this -> imagePath === null ) { $ this -> imagePath = '/images/' . strtolower ( ( new \ ReflectionClass ( $ this -> owner ) ) -> getShortName ( ) ) ; } return $ this -> imagePath ; } | Get image path |
57,916 | public function getImageAbsolutePath ( ) { if ( $ this -> _imageAbsolutePath === null ) { $ this -> _imageAbsolutePath = Yii :: getAlias ( '@webroot' ) . '/' . ( defined ( 'IS_BACKEND' ) ? '../' : '' ) . ltrim ( $ this -> getImagePath ( ) , '/' ) ; if ( ! file_exists ( $ this -> _imageAbsolutePath ) ) { yii \ helpers \... | Get absolute team image path in filesystem |
57,917 | public function hasImage ( ) { $ image = $ this -> owner -> getAttribute ( $ this -> imageAttribute ) ; return ! empty ( $ image ) && $ image != $ this -> imageDefault ; } | Check team image |
57,918 | public function getImageUrl ( ) { return ! $ this -> hasImage ( ) ? $ this -> getImageDefaultUrl ( ) : $ this -> _imageUrl ( $ this -> owner -> getAttribute ( $ this -> imageAttribute ) ) ; } | Get team image URL |
57,919 | public function imageChangeByUpload ( ) { $ formName = $ this -> owner -> formName ( ) ; if ( ! empty ( $ _POST [ $ formName ] [ $ this -> imageAttribute ] ) && $ _POST [ $ formName ] [ $ this -> imageAttribute ] == 'empty' ) { $ this -> imageReset ( ) ; } else { if ( ! empty ( $ _FILES [ $ formName ] [ 'tmp_name' ] [ ... | Change image by uploaded file |
57,920 | public function imageReset ( ) { $ this -> imageRemoveFile ( ) ; $ this -> owner -> setAttribute ( $ this -> imageAttribute , null ) ; $ this -> owner -> updateAttributes ( [ $ this -> imageAttribute ] ) ; } | Reset image to default |
57,921 | protected function read ( $ namespace , $ group , $ locale , $ item ) { $ this -> load ( $ namespace , $ group , $ locale ) ; $ data = Arr :: get ( $ this -> loaded [ $ namespace ] [ $ group ] [ $ locale ] , $ item ) ; return $ data ; } | Retrieve a data out the loaded array . |
57,922 | protected function handleDoubleQuotedString ( File $ phpcsFile , $ stackPointer , $ workingString ) { $ stringTokens = token_get_all ( '<?php ' . $ workingString ) ; foreach ( $ stringTokens as $ token ) { if ( is_array ( $ token ) && $ token [ 0 ] === T_VARIABLE ) { $ error = 'Variable "%s" not allowed in double quote... | This method adds errors if double quoted strings contain variables . |
57,923 | protected function handleSpecialChars ( File $ phpcsFile , $ stackPointer , $ workingString ) { foreach ( $ this -> specialChars as $ testChar ) { if ( strpos ( $ workingString , $ testChar ) !== false ) { $ error = 'Please use constants (LF, CR, CRLF, ...) using concatenation instead of "%s" in double quotes' ; $ erro... | This method adds errors if double quoted strings contain control characters like \ n . |
57,924 | public function getNextDefinition ( input \ parameter \ values \ Arguments $ values ) : ? input \ Argument { $ nextIndex = $ values -> count ( ) ; $ items = array_values ( $ this -> items ) ; if ( isset ( $ items [ $ nextIndex ] ) ) { return $ items [ $ nextIndex ] ; } if ( isset ( $ items [ $ nextIndex - 1 ] ) && $ it... | Returns the next Input Argument Definition for the given Input Argument values collection unless the collection already exceeds the number of defined Arguments . |
57,925 | public function add ( core \ interfaces \ Named $ argument ) : core \ collections \ interfaces \ NamedObjectSet { if ( $ this -> hasMultiparam ) { throw new \ LogicException ( "Cannot define additional arguments after an Argument [name: " . end ( $ this -> items ) -> getName ( ) . "] which accepts multiple values." ) ;... | Adds a Input Argument Definition to this collection . |
57,926 | protected function unpack ( array $ definition ) : input \ Argument { if ( isset ( $ definition [ 2 ] ) && is_int ( $ definition [ 2 ] ) ) { $ definition [ 2 ] = new input \ Value ( $ definition [ 2 ] ) ; } return new input \ Argument ( ... $ definition ) ; } | Unpacks a sequence of Argument constructor arguments into an Argument instance . |
57,927 | protected function guardAgainstNull ( $ data , $ dataName = 'Argument' , $ exceptionClass = 'Zend\Stdlib\Exception\InvalidArgumentException' ) { if ( null === $ data ) { $ message = sprintf ( '%s cannot be null' , $ dataName ) ; throw new $ exceptionClass ( $ message ) ; } } | Verify that the data is not null |
57,928 | protected function send ( array $ args = [ ] ) { $ this -> log -> debug ( 'send()ing command' , $ args ) ; $ response = RespUtils :: deserialize ( $ this -> stream -> write ( RespUtils :: serialize ( $ args ) ) ) ; $ this -> log -> debug ( 'response' , [ $ response ] ) ; return $ response ; } | Send request and retrieve response to the connected disque node . |
57,929 | protected function mapJobs ( array $ list ) { return array_map ( function ( $ element ) { return Job :: create ( [ 'queue' => $ element [ 0 ] , 'id' => $ element [ 1 ] , 'body' => isset ( $ element [ 2 ] ) ? $ element [ 2 ] : '' , ] ) ; } , $ list ) ; } | Map Disque s job responses to Job objects . |
57,930 | public function getOGTypeMapping ( $ name , $ subname = null ) { if ( $ types = $ this -> owner -> config ( ) -> open_graph_types ) { if ( isset ( $ types [ $ name ] ) ) { if ( is_array ( $ types [ $ name ] ) && $ subname ) { return $ types [ $ name ] [ $ subname ] ; } if ( ! is_array ( $ types [ $ name ] ) ) { return ... | Answers the open graph type for the mapping with the given name and optional sub - name . |
57,931 | public function getOGTypeNamespace ( ) { if ( $ type = $ this -> owner -> OGType ) { return ( strpos ( $ type , '.' ) !== false ) ? explode ( '.' , $ type ) [ 0 ] : $ type ; } } | Answers the open graph type namespace for the page . |
57,932 | public function getOGImage ( ) { $ config = $ this -> getSiteConfig ( ) ; if ( ( $ image = $ this -> owner -> MetaImage ) && $ image -> exists ( ) ) { return $ image -> AbsoluteURL ; } if ( $ config -> AppIconLargeID && $ config -> AppIconLarge ( ) -> exists ( ) ) { return $ config -> AppIconLarge ( ) -> AbsoluteURL ; ... | Answers the image for the open graph tag . |
57,933 | public function MetaTags ( & $ tags ) { if ( ! preg_match ( '/[\n]$/' , $ tags ) ) { $ tags .= "\n" ; } foreach ( $ this -> owner -> config ( ) -> open_graph_metadata as $ tag => $ property ) { $ this -> addMetaTag ( $ tags , "og:{$tag}" , $ this -> owner -> $ property ) ; } } | Appends the additional open graph tags to the provided meta tags . |
57,934 | protected function addMetaTag ( & $ tags , $ property = null , $ content = null ) { if ( is_array ( $ content ) ) { foreach ( $ content as $ value ) { $ this -> addMetaTag ( $ tags , $ property , $ value ) ; } } else { if ( $ content ) { $ tags .= $ this -> getMetaTag ( $ property , $ content ) ; } } } | Appends a meta tag with the given property name and content value to the provided tags variable . |
57,935 | protected function getMetaTag ( $ property = null , $ content = null ) { return sprintf ( "<meta property=\"%s\" content=\"%s\" />\n" , Convert :: raw2att ( $ property ) , Convert :: raw2att ( $ content ) ) ; } | Answers a meta tag with the given property name and content value . |
57,936 | protected function getNamespaceURI ( $ prefix ) { $ namespaces = $ this -> owner -> config ( ) -> open_graph_namespaces ; if ( isset ( $ namespaces [ $ prefix ] ) ) { return $ namespaces [ $ prefix ] ; } } | Answers the namespace URI for the specified prefix . |
57,937 | public function push ( $ socketMessage ) { $ message = json_decode ( $ socketMessage , true ) ; if ( $ message [ 'channel' ] === 'global' ) { if ( ! empty ( $ this -> subscribedChannels ) ) { return ; } foreach ( $ this -> subscribedChannels as $ channel ) { $ channel -> broadcast ( $ message ) ; } return ; } if ( ! ar... | Push socket messages to subscribers of individual channels . Broadcasting to all subscribers is possible via the global channel . |
57,938 | public function insert ( $ name , $ value , $ priority = 0 ) { if ( ! isset ( $ this -> items [ $ name ] ) ) { $ this -> count ++ ; } $ this -> sorted = false ; $ this -> items [ $ name ] = [ 'data' => $ value , 'priority' => ( int ) $ priority , 'serial' => $ this -> serial ++ , ] ; } | Insert a new item . |
57,939 | public function remove ( $ name ) { if ( isset ( $ this -> items [ $ name ] ) ) { $ this -> count -- ; } unset ( $ this -> items [ $ name ] ) ; } | Remove a item . |
57,940 | public function clear ( ) { $ this -> items = [ ] ; $ this -> serial = 0 ; $ this -> count = 0 ; $ this -> sorted = false ; } | Remove all items . |
57,941 | protected function sort ( ) { if ( ! $ this -> sorted ) { uasort ( $ this -> items , [ $ this , 'compare' ] ) ; $ this -> sorted = true ; } } | Sort all items . |
57,942 | protected function compare ( array $ item1 , array $ item2 ) { return ( $ item1 [ 'priority' ] === $ item2 [ 'priority' ] ) ? ( $ item1 [ 'serial' ] > $ item2 [ 'serial' ] ? - 1 : 1 ) * $ this -> isLIFO : ( $ item1 [ 'priority' ] > $ item2 [ 'priority' ] ? - 1 : 1 ) ; } | Compare the priority of two items . |
57,943 | public function toArray ( $ flag = self :: EXTR_DATA ) { $ this -> sort ( ) ; if ( $ flag == self :: EXTR_BOTH ) { return $ this -> items ; } return array_map ( function ( $ item ) use ( $ flag ) { return ( $ flag == PriorityList :: EXTR_PRIORITY ) ? $ item [ 'priority' ] : $ item [ 'data' ] ; } , $ this -> items ) ; } | Return list as array |
57,944 | protected function imageUpload ( $ field , UploadedFile $ file ) { if ( UPLOAD_ERR_OK == $ file -> getError ( ) ) { $ asserts = $ this -> getAsserts ( ) [ $ field ] ; foreach ( $ asserts as $ assert ) { if ( $ assert instanceof Image ) { $ path = $ file -> getPathname ( ) ; $ pathWithExtension = $ path . '.' . $ file -... | File upload callback Resizes the image according to validation constraints |
57,945 | public function addAttribute ( $ key , $ value , $ type = Attribute :: T_DEFAULT ) { $ this -> attributes [ ] = new Attribute ( $ key , $ value , $ type ) ; return $ this ; } | Append an attributes to match |
57,946 | public function addPseudo ( $ name , $ argument = false ) { $ this -> pseudos [ ] = new Pseudo ( $ name , $ argument ) ; return $ this ; } | Append an pseudo class to match |
57,947 | public function add ( $ type = false , $ identification = false , $ tagName = false , $ classes = false , $ pseudos = false ) { return $ this -> selector = new self ( $ this , $ type , $ identification , $ tagName , $ classes , $ pseudos ) ; } | Creates an sets the child selector |
57,948 | public function convert ( $ dotnetFormat ) { $ stringLiterals = [ ] ; $ callback = function ( $ matches ) use ( & $ stringLiterals ) { $ stringLiterals [ ] = reset ( $ matches ) ; return '%s' ; } ; $ dotnetFormatPlaceholders = preg_replace_callback ( $ this -> getPatternStringLiteralsDotNet ( ) , $ callback , $ dotnetF... | Convert a . NET custom date format string to it s PHP equivalent . |
57,949 | public function encode ( $ value ) { $ encryptedValue = $ this -> getEncryptor ( ) -> encrypt ( $ value ) ; $ encodedValue = base64_encode ( $ encryptedValue ) ; return $ encodedValue ; } | Encrypt and encode a value . |
57,950 | public function decode ( $ encodedValue ) { $ encryptedValue = base64_decode ( $ encodedValue ) ; $ value = $ this -> getEncryptor ( ) -> decrypt ( $ encryptedValue ) ; return $ value ; } | Decode and decrypt a value . |
57,951 | protected function setEnvironmentVariable ( $ name , $ value ) { $ name = strtoupper ( $ name ) ; $ result = putenv ( "$name=$value" ) ; if ( $ result === false ) { throw new Exception \ RuntimeException ( sprintf ( 'Failed to set environment variable "%s"' , $ name ) ) ; } } | Set environment variable . |
57,952 | public function getParent ( int $ level = 1 ) : self { $ tree = PathTree :: make ( $ this -> path ) -> getInversedPathTree ( ) ; if ( $ level > count ( $ tree ) - 1 ) { throw OverFlowRootDirException :: make ( ) ; } return $ tree [ $ level ] ; } | Devuelve el directorio padre del nivel indicado |
57,953 | public function addClass ( $ class ) { $ this -> setVariable ( self :: VIEW_MODEL_CLASS , $ this -> addValue ( $ this -> getVariable ( self :: VIEW_MODEL_CLASS ) , $ class ) ) ; } | Adds a css class name . |
57,954 | public function setAttributes ( $ attributes ) { $ this -> setVariable ( self :: ATTRIBUTES , "" ) ; foreach ( $ attributes as $ name => $ value ) { $ this -> addAttribute ( $ name , $ value ) ; } } | Sets an array of attributes . |
57,955 | public function html ( PhpRenderer $ renderer = null ) { $ view = new View ( ) ; $ view -> setResponse ( new Response ( ) ) ; $ resolver = new TemplateMapResolver ( ) ; if ( $ renderer === null ) { $ renderer = new PhpRenderer ( ) ; $ resolver -> add ( $ this -> getTemplate ( ) , $ this -> getDefaultTemplatePath ( $ th... | Returns this view model as rendered html string . |
57,956 | protected function extractValueFromAssignmentString ( $ assignment ) { if ( ! $ assignment ) { return null ; } $ assignmentArray = explode ( "=" , $ assignment ) ; return isset ( $ assignmentArray [ 1 ] ) ? $ assignmentArray [ 1 ] : null ; } | Returns the value after the equality sign . |
57,957 | protected function assembleAssignmentString ( $ name , $ value , $ quote = '"' ) { if ( $ quote === '"' ) { return $ name . '="' . $ value . '"' ; } else if ( $ quote === "'" ) { return $ name . "='" . $ value . "'" ; } else if ( $ quote === false ) { return $ name . "=" . $ value ; } } | Returns a assignment string like a = b . |
57,958 | protected function buildHeaders ( \ Zend_Controller_Response_Abstract $ response , array $ headers ) { foreach ( $ headers as $ header => $ value ) { if ( ! in_array ( $ header , $ this -> defaultHeaders ) ) { $ response -> setHeader ( $ header , $ value ) ; } } return $ this ; } | Method build response headers |
57,959 | protected function disableViewAndLayout ( ) { $ layoout = \ Zend_Layout :: getMvcInstance ( ) ; if ( null !== $ layoout ) { $ layoout -> disableLayout ( ) ; } $ view = \ Zend_Controller_Action_HelperBroker :: getStaticHelper ( 'viewRenderer' ) ; if ( null !== $ view ) { $ view -> setNoRender ( true ) ; } return $ this ... | Method disable default html view and layout |
57,960 | public function run ( ServerRequestInterface $ request = null ) : void { if ( null === $ request ) { $ request = $ this -> getContainer ( ) -> get ( ServerRequestFactoryInterface :: class ) -> createServerRequestFromArray ( $ _SERVER ) ; } try { $ this -> response = $ this -> handleRequest ( $ request ) ; } catch ( \ T... | Application entry point . Takes the request as param or if it is not provided one is created from the globals and runs it throught the whole app stack . The response is then sent to the browser and the app business is finished . |
57,961 | private function handleRequest ( ServerRequestInterface $ request ) : ResponseInterface { $ this -> eventDispatcher -> dispatch ( new EventBeforeAppHandlingRequest ( $ request ) ) ; $ routerMatch = $ this -> matchRoute ( $ request ) ; $ stack = $ this -> getFullMiddlewareStack ( $ request , $ routerMatch ) ; $ this -> ... | Passes the response through the whole application stack . |
57,962 | private function matchRoute ( ServerRequestInterface $ request ) : RouterMatch { $ this -> eventDispatcher -> dispatch ( new EventBeforeAppMatchingRoute ( $ request ) ) ; try { $ routerMatch = $ this -> router -> match ( $ request ) ; } catch ( \ Throwable $ e ) { $ statusCode = 404 ; $ message = "$statusCode: Router c... | Matches the request to a route . |
57,963 | public function init ( ) { if ( version_compare ( $ GLOBALS [ 'wp_version' ] , self :: MIN_WP_VER , '<' ) ) { Compat :: loadNotices ( ) ; } add_action ( 'after_setup_theme' , [ $ this -> theme , 'addThemeSupports' ] ) ; add_action ( 'widgets_init' , [ $ this -> theme , 'registerWidgets' ] ) ; add_action ( 'wp_enqueue_s... | Initializes the framework |
57,964 | public function loginAction ( Request $ request ) { $ oauth = $ this -> get ( 'campaignchain.security.authentication.client.oauth.authentication' ) ; $ oauth -> authenticate ( self :: RESOURCE_OWNER , $ this -> applicationInfo , true ) ; $ wizard = $ this -> get ( 'campaignchain.core.channel.wizard' ) ; $ wizard -> set... | Perform the login into LinkedIn |
57,965 | public function editAction ( ) { if ( method_exists ( $ this , 'getEditForm' ) ) { $ form = $ this -> getEditForm ( ) ; } else { $ form = $ this -> getForm ( ) ; } $ id = $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'id' , 0 ) ; $ form -> add ( [ 'type' => 'Zend\Form\Element\Hidden' , 'name' => 'id' , 'att... | Altera uma entidade |
57,966 | public function safeAttributes ( ) { $ t = Yii :: createObject ( $ this -> getTranslationModelClassName ( ) ) ; return ArrayHelper :: merge ( parent :: safeAttributes ( ) , $ t -> safeAttributes ( ) ) ; } | Override safe attributes to include translation attributes |
57,967 | public function triggerEvent ( $ event , Payload $ payload ) { if ( $ payload -> state ( ) === null ) { $ this -> updatePayload ( $ this -> process -> initialState ( ) , $ payload ) ; } $ state = $ this -> process -> state ( $ payload -> state ( ) ) ; $ nextStateName = $ state -> triggerEvent ( $ event , $ payload ) ; ... | Trigger event for subject identified by identifier Restore subject from handler by its identifier then triggers event and saves subject Return run history |
57,968 | private function handleOnStateWasSet ( State $ state , Payload $ payload ) { while ( $ state -> hasEvent ( self :: ON_STATE_WAS_SET ) ) { $ newState = $ state -> triggerEvent ( self :: ON_STATE_WAS_SET , $ payload ) ; if ( $ newState === null ) { break ; } $ state = $ this -> process -> state ( $ newState ) ; $ this ->... | Handles onStateWasSet event Returns true if there was state change |
57,969 | public function hasErrors ( $ key = NULL ) { if ( $ key ) { return isset ( $ this [ $ key ] ) ; } else { if ( count ( $ this ) ) { return true ; } else { return false ; } } } | Does the handler have an error for the given key ? |
57,970 | public function getMethods ( $ path ) { if ( $ this -> methods -> has ( $ path ) ) { return $ this -> methods -> get ( $ path ) -> toArray ( ) ; } return [ ] ; } | Returns methods for a given path |
57,971 | public function setDate ( $ year , $ month = 1 , $ day = 1 ) { switch ( gettype ( $ year ) ) { case 'object' : $ year = ( array ) $ year ; case 'array' : $ arrIn = array_change_key_case ( $ year ) ; $ year = $ this -> format ( 'Y' ) ; $ month = $ this -> format ( 'n' ) ; $ day = $ this -> format ( 'j' ) ; foreach ( $ a... | Adds the ability to pass in an arrayor object with key names of variable length but a minimum of 3 characters upper or lower case . Requires one object one associative array or 3 integer parameters . |
57,972 | public function setTime ( $ hour , $ minute = 0 , $ second = 0 , $ mcs = 0 ) { switch ( gettype ( $ hour ) ) { case 'object' : $ hour = ( array ) $ hour ; case 'array' : $ arrIn = array_change_key_case ( $ hour ) ; $ hour = $ this -> format ( 'G' ) ; $ minute = $ this -> format ( 'i' ) ; $ second = $ this -> format ( '... | Adds the ability to pass in an array with key names of variable length but a minimum of 3 characters upper or lower case . Requires one object one associative array or 4 integer parameters . |
57,973 | protected function _writeStream ( $ buffer ) { $ fd = $ this -> socket_ ; $ total = TStringFuncFactory :: create ( ) -> strlen ( $ buffer ) ; if ( $ total <= 0 ) { return ; } $ failed = FALSE ; $ sent = 0 ; while ( ! $ failed && $ sent < $ total ) { if ( ! is_resource ( $ fd ) ) { $ failed = TRUE ; } try { $ written = ... | Helper to write the given buffer to the persistent socket . |
57,974 | protected function _readStream ( ) { if ( ! $ this -> debug_ ) { error_log ( 'Intended as a debug-only function' ) ; return ; } if ( ! is_resource ( $ this -> socket_ ) ) { error_log ( "Invalid socket handle" ) ; return ; } $ buffer = "" ; $ start = microtime ( TRUE ) ; while ( ! feof ( $ this -> socket_ ) ) { $ meta =... | Intended for debugging purposes only . The response is ignored in normal production circumstances as not to block the calling process . |
57,975 | protected function _ensureSocketCreated ( ) { if ( is_resource ( $ this -> socket_ ) ) { return TRUE ; } $ sockaddr = $ this -> scheme_ . '://' . $ this -> host_ ; $ port = $ this -> port_ ; $ timeout = self :: DEFAULT_CONNECT_TIMEOUT_SECS ; for ( $ retry = 0 ; $ retry < self :: MAX_SOCKET_OPEN_RETRIES ; $ retry ++ ) {... | Create the persistent socket connection if necessary . Otherwise do nothing . |
57,976 | protected function _closeSocket ( ) { if ( $ this -> debug_ ) { error_log ( "Closing socket." ) ; } $ fd = $ this -> socket_ ; if ( is_resource ( $ fd ) ) { $ this -> socket_ = null ; @ fclose ( $ fd ) ; } } | Close the persistent connection . Note this does not necessarily close the socket itself as it is persisted but the handle this process has to it . |
57,977 | public function updateRewrite ( string $ postType , $ args ) { global $ wp_post_types , $ wp_rewrite ; $ pageForPostType = get_option ( 'page_for_' . $ postType ) ; if ( ! $ pageForPostType ) { return ; } $ postStatus = get_post_status ( $ pageForPostType ) ; if ( ! in_array ( $ postStatus , array ( 'publish' , 'privat... | Updates the rewrite rules for the posttype |
57,978 | public function rebuildRewriteRules ( $ postType , $ args ) { global $ wp_post_types , $ wp_rewrite ; if ( ! is_admin ( ) && empty ( get_option ( 'permalink_structure' ) ) ) { return ; } if ( $ args -> has_archive ) { $ archiveSlug = $ args -> has_archive === true ? $ args -> rewrite [ 'slug' ] : $ args -> has_archive ... | Rebuild rewrite rules |
57,979 | public function orderBy ( $ col = 'id' , $ type = 'asc' ) { try { if ( ! is_null ( $ this -> query ) ) { $ this -> query .= ' ORDER BY ' . $ col . ' ' . $ type ; return $ this ; } } catch ( \ Exception $ exception ) { var_dump ( $ exception -> getMessage ( ) ) ; } } | Order by statement |
57,980 | public function orWhereLike ( $ column , $ value ) { try { if ( ! is_null ( $ this -> query ) ) { $ this -> query .= ' OR ' . $ column . ' LIKE "' . $ value . '"' ; return $ this ; } } catch ( \ Exception $ exception ) { var_dump ( $ exception -> getMessage ( ) ) ; } } | Or where like statement |
57,981 | public function groupWhere ( $ callback ) { $ origQuery = $ this -> query ; $ this -> query = '' ; $ qb = $ callback ( $ this ) ; $ query = $ qb -> query . ')' ; $ query = preg_replace ( '/AND /' , 'AND (' , $ query , 1 ) ; $ this -> query = $ origQuery . $ query ; } | Group where statement |
57,982 | public function getInfoAction ( $ actorId , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'EcommerceBundle:Address' ) -> findOneById ( $ id ) ; $ addressResponse = new stdClass ( ) ; $ addressResponse -> id = $ entity -> getId ( ) ; $ addressResponse -> address = $ ent... | Returns a list of Address entities in JSON format . |
57,983 | public function & createTitle ( $ text = '' , $ autoadd = true ) { $ title = new PanelTitle ( ) ; if ( ! empty ( $ text ) ) { $ title -> setTitle ( $ text ) ; } if ( $ autoadd ) { $ this -> title = $ title ; } return $ title ; } | Creates a PanelTitle object adds it by default as title to use in the heading and returns a reference to it |
57,984 | public static function format ( $ date = false , $ format = 'Y-m-d H:i:s' ) { if ( $ date ) { $ DateTime = new DateTime ( $ date ) ; return $ DateTime -> format ( $ format ) ; } return false ; } | Get date in given format . |
57,985 | public static function isDate ( $ date = false , $ format = 'Y-m-d H:i:s' ) { if ( $ date ) { $ DateTime = DateTime :: createFromFormat ( $ format , $ date ) ; return $ DateTime && $ DateTime -> format ( $ format ) == $ date ; } return false ; } | Check if date is valid . |
57,986 | public static function Auto ( $ Mixed ) { $ Formatter = C ( 'Garden.InputFormatter' ) ; if ( ! method_exists ( 'Gdn_Format' , $ Formatter ) ) return $ Mixed ; return Gdn_Format :: $ Formatter ( $ Mixed ) ; } | Takes a mixed variable filters unsafe things renders BBCode and returns it . |
57,987 | public static function Clean ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) return self :: To ( $ Mixed , 'Clean' ) ; $ Mixed = strtr ( $ Mixed , self :: $ _CleanChars ) ; $ Mixed = preg_replace ( '/[^A-Za-z0-9 ]/' , '' , urldecode ( $ Mixed ) ) ; $ Mixed = preg_replace ( '/ +/' , '-' , trim ( $ Mixed ) ) ; return strtol... | Convert certain unicode characters into their ascii equivalents . |
57,988 | public static function DateFull ( $ Timestamp , $ Format = '' ) { if ( $ Timestamp === NULL ) return T ( 'Null Date' , '-' ) ; if ( ! is_numeric ( $ Timestamp ) ) { $ Timestamp = self :: ToTimestamp ( $ Timestamp ) ; } if ( ! $ Timestamp ) $ Timestamp = time ( ) ; $ GmTimestamp = $ Timestamp ; $ Now = time ( ) ; $ Sess... | Formats a MySql datetime or a unix timestamp for display in the system . |
57,989 | public static function Display ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) return self :: To ( $ Mixed , 'Display' ) ; else { $ Mixed = htmlspecialchars ( $ Mixed , ENT_QUOTES , C ( 'Garden.Charset' , '' ) ) ; $ Mixed = str_replace ( array ( """ , "&" ) , array ( '"' , '&' ) , $ Mixed ) ; $ Mixed = self :: Me... | Takes a mixed variable formats it for display on the screen and returns it . |
57,990 | public static function Email ( $ Email ) { $ Max = max ( 3 , floor ( strlen ( $ Email ) / 2 ) ) ; $ Chunks = str_split ( $ Email , mt_rand ( 3 , $ Max ) ) ; $ Chunks = array_map ( 'htmlentities' , $ Chunks ) ; $ St = mt_rand ( 0 , 1 ) ; $ End = count ( $ Chunks ) - mt_rand ( 1 , 4 ) ; $ Result = '' ; foreach ( $ Chunks... | Formats an email address in a non - scrapable format . |
57,991 | public static function Form ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) return self :: To ( $ Mixed , 'Form' ) ; else { if ( C ( 'Garden.Format.ReplaceNewlines' , TRUE ) ) return nl2br ( htmlspecialchars ( $ Mixed , ENT_QUOTES , C ( 'Garden.Charset' , '' ) ) ) ; else return htmlspecialchars ( $ Mixed , ENT_QUOTES , C ... | Takes a mixed variable formats it for display in a form and returns it . |
57,992 | public static function Html ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) { return self :: To ( $ Mixed , 'Html' ) ; } else { $ IsHtml = strpos ( $ Mixed , '<' ) !== FALSE || ( bool ) preg_match ( '/&#?[a-z0-9]{1,10};/i' , $ Mixed ) ; if ( $ IsHtml ) { $ Formatter = Gdn :: Factory ( 'HtmlFormatter' ) ; if ( is_null ( $ ... | Takes a mixed variable filters unsafe html and returns it . |
57,993 | public static function Image ( $ Body ) { if ( is_string ( $ Body ) ) { $ Image = @ unserialize ( $ Body ) ; if ( ! $ Image ) return Gdn_Format :: Html ( $ Body ) ; } $ Url = GetValue ( 'Image' , $ Image ) ; $ Caption = Gdn_Format :: PlainText ( GetValue ( 'Caption' , $ Image ) ) ; return '<div class="ImageWrap">' . '<... | Format a serialized string of image properties as html . |
57,994 | public static function PlainText ( $ Body , $ Format = 'Html' ) { $ Result = Gdn_Format :: To ( $ Body , $ Format ) ; if ( $ Format != 'Text' ) { $ Result = str_replace ( array ( "\n" , "\r" ) , ' ' , $ Result ) ; $ Result = preg_replace ( '`<br\s*/?>`' , "\n" , $ Result ) ; $ Result = str_replace ( '<li>' , '* ' , $ R... | Format a string as plain text . |
57,995 | public static function Links ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) return self :: To ( $ Mixed , 'Links' ) ; else { $ Regex = "`(?:(</?)([!a-z]+))|(/?\s*>)|((?:https?|ftp)://[\@a-z0-9\x21\x23-\x27\x2a-\x2e\x3a\x3b\/;\x3f-\x7a\x7e\x3d]+)`i" ; self :: LinksCallback ( NULL ) ; $ Mixed = preg_replace_callback ( $ Re... | Formats the anchor tags around the links in text . |
57,996 | protected static function ListCallback ( $ Matches ) { $ Content = explode ( "[*]" , $ Matches [ 1 ] ) ; $ Result = '' ; foreach ( $ Content as $ Item ) { if ( trim ( $ Item ) != '' ) $ Result .= '<li>' . $ Item . '</li>' ; } $ Result = '<ul>' . $ Result . '</ul>' ; return $ Result ; } | Formats BBCode list items . |
57,997 | public static function GetEmbedSize ( ) { $ Sizes = array ( 'tiny' => array ( 400 , 225 ) , 'small' => array ( 560 , 340 ) , 'normal' => array ( 640 , 385 ) , 'big' => array ( 853 , 505 ) , 'huge' => array ( 1280 , 745 ) ) ; $ Size = Gdn :: Config ( 'Garden.Format.EmbedSize' , 'normal' ) ; if ( ! isset ( $ Sizes [ $ Si... | Returns embedded video width and height based on configuration . |
57,998 | public static function Markdown ( $ Mixed ) { if ( ! is_string ( $ Mixed ) ) { return self :: To ( $ Mixed , 'Markdown' ) ; } else { $ Formatter = Gdn :: Factory ( 'HtmlFormatter' ) ; if ( is_null ( $ Formatter ) ) { return Gdn_Format :: Display ( $ Mixed ) ; } else { require_once ( PATH_LIBRARY . '/vendors/markdown/ma... | Format a string using Markdown syntax . Also purifies the output html . |
57,999 | public static function Serialize ( $ Mixed ) { if ( is_array ( $ Mixed ) || is_object ( $ Mixed ) || ( is_string ( $ Mixed ) && ( substr_compare ( 'a:' , $ Mixed , 0 , 2 ) === 0 || substr_compare ( 'O:' , $ Mixed , 0 , 2 ) === 0 || substr_compare ( 'arr:' , $ Mixed , 0 , 4 ) === 0 || substr_compare ( 'obj:' , $ Mixed ,... | Takes any variable and serializes it . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.