idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
14,700 | public function convertWithAdditionalSettings ( $ saveFormat = 'pdf' , $ textCompression = '' , $ embedFullFonts = '' , $ compliance = '' , $ jpegQuality = '' , $ saveMetafilesAsPng = '' , $ pdfPassword = '' , $ embedTrueTypeFontsForASCII = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileN... | Convert PowerPoint Documents to other File Formats with Additional Settings |
14,701 | public function getTiffFrameProperties ( $ frameId ) { if ( $ frameId == '' ) throw new Exception ( 'Frame ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/frames/' . $ frameId . '/properties' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils... | Get TIFF Frame Properties . |
14,702 | public function extractFrames ( $ frameId , $ outPath ) { if ( $ frameId == '' ) throw new Exception ( 'Frame ID not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/frames/' . $ frameId . '?s... | Extract Frame from a Multi - Frame TIFF Image . |
14,703 | public function cropFrame ( $ frameId , $ x , $ y , $ recWidth , $ recHeight , $ outPath ) { if ( $ frameId == '' ) throw new Exception ( 'Frame ID not specified' ) ; if ( $ x == '' ) throw new Exception ( 'X position not specified' ) ; if ( $ y == '' ) throw new Exception ( 'Y position not specified' ) ; if ( $ recWid... | Crop a TIFF Frame . |
14,704 | public function manipulateFrame ( $ frameId , $ rotateFlipMethod , $ newWidth , $ newHeight , $ x , $ y , $ rectWidth , $ rectHeight , $ outPath ) { if ( $ frameId == '' ) throw new Exception ( 'Frame ID not specified' ) ; if ( $ rotateFlipMethod == '' ) throw new Exception ( 'RotateFlip method not specified' ) ; if ( ... | Manipulate a Frame and Save the Modified Frame Along with Unmodified Frames . |
14,705 | public function checkFlag ( array $ context ) : bool { if ( ! isset ( $ context [ 'user' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The context parameter must contain a "user" key to be able to evaluate the %s flag.' , $ this -> getName ( ) ) ) ; } $ user = $ context [ 'user' ] ; if ( is_string ( $ user ... | Checks if the author of a model is the same as the user in a given context . |
14,706 | public function shift ( TreeNodeInterface $ node , int $ stateIndex ) : void { $ item = new StackItem ( ) ; $ item -> state = $ stateIndex ; $ item -> node = $ node ; if ( $ this -> actions ) { $ this -> actions -> applyToNode ( $ node ) ; } $ this -> items [ ] = $ item ; $ this -> stateIndex = $ stateIndex ; $ this ->... | Perform a Shift of a node into the stack |
14,707 | public function reduce ( ) : void { $ rule = $ this -> stateRow -> reduceRule ; if ( ! $ rule ) { throw new NoReduceException ( ) ; } $ reduce_count = count ( $ rule -> getDefinition ( ) ) ; $ total_count = count ( $ this -> items ) ; if ( $ total_count < $ reduce_count ) { throw new InternalException ( 'Not enough ite... | Perform the Reduce |
14,708 | public function setInstallmentDataBeforeAuthorization ( $ installmentQuantity ) { if ( $ this -> _calculator === null ) { throw new LocalizedException ( new Phrase ( 'You need to set an installment calculator befor prior to' . 'installments' ) ) ; } $ quote = $ this -> _getQuote ( ) ; $ interestRate = $ this -> _getCal... | Sets interest info on order object with help from the installments order manager class |
14,709 | public function getInstallmentConfig ( ) { $ installmentConfig = $ this -> _dataObjectFactory -> create ( ) ; $ maxInstallmentQty = $ this -> getMaximumInstallmentQuantity ( ) ; $ installmentConfig -> maximumInstallmentQty = $ maxInstallmentQty ; $ installmentConfig -> minimumInstallmentAmount = $ this -> getMinimumIns... | Returns all the information that another class might need to compute interest rates and installments |
14,710 | public function getInstallments ( $ paymentAmount ) { $ installments = [ ] ; $ this -> setPaymentAmount ( $ paymentAmount ) ; $ maxInstallmentQty = $ this -> getMaximumInstallmentQuantity ( ) ; for ( $ curInstallment = 1 ; ( $ curInstallment <= 12 && $ curInstallment <= $ maxInstallmentQty ) ; $ curInstallment ++ ) { i... | Computes the installments for a given payment amount |
14,711 | public function getInterestAmount ( $ amount , $ installmentQuantity ) { $ minimumAmountNoInterest = $ this -> getMinimumAmountNoInterest ( $ installmentQuantity ) ; if ( ( $ minimumAmountNoInterest === null ) || ( $ minimumAmountNoInterest !== null ) && ( $ amount < $ minimumAmountNoInterest ) ) { $ interestRateForIns... | Returns the interest fee for a given amount and interest rate |
14,712 | public function getInterestRateForInstallment ( $ installments ) { $ interestRate = $ this -> getInterestRate ( ) ; $ computationInstallments = ( $ installments - 1 ) ; $ totalInterestRate = ( float ) pow ( $ interestRate , $ computationInstallments ) ; return $ totalInterestRate ; } | Given a number of installments returns the total interest rate do be applied |
14,713 | public function getMinimumAmountNoInterest ( $ installments ) { $ return = null ; foreach ( $ this -> _minimumAmountNoInterest as $ installmentQty => $ minOrderValue ) { if ( $ installmentQty == $ installments ) { $ return = ( float ) $ minOrderValue ; break ; } } return $ return ; } | Gets the minimum amount for which in the specified installment qty no interest should apply |
14,714 | public function getTotalAmountAfterInterest ( $ installments ) { $ return = $ amount = $ this -> getPaymentAmount ( ) ; if ( $ this -> isApplyInterest ( $ installments ) ) { $ return = ( $ amount ) * $ this -> getInterestRateForInstallment ( $ installments ) ; } return $ return ; } | Computes the maximum amount after interest is applied |
14,715 | public function isApplyInterest ( $ installments ) { $ return = true ; $ interestRate = $ this -> getInterestRate ( ) ; $ paymentAmount = $ this -> getPaymentAmount ( ) ; if ( ( $ installments > 1 ) && ( $ interestRate > 1 ) ) { $ minimumOrderValueNoInterest = $ this -> getMinimumAmountNoInterest ( $ installments ) ; i... | Decides whether interest should be applied to the current payment |
14,716 | public function reset ( ) { $ this -> url = null ; $ this -> params = array ( ) ; $ this -> options = array ( ) ; $ this -> callType = null ; $ this -> responseType = null ; } | Resets all variables to prepare for fresh object creation if needed for looping . |
14,717 | public function setParams ( $ params ) { if ( is_array ( $ params ) ) { foreach ( $ params as $ key => $ param ) { $ this -> params [ $ key ] = $ param ; } } } | Expects an array of one or more key = > value pairs of params to later add to the URL string |
14,718 | public function setOptions ( $ options ) { if ( is_array ( $ options ) ) { foreach ( $ options as $ key => $ option ) { $ this -> options [ $ key ] = $ option ; } } } | Expects an array of one or more key = > value pairs of params to later use as options with curl to alter the way curl is used . |
14,719 | public function doApiCall ( ) { $ parsedResponse = array ( ) ; $ jsonResponse = false ; $ curlUrl = $ this -> createUrl ( ) ; if ( $ curlUrl ) { $ jsonResponse = $ this -> submitCurlRequest ( $ curlUrl ) ; } if ( $ jsonResponse ) { $ parsedResponse = $ this -> parseJsonResponse ( $ jsonResponse ) ; } return $ parsedRes... | This is a wrapper to execute the entire process of an API call . It initiates the creation of the URL and using the returned URL it initiates the curl request and the resulting JSON is then sent to the parser . The end result is a usable array . |
14,720 | public function createUrl ( ) { $ curlUrl = $ this -> url . '?' ; foreach ( $ this -> params as $ key => $ value ) { $ curlUrl .= $ key . '=' . $ value ; $ curlUrl .= '&' ; } return $ curlUrl ; } | Create the URL string complete with any params . |
14,721 | protected function submitCurlRequest ( $ curlUrl ) { $ session = curl_init ( ) ; curl_setopt ( $ session , CURLOPT_URL , $ curlUrl ) ; curl_setopt ( $ session , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ session , CURLOPT_RETURNTRANSFER , 1 ) ; if ( ! empty ( $ this -> options ) ) { foreach ( $ this -> options as $ key => ... | Build the curl resource and execute it to return the raw result . |
14,722 | public static function processCommand ( $ url , $ method = 'GET' , $ headerType = 'XML' , $ src = '' , $ returnType = 'xml' ) { $ dispatcher = AsposeApp :: getEventDispatcher ( ) ; $ method = strtoupper ( $ method ) ; $ headerType = strtoupper ( $ headerType ) ; AsposeApp :: getLogger ( ) -> info ( "Aspose Cloud SDK: p... | Performs Aspose Api Request . |
14,723 | public static function uploadFileBinary ( $ url , $ localFile , $ headerType = 'XML' , $ method = 'PUT' ) { $ method = strtoupper ( $ method ) ; $ headerType = strtoupper ( $ headerType ) ; AsposeApp :: getLogger ( ) -> info ( "Aspose Cloud SDK: uploadFileBinary called" , array ( 'url' => $ url , 'localFile' => $ local... | Performs Aspose Api Request to Upload a file . |
14,724 | public static function saveFile ( $ input , $ fileName ) { $ fh = fopen ( $ fileName , 'w' ) or die ( 'cant open file' ) ; fwrite ( $ fh , $ input ) ; fclose ( $ fh ) ; } | Saves the files |
14,725 | public function getFieldCount ( $ jsonResponse , $ fieldName ) { $ arr = json_decode ( $ jsonResponse ) -> { $ fieldName } ; return count ( $ arr , COUNT_RECURSIVE ) ; } | This method parses XML for a count of a particular field . |
14,726 | private function getVideo ( ) { $ videoUrl = 'http://file.api.wechat.com/cgi-bin/media/get?access_token=' . $ this -> getAccessToken ( ) . '&media_id=' . $ this -> event -> get ( 'MediaId' ) ; return [ new Video ( $ videoUrl , $ this -> event ) ] ; } | Create the video url from an incoming message . |
14,727 | public function read ( $ symbology ) { $ strURI = Product :: $ baseProductUri . '/barcode/' . $ this -> getFileName ( ) . '/recognize?' . ( ! isset ( $ symbology ) || trim ( $ symbology ) === '' ? 'type=' : 'type=' . $ symbology ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand (... | Reads all or specific barcodes from images . |
14,728 | public function readFromLocalImage ( $ localImage , $ remoteFolder , $ barcodeReadType ) { $ folder = new Folder ( ) ; $ folder -> UploadFile ( $ localImage , $ remoteFolder ) ; $ data = $ this -> ReadR ( basename ( $ localImage ) , $ remoteFolder , $ barcodeReadType ) ; return $ data ; } | Read Barcode from Local Image . |
14,729 | public function readR ( $ remoteImageName , $ remoteFolder , $ readType ) { $ uri = $ this -> uriBuilder ( $ remoteImageName , $ remoteFolder , $ readType ) ; $ signedURI = Utils :: sign ( $ uri ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ... | Read Barcode from Aspose Cloud Storage |
14,730 | public function uriBuilder ( $ remoteImage , $ remoteFolder , $ readType ) { $ uri = Product :: $ baseProductUri . '/barcode/' ; if ( $ remoteImage != null ) $ uri .= $ remoteImage . '/' ; $ uri .= 'recognize?' ; if ( $ readType == 'AllSupportedTypes' ) $ uri .= 'type=' ; else $ uri .= 'type=' . $ readType ; if ( $ rem... | Build uri . |
14,731 | public function readFromURL ( $ url , $ symbology ) { if ( $ url == '' ) throw new Exception ( 'URL not specified' ) ; if ( $ symbology == '' ) throw new Exception ( 'Symbology not specified' ) ; $ strURI = Product :: $ baseProductUri . '/barcode/recognize?type=' . $ symbology . '&url=' . $ url ; $ signedURI = Utils ::... | Read Barcode from External Image URL |
14,732 | public function readSpecificRegion ( $ symbology , $ rectX , $ rectY , $ rectWidth , $ rectHeight ) { if ( $ symbology == '' ) throw new Exception ( 'Symbology not specified' ) ; if ( $ rectX == '' ) throw new Exception ( 'X position not specified' ) ; if ( $ rectY == '' ) throw new Exception ( 'Y position not specifie... | Read Barcode from Specific Region of Image |
14,733 | public function readWithChecksum ( $ symbology , $ checksumValidation ) { if ( $ symbology == '' ) throw new Exception ( 'Symbology not specified' ) ; if ( $ checksumValidation == '' ) throw new Exception ( 'Checksum not specified' ) ; $ strURI = Product :: $ baseProductUri . '/barcode/' . $ this -> getFileName ( ) . '... | Recognize Barcode with Checksum Option from Storage |
14,734 | public function readByAlgorithm ( $ symbology , $ binarizationHints ) { if ( $ symbology == '' ) throw new Exception ( 'Symbology not specified' ) ; if ( $ binarizationHints == '' ) throw new Exception ( 'Binarization Hints count not specified' ) ; $ strURI = Product :: $ baseProductUri . '/barcode/' . $ this -> getFil... | Read Barcodes by Applying Image Processing Algorithm |
14,735 | public function insertPageNumber ( $ fileName , $ alignment , $ format , $ isTop , $ setPageNumberOnFirstPage ) { if ( $ fileName == '' ) throw new Exception ( 'File not specified' ) ; $ fieldsArray = array ( 'Format' => $ format , 'Alignment' => $ alignment , 'IsTop' => $ isTop , 'SetPageNumberOnFirstPage' => $ setPag... | Inserts page number field into the document . |
14,736 | public function getMailMergeFieldNames ( $ fileName ) { if ( $ fileName == '' ) throw new Exception ( 'No file name specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ fileName . '/mailMergeFieldNames' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedUR... | Gets all merge filed names from document . |
14,737 | public function query ( $ q = null ) { return Product :: where ( function ( $ query ) use ( $ q ) { if ( $ q ) { foreach ( explode ( ' ' , $ q ) as $ keyword ) { $ query -> where ( 'description' , 'like' , "%{$keyword}%" ) ; } } } ) -> orderBy ( 'description' ) -> paginate ( ) ; } | Queries the product catalogue and returns a paginated result . |
14,738 | public function save ( ProductContract $ product , array $ attributes = [ ] ) { $ result = $ product -> save ( ) ; $ details = [ ] ; foreach ( $ attributes as $ key => $ value ) { if ( $ value ) { $ details [ $ key ] = compact ( 'value' ) ; } } $ product -> attributes ( ) -> sync ( $ details ) ; return $ result ; } | Stores a product . |
14,739 | public function getResources ( ) { $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/resources/' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code ==... | Get project resource items . Each resource item has a link to get full resource representation in the project . |
14,740 | public function getResource ( $ resourceId ) { if ( $ resourceId == '' ) throw new Exception ( 'Resource ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/resources/' . $ resourceId ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCom... | Get resource information . |
14,741 | protected function getStubContent ( $ name ) { if ( ! isset ( static :: $ stubs [ $ name ] ) ) { if ( ! is_file ( $ path = base_path ( "resources/stubs/vendor/models-generator/$name.stub" ) ) ) { $ path = __DIR__ . "/../../resources/stubs/$name.stub" ; } static :: $ stubs [ $ name ] = file_get_contents ( $ path ) ; } r... | Retourne le contenu d un stub . |
14,742 | public static function handle ( $ model ) { if ( ! $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) return false ; return $ model -> save ( ) ; } | Handles a comment model when submitted |
14,743 | public function querySync ( ) { $ adapter = $ this -> _dbAdapter ? : Table :: getDefaultDbAdapter ( ) ; return $ adapter -> querySync ( $ this -> assemble ( ) , $ this -> _bind , $ this -> _consistency , $ this -> _options ) ; } | Executes the current query and returns the response |
14,744 | public function prepare ( ) { $ adapter = $ this -> _dbAdapter ? : Table :: getDefaultDbAdapter ( ) ; return $ adapter -> prepare ( $ this -> assemble ( ) ) ; } | Prepares the current query and returns the response |
14,745 | public function loadParameters ( ) { $ container = \ System :: getContainer ( ) ; if ( $ container -> hasParameter ( 'contao.video.valid_extensions' ) ) { $ GLOBALS [ 'TL_CONFIG' ] [ 'validVideoTypes' ] = implode ( ',' , $ container -> getParameter ( 'contao.video.valid_extensions' ) ) ; } if ( $ container -> hasParame... | Push symfony configuration into the contao config array |
14,746 | public static function getFromRequest ( $ create = true ) { $ sessionData = [ 'LastIP' => inet_pton ( $ _SERVER [ 'REMOTE_ADDR' ] ) , 'LastRequest' => time ( ) , ] ; if ( ! empty ( $ _COOKIE [ static :: $ cookieName ] ) ) { if ( $ Session = static :: getByHandle ( $ _COOKIE [ static :: $ cookieName ] ) ) { $ Session = ... | Gets or sets up a session based on current cookies . Will always update the current session s LastIP and LastRequest fields . |
14,747 | public function overviewAction ( Request $ request , FormFactoryInterface $ formFactory , ExtraFormBuilderInterface $ extraFormBuilder ) { $ formName = 'overview' ; $ data = $ request -> request -> get ( $ formName ) ; $ configurationRaw = $ data [ 'configuration' ] ; $ configuration = json_decode ( $ configurationRaw ... | Overview action . |
14,748 | public function create ( $ filename = null , array $ options = [ ] , array $ plugins = [ ] ) { try { $ thumb = new PHPThumb ( $ filename , $ options , $ plugins ) ; } catch ( \ Exception $ exc ) { throw new Exception \ RuntimeException ( $ exc -> getMessage ( ) , $ exc -> getCode ( ) , $ exc ) ; } return $ thumb ; } | Create image thumbnail object |
14,749 | public function createReflection ( $ percent , $ reflection , $ white , $ border , $ borderColor ) { return new Plugins \ Reflection ( $ percent , $ reflection , $ white , $ border , $ borderColor ) ; } | Create reflection plugin |
14,750 | public function createWatermark ( PHPThumb $ watermarkThumb , array $ position = [ 0 , 0 ] , $ scale = .5 ) { return new Plugins \ Watermark ( $ watermarkThumb , $ position , $ scale ) ; } | Create a watermark on image |
14,751 | public function offsetSet ( $ columnName , $ value ) { if ( ! in_array ( $ columnName , static :: $ _primary ) ) { $ this -> _modifiedData [ $ columnName ] = $ value ; } parent :: offsetSet ( $ columnName , $ value ) ; } | Set row field value |
14,752 | public function onPreSerialize ( ObjectEvent $ event ) { $ configuredType = $ event -> getObject ( ) ; if ( $ configuredType instanceof ConfiguredType ) { try { $ configurationArray = json_decode ( $ configuredType -> getConfiguration ( ) , true ) ; $ extraFormType = $ this -> registry -> getType ( $ configurationArray... | Method called on pre serialize event . |
14,753 | protected function outputComment ( $ comment ) { if ( $ this -> commentOptions instanceof \ Closure ) { $ options = call_user_func ( $ this -> commentOptions , $ comment ) ; } else { $ options = $ this -> commentOptions ; } $ options = ArrayHelper :: merge ( $ options , [ 'data-comment-id' => $ comment -> id ] ) ; if (... | Outputs a single comment |
14,754 | public static function create ( $ dir , $ debug = false , array $ options = array ( ) ) { $ options = array_merge ( self :: $ defaultOptions , $ options ) ; $ commandString = $ options [ 'git_executable' ] . ' init' ; $ command = new $ options [ 'command_class' ] ( $ dir , $ commandString , $ debug ) ; $ command -> run... | Create a new Git repository in filesystem running git init Returns the git repository wrapper |
14,755 | public static function cloneUrl ( $ url , $ dir , $ debug = false , array $ options = array ( ) ) { $ options = array_merge ( self :: $ defaultOptions , $ options ) ; $ commandString = $ options [ 'git_executable' ] . ' clone ' . escapeshellarg ( $ url ) . ' ' . escapeshellarg ( $ dir ) ; $ command = new $ options [ 'c... | Clone a new Git repository in filesystem running git clone Returns the git repository wrapper |
14,756 | public function getCommits ( $ nbCommits = 10 ) { $ output = $ this -> git ( sprintf ( 'log -n %d --date=%s --format=format:%s' , $ nbCommits , $ this -> dateFormat , $ this -> logFormat ) ) ; return $ this -> parseLogsIntoArray ( $ output ) ; } | Return the result of git log formatted in a PHP array |
14,757 | private function parseLogsIntoArray ( $ logOutput ) { $ commits = array ( ) ; foreach ( explode ( "\n" , $ logOutput ) as $ line ) { $ infos = explode ( '|' , $ line ) ; $ commits [ ] = array ( 'id' => $ infos [ 0 ] , 'tree' => $ infos [ 1 ] , 'author' => array ( 'name' => $ infos [ 2 ] , 'email' => $ infos [ 3 ] ) , '... | Convert a formatted log string into an array |
14,758 | public function setOutputPath ( $ path ) { if ( ! file_exists ( $ path ) ) { if ( ! mkdir ( $ path , 0755 , true ) ) { throw new BadOutputPathException ( sprintf ( 'Output path %s does not exist and could not be created!' , $ path ) , $ path ) ; } } else { if ( ! is_dir ( $ path ) ) { throw new BadOutputPathException (... | Sets output path . |
14,759 | protected function processFoxyRequest ( HTTPRequest $ request ) { $ encryptedData = $ request -> postVar ( 'FoxyData' ) ? urldecode ( $ request -> postVar ( 'FoxyData' ) ) : urldecode ( $ request -> postVar ( 'FoxySubscriptionData' ) ) ; $ decryptedData = $ this -> decryptFeedData ( $ encryptedData ) ; $ this -> parseF... | Process a request after a transaction is completed via Foxy |
14,760 | private function parseFeedData ( $ encryptedData , $ decryptedData ) { $ orders = new \ SimpleXMLElement ( $ decryptedData ) ; foreach ( $ orders -> transactions -> transaction as $ transaction ) { $ this -> processTransaction ( $ transaction , $ encryptedData ) ; } } | Parse the XML data feed from Foxy to a SimpleXMLElement object |
14,761 | public function sso ( ) { $ fcsid = $ this -> request -> getVar ( 'fcsid' ) ; $ timestampNew = strtotime ( '+30 days' ) ; if ( ! $ Member = Security :: getCurrentUser ( ) ) { $ Member = new Member ( ) ; $ Member -> Customer_ID = 0 ; } $ auth_token = sha1 ( $ Member -> Customer_ID . '|' . $ timestampNew . '|' . FoxyCart... | Single Sign on integration with FoxyCart . |
14,762 | private static function terminate ( ) : Promise { if ( self :: $ onClose === null ) { return Promise \ any ( [ ] ) ; } if ( self :: $ signalWatchers ) { foreach ( self :: $ signalWatchers as $ watcher ) { Loop :: cancel ( $ watcher ) ; } } $ onClose = self :: $ onClose ; self :: $ onClose = null ; $ promises = [ ] ; fo... | Invokes any termination callbacks . |
14,763 | private static function onReceivedMessage ( string $ event , $ data ) { foreach ( self :: $ onMessage [ $ event ] ?? [ ] as $ callback ) { asyncCall ( $ callback , $ data ) ; } } | Internal callback triggered when a message is received from the parent . |
14,764 | public static function createLogHandler ( string $ logLevel = LogLevel :: DEBUG , bool $ bubble = false ) : HandlerInterface { if ( ! self :: isWorker ( ) ) { throw new \ Error ( __FUNCTION__ . " should only be called when running as a worker. " . "Create your own log handler when not running as part of a cluster" ) ; ... | Creates a log handler in worker processes that communicates log messages to the parent . |
14,765 | public static function prepareOptions ( $ value , $ defaults = [ ] ) { if ( is_string ( $ value ) ) { $ value = json_decode ( $ value , true ) ; } return is_array ( $ value ) ? array_merge ( $ defaults , $ value ) : $ defaults ; } | Prepares options . |
14,766 | public function process ( DOMElement $ node , Item $ item ) { foreach ( $ this -> keys as $ key ) { $ item -> setExtra ( $ key , $ this -> getValue ( $ node , $ key ) ) ; } } | Execute the Aggregator |
14,767 | public function onAfterWrite ( ) { parent :: onAfterWrite ( ) ; if ( $ this -> owner -> PasswordEncryption != Security :: config ( ) -> get ( 'password_encryption_algorithm' ) ) { $ this -> resetPasswordEncryption ( ) ; } } | If the PasswordEncryption for the current membrer is different than the default update to the default . |
14,768 | public function setDataFromTransaction ( $ transaction ) { foreach ( $ this -> owner -> config ( ) -> get ( 'customer_map' ) as $ type => $ map ) { switch ( $ type ) { case 'int' : foreach ( $ map as $ foxyField => $ foxyStripeField ) { if ( ( int ) $ transaction -> { $ foxyField } ) { $ this -> owner -> { $ foxyStripe... | Use the config setting for Member mapping the Foxy fields to the SilverStripe fields . |
14,769 | private function resetPasswordEncryption ( ) { $ defaultEncryption = Security :: config ( ) -> get ( 'password_encryption_algorithm' ) ; if ( $ this -> owner -> PasswordEncryption != $ defaultEncryption ) { DB :: prepared_query ( 'UPDATE "Member" SET "PasswordEncryption" = ? WHERE ID = ?' , [ $ defaultEncryption , $ th... | Reset the password encryption for the member to the config default . Passwords from Foxy are encrypted so the encryption type is set to none when processing the account from the data feed . Reseting is required for login to work on the website . |
14,770 | protected function buildConstraint ( array $ constraint ) { $ extraFormConstraint = $ this -> constraintRegistry -> getConstraint ( $ constraint [ 'extra_form_constraint' ] ) ; $ className = $ extraFormConstraint -> getClassName ( ) ; $ options = isset ( $ constraint [ 'options' ] ) ? $ constraint [ 'options' ] : array... | Build constraint . |
14,771 | protected function buildFormOptions ( $ name , array $ field , $ data = null ) { if ( isset ( $ field [ 'options' ] [ 'constraints' ] ) ) { $ field [ 'options' ] [ 'options' ] = $ this -> buildFormOptions ( '' , $ field [ 'options' ] ) ; } $ constraints = array ( ) ; foreach ( $ field [ 'constraints' ] as $ constraint ... | Build form options . |
14,772 | public function updatevalue ( \ SilverStripe \ Control \ HTTPRequest $ request ) { if ( $ request -> getVar ( 'Price' ) && FoxyStripeSetting :: current_foxystripe_setting ( ) -> CartValidation ) { $ vars = $ request -> getVars ( ) ; $ signedPrice = FoxyCart_Helper :: fc_hash_value ( $ this -> Code , 'price' , $ vars [ ... | create new encrypted price value based on user input . |
14,773 | public function addFeed ( $ channel , $ feed ) { if ( ! filter_var ( $ feed , FILTER_VALIDATE_URL ) ) { throw new LogicException ( 'You tried to add a invalid url.' ) ; } $ this -> feeds [ $ channel ] [ ] = $ feed ; } | Add feed to channel |
14,774 | public function getFeed ( $ channel ) { if ( ! isset ( $ this -> feeds [ $ channel ] ) ) { throw new LogicException ( 'You tried to get a not existent channel' ) ; } return $ this -> feeds [ $ channel ] ; } | Retrieve a channel |
14,775 | public function setFeed ( $ channel , $ feed ) { if ( ! is_string ( $ channel ) ) { throw new LogicException ( 'You tried to add a invalid channel.' ) ; } $ this -> feeds [ $ channel ] = array ( ) ; $ this -> addFeed ( $ channel , $ feed ) ; } | Set a channel |
14,776 | protected function get ( $ url ) { $ request = $ this -> http -> get ( $ url , array ( 'User-Agent' => self :: USER_AGENT . ' v.' . self :: VERSION ) ) ; $ response = $ request -> send ( ) ; if ( ! $ response -> isSuccessful ( ) ) { $ this -> log ( 'fail with ' . $ response -> getStatusCode ( ) . ' http code in url "' ... | Retrieve content from a resource |
14,777 | public function getPermutations ( array $ sourceDataSet , $ subsetSize = null ) { $ combinationMap = $ this -> _combination -> getCombinations ( $ sourceDataSet , $ subsetSize ) ; $ permutationsMap = [ ] ; foreach ( $ combinationMap as $ combination ) { $ permutationsMap = array_merge ( $ permutationsMap , $ this -> _f... | Creates all the possible permutations for the source data set . |
14,778 | private function _findPermutations ( $ combination ) { if ( count ( $ combination ) <= 1 ) { return [ $ combination ] ; } $ permutationList = [ ] ; $ startKey = $ this -> _processSubPermutations ( $ combination , $ permutationList ) ; $ key = key ( $ combination ) ; while ( $ key != $ startKey ) { $ this -> _processSub... | Recursive function to find the permutations of the given combination . |
14,779 | public function generate ( ) { $ this -> objElement = \ ElementsModel :: findPublishedByAlias ( $ this -> type ) ; if ( $ this -> objElement === null ) { return ; } if ( ! array_key_exists ( $ this -> objElement -> template , TemplateLoader :: getFiles ( ) ) ) { TemplateLoader :: addFile ( $ this -> objElement -> templ... | Generate the pattern data and parse the elements template |
14,780 | protected function compile ( ) { $ colPattern = \ PatternModel :: findVisibleByPid ( $ this -> objElement -> id ) ; if ( $ colPattern === null ) { return ; } $ intPid = ( $ this -> origId ) ? $ this -> origId : $ this -> id ; $ colData = \ DataModel :: findByPid ( $ intPid ) ; if ( $ colData !== null ) { foreach ( $ co... | Compile the pattern |
14,781 | protected static function setPath ( $ path = null ) { if ( ! static :: $ pathStack ) { $ requestURI = parse_url ( $ _SERVER [ 'REQUEST_URI' ] ) ; static :: $ pathStack = static :: $ requestPath = explode ( '/' , ltrim ( $ requestURI [ 'path' ] , '/' ) ) ; } static :: $ _path = isset ( $ path ) ? $ path : static :: $ pa... | protected static methods |
14,782 | public function reverseTransform ( $ out ) { if ( null !== $ out && is_array ( $ out ) ) { return strtoupper ( sprintf ( '%s%s%s%s%s%s%s%s' , $ out [ 'c1' ] , $ out [ 'c2' ] , $ out [ 'c3' ] , $ out [ 'c4' ] , $ out [ 'c5' ] , $ out [ 'c6' ] , $ out [ 'c7' ] , $ out [ 'c8' ] ) ) ; } return $ out ; } | Reverse transforms . |
14,783 | public function setDefaultType ( $ value , DataContainer $ dc ) { $ db = Database :: getInstance ( ) ; if ( $ value ) { $ db -> prepare ( "UPDATE tl_elements SET defaultType='' WHERE NOT id=? AND pid=?" ) -> execute ( $ dc -> activeRecord -> id , $ dc -> activeRecord -> pid ) ; } return $ value ; } | Reset all other default type settings |
14,784 | public function checkTitle ( $ value , DataContainer $ dc ) { $ db = Database :: getInstance ( ) ; $ objTitle = $ db -> prepare ( "SELECT id FROM tl_elements WHERE NOT id=? AND pid=? AND title=?" ) -> execute ( $ dc -> activeRecord -> id , $ dc -> activeRecord -> pid , $ value ) ; if ( $ objTitle -> numRows > 0 ) { thr... | Check if the title is not already in use |
14,785 | public function generateAlias ( DataContainer $ dc ) { $ db = Database :: getInstance ( ) ; $ alias = \ StringUtil :: generateAlias ( \ ThemeModel :: findById ( $ dc -> activeRecord -> pid ) -> name . '-' . $ dc -> activeRecord -> title ) ; if ( $ alias != $ dc -> activeRecord -> alias ) { $ db -> prepare ( "UPDATE tl_... | Auto - generate an element alias and adjust existing content in case the element is renamed |
14,786 | public function getContentElementTemplates ( DataContainer $ dc ) { $ arrTemplates = array ( ) ; foreach ( \ TemplateLoader :: getPrefixedFiles ( 'ce_' ) as $ strTemplate ) { $ arrTemplates [ $ strTemplate ] [ ] = 'root' ; } $ arrCustomized = glob ( TL_ROOT . '/templates/ce_*' ) ; if ( is_array ( $ arrCustomized ) ) { ... | Return content element templates as array |
14,787 | public function editButton ( $ row , $ href , $ label , $ title , $ icon , $ attributes ) { switch ( $ row [ 'type' ] ) { case 'group' : return \ Image :: getHtml ( str_replace ( '.' , '_.' , $ icon ) , $ label ) . ' ' ; case 'element' : return '<a href="' . $ this -> addToUrl ( $ href . '&id=' . $ row [ 'id' ] ) .... | Return the pattern edit button |
14,788 | public function findByTags ( array $ tags ) { $ qb = $ this -> createQueryBuilder ( 'c' ) ; foreach ( $ tags as $ key => $ tag ) { $ operator = substr ( $ tag , 0 , 1 ) ; if ( $ operator === '+' || $ operator === '-' ) { $ tag = substr ( $ tag , 1 ) ; } $ literalExpr = $ qb -> expr ( ) -> literal ( '%' . $ tag . '%' ) ... | Find configured types by tags . |
14,789 | public function getAllTags ( ) { $ qb = $ this -> createQueryBuilder ( 'c' ) ; $ qb -> select ( 'c.tags' ) -> where ( $ qb -> expr ( ) -> isNotNull ( 'c.tags' ) ) -> distinct ( ) ; $ tagStrings = array_map ( 'current' , $ qb -> getQuery ( ) -> getScalarResult ( ) ) ; $ distinctTags = array ( ) ; foreach ( $ tagStrings ... | Get all tags . |
14,790 | public function find ( $ username ) { $ parameters [ 'username' ] = $ username ; return $ this -> apiClient -> callEndpoint ( self :: ENDPOINT , $ parameters ) ; } | Returns a user . This resource cannot be accessed anonymously . |
14,791 | public function update ( $ username , $ parameters = array ( ) ) { $ parameters [ 'username' ] = $ username ; return $ this -> apiClient -> callEndpoint ( self :: ENDPOINT , $ parameters , null , HttpMethod :: REQUEST_PUT ) ; } | Modify user . The value fields present will override the existing value . Fields skipped in request will not be changed . |
14,792 | public function add ( $ username , $ parameters = array ( ) ) { $ parameters [ 'username' ] = $ username ; return $ this -> apiClient -> callEndpoint ( self :: ENDPOINT , $ parameters , null , HttpMethod :: REQUEST_POST ) ; } | Create user . By default created user will not be notified with email . If password field is not set then password will be randomly generated . |
14,793 | public function findAvatars ( $ username ) { $ parameters [ 'username' ] = $ username ; return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/avatars' , self :: ENDPOINT ) , $ parameters ) ; } | Returns all avatars which are visible for the currently logged in user . |
14,794 | public function updatePassword ( $ username , $ password ) { $ parameters [ 'username' ] = $ username ; $ parameters [ 'password' ] = $ password ; return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/avatars' , self :: ENDPOINT ) , $ parameters , null , HttpMethod :: REQUEST_PUT ) ; } | Modify user password . |
14,795 | public function picker ( $ query , $ maxResults = null , $ showAvatar = null , $ exclude = null ) { $ parameters = array ( 'query' => $ query , 'maxResults' => $ maxResults , 'showAvatar' => $ showAvatar , 'exclude' => $ exclude ) ; return $ this -> apiClient -> callEndpoint ( sprintf ( '%s/picker' , self :: ENDPOINT )... | Returns a list of users matching query with highlighting . This resource cannot be accessed anonymously . |
14,796 | public function search ( $ username , $ startAt = null , $ maxResults = null , $ includeActive = null , $ includeInactive = null ) { $ parameters = array ( 'username' => $ username , 'startAt' => $ startAt , 'maxResults' => $ maxResults , 'includeActive' => $ includeActive , 'includeInactive' => $ includeInactive ) ; r... | Returns a list of users that match the search string . This resource cannot be accessed anonymously . |
14,797 | public static function getRevisionRecords ( $ options = [ ] ) { $ options = Util :: prepareOptions ( $ options , [ 'indexField' => false , 'conditions' => [ ] , 'order' => false , 'limit' => false , 'offset' => 0 , ] ) ; $ query = 'SELECT * FROM `%s` WHERE (%s)' ; $ params = [ static :: getHistoryTable ( ) , count ( $ ... | Gets raw revision data from the database and constructs a query |
14,798 | public function beforeVersionedSave ( ) { $ this -> wasDirty = false ; if ( $ this -> isDirty && static :: $ createRevisionOnSave ) { $ this -> Created = time ( ) ; $ this -> wasDirty = true ; } } | Sets wasDirty isDirty Created for the object before save |
14,799 | public function afterVersionedSave ( ) { if ( $ this -> wasDirty && static :: $ createRevisionOnSave ) { $ recordValues = $ this -> _prepareRecordValues ( ) ; $ set = static :: _mapValuesToSet ( $ recordValues ) ; DB :: nonQuery ( 'INSERT INTO `%s` SET %s' , [ static :: getHistoryTable ( ) , join ( ',' , $ set ) , ] ) ... | After save to regular database this saves to the history table |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.