idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
232,600 | public function getLabel ( ) { if ( $ this -> label ) { return $ this -> translate ( $ this -> label ) ; } $ labels = array ( ) ; if ( $ this -> form -> model && is_string ( $ this -> form -> model ) ) { $ class = $ this -> form -> model ; $ labels = $ class :: getLabels ( ) ; } elseif ( $ this -> form -> model && is_o... | Get label for current field . It will first try to get label attribute if that s not specified it will check for a model and read the label from there if it s still not found then it will generate one using the name . |
232,601 | public function display ( Form $ form ) { if ( ! $ this -> visible ) { return "" ; } $ this -> form = $ form ; if ( ! isset ( $ this -> rowHtmlOptions [ 'class' ] ) ) { $ this -> rowHtmlOptions [ 'class' ] = $ this -> rowClass ; } else { $ this -> rowHtmlOptions [ 'class' ] .= ' ' . $ this -> rowClass ; } if ( ! is_nul... | Get html content for current field . |
232,602 | public function getHTMLError ( ) { $ error = $ this -> getError ( ) ; if ( ! is_null ( $ error ) ) { if ( is_string ( $ error ) ) { $ errorContent = Html :: get ( ) -> tag ( 'span' , $ error ) ; } elseif ( is_array ( $ error ) ) { $ errors = array ( ) ; foreach ( $ error as $ message ) { $ errors [ ] = Html :: get ( ) ... | Get HTML code for errors . |
232,603 | public function getError ( ) { if ( $ this -> error ) { return $ this -> translate ( $ this -> error ) ; } if ( $ this -> form -> model && is_object ( $ this -> form -> model ) && $ this -> form -> model -> hasErrors ( $ this -> name ) ) { $ errors = $ this -> form -> model -> getErrors ( $ this -> name ) ; foreach ( $... | Return a simple text message or a list of messages with errors for current field |
232,604 | public function query ( $ sql , $ binders = array ( ) , $ suggestedClass = null , $ debug = false ) { $ minBinderLocation = 0 ; if ( ! is_array ( $ binders ) ) $ binders = array ( $ binders ) ; if ( ! empty ( $ binders ) ) { foreach ( $ binders as & $ bound ) { $ bound = $ this -> provider -> escapeItem ( $ bound ) ; $... | Run an SQL query |
232,605 | public function __getSerialisablePropertyValue ( $ propertyName ) { $ map = $ this -> __getSerialisablePropertyMap ( ) ; if ( array_key_exists ( $ propertyName , $ map ) ) { return $ map [ $ propertyName ] ; } elseif ( array_key_exists ( substr ( strtoupper ( $ propertyName ) , 0 , 1 ) . substr ( $ propertyName , 1 ) ,... | Get a serialisable property value by name if it exists . Throw an exception if it doesn t exist . |
232,606 | public function __getSerialisablePropertyMap ( ) { $ propertyAccessors = $ this -> __findSerialisablePropertyAccessors ( ) ; $ propertyMap = array ( ) ; foreach ( $ propertyAccessors as $ accessorSet ) { if ( isset ( $ accessorSet [ "get" ] ) ) { $ accessor = $ accessorSet [ "get" ] ; if ( $ accessor instanceof \ Refle... | Get an associative array of all of the serialisable properties defined on this class . |
232,607 | public function __setSerialisablePropertyMap ( $ propertyMap , $ ignoreNoneWritableProperties = false ) { $ propertyAccessors = $ this -> __findSerialisablePropertyAccessors ( ) ; $ noneWritables = array ( ) ; foreach ( $ propertyMap as $ inputPropertyName => $ propertyValue ) { $ propertyName = strtolower ( $ inputPro... | Set an associative array of serialisable properties |
232,608 | public function __findSerialisablePropertyAccessors ( ) { $ className = get_class ( $ this ) ; if ( ! isset ( self :: $ __accessorMaps [ $ className ] ) ) { $ reflectionClass = new \ ReflectionClass ( $ className ) ; $ accessors = array ( ) ; $ methods = $ reflectionClass -> getMethods ( ) ; foreach ( $ methods as $ me... | Find all serialisable property objects return a map of accessor objects keyed in by GET and SET . |
232,609 | public function forever ( $ name = '' , $ value = '' , $ path = '/' , $ domain = null , $ secure = false , $ httpOnly = false ) { $ this -> set ( $ name , $ value , 2628000 , $ path , $ domain , $ secure , $ httpOnly ) ; return $ this ; } | this cookie life very long time |
232,610 | public function format ( $ entities ) { $ data = array ( 'models' => array ( ) , 'images' => array ( ) , 'links' => array ( ) ) ; if ( ! is_array ( $ entities ) ) { $ entities = array ( $ entities -> getId ( ) => $ entities ) ; } foreach ( $ entities as $ entity ) { if ( $ entity instanceof \ Application \ Togu \ Appli... | Prepares the data to be serialized |
232,611 | public function register ( ) { $ this -> prepare_hook = $ this -> prepare_hook ? : Hook :: subscribe ( 'Wedeto.HTTP.Forms.Form.prepare' , [ $ this , 'hookPrepareForm' ] ) ; $ this -> validate_hook = $ this -> validate_hook ? : Hook :: subscribe ( 'Wedeto.HTTP.Forms.Form.isValid' , [ $ this , 'hookIsValid' ] ) ; } | Subscribe to two hooks prepare and isValid |
232,612 | public function unregister ( ) { if ( $ this -> prepare_hook ) { Hook :: unsubscribe ( 'Wedeto.HTTP.Forms.Form.prepare' , $ this -> prepare_hook ) ; $ this -> prepare_hook = null ; } if ( $ this -> validate_hook ) { Hook :: unsubscribe ( 'Wedeto.HTTP.Forms.Form.isValid' , $ this -> validate_hook ) ; $ this -> validate_... | Unsubscribe from the two hooks |
232,613 | public function hookPrepareForm ( Dictionary $ params ) { $ session = $ params [ 'session' ] ; $ form = $ params [ 'form' ] ; if ( $ session !== null ) { $ nonce_name = Nonce :: getParameterName ( ) ; if ( ! isset ( $ form [ $ nonce_name ] ) ) { $ context = [ ] ; $ nonce = Nonce :: getNonce ( $ form -> getName ( ) , $ ... | The hook called when the form is being prepared . Is used to add the nonce field to the form . |
232,614 | public function hookIsValid ( Dictionary $ params ) { $ form = $ params [ 'form' ] ; $ request = $ params [ 'request' ] ; $ arguments = $ params [ 'arguments' ] ; $ result = Nonce :: validateNonce ( $ form -> getName ( ) , $ request -> session , $ arguments ) ; $ nonce_name = Nonce :: getParameterName ( ) ; if ( $ resu... | The hook called when the form is validated . Is used to validate that the received nonce is valid . |
232,615 | public static function createNewInstanceWithoutConstructor ( $ className , array $ arguments = [ ] ) { $ reflectedClass = new ReflectionClass ( $ className ) ; $ newInstance = $ reflectedClass -> newInstanceWithoutConstructor ( ) ; $ reflectedConstructor = $ reflectedClass -> getConstructor ( ) ; if ( null !== $ reflec... | Creates a new instance of the class with the specified class name without invoking its constructor . |
232,616 | public static function invokeMethod ( $ object , $ methodName , array $ arguments = [ ] ) { $ reflectedObject = new ReflectionObject ( $ object ) ; $ reflectedMethod = $ reflectedObject -> getMethod ( $ methodName ) ; $ reflectedMethod -> setAccessible ( true ) ; $ reflectedMethod -> invokeArgs ( $ object , $ arguments... | Invokes the specified method on the specified object . |
232,617 | public function add ( string $ name , callable $ callback ) : \ IvoPetkov \ BearFrameworkAddons \ ServerRequests { $ this -> callbacks [ $ name ] = $ callback ; return $ this ; } | Register a named callback |
232,618 | public function execute ( string $ name , array $ data , \ BearFramework \ App \ Response $ response ) : string { if ( isset ( $ this -> callbacks [ $ name ] ) ) { return ( string ) call_user_func ( $ this -> callbacks [ $ name ] , $ data , $ response ) ; } return '' ; } | Executes the callback for the name specified |
232,619 | public function process ( array $ input ) { try { $ success = $ this -> v -> validate ( $ input ) ; } catch ( ValidationException $ e ) { $ this -> setErrorsAndThrowException ( ) ; } if ( ! $ success ) { $ this -> setErrorsAndThrowException ( ) ; } Event :: fire ( "form.processing" , array ( $ input ) ) ; return $ this... | Processa l input e chiama create o opdate a seconda |
232,620 | public function renderContent ( ) { if ( is_object ( $ this -> content ) && ! method_exists ( $ this -> content , '__toString' ) ) { throw new \ LogicException ( 'Cannot render content: it is an object without __toString method!' ) ; } if ( is_array ( $ this -> content ) ) { throw new \ LogicException ( 'Cannot render ... | Render content . |
232,621 | protected function attributes ( $ attributes = [ ] ) { $ ar = [ ] ; foreach ( $ attributes as $ key => $ value ) { $ element = $ this -> attribute ( $ key , $ value ) ; if ( ! is_null ( $ element ) ) { $ ar [ ] = $ element ; } } return count ( $ ar ) > 0 ? ' ' . implode ( ' ' , $ ar ) : '' ; } | Cycles through given attributes and sets them for the element . |
232,622 | protected function attribute ( $ key , $ value ) { if ( is_numeric ( $ key ) ) { $ key = $ value ; } if ( ! is_null ( $ value ) ) { return $ key . '="' . $ value . '"' ; } } | Creates the attribute string . |
232,623 | public function obfuscate ( $ value ) { $ safe = '' ; foreach ( str_split ( $ value ) as $ letter ) { if ( ord ( $ letter ) > 128 ) { return $ letter ; } switch ( rand ( 1 , 3 ) ) { case 1 : $ safe .= '&#' . ord ( $ letter ) . ';' ; break ; case 2 : $ safe .= '&#x' . dechex ( ord ( $ letter ) ) . ';' ; break ; case 3 :... | Obfuscates a string . |
232,624 | public function postMediaAction ( $ provider , Request $ request ) { $ pool = $ this -> get ( "sonata.media.pool" ) ; $ manager = $ this -> get ( "sonata.media.manager.media" ) ; $ formFactory = $ this -> get ( 'form.factory' ) ; try { $ mediaProvider = $ pool -> getProvider ( $ provider ) ; } catch ( \ RuntimeExceptio... | Create a new media |
232,625 | public function addOut ( $ str , $ wrapTag = 0 , $ attributes = array ( ) ) { if ( is_string ( $ str ) ) { if ( is_string ( $ wrapTag ) ) { $ str = Html :: element ( $ wrapTag , $ attributes , $ str ) ; } $ this -> mainOutput [ 'body' ] .= $ str ; return true ; } else { return false ; } } | Add a string to the output memory |
232,626 | public function clientKick ( $ clid , $ reasonid = Teamspeak :: KICK_CHANNEL , $ reasonmsg = null ) { $ this -> clientListReset ( ) ; $ this -> execute ( "clientkick" , array ( "clid" => $ clid , "reasonid" => $ reasonid , "reasonmsg" => $ reasonmsg ) ) ; } | Kicks one or more clients from their currently joined channel or from the server . |
232,627 | public function channelGroupGetByName ( $ name , $ type = Teamspeak :: GROUP_DBTYPE_REGULAR ) { foreach ( $ this -> channelGroupList ( ) as $ group ) { if ( $ group [ "name" ] == $ name && $ group [ "type" ] == $ type ) { return $ group ; } } throw new Ts3Exception ( "invalid groupID" , 0xA00 ) ; } | Returns the Channelgroup object matching the given name . |
232,628 | public function snapshotCreate ( $ mode = Teamspeak :: SNAPSHOT_STRING ) { $ snapshot = $ this -> request ( "serversnapshotcreate" ) -> toString ( false ) ; switch ( $ mode ) { case Teamspeak :: SNAPSHOT_BASE64 : return $ snapshot -> toBase64 ( ) ; break ; case Teamspeak :: SNAPSHOT_HEXDEC : return $ snapshot -> toHex ... | Creates and returns snapshot data for the selected virtual server . |
232,629 | public function checkData ( array $ data ) { $ keys = array ( 'to' , 'fullname' , 'title' , 'activationLink' , 'siteurl' , 'cdnurl' , 'siteName' ) ; foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ data ) ) { throw new \ Exception ( 'Key not in data' ) ; } } return $ this ; } | Checks if data contains neede keye |
232,630 | public static function register ( ) { $ class = new self ( ) ; Events :: addListener ( array ( $ class , 'screenLogEventListener' ) , 'screenLogEvent' , EventPriority :: NORMAL ) ; $ bar = Debugger :: getBar ( ) ; $ bar -> addPanel ( $ class ) ; } | Register the bar and register the event which will block the screen log |
232,631 | static function cryptoJsAesDecrypt ( $ passphrase , $ jsonString ) { $ jsondata = json_decode ( $ jsonString , true ) ; try { $ salt = hex2bin ( $ jsondata [ "s" ] ) ; $ iv = hex2bin ( $ jsondata [ "iv" ] ) ; } catch ( \ Exception $ e ) { return null ; } $ ct = base64_decode ( $ jsondata [ "ct" ] ) ; $ concatedPassphra... | Decrypt data from a CryptoJS json encoding string |
232,632 | static function cryptoJsAesEncrypt ( $ passphrase , $ value ) { $ salt = openssl_random_pseudo_bytes ( 8 ) ; $ salted = '' ; $ dx = '' ; while ( strlen ( $ salted ) < 48 ) { $ dx = md5 ( $ dx . $ passphrase . $ salt , true ) ; $ salted .= $ dx ; } $ key = substr ( $ salted , 0 , 32 ) ; $ iv = substr ( $ salted , 32 , 1... | Encrypt value to a cryptojs compatiable json encoding string |
232,633 | protected function Init ( ) { $ this -> login = ContentLogin :: Schema ( ) -> ByContent ( $ this -> Content ( ) ) ; $ this -> HandleLoggedIn ( ) ; $ passwordUrl = $ this -> login -> GetPasswordUrl ( ) ; $ this -> passwordUrl = $ passwordUrl ? FrontendRouter :: Url ( $ passwordUrl ) : '' ; $ this -> AddNameField ( ) ; $... | Initializes the login element |
232,634 | public function getIterator ( ) { $ resp = $ this -> query -> execute ( ) ; foreach ( $ resp -> data as $ document ) { yield $ document ; } while ( $ resp -> cursors -> next ) { $ resp = $ this -> query -> execute ( $ resp -> cursors -> next ) ; foreach ( $ resp -> data as $ document ) { yield $ document ; } } } | Required function for any class that implements IteratorAggregate . Will yield documents as they become available . If cursors are returned then subsequent requests will be made yielding more documents . |
232,635 | public function save ( $ doc ) { return $ this -> montage -> request ( 'post' , $ this -> montage -> url ( 'document-save' , $ this -> schema -> name ) , [ 'body' => json_encode ( $ doc ) ] ) ; } | Persist one or more document objects to montage . |
232,636 | public function get ( $ docId ) { return $ this -> montage -> request ( 'get' , $ this -> montage -> url ( 'document-detail' , $ this -> schema -> name , $ docId ) ) ; } | Get a single document by it s ID from montage . |
232,637 | public function delete ( $ docId ) { return $ this -> montage -> request ( 'delete' , $ this -> montage -> url ( 'document-detail' , $ this -> schema -> name , $ docId ) ) ; } | Delete a record with montage . |
232,638 | protected function initializeCallQueues ( ) { $ this -> inputs = new \ Slab \ Sequencer \ CallQueue ( ) ; $ this -> operations = new \ Slab \ Sequencer \ CallQueue ( ) ; $ this -> outputs = new \ Slab \ Sequencer \ CallQueue ( ) ; } | Sequenced constructor . |
232,639 | protected function executeCallQueues ( ) { foreach ( $ this -> inputs -> getEntries ( ) as $ entry ) { $ this -> executeCallQueueEntry ( $ entry ) ; if ( ! $ this -> executeQueues ) return ; } foreach ( $ this -> operations -> getEntries ( ) as $ entry ) { $ this -> executeCallQueueEntry ( $ entry ) ; if ( ! $ this -> ... | Execute call queues |
232,640 | protected function stopCallQueues ( ) { $ this -> executeQueues = false ; $ this -> inputs -> stopExecution ( ) ; $ this -> operations -> stopExecution ( ) ; $ this -> outputs -> stopExecution ( ) ; } | Stop call queues |
232,641 | protected function initSourceImageResource ( ) { $ ext = $ this -> getExtension ( ) ; switch ( $ ext ) { case 'gif' : $ this -> sourceImageResource = ImageCreateFromGif ( $ this -> sourceImagePath ) ; break ; case 'jpg' : $ this -> sourceImageResource = ImageCreateFromJpeg ( $ this -> sourceImagePath ) ; break ; case '... | Init the source image resource |
232,642 | protected function initDestImageResource ( ) { if ( function_exists ( "ImageCreateTrueColor" ) && $ this -> getExtension ( ) != 'gif' ) { $ this -> destImageResource = ImageCreateTrueColor ( $ this -> destImageWidth , $ this -> destImageHeight ) ; } else { $ this -> destImageResource = ImageCreate ( $ this -> destImage... | Init the destination resource image . This is an empty image and use the width and height values of the source image if resize is not called by the user |
232,643 | public function format ( Geo $ geo ) { return '<span class="h-geo">' . '<span class="p-latitude">' . ( string ) $ geo -> getLatitude ( ) . '</span>, ' . '<span class="p-longitude">' . ( string ) $ geo -> getLongitude ( ) . '</span>' . ( $ geo -> getAltitude ( ) === null ? '' : ' (elevation <span class="p-altitude">' . ... | Formats a geo . |
232,644 | function Save ( ) { $ this -> pageRights -> Save ( ) ; if ( ! $ this -> rights ) { $ this -> rights = new BackendSiteRights ( ) ; } $ this -> rights -> SetEdit ( $ this -> Value ( 'Edit' ) ) ; $ this -> rights -> SetRemove ( $ this -> Value ( 'Remove' ) ) ; $ this -> rights -> SetPageRights ( $ this -> pageRights -> Ri... | Saves the site rights |
232,645 | public static function XML2Array ( $ xmlString ) { try { $ xml = simplexml_load_string ( $ xmlString , "SimpleXMLElement" , LIBXML_NOCDATA ) ; $ json = json_encode ( $ xml ) ; $ result = json_decode ( $ json , TRUE ) ; } catch ( \ Exception $ ex ) { $ result = '' ; } return $ result ; } | Convert XML to array |
232,646 | public static function array2XML ( $ haystack , $ rootElementName = '' ) { $ args = func_get_args ( ) ; $ isRoot = ! isset ( $ args [ 2 ] ) ; $ root = isset ( $ args [ 3 ] ) ? $ args [ 3 ] : new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ parent = isset ( $ args [ 2 ] ) ? $ args [ 2 ] : ( $ rootElementName !== '' ? $ root ->... | Convert array to XML object |
232,647 | private function fetchLocal ( ) { $ finfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ this -> mime = finfo_file ( $ finfo , $ this -> path ) ; finfo_close ( $ finfo ) ; $ this -> data = file_get_contents ( $ this -> path , FILE_USE_INCLUDE_PATH ) ; } | Fetch a local file and grab its mime type and file content |
232,648 | public function create ( $ sMethod = null ) { if ( empty ( $ sMethod ) ) { $ sMethod = self :: $ sDefaultMechanism ; } if ( array_search ( $ sMethod , $ this -> aRegisteredMechanisms ) === false ) { throw new Exception ( 'Unknown caching mechanism' ) ; } if ( ! isset ( $ this -> aCacheInstance [ $ sMethod ] ) ) { requi... | Create and return caching mechanism object according to passed name |
232,649 | public function setModule ( $ value ) { if ( is_object ( $ value ) ) { $ this -> module = get_class ( $ value ) ; } else { $ this -> module = ( string ) $ value ; } } | Set module property |
232,650 | public function compile ( ) { $ this -> doLoad ( ) ; $ data = ( array ) $ this -> data ; $ this -> removeKey ( $ data , 'include' ) ; $ this -> removeKey ( $ data , '__META__' ) ; return var_export ( $ data , true ) ; } | Compiles the current configuration to a valid PHP snippet . |
232,651 | public function load ( ) { if ( empty ( $ this -> data ) ) { $ this -> data = $ this -> doLoad ( ) ; } return $ this -> data ; } | Loads and returns the configuration data . |
232,652 | private static function CalcKey ( Member $ member ) { return sha1 ( $ member -> GetPasswordSalt ( ) . $ member -> GetConfirmed ( ) . $ member -> GetName ( ) ) ; } | Returns the password key |
232,653 | public function assign ( $ value , int $ type = PDO :: PARAM_STR ) { $ key = $ this -> getNextKey ( ) ; $ this -> params [ $ key ] = $ value ; $ this -> param_types [ $ key ] = $ type ; return $ key ; } | Set a value for the next parameters in the query |
232,654 | public function getParameterType ( string $ key ) { if ( ! array_key_exists ( $ key , $ this -> params ) ) throw new OutOfRangeException ( "Invalid key: $key" ) ; return $ this -> param_types [ $ key ] ; } | Get the type of parameter the key is set to |
232,655 | public function set ( string $ key , $ value , int $ type = PDO :: PARAM_STR ) { $ this -> params [ $ key ] = $ value ; $ this -> param_types [ $ key ] = $ type ; return $ this ; } | Set the value for an existing parameters . |
232,656 | public function registerTable ( $ name , $ alias ) { if ( ! empty ( $ alias ) && empty ( $ name ) ) return ; if ( ! empty ( $ alias ) && ! empty ( $ this -> parent_scope ) ) { $ table = $ this -> parent_scope -> resolveAlias ( $ alias ) ; if ( ! empty ( $ table ) ) throw new QueryException ( "Duplicate alias \"$alias\"... | Register a table used in the query |
232,657 | public function resolveAlias ( string $ alias ) { if ( isset ( $ this -> aliases [ $ alias ] ) ) return $ this -> aliases [ $ alias ] ; if ( empty ( $ this -> parent_scope ) ) return null ; return $ this -> parent_scope -> resolveAlias ( $ alias ) ; } | Find a table by its alias |
232,658 | public function resolveTable ( string $ name ) { if ( ! empty ( $ name ) && is_string ( $ name ) ) { if ( isset ( $ this -> aliases [ $ name ] ) ) return array ( $ this -> aliases [ $ name ] , $ name ) ; if ( isset ( $ this -> tables [ $ name ] ) ) { if ( count ( $ this -> tables [ $ name ] ) === 1 ) return array ( $ n... | Find a table by its name |
232,659 | public function bindParameters ( \ PDOStatement $ statement ) { foreach ( array_keys ( $ this -> params ) as $ key ) { $ type = $ this -> param_types [ $ key ] ; $ statement -> bindParam ( $ key , $ this -> params [ $ key ] , $ type ) ; } return $ this ; } | Bind the paramters to a PDOStatement |
232,660 | public function generateAlias ( Clause $ clause ) { if ( $ clause instanceof FieldName ) { $ table = $ clause -> getTable ( ) ; if ( empty ( $ table ) ) { return "" ; } $ prefix = $ table -> getPrefix ( ) ; $ alias = $ prefix . '_' . $ clause -> getField ( ) ; } elseif ( $ clause instanceof SQLFunction ) { $ func = $ c... | Generate an alias for a table |
232,661 | public function getSubScope ( int $ num = null ) { if ( $ num !== null ) { if ( ! isset ( $ this -> scopes [ $ num ] ) ) throw new QueryException ( "Invalid scope number: $num" ) ; return $ this -> scopes [ $ num ] ; } $ scope = new Parameters ( $ this -> driver ) ; $ scope -> params = & $ this -> params ; $ scope -> p... | Create a sub scope for a nester query |
232,662 | private function loadPvForQuote ( $ quoteId ) { if ( ! isset ( $ this -> cachePvQuote [ $ quoteId ] ) ) { $ found = $ this -> daoPvQuote -> getById ( ( int ) $ quoteId ) ; $ this -> cachePvQuote [ $ quoteId ] = $ found ; } return $ this -> cachePvQuote [ $ quoteId ] ; } | Cacheable loader for quote s PV . |
232,663 | private function loadPvForQuoteItem ( $ itemId ) { if ( ! isset ( $ this -> cachePvQuoteItem [ $ itemId ] ) ) { $ found = $ this -> daoPvQuoteItem -> getById ( ( int ) $ itemId ) ; $ this -> cachePvQuoteItem [ $ itemId ] = $ found ; } return $ this -> cachePvQuoteItem [ $ itemId ] ; } | Cacheable loader for quote item s PV . |
232,664 | protected function remove ( $ filterOrName ) { $ name = $ this -> getNameByFilter ( $ filterOrName ) ; if ( $ this -> has ( $ name ) ) { unset ( $ this -> collection [ $ name ] ) ; return true ; } return false ; } | Removes a filter from the collection . |
232,665 | static public function createSplFileInfo ( $ baseDir , $ path ) { $ absPath = realpath ( $ path ) ; $ baseDirLen = strlen ( $ baseDir ) ; if ( $ baseDir === substr ( $ absPath , 0 , $ baseDirLen ) ) { $ subPathName = ltrim ( substr ( $ absPath , $ baseDirLen ) , '\\/' ) ; $ dir = dirname ( $ subPathName ) ; $ subPath =... | Generate SplFileInfo from base dir |
232,666 | protected function loadStorage ( $ resource ) { $ template = $ this -> parser -> parse ( $ resource ) ; $ key = $ template -> getLogicalName ( ) ; if ( isset ( $ this -> cache [ $ key ] ) ) { return $ this -> cache [ $ key ] ; } $ storage = $ this -> template_loader -> load ( $ template ) ; if ( ! $ storage instanceof ... | Loads a resource from the template loader |
232,667 | public function write ( $ text , $ color = null , $ bgColor = null ) { $ this -> adapter -> write ( $ text , $ color , $ bgColor ) ; } | Write a chunk of text to console . |
232,668 | public function writeLine ( $ text = "" , $ color = null , $ bgColor = null ) { $ this -> adapter -> writeLine ( $ text , $ color , $ bgColor ) ; } | Write a single line of text to console and advance cursor to the next line . If the text is longer than console width it will be truncated . |
232,669 | public function writeTextBlock ( $ text , $ width , $ height = null , $ x = 0 , $ y = 0 , $ color = null , $ bgColor = null ) { $ this -> adapter -> writeTextBlock ( $ text , $ width , $ height , $ x , $ y , $ color , $ bgColor ) ; } | Write a block of text at the given coordinates matching the supplied width and height . In case a line of text does not fit desired width it will be wrapped to the next line . In case the whole text does not fit in desired height it will be truncated . |
232,670 | public function colorize ( $ string , $ color = null , $ bgColor = null ) { return $ this -> adapter -> colorize ( $ string , $ color , $ bgColor ) ; } | Prepare a string that will be rendered in color . |
232,671 | public function writeSelectPrompt ( $ message , & $ options ) { $ this -> writeLine ( ) ; foreach ( $ options as $ optionKey => $ optionValue ) { $ options [ $ optionKey ] = $ this -> translator -> translate ( $ optionValue ) ; } $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Select ( $ this -> t... | Write a customizable prompt |
232,672 | public function writeLinePrompt ( $ message ) { $ this -> writeLine ( ) ; $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Line ( $ this -> translator -> translate ( $ message ) , false ) ; $ answer = $ prompt -> show ( ) ; $ this -> writeLine ( ) ; return $ answer ; } | Write a customizable line prompt |
232,673 | public function writeConfirmPrompt ( $ message , $ yes , $ no ) { $ this -> writeLine ( ) ; $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Confirm ( $ this -> translator -> translate ( $ message ) , $ this -> translator -> translate ( $ yes ) , $ this -> translator -> translate ( $ no ) ) ; $ ans... | Write a customizable confirm prompt |
232,674 | public function writeBadge ( $ badgeText , $ badgeColor ) { $ this -> adapter -> write ( $ this -> translator -> translate ( $ badgeText ) , Color :: NORMAL , $ badgeColor ) ; $ this -> adapter -> write ( ' ' ) ; } | Write a customizable badge |
232,675 | public function writeBadgeLine ( $ message , array $ placeholders = [ ] , $ badgeText , $ badgeColor , $ preNewLine = false , $ postNewLine = false ) { if ( $ preNewLine ) { $ this -> adapter -> writeLine ( ) ; } $ this -> adapter -> write ( $ this -> translator -> translate ( $ badgeText ) , Color :: NORMAL , $ badgeC... | Write a line with customizable badge |
232,676 | public function writeListItemLineLevel3 ( $ message , array $ placeholders = [ ] ) { $ this -> adapter -> write ( ' * ' ) ; $ this -> adapter -> writeLine ( vsprintf ( $ this -> translator -> translate ( $ message ) , $ placeholders ) ) ; } | Write a list item line for third level |
232,677 | public function writeGoLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_go' , Color :: YELLOW , false , true ) ; } | Write a line with a yellow GO badge |
232,678 | public function writeTaskLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_task' , Color :: BLUE , false , false ) ; } | Write a line with a Blue Done badge |
232,679 | public function writeOkLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_ok' , Color :: GREEN , true , true ) ; } | Write a line with a green OK badge |
232,680 | public function writeFailLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_fail' , Color :: RED , true , true ) ; } | Write a line with a red Fail badge |
232,681 | public function writeWarnLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_warning' , Color :: RED , true , true ) ; } | Write a line with a red Warn badge |
232,682 | public function writeTodoLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_todo' , Color :: GREEN , false , true ) ; } | Write a line with a yellow to - do badge |
232,683 | public static function katana_filter ( $ param = '' ) { if ( $ param ) { $ param = trim ( $ param , ' _' ) ; return sprintf ( '%s_%s' , Config :: KATANA_FILTER , $ param ) ; } else { return Config :: KATANA_FILTER ; } } | Creates a specific katana filter based on a param like a post_id a page template name or similar . |
232,684 | public function get ( $ option , $ slug ) { if ( $ this -> is_active ( ) ) { $ this -> prepare ( $ slug ) ; $ slug = $ this -> slug ; if ( isset ( $ this -> plugin [ $ slug ] [ $ option ] ) ) { return $ this -> plugin [ $ slug ] [ $ option ] ; } elseif ( '*' == $ option && isset ( $ this -> plugin [ $ slug ] ) ) { retu... | Get plugin options . |
232,685 | protected function is_updated ( ) { if ( $ this -> is_active ( ) && isset ( $ this -> plugin [ $ this -> slug ] [ 'last-update' ] ) ) { $ interval = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'interval' ) ; $ last_update = $ this -> plugin [ $ this -> slug ] [ 'last-update' ] ; if ( ( time ( ) - $ last_update ) < $ in... | Check the last update . |
232,686 | protected function prepare ( $ slug ) { $ this -> slug = $ slug ; $ file = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'file' , 'plugins' ) ; if ( empty ( $ this -> plugin ) ) { $ this -> plugin = $ this -> model -> get_plugins_info ( $ file ) ; } if ( ! $ this -> is_updated ( ) ) { $ this -> plugin [ $ slug ] = $ this... | Get plugin info . |
232,687 | protected function get_plugin_info ( $ slug ) { $ args = ( object ) [ 'slug' => $ slug ] ; $ request = [ 'action' => 'plugin_information' , 'timeout' => 15 , 'request' => serialize ( $ args ) , ] ; $ url = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'url' , 'wp-api' ) ; $ resp = wp_remote_post ( $ url , [ 'body' => $ r... | Get plugin info in WordPress API . |
232,688 | public function hydrate ( $ document , $ data , $ readOnly = false ) { $ metadata = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( ! empty ( $ metadata -> lifecycleCallbacks [ Event :: preLoad ] ) ) { $ args = [ new PreLoadEventArgs ( $ document , $ this -> dm , $ data ) ] ; $ metadata -> invokeLi... | Hydrate array of DynamoDB document data into the given document object . |
232,689 | public function addLabels ( Search $ entity ) { if ( $ entity -> getLabels ( ) -> count ( ) ) { $ this -> add ( function ( QueryBuilder $ query ) use ( $ entity ) { $ ids = [ ] ; foreach ( $ entity -> getLabels ( ) as $ label ) { $ ids [ ] = ( int ) $ label -> getId ( ) ; } $ query -> innerJoin ( 'i.labels' , 'l' ) -> ... | Add labels . |
232,690 | public function listen ( ) { if ( $ _SERVER [ 'REQUEST_METHOD' ] != 'POST' ) { throw new InvalidRequestException ( 'Expected a POST request.' ) ; } $ remoteAddress = $ this -> getRemoteAddress ( ) ; if ( ! $ this -> isValidRemoteAddress ( $ remoteAddress ) ) { throw new InvalidRequestException ( 'Invalid remote address... | Listens for incoming requests . |
232,691 | public function checkSubscription ( ) { if ( ! $ this -> subscriberSocket ) { $ this -> subscriberSocket = $ this -> context -> getSocket ( \ ZMQ :: SOCKET_SUB ) ; $ this -> subscriberSocket -> connect ( $ this -> publisherPmSocketAddress ) ; $ this -> subscriberSocket -> setSockOpt ( \ ZMQ :: SOCKOPT_SUBSCRIBE , "" ) ... | Check if subscription contain pid of process |
232,692 | public function standOnPauseIfMust ( ) { if ( $ this -> mustStandOnPause ) { $ this -> iAmInPause = true ; while ( $ this -> canContinue === false ) { $ this -> logger -> info ( getmypid ( ) . " come to usleep for microseconds: " . $ this -> uSleepTime ) ; usleep ( $ this -> uSleepTime ) ; $ this -> logger -> info ( ge... | Go into infinite loop with periodic checking of the subscription if it allows to continue |
232,693 | public function continueExecution ( ) { $ this -> logger -> info ( "TerminatorPauseStander " . getmypid ( ) . " CONTINUED." ) ; $ this -> iAmInPause = false ; $ this -> mustStandOnPause = false ; $ this -> canContinue = false ; return null ; } | Exit from infinite loop |
232,694 | public static function parseError ( RequestException $ requestException , $ isAssoc = true ) { $ error = $ error = json_decode ( $ requestException -> getResponse ( ) -> getBody ( ) , $ isAssoc ) ; if ( ! is_null ( $ error ) ) { return $ error ; } else { return $ requestException -> getMessage ( ) ; } } | Returns an object or array of the FDC error parsed from the Guzzle Request exception |
232,695 | public function cmdGetAlias ( ) { $ result = $ this -> getListAlias ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableAlias ( $ result ) ; $ this -> output ( ) ; } | Callback for alias - get command |
232,696 | public function cmdAddAlias ( ) { $ params = $ this -> getParam ( ) ; if ( count ( $ params ) != 3 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } list ( $ entity , $ entity_id , $ alias ) = $ params ; if ( empty ( $ entity ) || empty ( $ entity_id ) || empty ( $ alias ) || ! is_numeric ( $ enti... | Callback for alias - add command |
232,697 | public function cmdGenerateAlias ( ) { $ entity = $ this -> getParam ( 0 ) ; $ entity_id = $ this -> getParam ( 1 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ entity ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! isset ( $ entity_id ) && empty ( $ all ) ) { $ this -> error... | Callback for alias - generate command |
232,698 | protected function addAlias ( $ entity , $ entity_id , $ alias ) { $ this -> alias -> delete ( array ( 'entity' => $ entity , 'entity_id' => $ entity_id ) ) ; $ data = array ( 'alias' => $ alias , 'entity' => $ entity , 'entity_id' => $ entity_id ) ; return $ this -> alias -> add ( $ data ) ; } | Add a URL alias |
232,699 | protected function generateListAlias ( $ entity ) { if ( ! $ this -> alias -> isSupportedEntity ( $ entity ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ model = gplcart_instance_model ( $ entity ) ; if ( ! $ model instanceof CrudInterface ) { $ this -> errorAndExit ( $ this -> text ( 'Inv... | Mass generate URL aliases for the given entity |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.