idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
43,600
protected function getSelectedOptionByLabel ( $ select , $ option_label , $ check_selected = TRUE ) { if ( ! $ field = $ this -> getSession ( ) -> getPage ( ) -> findField ( $ select ) ) { throw new ExpectationException ( "Field '$select' not found." , $ this -> getSession ( ) ) ; } $ this -> assertElementType ( $ fiel...
Returns an option from a specific select .
43,601
public function uploadPartToAmazon ( $ filePath , $ uploadEndpoint , $ uploadRequestInfo , $ chunkNumber , $ chunk , $ numberOfChunks ) { $ finalKey = sprintf ( "%s/p%d" , $ uploadRequestInfo [ 'multipart_params' ] [ 'key' ] , $ chunkNumber ) ; $ formData = [ self :: getFormDataParams ( 'x-amz-credential' , $ uploadReq...
Uploads a chunk of a file to an S3 bucket using multipart upload .
43,602
public function getMultiple ( $ keys , $ default = null ) { $ result = [ ] ; foreach ( $ keys as $ key ) { if ( ( $ entry = $ this -> object -> get ( $ key ) ) !== false ) { $ result [ $ key ] = $ entry ; } else { $ result [ $ key ] = $ default ; } } return $ result ; }
Returns the cached values for the given cache keys .
43,603
public function getMetapropertySpecificOptionDependencies ( $ propertyId , $ optionId , $ query ) { return $ this -> requestHandler -> sendRequestAsync ( 'GET' , 'api/v4/metaproperties/' . $ propertyId . '/options/' . $ optionId . '/dependencies/' , [ 'query' => $ query ] ) ; }
Gets a list of all meta property option dependencies for a specific option
43,604
public function getMediaDownloadLocationForAssetItem ( $ mediaId , $ itemId , $ hash = false ) { return $ this -> requestHandler -> sendRequestAsync ( 'GET' , 'api/v4/media/' . $ mediaId . '/download/' . $ itemId . '/' , [ 'query' => [ 'hash' => $ hash ] ] ) ; }
Gets the download location for a specific asset item
43,605
public static function extractParamValues ( $ params , & $ values ) { foreach ( $ params as $ k => $ v ) { if ( is_array ( $ v ) || is_object ( $ v ) ) { self :: extractParamValues ( $ v , $ values ) ; } else { if ( is_bool ( $ v ) ) { $ v = intval ( $ v ) ; } $ values [ ] = $ v ; } } }
Extracts the values of a set of parameters recursing into nested assoc arrays .
43,606
public function send ( $ template , $ email , $ vars = [ ] , $ options = [ ] , $ schedule_time = null ) { $ post = [ ] ; $ post [ 'template' ] = $ template ; $ post [ 'email' ] = $ email ; $ post [ 'vars' ] = $ vars ; $ post [ 'options' ] = $ options ; if ( $ schedule_time ) { $ post [ 'schedule_time' ] = $ schedule_ti...
Remotely send an email template to a single email address .
43,607
public function multisend ( $ template_name , $ emails , $ vars = [ ] , $ evars = [ ] , $ options = [ ] ) { $ post [ 'template' ] = $ template_name ; $ post [ 'email' ] = is_array ( $ emails ) ? implode ( ',' , $ emails ) : $ emails ; $ post [ 'vars' ] = $ vars ; $ post [ 'evars' ] = $ evars ; $ post [ 'options' ] = $ ...
Remotely send an email template to multiple email addresses .
43,608
public function scheduleBlast ( $ name , $ list , $ schedule_time , $ from_name , $ from_email , $ subject , $ content_html , $ content_text , $ options = [ ] ) { $ data = $ options ; $ data [ 'name' ] = $ name ; $ data [ 'list' ] = $ list ; $ data [ 'schedule_time' ] = $ schedule_time ; $ data [ 'from_name' ] = $ from...
Schedule a mass mail blast
43,609
public function scheduleBlastFromTemplate ( $ template , $ list , $ schedule_time , $ options = [ ] ) { $ data = $ options ; $ data [ 'copy_template' ] = $ template ; $ data [ 'list' ] = $ list ; $ data [ 'schedule_time' ] = $ schedule_time ; return $ this -> apiPost ( 'blast' , $ data ) ; }
Schedule a mass mail from a template
43,610
public function scheduleBlastFromBlast ( $ blast_id , $ schedule_time , $ options = [ ] ) { $ data = $ options ; $ data [ 'copy_blast' ] = $ blast_id ; $ data [ 'schedule_time' ] = $ schedule_time ; return $ this -> apiPost ( 'blast' , $ data ) ; }
Schedule a mass mail blast from previous blast
43,611
public function updateBlast ( $ blast_id , $ name = null , $ list = null , $ schedule_time = null , $ from_name = null , $ from_email = null , $ subject = null , $ content_html = null , $ content_text = null , $ options = [ ] ) { $ data = $ options ; $ data [ 'blast_id' ] = $ blast_id ; if ( ! is_null ( $ name ) ) { $ ...
updates existing blast
43,612
public function saveTemplate ( $ template_name , array $ template_fields = [ ] ) { $ data = $ template_fields ; $ data [ 'template' ] = $ template_name ; return $ this -> apiPost ( 'template' , $ data ) ; }
Save a template .
43,613
public function saveTemplateFromRevision ( $ template_name , $ revision_id ) { $ revision_id = ( int ) $ revision_id ; return $ this -> saveTemplate ( $ template_name , [ 'revision' => $ revision_id ] ) ; }
Save a template from revision
43,614
public function saveInclude ( $ include_name , array $ include_fields = [ ] ) { $ data = $ include_fields ; $ data [ 'include' ] = $ include_name ; return $ this -> apiPost ( 'include' , $ data ) ; }
Save an include
43,615
public function saveList ( $ list , $ type = null , $ primary = null , $ query = [ ] , $ vars = [ ] ) { $ data = [ 'list' => $ list , 'type' => $ type , 'primary' => $ primary ? 1 : 0 , 'query' => $ query , 'vars' => $ vars , ] ; return $ this -> apiPost ( 'list' , $ data ) ; }
Create a list or update a list .
43,616
public function purchase ( $ email , array $ items , $ incomplete = null , $ message_id = null , array $ options = [ ] ) { $ data = $ options ; $ data [ 'email' ] = $ email ; $ data [ 'items' ] = $ items ; if ( ! is_null ( $ incomplete ) ) { $ data [ 'incomplete' ] = ( int ) $ incomplete ; } if ( ! is_null ( $ message_...
Record that a user has made a purchase or has added items to their purchase total .
43,617
public function purchaseIncomplete ( $ email , array $ items , $ message_id , array $ options = [ ] ) { return $ this -> purchase ( $ email , $ items , 1 , $ message_id , $ options ) ; }
Make a purchase API call with incomplete flag
43,618
public function stats_list ( $ list = null , $ date = null ) { $ data = [ ] ; if ( ! is_null ( $ list ) ) { $ data [ 'list' ] = $ list ; } if ( ! is_null ( $ date ) ) { $ data [ 'date' ] = $ date ; } $ data [ 'stat' ] = 'list' ; return $ this -> stats ( $ data ) ; }
Retrieve information about your subscriber counts on a particular list on a particular day .
43,619
public function stats_blast ( $ blast_id = null , $ start_date = null , $ end_date = null , array $ data = [ ] ) { $ data [ 'stat' ] = 'blast' ; if ( ! is_null ( $ blast_id ) ) { $ data [ 'blast_id' ] = $ blast_id ; } if ( ! is_null ( $ start_date ) ) { $ data [ 'start_date' ] = $ start_date ; } if ( ! is_null ( $ end_...
Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range .
43,620
public function stats_send ( $ template = null , $ start_date = null , $ end_date = null , array $ data = [ ] ) { $ data [ 'stat' ] = 'send' ; if ( ! is_null ( $ template ) ) { $ data [ 'template' ] = $ template ; } if ( ! is_null ( $ start_date ) ) { $ data [ 'start_date' ] = $ start_date ; } if ( ! is_null ( $ end_da...
Retrieve information about a particular send or aggregated information from all of templates over a specified date range .
43,621
protected function processJob ( $ job , array $ data = [ ] , $ report_email = false , $ postback_url = false , array $ binary_data_param = [ ] , array $ options = [ ] ) { $ data [ 'job' ] = $ job ; if ( $ report_email ) { $ data [ 'report_email' ] = $ report_email ; } if ( $ postback_url ) { $ data [ 'postback_url' ] =...
process job api call
43,622
public function processImportJob ( $ list , $ emails , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { $ data = [ 'emails' => $ emails , 'list' => $ list ] ; return $ this -> processJob ( 'import' , $ data , $ report_email , $ postback_url , [ ] , $ options ) ; }
Process import job from given email string CSV
43,623
public function processImportJobFromFile ( $ list , $ file_path , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { $ data = [ 'file' => $ file_path , 'list' => $ list ] ; return $ this -> processJob ( 'import' , $ data , $ report_email , $ postback_url , [ 'file' ] , $ options ) ; }
Process import job from given file path of a CSV or email per line file
43,624
public function processPurchaseImportJobFromFile ( $ file_path , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { $ data = [ 'file' => $ file_path ] ; return $ this -> processJob ( 'purchase_import' , $ data , $ report_email , $ postback_url , [ 'file' ] , $ options ) ; }
Process purchase import job from given file path of an email per line JSON file
43,625
public function processSnapshotJob ( array $ query , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { $ data = [ 'query' => $ query ] ; return $ this -> processJob ( 'snaphot' , $ data , $ report_email , $ postback_url , [ ] , $ options ) ; }
Process a snapshot job
43,626
public function processExportListJob ( $ list , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { $ data = [ 'list' => $ list ] ; return $ this -> processJob ( 'export_list_data' , $ data , $ report_email , $ postback_url , [ ] , $ options ) ; }
Process a export list job
43,627
public function processBlastQueryJob ( $ blast_id , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { return $ this -> processJob ( 'blast_query' , [ 'blast_id' => $ blast_id ] , $ report_email , $ postback_url , [ ] , $ options ) ; }
Export blast data in CSV format
43,628
public function processUpdateJobFromUrl ( $ url , array $ update = [ ] , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { return $ this -> processUpdateJob ( 'url' , $ url , $ update , $ report_email , $ postback_url , [ ] , $ options ) ; }
Perform a bulk update of any number of user profiles from given URL
43,629
public function processUpdateJobFromFile ( $ file , array $ update = [ ] , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { return $ this -> processUpdateJob ( 'file' , $ file , $ update , $ report_email , $ postback_url , [ 'file' ] , $ options ) ; }
Perform a bulk update of any number of user profiles from given file
43,630
public function processUpdateJobFromQuery ( $ query , array $ update = [ ] , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { return $ this -> processUpdateJob ( 'query' , $ query , $ update , $ report_email , $ postback_url , [ ] , $ options ) ; }
Perform a bulk update of any number of user profiles from a query
43,631
public function processUpdateJobFromEmails ( $ emails , array $ update = [ ] , $ report_email = false , $ postback_url = false , array $ options = [ ] ) { return $ this -> processUpdateJob ( 'emails' , $ emails , $ update , $ report_email , $ postback_url , [ ] , $ options ) ; }
Perform a bulk update of any number of user profiles from emails CSV
43,632
public function saveUser ( $ id , array $ options = [ ] ) { $ data = $ options ; $ data [ 'id' ] = $ id ; return $ this -> apiPost ( 'user' , $ data ) ; }
Save existing user
43,633
public function getUserByKey ( $ id , $ key , array $ fields = [ ] ) { $ data = [ 'id' => $ id , 'key' => $ key , 'fields' => $ fields ] ; return $ this -> apiGet ( 'user' , $ data ) ; }
Get user by specified key
43,634
public function previewTemplateWithHTML ( $ template , $ email ) { $ data = [ ] ; $ data [ 'template' ] = $ template ; $ data [ 'email' ] = $ email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an HTML preview of a template .
43,635
public function previewBlastWithHTML ( $ blast_id , $ email ) { $ data = [ ] ; $ data [ 'blast_id' ] = $ blast_id ; $ data [ 'email' ] = $ email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an HTML preview of a blast .
43,636
public function previewRecurringBlastWithHTML ( $ blast_repeat_id , $ email ) { $ data = [ ] ; $ data [ 'blast_repeat_id' ] = $ blast_repeat_id ; $ data [ 'email' ] = $ email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; }
Get an HTML preview of a recurring blast .
43,637
public function previewContentWithHTML ( $ content_html , $ email ) { $ data = [ ] ; $ data [ 'content_html' ] = $ content_html ; $ data [ 'email' ] = $ email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an HTML preview of content_html .
43,638
public function previewTemplateWithEmail ( $ template , $ send_email ) { $ data = [ ] ; $ data [ 'template' ] = $ template ; $ data [ 'send_email' ] = $ send_email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an email preview of a template .
43,639
public function previewBlastWithEmail ( $ blast_id , $ send_email ) { $ data = [ ] ; $ data [ 'blast_id' ] = $ blast_id ; $ data [ 'send_email' ] = $ send_email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an email preview of a blast .
43,640
public function previewRecurringBlastWithEmail ( $ blast_repeat_id , $ send_email ) { $ data = [ ] ; $ data [ 'blast_repeat_id' ] = $ blast_repeat_id ; $ data [ 'send_email' ] = $ send_email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an email preview of a recurring blast .
43,641
public function previewContentWithEmail ( $ content_html , $ send_email ) { $ data = [ ] ; $ data [ 'content_html' ] = $ content_html ; $ data [ 'send_email' ] = $ send_email ; $ result = $ this -> apiPost ( 'preview' , $ data ) ; return $ result ; }
Get an email preview of content_html .
43,642
public function postTrigger ( $ template , $ time , $ time_unit , $ event , $ zephyr ) { $ data = [ ] ; $ data [ 'template' ] = $ template ; $ data [ 'time' ] = $ time ; $ data [ 'time_unit' ] = $ time_unit ; $ data [ 'event' ] = $ event ; $ data [ 'zephyr' ] = $ zephyr ; $ result = $ this -> apiPost ( 'trigger' , $ da...
Create a trigger for templates
43,643
public function postEventTrigger ( $ event , $ time , $ time_unit , $ zephyr ) { $ data = [ ] ; $ data [ 'time' ] = $ time ; $ data [ 'time_unit' ] = $ time_unit ; $ data [ 'event' ] = $ event ; $ data [ 'zephyr' ] = $ zephyr ; $ result = $ this -> apiPost ( 'trigger' , $ data ) ; return $ result ; }
Create a trigger for events
43,644
public function postEvent ( $ id , $ event , $ options = [ ] ) { $ data = $ options ; $ data [ 'id' ] = $ id ; $ data [ 'event' ] = $ event ; $ result = $ this -> apiPost ( 'event' , $ data ) ; return $ result ; }
Notify Sailthru of an event
43,645
protected function httpRequestCurl ( $ action , array $ data , $ method = 'POST' , $ options = [ ] ) { $ url = $ this -> api_uri . "/" . $ action ; $ ch = curl_init ( ) ; $ options = array_merge ( $ this -> options , $ options ) ; if ( $ method == 'POST' ) { curl_setopt ( $ ch , CURLOPT_POST , true ) ; if ( $ this -> f...
Perform an HTTP request using the curl extension
43,646
protected function httpRequest ( $ action , $ data , $ method = 'POST' , $ options = [ ] ) { $ response = $ this -> { $ this -> http_request_type } ( $ action , $ data , $ method , $ options ) ; $ json = json_decode ( $ response , true ) ; if ( $ json === NULL ) { throw new Sailthru_Client_Exception ( "Response: {$resp...
Perform an HTTP request checking for curl extension support
43,647
public function apiGet ( $ action , $ data = [ ] , $ method = 'GET' , $ options = [ ] ) { return $ this -> httpRequest ( $ action , $ this -> prepareJsonPayload ( $ data ) , $ method , $ options ) ; }
Perform an API GET request using the shared - secret auth hash .
43,648
protected function prepareJsonPayload ( array $ data , array $ binary_data = [ ] ) { $ payload = [ 'api_key' => $ this -> api_key , 'format' => 'json' , 'json' => json_encode ( $ data ) ] ; $ payload [ 'sig' ] = Sailthru_Util :: getSignatureHash ( $ payload , $ this -> secret ) ; if ( ! empty ( $ binary_data ) ) { $ pa...
Prepare JSON payload
43,649
public function getLastRateLimitInfo ( $ action , $ method ) { $ rate_limit_info = $ this -> lastRateLimitInfo ; $ method = strtoupper ( $ method ) ; return ( isset ( $ rate_limit_info [ $ action ] ) && isset ( $ rate_limit_info [ $ action ] [ $ method ] ) ) ? $ rate_limit_info [ $ action ] [ $ method ] : null ; }
get the rate limit information for the very last call with given action and method
43,650
private function parseRateLimitHeaders ( $ headers ) { if ( $ headers === null ) { return null ; } $ header_lines = explode ( "\n" , $ headers ) ; $ rate_limit_headers = [ ] ; foreach ( $ header_lines as $ hl ) { if ( strpos ( $ hl , "X-Rate-Limit-Limit" ) !== FALSE && ! isset ( $ rate_limit_headers [ 'limit' ] ) ) { l...
parse rate limit headers from http response
43,651
protected function _dynamicSelectStructure ( array $ options ) : array { $ result = [ ] ; foreach ( $ options as $ k => $ v ) { $ result [ $ v [ 'label' ] ] = ! empty ( $ v [ 'children' ] ) ? $ this -> _dynamicSelectStructure ( $ v [ 'children' ] ) : [ ] ; } return $ result ; }
Converts list options to supported dynamiSelect lib structure
43,652
public function getPanels ( array $ config , array $ data ) : array { $ result = [ 'success' => [ ] , 'fail' => [ ] ] ; foreach ( Panel :: getPanelNames ( $ config ) as $ name ) { $ panel = new Panel ( $ name , $ config ) ; if ( ! empty ( $ data ) && $ panel -> evalExpression ( $ data ) ) { $ result [ 'success' ] [ ] =...
List of evaluated Panels .
43,653
public static function getInstance ( string $ checkClass ) : CheckInterface { $ checkClass = $ checkClass ; if ( ! class_exists ( $ checkClass ) ) { throw new RuntimeException ( "Check class [$checkClass] does not exist" ) ; } if ( ! in_array ( static :: $ interface , array_keys ( class_implements ( $ checkClass ) ) ) ...
Get an instance of a given check class
43,654
public static function getList ( string $ module ) : array { $ default = Configure :: read ( 'CsvMigrations.ValidateShell.module._default' ) ; $ result = Configure :: read ( 'CsvMigrations.ValidateShell.module.' . $ module ) ; $ result = empty ( $ result ) ? $ default : $ result ; $ result = empty ( $ result [ 'checks'...
Get ValidateShell checks configuration for a given module
43,655
public function getOptionParser ( ) { $ parser = parent :: getOptionParser ( ) ; $ parser -> setDescription ( 'Bakes Module bootstrap configuration files and MVC classes' ) ; $ parser -> addArgument ( 'name' , [ 'help' => 'The Module name to bake' , 'required' => true ] ) ; return $ parser ; }
Configure option parser
43,656
private function bake ( string $ name , string $ template , array $ data = [ ] , string $ suffix = '' , array $ options = [ ] ) : bool { $ this -> BakeTemplate -> set ( $ data ) ; $ contents = $ this -> BakeTemplate -> generate ( 'CsvMigrations.' . $ template ) ; $ path = empty ( $ options [ 'path' ] ) ? $ this -> getP...
Wrapper method responsible for baking the actual files .
43,657
private function bakeModuleConfig ( string $ name ) : void { $ options = [ 'path' => Configure :: read ( 'CsvMigrations.modules.path' ) . $ name . DS . 'config' . DS , 'ext' => 'json' ] ; $ this -> bake ( 'config.dist' , 'Module/config/config' , [ ] , '' , $ options ) ; $ this -> bake ( 'fields.dist' , 'Module/config/f...
Bake Module configuration files .
43,658
private function bakeViewsConfig ( string $ name ) : void { $ options = [ 'path' => Configure :: read ( 'CsvMigrations.modules.path' ) . $ name . DS . 'views' . DS , 'ext' => 'json' ] ; $ this -> bake ( 'add.dist' , 'Module/views/add' , [ ] , '' , $ options ) ; $ this -> bake ( 'edit.dist' , 'Module/views/edit' , [ ] ,...
Bake Views configuration files .
43,659
private function bakeController ( string $ name ) : void { $ this -> pathFragment = 'Controller/' ; $ this -> bake ( $ name , 'Controller/controller' , [ 'name' => $ name ] , 'Controller' ) ; }
Bake Controller class .
43,660
private function bakeApiController ( string $ name ) : void { $ apiPaths = $ this -> getTargetApiPath ( ) ; $ this -> pathFragment = $ apiPaths [ 'fragment' ] ; $ this -> bake ( $ name , 'Controller/Api/controller' , array_merge ( [ 'name' => $ name ] , $ apiPaths ) , 'Controller' ) ; }
Bake API Controller class .
43,661
private function bakeFeature ( string $ name ) : void { $ this -> pathFragment = 'Feature/Type/Module/' ; $ this -> bake ( $ name , 'Feature/feature' , [ 'name' => $ name ] , 'Feature' ) ; }
Bake Feature class .
43,662
protected function getTargetApiPath ( ) : array { $ result = [ 'fragment' => 'Controller/Api' , 'namespace' => 'App\Controller\Api' , ] ; $ versions = Utility :: getApiVersions ( ) ; if ( empty ( $ versions ) ) { return $ result ; } $ recent = end ( $ versions ) ; if ( preg_match ( '/^api(.*)$/' , $ recent [ 'prefix' ]...
Get Target API Path for API Controllers
43,663
public static function getByTableField ( $ table , string $ field , array $ options = [ ] , ? View $ view = null ) : FieldHandlerInterface { $ table = is_string ( $ table ) ? TableRegistry :: get ( $ table ) : $ table ; $ handler = self :: getHandler ( $ table , $ field , $ options , $ view ) ; return $ handler ; }
Get an instance of field handler for given table field .
43,664
public function renderInput ( $ table , string $ field , $ data = '' , array $ options = [ ] ) : string { $ handler = self :: getByTableField ( $ table , $ field , $ options , $ this -> cakeView ) ; return $ handler -> renderInput ( $ data , $ options ) ; }
Render field form input .
43,665
public function renderName ( $ table , string $ field , array $ options = [ ] ) : string { $ handler = self :: getByTableField ( $ table , $ field , $ options , $ this -> cakeView ) ; return $ handler -> renderName ( ) ; }
Render field form label .
43,666
public function getSearchOptions ( $ table , string $ field , array $ options = [ ] ) : array { $ handler = self :: getByTableField ( $ table , $ field , $ options , $ this -> cakeView ) ; return $ handler -> getSearchOptions ( $ options ) ; }
Get search options .
43,667
public function fieldToDb ( CsvField $ csvField , $ table , string $ field = '' ) : array { if ( '' === $ field ) { $ field = $ csvField -> getName ( ) ; } $ handler = self :: getByTableField ( $ table , $ field ) ; return $ handler -> fieldToDb ( $ csvField ) ; }
Convert field CSV into database fields
43,668
protected static function getHandler ( Table $ table , $ field , array $ options = [ ] , View $ view = null ) : FieldHandlerInterface { if ( empty ( $ field ) ) { throw new InvalidArgumentException ( "Field parameter is empty" ) ; } $ fieldName = '' ; if ( is_string ( $ field ) ) { $ fieldName = $ field ; } if ( ! empt...
Get field handler instance
43,669
protected static function getStubFromArray ( string $ fieldName , array $ field ) : array { if ( empty ( $ field [ 'name' ] ) && ! empty ( $ fieldName ) ) { $ field [ 'name' ] = $ fieldName ; } if ( empty ( $ field [ 'name' ] ) ) { throw new InvalidArgumentException ( "Field array is missing 'name' key" ) ; } if ( empt...
Get stub fields from a field array
43,670
protected function addFieldsToSchema ( array $ schema , string $ module ) : array { if ( isset ( $ schema [ 'definitions' ] [ 'fieldName' ] ) ) { $ fields = Utility :: getRealModuleFields ( $ module , false ) ; if ( ! empty ( $ fields ) ) { $ schema [ 'definitions' ] [ 'fieldName' ] [ 'enum' ] = $ fields ; } } return $...
Add fields from migration config to schema .
43,671
protected function addVirtualFieldsToSchema ( array $ schema , string $ module ) : array { if ( isset ( $ schema [ 'definitions' ] [ 'virtualFieldName' ] ) ) { $ virtualFields = Utility :: getVirtualModuleFields ( $ module , false ) ; if ( ! empty ( $ virtualFields ) ) { $ schema [ 'definitions' ] [ 'virtualFieldName' ...
Add virtual fields from migration config to schema .
43,672
protected function addModulesToSchema ( array $ schema , string $ module ) : array { if ( isset ( $ schema [ 'definitions' ] [ 'moduleName' ] ) ) { $ modules = Utility :: getModules ( ) ; if ( ! empty ( $ modules ) ) { $ schema [ 'definitions' ] [ 'moduleName' ] [ 'enum' ] = array_values ( $ modules ) ; } } return $ sc...
Add available modules to schema .
43,673
protected function addRelationToSchema ( array $ schema , string $ module ) : array { if ( isset ( $ schema [ 'definitions' ] [ 'relation' ] ) ) { $ relations = Utility :: getRealRelationFields ( $ module ) ; if ( ! empty ( $ relations ) ) { $ schema [ 'definitions' ] [ 'relation' ] [ 'enum' ] = $ relations ; } } retur...
Add relation fields
43,674
public function getFiles ( string $ field , string $ id ) : ResultSetInterface { $ query = $ this -> storageTable -> find ( 'all' ) -> where ( [ self :: FILE_STORAGE_FOREIGN_KEY => $ id , 'model' => $ this -> table -> getTable ( ) , 'model_field' => $ field ] ) -> order ( $ this -> getOrderClause ( $ field ) ) ; $ resu...
Get files by foreign key record .
43,675
private function getOrderClause ( string $ field ) : array { $ className = App :: shortName ( get_class ( $ this -> table ) , 'Model/Table' , 'Table' ) ; $ config = ( new ModuleConfig ( ConfigType :: FIELDS ( ) , $ className ) ) -> parse ( ) ; if ( ! property_exists ( $ config , $ field ) ) { return [ ] ; } if ( ! prop...
Adds order clause to the provided Query based on specified field configuration .
43,676
private function attachThumbnails ( FileStorage $ entity ) : FileStorage { $ entity -> set ( 'thumbnails' , $ this -> getThumbnails ( $ entity ) ) ; return $ entity ; }
Attaches thumbnails field to FileStorage entity .
43,677
public function getThumbnails ( FileStorage $ entity ) : array { $ versions = ( array ) Configure :: read ( 'FileStorage.imageHashes.file_storage' ) ; if ( empty ( $ versions ) ) { return [ ] ; } $ result = [ ] ; foreach ( array_keys ( $ versions ) as $ version ) { $ result [ $ version ] = $ this -> getThumbnail ( $ en...
File storage entity thumbnails getter .
43,678
public function getThumbnail ( FileStorage $ entity , string $ version ) : string { $ versions = ( array ) Configure :: read ( 'FileStorage.imageHashes.file_storage' ) ; if ( empty ( $ versions ) ) { return str_replace ( DS , '/' , $ entity -> get ( 'path' ) ) ; } if ( ! array_key_exists ( $ version , $ versions ) ) { ...
File storage entity thumbnail url getter by version .
43,679
public function getThumbnailSizeList ( ) : array { $ thumbnails = [ ] ; $ versions = Configure :: read ( 'ThumbnailVersions' , [ ] ) ; foreach ( $ versions as $ version => $ definition ) { $ thumbnails [ $ version ] = sprintf ( '%s (%d x %d)' , ucfirst ( $ version ) , $ definition [ 'thumbnail' ] [ 'width' ] , $ defini...
Return all the available sizes for thumbnails
43,680
private function getImagePath ( FileStorage $ entity , string $ version ) : string { $ hash = ( string ) Configure :: read ( sprintf ( 'FileStorage.imageHashes.file_storage.%s' , $ version ) ) ; if ( empty ( $ hash ) ) { return $ entity -> get ( 'path' ) ; } $ event = new Event ( 'ImageVersion.getVersions' , $ this , [...
Image path getter .
43,681
private function getIconPath ( FileStorage $ entity , string $ version ) : string { $ imgSizes = ( array ) Configure :: read ( sprintf ( 'FileStorage.imageSizes.%s' , $ entity -> get ( 'model' ) ) ) ; if ( empty ( $ imgSizes ) ) { return Utility :: getFileTypeIcon ( $ entity -> get ( 'extension' ) ) ; } $ position = ar...
Icon path getter .
43,682
private function getUrlHelper ( ) : UrlHelper { if ( null === $ this -> urlHelper ) { $ this -> urlHelper = new UrlHelper ( new View ( ) ) ; } return $ this -> urlHelper ; }
UrlHelper getter method .
43,683
private function getFileFields ( ) : array { $ config = new ModuleConfig ( ConfigType :: MIGRATION ( ) , $ this -> table -> getAlias ( ) ) ; $ config = json_encode ( $ config -> parse ( ) ) ; if ( false === $ config ) { return [ ] ; } $ fields = json_decode ( $ config , true ) ; if ( empty ( $ fields ) ) { return [ ] ;...
File - type fields getter .
43,684
public function delete ( string $ id ) : bool { $ query = $ this -> storageTable -> find ( 'all' , [ 'conditions' => [ self :: FILE_STORAGE_FOREIGN_KEY => $ id ] ] ) ; $ entity = $ query -> first ( ) ; if ( is_null ( $ entity ) ) { return false ; } if ( $ this -> storageTable -> delete ( $ entity ) ) { $ this -> remove...
File delete method .
43,685
private function handleThumbnails ( FileStorage $ entity , string $ eventName ) : bool { if ( ! in_array ( strtolower ( $ entity -> get ( 'extension' ) ) , self :: IMAGE_EXTENSIONS ) ) { return false ; } $ imgSizes = ( array ) Configure :: read ( sprintf ( 'FileStorage.imageSizes.%s' , $ entity -> get ( 'model' ) ) ) ;...
Method used for handling image file thumbnails creation and removal .
43,686
public function validationDefault ( Validator $ validator ) : Validator { if ( ! Configure :: read ( 'CsvMigrations.tableValidation' ) ) { return $ validator ; } return $ this -> validationEnabled ( $ validator ) ; }
Set Table validation rules if the validation is globally enabled .
43,687
public function validationEnabled ( Validator $ validator ) : Validator { $ className = App :: shortName ( get_class ( $ this ) , 'Model/Table' , 'Table' ) ; $ config = ( new ModuleConfig ( ConfigType :: MIGRATION ( ) , $ className ) ) -> parse ( ) ; $ config = json_encode ( $ config ) ; if ( false === $ config ) { ret...
Set Table validation rules .
43,688
public function getFieldsDefinitions ( array $ stubFields = [ ] ) : array { $ result = [ ] ; if ( ! empty ( $ this -> _fieldDefinitions ) ) { $ result = $ this -> _fieldDefinitions ; } if ( empty ( $ result ) ) { $ moduleName = App :: shortName ( get_class ( $ this ) , 'Model/Table' , 'Table' ) ; list ( , $ moduleName ...
Get fields from CSV file
43,689
public function setJoinData ( Table $ table , EntityInterface $ entity ) : self { $ entityClass = $ table -> getEntityClass ( ) ; if ( ! $ entity instanceof $ entityClass ) { throw new InvalidArgumentException ( sprintf ( 'Entity must be an instance of "%s". Instead, instance of "%s" was provided.' , $ table -> getEnti...
Join data setter .
43,690
protected function provideFromRequest ( RequestInterface $ request , string $ field ) : string { Assert :: isInstanceOf ( $ request , ServerRequest :: class ) ; $ data = $ request -> getData ( ) ; $ result = is_array ( $ data ) && array_key_exists ( $ field , $ data ) ? ( string ) $ data [ $ field ] : '' ; return $ res...
Get field value from Request
43,691
public function provide ( $ data = null , array $ options = [ ] ) { $ result = '' ; if ( ! empty ( $ data ) ) { return $ data ; } $ result = $ this -> config -> getField ( ) ; $ result = $ this -> cleanName ( $ result ) ; return $ result ; }
Provide rendered name
43,692
public function renderValue ( string $ value , string $ list ) : void { $ table = $ this -> loadModel ( 'CsvMigrations.Dblists' ) ; $ this -> _createList ( $ list ) ; $ query = $ table -> find ( ) -> enableHydration ( true ) -> where ( [ $ table -> aliasField ( 'name' ) => $ list ] ) -> matching ( 'DblistItems' , funct...
Match and render the sucessfull value .
43,693
protected function _createList ( string $ name ) : bool { $ table = $ this -> loadModel ( 'CsvMigrations.Dblists' ) ; if ( $ table -> exists ( [ 'name' => $ name ] ) ) { return false ; } $ entity = $ table -> newEntity ( [ 'name' => $ name ] ) ; return ( bool ) $ table -> save ( $ entity ) ; }
Create new list .
43,694
public static function getProcessedFile ( ImportEntity $ import , bool $ fullBase = true ) : string { $ pathInfo = pathinfo ( $ import -> get ( 'filename' ) ) ; $ extension = $ pathInfo [ 'extension' ] ?? '' ; if ( ! empty ( $ extension ) ) { $ extension = '.' . $ extension ; } $ result = $ pathInfo [ 'filename' ] . st...
Processed filename getter .
43,695
public function upload ( ) : string { if ( ! $ this -> _validateUpload ( ) ) { return '' ; } $ result = $ this -> _uploadFile ( ) ; if ( '' === $ result ) { $ this -> flash -> error ( 'Unable to upload file to the specified directory.' ) ; } return $ result ; }
Import file upload logic .
43,696
public function create ( ImportsTable $ table , ImportEntity $ entity , string $ filename ) : bool { $ modelName = $ this -> request -> getParam ( 'controller' ) ; if ( $ this -> request -> getParam ( 'plugin' ) ) { $ modelName = $ this -> request -> getParam ( 'plugin' ) . '.' . $ modelName ; } $ data = [ 'filename' =...
Create import record .
43,697
public function getImportResults ( ImportEntity $ entity , array $ columns ) : QueryInterface { $ sortCol = Hash :: get ( $ this -> request -> getQueryParams ( ) , 'order.0.column' , 0 ) ; $ sortCol = array_key_exists ( $ sortCol , $ columns ) ? $ columns [ $ sortCol ] : current ( $ columns ) ; $ sortDir = Hash :: get ...
Import results getter .
43,698
public static function prepareOptions ( array $ options ) : array { if ( empty ( $ options [ 'fields' ] ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ options [ 'fields' ] as $ field => $ params ) { if ( empty ( $ params [ 'column' ] ) && empty ( $ params [ 'default' ] ) ) { continue ; } $ result [ 'fields' ] [ $ fi...
Prepare import options by removing fields with empty mapping parameters .
43,699
public static function getRowsCount ( string $ path , bool $ withHeader = false ) : int { $ result = trim ( exec ( "/usr/bin/env wc -l '" . $ path . "'" , $ output , $ return ) ) ; if ( 0 === $ return ) { list ( $ result , ) = explode ( ' ' , $ result ) ; $ result = ( int ) $ result ; if ( 0 < $ result ) { $ result -= ...
Get CSV file rows count .