idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
10,400
public function setToken ( $ key , $ value , $ duration = 60 ) { $ this -> cache -> put ( 'reactor.tokens.' . $ key , $ value , $ duration ) ; }
Setter for token
10,401
public function makeNewToken ( $ key , $ duration = 60 ) { $ token = str_random ( 32 ) ; $ this -> setToken ( $ key , $ token , $ duration ) ; return $ token ; }
Creates a new token and returns it
10,402
public function requestHasToken ( $ key ) { $ token = $ this -> request -> input ( $ key , null ) ; if ( $ token && $ token === $ this -> getToken ( $ key ) ) { return true ; } return false ; }
Checks if the request has the token
10,403
public function setOrderStatusDetail ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ OrderStatusDetail $ orderStatusDetail = null ) { $ this -> order_status_detail = $ orderStatusDetail ; return $ this ; }
Set orderStatusDetail .
10,404
public function setCustomer ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Customer \ Customer $ customer = null ) { $ this -> customer = $ customer ; return $ this ; }
Set customer .
10,405
public function setTrading ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Trading $ trading = null ) { $ this -> trading = $ trading ; return $ this ; }
Set trading .
10,406
public function addShipping ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Shipping $ shipping ) { $ this -> shippings [ ] = $ shipping ; return $ this ; }
Add shipping .
10,407
public function removeShipping ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Shipping $ shipping ) { return $ this -> shippings -> removeElement ( $ shipping ) ; }
Remove shipping .
10,408
public function removeFeedback ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Feedback \ Feedback $ feedback ) { return $ this -> feedbacks -> removeElement ( $ feedback ) ; }
Remove feedback .
10,409
private function addIndexerSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'indexer' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> booleanNode ( 'sudo' ) -> defaultValue ( false ) -> end ( ) -> scalarNode ( 'bin' ) -> defaultValue ( '/usr/bin/indexer' ) -> end ( ) -> scalarNode ( 'confi...
Set indexer parameters
10,410
private function addIndexesSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'indexes' ) -> isRequired ( ) -> requiresAtLeastOneElement ( ) -> useAttributeAsKey ( 'key' ) -> prototype ( 'scalar' ) -> end ( ) -> end ( ) -> end ( ) ; }
Set indexes parameters
10,411
private function addSearchdSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'searchd' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'host' ) -> defaultValue ( 'localhost' ) -> end ( ) -> scalarNode ( 'port' ) -> defaultValue ( '9312' ) -> end ( ) -> scalarNode ( 'socket' ) -...
Set search daemon parameters
10,412
public function setOptions ( $ options ) { switch ( true ) { case ( $ options instanceof ezcCacheStorageMemcacheOptions ) : $ this -> properties [ 'options' ] = $ options ; break ; case ( $ options instanceof ezcCacheStorageOptions ) : $ this -> properties [ 'options' ] -> mergeStorageOptions ( $ options ) ; break ; ca...
Set new options .
10,413
function getResponsabilidadIva ( $ id = 0 ) { if ( $ id == 0 ) { $ id = $ this -> id ; } $ ret = $ this -> find ( 'first' , array ( 'conditions' => array ( 'Cliente.id' => $ id ) , 'contain' => array ( 'IvaResponsabilidad' ) ) ) ; return $ ret ; }
Me devuelve la responsabilidad del cliente frente el IVA
10,414
public function filerBySearch ( $ data ) { $ filter = $ data [ 'search' ] ; $ condition = array ( 'OR' => array ( $ this -> alias . '.nombre LIKE' => '%' . $ filter . '%' , $ this -> alias . '.nrodocumento LIKE' => '%' . $ filter . '%' , $ this -> alias . '.telefono LIKE' => '%' . $ filter . '%' , $ this -> alias . '.d...
Or conditions with like
10,415
public function zip ( ) { if ( empty ( $ this -> filepath ) ) { throw ( new \ Exception ( "Must set \sb\Email\Attachment::file_path before zipping attachment" ) ) ; } if ( empty ( $ this -> name ) ) { $ this -> name = basename ( $ this -> filepath ) ; } $ zip = new \ ZipArchive ( ) ; $ zipfile_path = \ ROOT . "/private...
Zips the attachment before sending and sets the proper mime type
10,416
public function addEpisodeJob ( Keychain $ keychain , $ uniqID , $ overwrite = false , $ worker_queue = false , $ first = false ) { $ this -> jobService -> addJob ( "Oktolab\MediaBundle\Model\ImportEpisodeMetadataJob" , [ 'keychain' => $ keychain -> getUniqID ( ) , 'uniqID' => $ uniqID , 'overwrite' => $ overwrite ] , ...
starts an import worker for an episode by uniqID from the given Keychain
10,417
public function addImportSeriesPosterframeJob ( $ uniqID , $ keychain , $ filekey ) { $ this -> jobService -> addJob ( "Oktolab\MediaBundle\Model\ImportSeriesPosterframeJob" , [ 'uniqID' => $ uniqID , 'keychain' => $ keychain -> getUniqID ( ) , 'key' => $ filekey ] ) ; }
please use addSeriesPosterframeJob in the future .
10,418
public function describeColumns ( $ conn , $ table , $ schema = null ) { $ dialect = $ this -> getDialect ( $ conn ) ; if ( method_exists ( $ dialect , 'showFullColumns' ) ) { $ sql = $ this -> getDialect ( $ conn ) -> showFullColumns ( $ table , $ schema ) ; $ comments = [ ] ; foreach ( $ conn -> fetchAll ( $ sql , Db...
Adds comment to column
10,419
public function describeIndexes ( $ conn , $ table , $ schema = null ) { $ dialect = $ conn -> getDialectType ( ) ; $ method = 'describeIndexes' . $ dialect ; if ( ! method_exists ( $ this , $ method ) ) { throw new Exception ( "Describe index for $dialect is not implemented yet" ) ; } return $ this -> $ method ( $ con...
Describes table indexes
10,420
public function createTable ( $ conn , $ table , $ schema , array $ definition ) { if ( empty ( $ definition [ 'columns' ] ) ) { throw new Exception ( "The table must contain at least one column" ) ; } $ conn -> execute ( $ this -> getDialect ( $ conn ) -> createTable ( $ table , $ schema , $ definition ) ) ; }
creates database table
10,421
public static function getConnection ( $ dsn ) { if ( ! is_array ( $ dsn ) ) { $ dsn = self :: parseDsn ( $ dsn ) ; } if ( ! isset ( $ dsn [ 'adapter' ] ) ) { throw new Exception ( "database adapter is missing for " . json_encode ( $ dsn ) ) ; } $ class = 'Phalcon\Db\Adapter\Pdo\\' . ucfirst ( $ dsn [ 'adapter' ] ) ; $...
creates database connect by dsn
10,422
public function setOptions ( array $ opt = array ( ) ) { if ( isset ( $ opt [ 'compileDir' ] ) || isset ( $ opt [ 'compile_dir' ] ) ) { trigger_error ( 'Dwoo ZF Adapter: the compile dir should be set in the $options[\'engine\'][\'compileDir\'] value the adapter settings' , E_USER_WARNING ) ; } if ( isset ( $ opt [ 'cac...
Set object state from options array - engine = engine class name|engine object|array of options for engine - dataProvider = data provider class name|data provider object|array of options for data provider - compiler = compiler class name|compiler object|array of options for compiler - templateFile =
10,423
public function setEngine ( $ engine ) { if ( $ engine instanceof Dwoo ) { $ this -> _engine = $ engine ; } elseif ( is_subclass_of ( $ engine , 'Dwoo' ) || 'Dwoo' === $ engine ) { $ this -> _engine = new $ engine ( ) ; } else { throw new Dwoo_Exception ( "Custom engine must be a subclass of Dwoo" ) ; } }
Sets template engine
10,424
public function setDataProvider ( $ data ) { if ( $ data instanceof Dwoo_IDataProvider ) { $ this -> _dataProvider = $ data ; } elseif ( is_subclass_of ( $ data , 'Dwoo_Data' ) || 'Dwoo_Data' == $ data ) { $ this -> _dataProvider = new $ data ( ) ; } else { throw new Dwoo_Exception ( "Custom data provider must be a sub...
Sets Dwoo data object
10,425
public function setCompiler ( $ compiler ) { if ( $ compiler instanceof Dwoo_ICompiler ) { $ this -> _compiler = $ compiler ; } elseif ( is_subclass_of ( $ compiler , 'Dwoo_Compiler' ) || 'Dwoo_Compiler' == $ compiler ) { $ this -> _compiler = new $ compiler ; } else { throw new Dwoo_Exception ( "Custom compiler must b...
Sets Dwoo compiler
10,426
public function getCompiler ( ) { if ( null === $ this -> _compiler ) { $ this -> _compiler = Dwoo_Compiler :: compilerFactory ( ) ; } return $ this -> _compiler ; }
Return the Dwoo compiler object
10,427
public function getTemplateFile ( $ template ) { $ templateFileClass = $ this -> _templateFileClass ; $ dwooTemplateFile = new $ templateFileClass ( $ template ) ; if ( ! ( $ dwooTemplateFile instanceof Dwoo_ITemplate ) ) { throw new Dwoo_Exception ( "Custom templateFile class must be a subclass of Dwoo_ITemplate" ) ; ...
Initializes Dwoo_ITemplate type of class and sets properties from _templateFileSettings
10,428
public function assign ( $ name , $ val = null ) { $ this -> getDataProvider ( ) -> assign ( $ name , $ val ) ; return $ this ; }
Passes data to Dwoo_Data object
10,429
public function _run ( ) { echo $ this -> _engine -> get ( $ this -> getTemplateFile ( func_get_arg ( 0 ) ) , $ this -> getDataProvider ( ) , $ this -> getCompiler ( ) ) ; }
Processes a view script and outputs it . Output is then passed through filters .
10,430
public function size ( $ remote_file ) { $ size = @ ftp_size ( $ this -> connection , $ remote_file ) ; if ( $ size && $ size != - 1 ) { return $ size ; } else { throw new \ Exception ( "Could not get remote file size: " . $ path ) ; } }
Gets the size of a remote file
10,431
public function chmod ( $ remote_file , $ mode ) { $ mode = octdec ( str_pad ( $ mode , 4 , '0' , STR_PAD_LEFT ) ) ; $ mode = ( int ) $ mode ; if ( ! @ ftp_chmod ( $ this -> connection , $ mode , $ remote_file ) !== false ) { throw new \ Exception ( "Could not change remote file to mode: " . $ mode ) ; } return true ; ...
Change the file mode of a remote file
10,432
private function findWorkerTenderProcessesForTube ( $ tube ) { $ processes = array ( ) ; $ command = "ps ax " ; $ command .= "|grep php " ; $ command .= "|grep -v stop " ; $ command .= "|grep worker-tender " ; if ( $ tube !== '' ) { $ command .= "|grep " . escapeshellarg ( 'use-tube=' . $ tube ) ; } $ data = exec ( $ c...
Returns a list of processes that match the worker - tender
10,433
public function run ( $ method , $ action , $ data ) { $ method = strtoupper ( $ method ) ; if ( is_callable ( [ $ this , $ method ] ) ) { return $ this -> $ method ( $ action , $ data ) ; } return $ this -> httpError ( 405 , 'Method Not Allowed' ) ; }
Run the Nymph REST server process .
10,434
protected function httpError ( $ errorCode , $ message , $ exception = null ) { header ( "HTTP/1.1 $errorCode $message" , true , $ errorCode ) ; if ( $ exception ) { echo json_encode ( [ 'textStatus' => "$errorCode $message" , 'exception' => get_class ( $ exception ) , 'code' => $ exception -> getCode ( ) , 'message' =...
Return the request with an HTTP error response .
10,435
public function listen ( $ request , $ response ) { $ this -> hits ++ ; $ path = '/' . ltrim ( $ request -> getPath ( ) , '/' ) ; $ endpoint = NULL ; if ( isset ( $ this -> routes [ $ path ] ) ) { $ endpoint = $ this -> routes [ $ path ] ; } else { $ endpointKey = NULL ; if ( isset ( $ this -> lookupCache [ $ path ] ) ...
Handle an incoming request map it to the correct endpoint using routes and call the listen method on the endpoint
10,436
protected function scanRoutes ( $ root , $ realRoot = NULL ) { if ( $ realRoot === NULL ) $ realRoot = $ root ; $ result = array ( ) ; $ all = glob ( $ root . '/*' ) ; foreach ( $ all as $ path ) { if ( ! is_dir ( $ path ) ) { $ res = $ this -> createRouteFromFile ( $ realRoot , $ path ) ; if ( $ res ) $ result [ ] = $...
Recursively find all routes within path
10,437
public function s2o ( $ sql , $ params = null , $ class_name = '' , $ prepare_and_store = 1 ) { try { return parent :: s2o ( $ sql , $ params , $ class_name , $ prepare_and_store ) ; } catch ( \ Exception $ e ) { throw ( new \ sb \ PDO \ Exception ( 'CALLED: ' . __METHOD__ . "\nERROR RETURNED: " . print_r ( $ e , 1 ) )...
Additionally Logs the errors
10,438
public function setHeader ( $ keyName , $ value ) { $ normalizedKeyName = self :: normalizeHeaderKeyName ( $ keyName ) ; $ this -> headers [ $ normalizedKeyName ] = $ value ; }
Set a header . If it already exists the value is overwritten with the new one .
10,439
public function send ( ) { header ( sprintf ( 'HTTP/1.1 %s %s' , $ this -> statusCode , self :: codeToReason ( $ this -> statusCode ) ) ) ; foreach ( $ this -> headers as $ k => $ v ) { header ( sprintf ( '%s: %s' , $ k , $ v ) ) ; } echo $ this -> body ; }
Construct the response and send it out .
10,440
public function toArray ( ) { $ output = [ ] ; $ output [ ] = sprintf ( 'HTTP/1.1 %s %s' , $ this -> statusCode , self :: codeToReason ( $ this -> statusCode ) ) ; foreach ( $ this -> headers as $ k => $ v ) { $ output [ ] = sprintf ( '%s: %s' , $ k , $ v ) ; } $ output [ ] = '' ; $ output [ ] = $ this -> body ; return...
Convert the full response to array for the purpose of unit testing .
10,441
public function render ( $ textOnly = false ) { if ( $ textOnly ) return $ this -> renderText ( ) ; $ str = $ this -> getStyle ( ) ; $ str .= "<table><tr><td valign='top'>" ; $ str .= $ this -> _render ( false ) ; $ str .= "</td></tr></table>" ; return $ str ; }
Returns the renderer s web page .
10,442
private function normalizeValue ( $ value ) { switch ( $ this -> type ) { case self :: TYPE_STRING : return trim ( ( string ) $ value ) ; case self :: TYPE_INT : return intval ( $ value ) ; case self :: TYPE_FLOAT : return floatval ( $ value ) ; } throw new FilterException ( "Invalid filter value type \"{$this->type}\"...
Normalize input value
10,443
protected function getTagFromBranch ( $ branch ) { $ git = new GitRepository ( $ this -> input -> getArgument ( 'git-dir' ) ) ; $ tag = trim ( $ git -> describe ( ) -> tags ( ) -> always ( ) -> execute ( $ branch ) ) ; $ hash = trim ( $ git -> revParse ( ) -> short ( false ) -> execute ( $ branch ) ) ; return $ hash !=...
Retrieve the latest tag from a branch .
10,444
public function validate ( $ tag , $ alias ) { $ simpleAlias = preg_replace ( '~(\.x)?-dev~' , '' , $ alias ) ; $ versionLevel = count ( explode ( '.' , $ simpleAlias ) ) ; $ reducedTag = preg_replace ( '~-.*$~' , '' , $ tag ) ; $ reducedTag = implode ( '.' , array_slice ( explode ( '.' , $ reducedTag ) , 0 , $ version...
Validate the given branch .
10,445
protected function getConvertedParameters ( ) : array { $ parameters = $ this -> all ( ) ; $ parameters = $ this -> castBooleans ( $ parameters ) ; $ parameters = $ this -> convertToSnakeCase ( $ parameters ) ; if ( method_exists ( $ this , 'convertParameters' ) ) { $ parameters = $ this -> convertParameters ( $ parame...
Cast and convert parameters .
10,446
protected function castBooleans ( $ input ) : array { if ( $ this -> castToBooleanIsDisabled ( ) ) { return [ ] ; } $ casted = [ ] ; foreach ( $ input as $ key => $ value ) { $ casted [ $ key ] = $ this -> castValueToBoolean ( $ value ) ; } return $ casted ; }
Cast all string booleans to real boolean values .
10,447
protected function convertToSnakeCase ( $ input ) { if ( $ this -> convertToSnakeCaseIsDisabled ( ) ) { return ; } if ( is_null ( $ input ) ) { return null ; } elseif ( is_array ( $ input ) ) { return $ this -> convertArrayToSnakeCase ( $ input ) ; } return snake_case ( $ input ) ; }
Convert a string or array to snake case .
10,448
protected function convertArrayToSnakeCase ( array $ input ) : array { $ converted = [ ] ; foreach ( $ input as $ key => $ value ) { $ converted [ snake_case ( $ key ) ] = $ value ; } return $ converted ; }
Convert all keys of an array to snake case .
10,449
public function refreshLastUsed ( $ sessionId , $ lastUsed = null ) { if ( $ sessionInformation = $ this -> getSessionInformation ( $ sessionId ) ) { if ( $ sessionInformation -> getLastUsed ( ) !== $ lastUsed ) { $ sessionInformation -> refreshLastUsed ( $ lastUsed ) ; $ this -> saveSessionInformation ( $ sessionInfor...
Updates the given sessionId so its last request time is equal to the present date and time .
10,450
public function expireNow ( $ sessionId ) { if ( $ sessionInformation = $ this -> getSessionInformation ( $ sessionId ) ) { $ sessionInformation -> expireNow ( ) ; $ this -> saveSessionInformation ( $ sessionInformation ) ; } }
Expires the given sessionId .
10,451
public function registerNewSession ( $ sessionId , $ username , $ lastUsed = null ) { $ sessionInformation = new SessionInformation ( $ sessionId , $ username , $ lastUsed ? : time ( ) ) ; $ this -> saveSessionInformation ( $ sessionInformation ) ; }
Registers a new session for the given user .
10,452
public function collectGarbage ( $ maxLifetime = null ) { $ maxLifetime = $ maxLifetime ? : ini_get ( 'session.gc_maxlifetime' ) ; $ this -> sessionRegistryStorage -> collectGarbage ( $ maxLifetime ) ; }
Removes sessions information which last used timestamp is older than the given lifetime .
10,453
public function register ( ) { if ( ! $ this -> validate ( ) ) { return false ; } $ user = Yii :: createObject ( ModelMapHelper :: User ( ) ) ; $ user -> setAttributes ( $ this -> attributes ) ; $ result = $ user -> register ( ) ; if ( $ user -> hasErrors ( ) ) { foreach ( $ user -> errors as $ attribute => $ errors ) ...
Performs registration of user . Returns User object on success or false on failure .
10,454
public function getCollections ( ) { return $ this -> getCachedProperty ( 'collections' , function ( ) { $ result = [ ] ; $ items = $ this -> query ( 'app:collection' ) ; foreach ( $ items as $ item ) { $ result [ ] = $ this -> getExtensions ( ) -> parseElement ( $ this , $ item ) ; } return $ result ; } ) ; }
Return collections .
10,455
public function addCollection ( $ title ) { $ collections = $ this -> getCollections ( ) ; $ collection = $ this -> getExtensions ( ) -> createElement ( $ this , 'app:collection' ) ; $ collection -> addTitle ( $ title ) ; $ collections [ ] = $ collection ; $ this -> setCachedProperty ( 'collections' , $ collections ) ;...
Add new Collection
10,456
public function convertDateFields ( ) { $ grid_field = $ this -> getGridField ( ) ; $ config = $ grid_field -> getConfig ( ) ; $ db = Config :: inst ( ) -> get ( $ grid_field -> getModelClass ( ) , "db" ) ; $ dates = self :: config ( ) -> date_fields ; $ fields = $ this -> findDateFields ( ) ; foreach ( $ config -> get...
Get any date fields from the passed list and convert to . Nice format .
10,457
public function open ( $ method , $ action = '' , $ attr = array ( ) ) { $ method = strtolower ( $ method ) ; if ( $ method === 'file' ) { $ method = 'post' ; $ attr [ 'enctype' ] = 'multipart/form-data' ; } if ( ! in_array ( $ method , array ( 'post' , 'get' ) ) ) { $ method = 'post' ; } $ attr [ 'method' ] = $ method...
open a form
10,458
public function hidden ( $ name , $ attr = array ( ) ) { return $ this -> input ( $ name , false , array_merge ( $ attr , array ( 'type' => 'hidden' , 'wrapper' => false ) ) ) ; }
shortcut for hidden input field
10,459
public function password ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , $ label , array_merge ( $ attr , array ( 'type' => 'password' ) ) ) ; }
shortcut for password field
10,460
public function textarea ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , $ label , array_merge ( $ attr , array ( 'type' => 'textarea' ) ) ) ; }
shortcut for textarea field
10,461
public function file ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , $ label , array_merge ( $ attr , array ( 'type' => 'file' ) ) ) ; }
shortcut for file field
10,462
public function checkbox ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , $ label , array_merge ( $ attr , array ( 'type' => 'checkbox' ) ) ) ; }
shortcut for checkbox field
10,463
public function submit ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , false , array_merge ( $ attr , array ( 'type' => 'submit' , 'value' => $ label ) ) ) ; }
generate a submit input
10,464
public function button ( $ name , $ label , $ attr = array ( ) ) { return $ this -> input ( $ name , false , array_merge ( $ attr , array ( 'type' => 'button' , 'value' => $ label ) ) ) ; }
generate a button input
10,465
public function radio ( $ name , $ label , $ options , $ attr = array ( ) ) { return $ this -> input ( $ name , $ label , array_merge ( $ attr , array ( 'type' => 'radio' , 'options' => $ options ) ) ) ; }
generate a group of radio buttons
10,466
public function input ( $ name , $ label , $ attr = array ( ) ) { if ( empty ( $ attr [ 'id' ] ) ) { $ attr [ 'id' ] = $ this -> transformNameForID ( $ name ) ; } if ( $ label !== false ) { $ labelAttr = [ ] ; if ( is_array ( $ label ) ) { $ labelAttr = $ label ; $ label = ( ! empty ( $ label [ 'value' ] ) ) ? $ label ...
generate a complete input with wrapped div and label
10,467
public function generateField ( $ name , $ attr = array ( ) ) { $ tag = 'input' ; if ( in_array ( $ attr [ 'type' ] , $ this -> customGenerate ) ) { $ tag = $ attr [ 'type' ] ; } $ attr [ 'name' ] = $ this -> transformName ( $ name ) ; $ attr = $ this -> getData ( $ name , $ attr ) ; if ( $ tag !== 'input' ) { $ genera...
generate a field
10,468
public function generateRadioField ( $ attr ) { if ( empty ( $ attr [ 'name' ] ) ) { return '' ; } $ out = '' ; $ options = array ( ) ; if ( ! empty ( $ attr [ 'options' ] ) ) { $ options = $ attr [ 'options' ] ; } if ( isset ( $ attr [ 'checked' ] ) ) { $ checkedItem = $ attr [ 'checked' ] ; } unset ( $ attr [ 'option...
generate a selection of radio buttons
10,469
public function generateCheckboxField ( $ attr ) { if ( empty ( $ attr [ 'name' ] ) ) { return '' ; } $ out = '' ; if ( ( isset ( $ attr [ 'hiddenCheckbox' ] ) && $ attr [ 'hiddenCheckbox' ] ) || ! isset ( $ attr [ 'hiddenCheckbox' ] ) ) { $ out .= $ this -> input ( $ attr [ 'name' ] , false , array ( 'type' => 'hidden...
generate a checkbox
10,470
public function generateButtonField ( $ attr ) { $ value = 'Submit' ; if ( ! empty ( $ attr [ 'value' ] ) ) { $ value = $ attr [ 'value' ] ; } unset ( $ attr [ 'value' ] , $ attr [ 'type' ] ) ; return $ this -> Html -> tag ( 'button' , $ attr , $ value , true ) ; }
generate a button
10,471
public function generateSelectField ( $ attr ) { if ( empty ( $ attr [ 'name' ] ) ) { return '' ; } $ options = array ( ) ; if ( ! empty ( $ attr [ 'options' ] ) ) { $ options = $ attr [ 'options' ] ; } $ options = $ this -> generateSelectOptions ( $ options , $ attr ) ; unset ( $ attr [ 'options' ] , $ attr [ 'type' ]...
generate a select field
10,472
public function generateSelectOptions ( $ options , $ attr ) { $ return = '' ; foreach ( $ options as $ key => $ value ) { if ( is_array ( $ value ) ) { $ subArray = $ this -> generateSelectOptions ( $ value , $ attr ) ; $ return .= $ this -> Html -> tag ( 'optgroup' , array ( 'label' => $ key ) , $ subArray , true ) ;...
generate the options for a select box
10,473
public function transformName ( $ name ) { if ( strpos ( $ name , '.' ) !== false ) { $ bits = explode ( '.' , $ name , 2 ) ; $ bits [ '1' ] = '[' . str_replace ( '.' , '][' , $ bits [ '1' ] ) . ']' ; return implode ( '' , $ bits ) ; } else { return $ name ; } }
transform the dot notation name into proper name
10,474
public function transformNameForID ( $ name ) { $ bits = explode ( '.' , $ name ) ; array_walk ( $ bits , function ( & $ value , $ key ) { $ value = ucfirst ( strtolower ( $ value ) ) ; } ) ; return implode ( '' , $ bits ) ; }
transform the dot notation name into a name for input ID if no ID was passed
10,475
public function getInjects ( & $ attr ) { $ inject = array ( 'before' => '' , 'between' => '' , 'after' => '' ) ; if ( ! empty ( $ attr [ 'before' ] ) ) { $ inject [ 'before' ] = $ attr [ 'before' ] ; unset ( $ attr [ 'before' ] ) ; } if ( ! empty ( $ attr [ 'between' ] ) ) { $ inject [ 'between' ] = $ attr [ 'between'...
get injections from the attributes allows data to be entered before between after
10,476
public function getWrapper ( $ wrapper , $ attr ) { $ type = '' ; if ( ! empty ( $ attr [ 'type' ] ) ) { $ type = ' ' . $ attr [ 'type' ] ; if ( ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'select' ) && in_array ( 'multiple' , $ attr ) ) { $ type .= ' multiselect' ; } } $ defaults = array ( 'tag' => 'div' , '...
given any user defined wrapper instructions build the wrapper data
10,477
public function getData ( $ name , $ attr ) { if ( empty ( $ name ) ) { return $ attr ; } $ value = $ this -> Data -> getValue ( $ name ) ; if ( $ value !== null ) { $ isCheckbox = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'checkbox' ) ; $ isRadio = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'rad...
use the Data interface and find any post data
10,478
public function setData ( $ Data ) { if ( ! is_object ( $ Data ) || ! $ Data instanceof Data ) { throw new \ InvalidArgumentException ( 'The Data Interface must be a valid Data Object' ) ; } $ this -> Data = $ Data ; return true ; }
check and set the form data interface
10,479
public function setHtml ( $ Html ) { if ( ! is_object ( $ Html ) || ! $ Html instanceof HtmlObject ) { throw new \ InvalidArgumentException ( 'The HTML Object must be a valid HTML Object' ) ; } $ this -> Html = $ Html ; return true ; }
check and set the HTML Object
10,480
protected function addExtensionsFromTemplateConfiguration ( Transformation $ transformation , ProjectDescriptor $ project , \ Twig_Environment $ twigEnvironment ) { $ isDebug = $ transformation -> getParameter ( 'twig-debug' ) ? $ transformation -> getParameter ( 'twig-debug' ) -> getValue ( ) : false ; if ( $ isDebug ...
Tries to add any custom extensions that have been defined in the template or the transformation s configuration .
10,481
protected function getDestinationPath ( $ node , Transformation $ transformation ) { $ writer = $ this ; if ( ! $ node ) { throw new \ UnexpectedValueException ( 'The transformation node in the twig writer is not expected to be false or null' ) ; } if ( ! $ transformation -> getArtifact ( ) ) { $ rule = $ this -> route...
Uses the currently selected node and transformation to assemble the destination path for the file .
10,482
public function filter_sanitize ( $ v , $ p ) { $ option = Helper :: arrGet ( $ this -> sanitizes , $ p , $ p ) ; $ v -> setValue ( filter_var ( $ v -> getValue ( ) , $ option ) ) ; if ( $ p === 'int' ) { if ( ( int ) $ v -> getValue ( ) !== ( int ) ( float ) $ v -> getValue ( ) ) { $ v -> setValue ( '' ) ; } } }
sanitize the value using filter_var .
10,483
public function filter_datetime ( $ v , $ p ) { if ( is_bool ( $ p ) && $ p ) { $ p = 'Y-m-d H:i:s' ; } $ dt = \ date_create_from_format ( $ p , $ v -> getValue ( ) ) ; if ( ! $ dt ) { $ v -> setValue ( null ) ; $ v -> setError ( __METHOD__ , $ p ) ; return ; } $ v -> setValue ( $ dt -> format ( $ p ) ) ; }
check for valid date - time input string .
10,484
public function showMappingCommand ( string $ node ) { foreach ( $ this -> contentDimensionCombinator -> getAllAllowedCombinations ( ) as $ dimensions ) { $ context = $ this -> createContentContext ( 'live' , $ dimensions ) ; $ siteNode = $ context -> getNodeByIdentifier ( $ node ) ; $ taxonomyNodes = ( new FlowQuery (...
Show ElasticSearch filters and analyzers
10,485
public function toArray ( ) { $ this -> data = $ this -> transformer -> transformBack ( $ this -> data ) ; return $ this -> data ; }
Return array representation of item
10,486
public function validate ( $ schemaFile ) { if ( ! $ this -> xmlString ) throw new XmlParserException ( "attempting to validate before parsing" ) ; if ( ! extension_loaded ( "DOM" ) ) { trigger_error ( "DOM extension not loaded, will not validate XML" , E_USER_NOTICE ) ; return $ this ; } libxml_use_internal_errors ( t...
Validates XML using a schema .
10,487
public static function get ( $ node , $ tagName , $ count = 1 ) { $ node = $ node -> { $ tagName } ; if ( $ node -> count ( ) !== $ count ) throw new XmlParserException ( "xml does not have exactly $count $tagName's" ) ; return $ node [ 0 ] ; }
Returns a child node for a tag name from an XML node .
10,488
public static function connect ( $ mysqlConfig ) { $ dbConfig = array ( 'dsn' => 'mysql:dbname=' . $ mysqlConfig [ 'dbname' ] . ';host=' . $ mysqlConfig [ 'host' ] , 'user' => $ mysqlConfig [ 'user' ] , 'pass' => $ mysqlConfig [ 'pass' ] , 'options' => array ( PDO :: MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" ) , ) ; ...
Returns a PDO instance
10,489
private function writeField ( $ file , $ fieldName , $ field , $ isPrimary ) { fwrite ( $ file , "\n" ) ; if ( $ isPrimary ) { fwrite ( $ file , "\$def->idProperty = new ezcPersistentObjectIdProperty();\n" ) ; fwrite ( $ file , "\$def->idProperty->columnName = '$fieldName';\n" ) ; fwrite ( $ file , "\$d...
Write a field of the schema to the PersistentObject definition . This method writes a database field to the PersistentObject definition file .
10,490
private function writeTable ( $ dir , $ tableName , ezcDbSchemaTable $ table ) { $ file = $ this -> openFile ( $ dir , $ tableName ) ; fwrite ( $ file , "\$def = new ezcPersistentObjectDefinition();\n" ) ; fwrite ( $ file , "\$def->table = '$tableName';\n" ) ; fwrite ( $ file , "\$def->class = '{$this->prefix}$tableNam...
Writes the PersistentObject defintion for a table .
10,491
private function closeFile ( $ file ) { fwrite ( $ file , "return \$def;\n" ) ; fwrite ( $ file , "\n" ) ; fwrite ( $ file , "?>\n" ) ; fclose ( $ file ) ; }
Close a file where a PersistentObject definition has been written to . This method closes a file after writing a PersistentObject definition to it and writes the PHP closing tag to it .
10,492
private function determinePrimaries ( $ indexes ) { $ primaries = array ( ) ; foreach ( $ indexes as $ index ) { if ( $ index -> primary ) { foreach ( $ index -> indexFields as $ field => $ definiton ) { $ primaries [ $ field ] = true ; } } } return $ primaries ; }
Extract primary keys from an index definition . This method extracts the names of all primary keys from the index defintions of a table .
10,493
protected function generateTransformer ( ) { $ name = ( string ) $ this -> argument ( 'name' ) ; $ path = $ this -> laravel -> basePath ( ) . '/app/Transformers/' . $ name . '.php' ; if ( $ this -> files -> exists ( $ path ) ) { return $ this -> error ( $ name . ' already exists!' ) ; } $ this -> makeDirectory ( $ path...
Generate the transformer class .
10,494
protected function makeTransformer ( string $ name , string $ stub ) : string { $ stub = $ this -> replaceNamespace ( $ stub ) ; $ stub = $ this -> replaceClass ( $ stub , $ name ) ; $ stub = $ this -> replaceModel ( $ stub , $ name ) ; return $ stub ; }
Build the transformer class using the given name and stub .
10,495
protected function getModelNamespace ( string $ name ) : string { if ( $ this -> option ( 'model' ) ) { return $ this -> option ( 'model' ) ; } return 'App\\' . str_replace ( 'Transformer' , '' , $ name ) ; }
Get the full class path for the model .
10,496
public function setAppLocale ( $ locale = null , $ session = true ) { $ locale = $ locale ? : $ this -> session -> get ( '_locale' , null ) ; if ( $ locale ) { $ this -> app -> setLocale ( $ locale ) ; if ( $ session ) { $ this -> session -> put ( '_locale' , $ locale ) ; } $ this -> setTimeLocale ( $ locale ) ; } }
Sets the app locale
10,497
public function setTimeLocale ( $ locale = null ) { $ locale = $ locale ? : $ this -> session -> get ( '_locale' , $ this -> app -> getLocale ( ) ) ; setlocale ( LC_TIME , $ this -> config -> get ( 'translatable.full_locales.' . $ locale , null ) ) ; Carbon :: setLocale ( $ locale ) ; }
Sets the time locale
10,498
public static function send ( $ file , $ display_file_name = '' , $ seekat = 0 ) { $ display_file_name = $ display_file_name ? $ display_file_name : basename ( $ file ) ; $ display_file_name = str_replace ( " " , "_" , $ display_file_name ) ; header ( "HTTP/1.1 200 OK" ) ; header ( "Status: 200 OK" ) ; header ( "Pragma...
Send headers and begins force - download
10,499
public static function fileToZip ( $ path ) { if ( is_file ( $ path ) || is_dir ( $ path ) ) { $ zip = new \ ZipArchive ; $ zip_file = ROOT . '/private/cache/zip/' . md5 ( microtime ( true ) ) ; if ( ! is_dir ( dirname ( $ zip_file ) ) ) { mkdir ( dirname ( $ zip_file ) , 0775 , true ) ; } if ( $ zip -> open ( $ zip_fi...
Converts a file or directory into a zip file for consumption by the browser