idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
6,600 | protected function saveXMLtoDB ( & $ data ) { $ this -> validateParameters ( ) ; $ xmldoc = new \ DOMDocument ( "1.0" , "UTF-8" ) ; $ xmldoc -> formatOutput = true ; $ root = $ xmldoc -> createElement ( "array" ) ; $ root = $ xmldoc -> appendChild ( $ root ) ; array_to_dom ( $ root , $ data ) ; $ xml = $ xmldoc -> save... | This is internal auxiliary function for converting the settings to XML and storing it to the target table defined by the iniailization . |
6,601 | protected function loadXMLfromDB ( & $ data ) { $ this -> validateParameters ( ) ; $ query = "SELECT " . $ this -> settings_column . " FROM " . $ this -> settings_table ; if ( ! $ this -> dbworker -> execute_query ( $ query ) ) { throw new \ Exception ( $ this -> dbworker -> get_last_error ( ) . "\n\n" . $ this -> dbwo... | This is internal auxiliary function for loading the settings from the target table defined by the iniailization . |
6,602 | public function loadSettings ( ) { if ( $ this -> isDirty ( true ) ) { return true ; } if ( ! $ this -> loadXMLfromDB ( $ this -> settings ) ) { return false ; } $ this -> temp_settings = $ this -> settings ; unset ( $ this -> temp_settings [ "__dirty" ] ) ; return true ; } | Loads the settings from the target table . |
6,603 | public function saveSettings ( ) { $ old_dirty_state = $ this -> temp_settings [ "__dirty" ] ; unset ( $ this -> temp_settings [ "__dirty" ] ) ; if ( $ this -> saveXMLtoDB ( $ this -> temp_settings ) ) { $ this -> settings = $ this -> temp_settings ; return true ; } $ this -> temp_settings [ "__dirty" ] = $ old_dirty_s... | Saves the settings from to the target table . |
6,604 | public function remove ( $ entity ) { $ key = get_class ( $ entity ) . '::' . $ entity -> getId ( ) ; $ this -> getCache ( ) -> erase ( $ key ) ; return $ this ; } | Remove an entity from identity map |
6,605 | public static function initialize ( Config $ config ) { $ class = $ config -> getModelClass ( ) ; return $ config -> addRel ( new BelongsTo ( 'parent' , $ config , $ class :: getRepo ( ) ) ) -> addRel ( new HasMany ( 'children' , $ config , $ class :: getRepo ( ) , [ 'foreignKey' => 'parentId' ] ) ) ; } | Adds parent and children rels |
6,606 | public function onBeforeAutoloadDump ( ) { clearstatcache ( ) ; if ( file_exists ( __DIR__ . '/Plugin.php' ) ) { $ filesystem = new Filesystem ( ) ; $ tmp = $ this -> composer -> getRepositoryManager ( ) -> getLocalRepository ( ) -> getCanonicalPackages ( ) ; array_unshift ( $ tmp , $ this -> composer -> getPackage ( )... | Regenerate Spoom s package list on autoload - dump |
6,607 | public function writeAutoload ( array $ list ) { $ file = Autoload :: FILE ; if ( is_dir ( dirname ( $ file ) ) || mkdir ( dirname ( $ file ) , 0777 , true ) ) { uksort ( $ list , function ( $ a , $ b ) { return strlen ( $ b ) - strlen ( $ a ) ; } ) ; $ content = [ ] ; foreach ( $ list as $ namespace => $ path ) { $ is... | Rewrite autoload paths |
6,608 | public function getFileList ( PackageInterface $ package , $ map ) { $ directory = $ this -> getDirectory ( $ package ) ; $ result = [ ] ; try { foreach ( $ map as $ source => $ destination ) { if ( ! is_dir ( $ directory . $ source ) ) $ result [ $ directory . $ source ] = Autoload :: DIRECTORY . $ destination ; else ... | Get exposed file list from a package |
6,609 | public function Get ( $ key , $ appName = null ) { if ( ! is_null ( $ appName ) && ( ! $ this -> settings || ! isset ( $ this -> settings [ $ appName ] ) || ! isset ( $ this -> settings [ $ appName ] [ $ key ] ) ) ) { throw new \ RuntimeException ( "$key was not found in the Settings for " . $ appName . ". See above ar... | Gets the value for the given key . |
6,610 | public static function add ( $ key , $ value ) { if ( ! isset ( self :: $ config [ $ key ] ) || ! is_array ( self :: $ config [ $ key ] ) ) { return false ; } array_push ( self :: $ config [ $ key ] , $ value ) ; return true ; } | Add configuration subvalue to a array value already existing . |
6,611 | public function dependsOn ( $ dependencies ) { if ( is_array ( $ dependencies ) ) { $ this -> dependencies = array_merge ( $ dependencies , $ this -> dependencies ) ; } elseif ( is_string ( $ dependencies ) ) { $ this -> dependencies [ ] = $ dependencies ; } else { throw new LackOfCoffeeException ( 'Dependencies can ei... | Add a dependencies or list of dependencies to this node . |
6,612 | private function addFile ( \ Phar $ phar , \ SplFileInfo $ file , $ strip = true ) { $ this -> info ( 'add file: ' . str_replace ( base_path ( ) , '' , $ file -> getRealPath ( ) ) ) ; $ path = str_replace ( base_path ( ) , '' , $ file -> getRealPath ( ) ) ; $ content = file_get_contents ( $ file ) ; if ( $ strip ) $ co... | Adicionar arquivo do phar |
6,613 | private function addComposerBin ( \ Phar $ phar ) { $ this -> info ( 'add file BIN' ) ; $ content = file_get_contents ( base_path ( 'artisan' ) ) ; $ content = preg_replace ( '{^#!/usr/bin/env php\s*}' , '' , $ content ) ; $ phar -> addFromString ( 'artisan' , $ content ) ; } | Adicionar arquivo bin |
6,614 | protected function loadGitInfo ( ) { $ process = new Process ( 'git log --pretty="%H" -n1 HEAD' , base_path ( ) ) ; if ( $ process -> run ( ) != 0 ) throw new \ RuntimeException ( 'Can\'t run git log. You must ensure to run compile from git repository clone and that git binary is available.' ) ; $ this -> params [ 'pac... | Load GIT Info |
6,615 | public static function castStringArrayToIntArray ( $ array , $ recursion = true , $ unsigned = false ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && $ recursion ) { $ array [ $ key ] = self :: castStringArrayToIntArray ( $ value , $ recursion , $ unsigned ) ; } elseif ( ! is_array ( $ value )... | Casts a string array to an int array recursion is enabled by default |
6,616 | public static function castArrayToFloatArray ( $ array , $ recursion = true , $ unsigned = false ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && $ recursion ) { $ array [ $ key ] = self :: castArrayToFloatArray ( $ value , $ recursion , $ unsigned ) ; } elseif ( ! is_array ( $ value ) ) { $ a... | Casts a string array to an float array recursion is enabled by default |
6,617 | public static function guessAndCastValue ( $ value , & $ type = '' ) { $ matchesTrue = [ 'true' , 'yes' , 'ja' ] ; $ matchesFalse = [ 'false' , 'no' , 'nein' ] ; $ matchesNull = [ 'null' ] ; if ( in_array ( strtolower ( $ value ) , $ matchesTrue ) ) { $ type = 'boolean' ; return true ; } elseif ( in_array ( strtolower ... | Guesses and casts a string value to an actual data type |
6,618 | public static function maxStrlen ( array $ string ) { $ length = 0 ; foreach ( $ string as $ str ) { if ( strlen ( $ str ) > $ length ) { $ length = strlen ( $ str ) ; } } return $ length ; } | Returns the length of the longest string in the given array |
6,619 | public static function trimStringArray ( array $ string , $ recursion = true ) { foreach ( $ string as $ key => $ value ) { if ( is_array ( $ value ) && $ recursion ) { $ string [ $ key ] = self :: trimStringArray ( $ value ) ; } elseif ( ! is_array ( $ value ) ) { $ string [ $ key ] = trim ( $ value ) ; } } return $ s... | Trims an array of strings |
6,620 | public static function formatBytes ( $ bytes ) { $ bytes = ( double ) abs ( $ bytes ) ; if ( $ bytes === 0.0 ) { return '0.00 B' ; } $ units = array ( 'B' , 'KiB' , 'MiB' , 'GiB' , 'TiB' , 'PiB' , 'EiB' , 'ZiB' , 'YiB' ) ; $ index = ( int ) ( log ( $ bytes ) / log ( 1024 ) ) ; if ( $ index > 8 ) { throw new \ OutOfRang... | Takes an integer value and returns an formatted string . For example 1024 - > 1 KiB |
6,621 | public function getImageInfos ( ) { if ( ! $ this -> exists ( ) ) { return false ; } $ data = getimagesize ( $ this -> getRealPath ( ) ) ; $ result = array ( ) ; if ( ! empty ( $ data ) ) { if ( ! empty ( $ data [ 0 ] ) ) { $ result [ 'width' ] = $ data [ 0 ] ; } if ( ! empty ( $ data [ 1 ] ) ) { $ result [ 'height' ] ... | Scan image standrad infos |
6,622 | public function getIptcInfos ( ) { if ( ! $ this -> exists ( ) ) { return false ; } getimagesize ( $ this -> getRealPath ( ) , $ data ) ; $ _data = empty ( $ data [ "APP13" ] ) ? array ( ) : iptcparse ( $ data [ "APP13" ] ) ; $ iptcdata = array ( ) ; if ( ! empty ( $ data ) ) { foreach ( $ _data as $ tag => $ tab ) { $... | Scan image IPTC infos |
6,623 | public function getExifInfos ( ) { if ( ! $ this -> exists ( ) ) { return false ; } $ exifdata = array ( ) ; if ( $ data = exif_read_data ( $ this -> getRealPath ( ) , 'EXIF' , true ) ) { foreach ( $ data as $ key => $ section ) { foreach ( $ section as $ name => $ value ) { if ( is_string ( $ value ) ) { if ( ! isset ... | Scan image EXIF infos |
6,624 | public function getBase64Content ( $ to_href = false ) { if ( $ this -> exists ( ) && $ this -> isImage ( ) ) { $ image_infos = $ this -> getImageInfos ( ) ; $ base64 = '' ; if ( $ to_href ) { $ type = pathinfo ( $ this -> getRealPath ( ) , PATHINFO_EXTENSION ) ; $ base64 .= 'data:image/' . $ type . ';base64,' ; } $ da... | Get the base64 encoded image content |
6,625 | private function createInstance ( $ definition , $ arguments , $ shared ) { if ( is_string ( $ definition ) ) { return new $ definition ( ... $ arguments ) ; } if ( is_callable ( $ definition ) ) { return $ definition ( ... $ arguments ) ; } if ( is_object ( $ definition ) ) { if ( $ shared ) { return $ definition ; } ... | Create an instance of the given service . |
6,626 | public function logQuery ( array $ query ) { $ this -> queries [ ] = $ query ; if ( $ this -> logger ) { $ this -> logger -> info ( 'MongoDB Query: ' . json_encode ( $ query ) ) ; } } | Log a query . |
6,627 | public function get ( $ property , $ default_value = null ) { if ( property_exists ( $ this , $ property ) ) { return $ this -> $ property ; } return $ default_value ; } | Get a property if it exists ; else return the default_value |
6,628 | public static function getDefaultsFile ( $ defaultsFolder = '' ) { if ( ! $ defaultsFolder ) { $ defaultsFolder = FULCRUM_PLUGIN_DIR . 'config/' . static :: $ defaultsFolder ; } if ( ! $ defaultsFolder ) { return '' ; } $ defaultFile = static :: $ defaultsFile ? : self :: getClassname ( ) . '.php' ; return trailingslas... | Get the Defaults File path + name |
6,629 | protected static function getClassname ( ) { $ className = explode ( '\\' , get_called_class ( ) ) ; $ className = array_pop ( $ className ) ; return str_replace ( '_' , '-' , strtolower ( $ className ) ) ; } | Get the class shortname and format in a filename structure |
6,630 | public function connect ( $ host , $ user , $ pass , $ name ) { $ dsn = "mysql:host={$host};dbname={$name}" ; try { $ this -> pdo = new \ PDO ( $ dsn , $ user , $ pass ) ; $ this -> pdo -> setAttribute ( \ PDO :: ATTR_ERRMODE , \ PDO :: ERRMODE_EXCEPTION ) ; $ connected = true ; } catch ( \ PDOException $ pdo_e ) { $ c... | Provides a MySQL connection interface that catches a PDOException on failure . |
6,631 | public function disconnect ( ) { if ( $ this -> pdo instanceof \ PDO ) { $ this -> pdo = null ; $ disconnected = true ; } else { $ disconnected = false ; } return $ disconnected ; } | Destroys an existing PDO connection |
6,632 | public function getPrimaryKeys ( $ table ) { $ keys_query = "SHOW KEYS FROM {$table} WHERE Key_name='PRIMARY'" ; $ statement = $ this -> pdo -> prepare ( $ keys_query ) ; $ result = $ this -> statementWrapper ( $ statement , "Trying to get keys failed with the following message: " ) ; if ( $ result ) { $ keys = $ this ... | Gets the column names for all primary keys for a table or returns false if no keys exist |
6,633 | public function getRowById ( $ id , $ table ) { $ id = $ this -> quoteQueryStringVariable ( $ id ) ; $ key = $ this -> getPrimaryKeys ( $ table ) ; $ query = "SELECT * FROM {$table} WHERE {$key} = {$id}" ; $ statement = $ this -> pdo -> prepare ( $ query ) ; $ result = $ this -> statementWrapper ( $ ... | Retrieves a row represented by a single primary key |
6,634 | public function tableExists ( $ table ) { $ table_query = "SHOW TABLES LIKE '{$table}'" ; $ statement = $ this -> pdo -> prepare ( $ table_query ) ; $ statement -> execute ( ) ; $ row_count = $ statement -> rowCount ( ) ; if ( $ row_count == 0 ) { return false ; } else { return true ; } } | Determines whether a given table exists |
6,635 | private function processPrimaryKeyResult ( $ result ) { $ row_count = count ( $ result ) ; $ this -> updateLog ( "debug" , "{$row_count} keys found" ) ; if ( $ row_count == 1 ) { $ this -> updateLog ( "debug" , "Single key found; setting up key string" ) ; $ keys = $ result [ 0 ] [ 'Column_name' ] ; } else { $ this -> ... | Processes the result set from a primary key query |
6,636 | private function statementWrapper ( \ PDOStatement $ statement , $ log_message = null ) { if ( $ log_message === null ) { $ log_message = "Statement execution error: " ; } try { $ statement -> execute ( ) ; } catch ( \ PDOException $ pdo_e ) { $ context = array ( ) ; $ context [ "exception" ] = $ pdo_e ; $ this -> upda... | A wrapper for executing PDOStatement objects that either returns the statement execution result or catches any PDOException thrown and updates the class logger with the exception message . |
6,637 | public function setHash ( $ key , $ field , $ value ) { $ this -> redis -> hset ( $ key , $ field , $ value ) ; } | region Hash commands |
6,638 | public function addForeignKey ( $ table_column , $ reference_table , $ reference_column , $ delete_cascade = false , $ update_cascade = false ) { $ foreignKey = new \ stdClass ( ) ; $ foreignKey -> table_column = $ table_column ; $ foreignKey -> reference_table = $ reference_table ; $ foreignKey -> reference_column = $... | Add a foreign key to the table |
6,639 | public function setDefaultNull ( $ fieldNames ) { if ( is_array ( $ fieldNames ) ) { foreach ( $ fieldNames as $ field_name ) { $ this -> setDefaultNull ( $ field_name ) ; } } else { if ( isset ( $ this -> m_fields [ $ fieldNames ] ) ) { $ this -> m_fields [ $ fieldNames ] -> setDefault ( 'NULL' ) ; } else { $ err_msg ... | Given a list of field names this will set all those fields to default to null . |
6,640 | public function setCharacterSet ( $ charSet ) { $ possible_encodings = array ( "big5" , "dec8" , "cp850" , "hp8" , "koi8r" , "latin1" , "latin2" , "swe7" , "ascii" , "ujis" , "sjis" , "hebrew" , "tis620" , "euckr" , "koi8u" , "gb2312" , "greek" , "cp1250" , "gbk" , "latin5" , "armscii8" , "utf8" , "ucs2" , "cp866" , "k... | Specify the character set of the table . This is useful because as the developer of the application we may not know what the default character set was set to when the database itself was created . |
6,641 | public function setDefault ( $ fieldNames , $ default ) { if ( is_array ( $ fieldNames ) ) { foreach ( $ fieldNames as $ field_name ) { $ this -> setDefault ( $ field_name , $ default ) ; } } else { if ( isset ( $ this -> m_fields [ $ fieldNames ] ) ) { $ this -> m_fields [ $ fieldNames ] -> setDefault ( $ default ) ; ... | Given a list of field names this will set all those fields to default to the specified value |
6,642 | private function hasFields ( $ fields ) { $ hasFields = true ; foreach ( $ fields as $ field_name ) { if ( ! isset ( $ this -> m_fields [ $ field_name ] ) ) { $ dbgMsg = 'Hasfields returning that ' . $ field_name . ' does ' . 'not exist in ' . print_r ( $ this -> m_fields , true ) ; LogModel :: debugLog ( $ dbgMsg ) ; ... | Returns flag for if we have all of the fields specified by name . |
6,643 | public function getField ( $ field_name ) { $ field = null ; if ( isset ( $ this -> m_fields [ $ field_name ] ) ) { $ field = $ this -> m_fields [ $ field_name ] ; } else { $ err_msg = '[' . $ field_name . '] does not exist in table ' . '[' . $ this -> m_name . ']' ; throw new \ Exception ( $ err_msg ) ; } return $ fie... | Retrieves a field from the table by name |
6,644 | public function execute ( Framework $ framework , WebRequest $ request , Response $ response ) { if ( ! $ request instanceof \ Zepi \ Turbo \ Request \ WebRequest ) { return ; } $ this -> sessionManager -> reinitializeSession ( $ framework , $ request , $ response ) ; } | Starts the session after the initialization of the framework core and is one of the first events which will be executed . |
6,645 | public function version ( ) { return 'Vinala v' . $ this -> framework -> version . ( ! empty ( $ this -> framework -> tag ) ? ' ' . $ this -> framework -> tag : '' ) . ' (' . $ this -> framework -> stat . ') PHP Framework' ; } | Get the formal version of framework . |
6,646 | public function full ( ) { if ( $ this -> framework -> stat != 'final' ) { return $ this -> framework -> version . ( ! empty ( $ this -> framework -> tag ) ? ' ' . $ this -> framework -> tag : '' ) . ' (' . $ this -> framework -> stat . ')' ; } else { return $ this -> framework -> version . ( ! empty ( $ this -> framew... | The full version of framework . |
6,647 | public function kernel ( ) { return 'Vinala Kernel v' . $ this -> kernel -> version . ( ! empty ( $ this -> kernel -> tag ) ? ' ' . $ this -> kernel -> tag : '' ) . ' (' . $ this -> kernel -> stat . ')' . "\n" . $ this -> kernel -> sha ; } | Get the kernel version . |
6,648 | public function checkKernel ( ) { $ content = file_get_contents ( $ this -> kernelURL ) ; $ out = JSON :: decode ( $ content , true ) ; if ( $ this -> compaireSecondary ( $ out -> version , $ this -> kernel -> version ) && ( $ out -> sha != $ this -> kernel -> sha ) ) { return $ out ; } else { return false ; } } | To check if there is a new release of kernel . |
6,649 | protected function compaireSecondary ( $ old , $ new ) { $ oldMajor = dot ( $ old ) [ 0 ] ; $ newMajor = dot ( $ new ) [ 0 ] ; $ oldMinor = dot ( $ old ) [ 1 ] ; $ newMinor = dot ( $ new ) [ 1 ] ; $ oldSecondary = dot ( $ old ) [ 2 ] ; $ newSecondary = dot ( $ new ) [ 2 ] ; return $ oldSecondary != $ newSecondary && $ ... | Compaire secondary verion . |
6,650 | public function findManyByIds ( array $ ids ) { $ models = $ this -> model -> whereIn ( $ this -> model -> getKeyName ( ) , array_unique ( $ ids ) ) -> get ( ) ; return $ models ; } | Find many by IDs . |
6,651 | protected function writeFile ( string $ file , string $ data , bool $ append = false ) { return $ this -> write ( $ file , $ data , $ append ) ; } | Write data file from string |
6,652 | protected function writeFileProcess ( string $ file , \ Closure $ data , bool $ append = false ) { return $ this -> write ( $ file , $ data , $ append ) ; } | Write data process from the iteration callback |
6,653 | public function getDraftRevision ( $ entity ) { $ currentRevision = $ this -> getCurrentRevision ( $ entity ) ; $ latestRevision = $ this -> getLatestRevision ( $ entity ) ; return ( $ currentRevision < $ latestRevision ) ? $ latestRevision : null ; } | Finds the revision id for an entity that contains draft changes and returns false if entity is up - to - date with latest revision . |
6,654 | protected function setTemplateDir ( $ TemplateDir = null ) { if ( ! is_null ( $ TemplateDir ) ) { $ this -> TemplateDir = $ TemplateDir ; } else { $ this -> TemplateDir = root ( ) . 'storage/view/template/atomium' ; } } | Set template directory . |
6,655 | public function show ( $ file , $ data ) { $ this -> setTemplate ( $ file ) ; $ this -> assign ( $ data ) ; $ this -> store ( $ this -> compile ( ) ) ; $ this -> display ( ) ; } | show the template . |
6,656 | protected function assign ( $ data ) { if ( ! is_null ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } } } | set arrays vars . |
6,657 | protected function store ( $ content , $ name = null ) { $ name = ( is_null ( $ name ) ) ? $ this -> name ( ) : $ name ; $ file = fopen ( $ this -> TemplateDir . '/' . $ name , 'w' ) ; fwrite ( $ file , $ content ) ; fclose ( $ file ) ; return $ this -> TemplateDir . '/' . $ name ; } | store compiled template file . |
6,658 | protected function name ( $ name = null ) { $ filename = is_null ( $ name ) ? $ this -> filename ( ) : $ name ; $ hash = Hash :: make ( $ filename ) ; $ name = $ hash ; $ this -> templateFile = $ name ; return $ name ; } | template file name . |
6,659 | protected function display ( ) { foreach ( $ this -> values as $ key => $ value ) { $ $ key = $ value ; } require $ this -> TemplateDir . '/' . $ this -> templateFile ; } | display the view . |
6,660 | protected function switcher ( $ view , $ capture , $ viewName ) { if ( Strings :: contains ( $ view , "@capture('$capture')" ) ) { return "@capture('$capture'):" ; } elseif ( Strings :: contains ( $ view , '@capture("' . $ capture . '")' ) ) { return '@capture("' . $ capture . '"):' ; } else { throw new AromiumCaptureN... | get a the full open tag of capture . |
6,661 | public function call ( $ view , $ capture , $ data = null ) { $ viewName = $ view ; $ name = $ this -> name ( $ view . '_capture_' . $ capture ) ; $ view = self :: get ( $ view ) ; $ capture = self :: switcher ( $ view , $ capture , $ viewName ) ; $ view = AtomiumCompileCapture :: call ( $ view , $ capture ) ; if ( ! i... | get a capture . |
6,662 | public function get ( $ view ) { $ file = str_replace ( '.' , '/' , $ view ) ; $ link1 = root ( ) . 'resources/views/' . $ file . '.atom.php' ; $ link2 = root ( ) . 'resources/views/' . $ file . '.atom' ; if ( file_exists ( $ link1 ) ) { $ link3 = $ link1 ; } elseif ( file_exists ( $ link2 ) ) { $ link3 = $ link2 ; } $... | get a atomium viewview . |
6,663 | public function getUserId ( ) { $ params = Yii :: $ app -> request -> queryParams ; if ( empty ( $ params [ 'access-token' ] ) ) return false ; $ uid = $ this -> userIdentity -> findIdentityByAccessToken ( $ params [ 'access-token' ] ) ; if ( empty ( $ uid -> id ) ) return false ; else return $ uid -> id ; } | Get user id by access token . |
6,664 | static function getByName ( string $ hostname ) : IPAddress { $ host = gethostbyname ( $ hostname ) ; if ( $ host === $ hostname ) { throw new \ InvalidArgumentException ( $ hostname ) ; } return new self ( $ host ) ; } | Get the IPv4 address corresponding to a given Internet host name . |
6,665 | public function cover ( $ entity , array $ options = [ ] ) { $ options += [ 'internal' => false ] ; if ( ! $ options [ 'internal' ] ) { return null ; } return [ 'type' => 'video' , 'url' => 'vimeo://' . $ entity -> id ( ) , 'title' => $ entity -> title ( ) ] ; } | FIXME Find a way to support external media URLs . |
6,666 | public function getDefaultValues ( ) { $ values = [ ] ; foreach ( $ this -> getColumns ( ) as $ column ) { $ values [ $ column -> getName ( ) ] = $ column -> getDefaultValue ( ) ; } return $ values ; } | get column default values |
6,667 | public function init ( ) { parent :: init ( ) ; if ( $ this -> event -> RequireLoggedIn && ! Member :: currentUserID ( ) ) { return Security :: permissionFailure ( $ this , array ( 'default' => 'Please log in to register for this event.' ) ) ; } } | Perform a security check |
6,668 | public function index ( ) { $ exclude = null ; if ( ! $ this -> event -> canRegister ( ) ) { $ data = array ( 'Content' => '<p>This event cannot be registered for.</p>' ) ; } elseif ( ! $ this -> event -> getRemainingCapacity ( $ exclude ) ) { $ data = array ( 'Title' => $ this -> event -> Title . ' Is Full' , 'SoldOut... | Select ticket action |
6,669 | public function ReviewForm ( $ request = null ) { $ registration = $ this -> getCurrentRegistration ( ) ; $ hasContactableAttendees = $ registration -> contactableAttendees ( ) -> count ( ) > 0 ; $ fields = FieldList :: create ( ) ; $ required = array ( ) ; if ( $ hasContactableAttendees ) { $ required [ ] = "Registran... | Review attendees and capture registrant contact details . |
6,670 | public function submitreview ( $ data , $ form ) { $ registration = $ this -> getCurrentRegistration ( ) ; $ form -> saveInto ( $ registration ) ; $ registrantid = isset ( $ data [ 'RegistrantAttendeeID' ] ) ? ( int ) $ data [ 'RegistrantAttendeeID' ] : null ; if ( $ registrantid && $ attendee = $ registration -> Atten... | Submit review action |
6,671 | public function payment ( ) { $ registration = $ this -> getCurrentRegistration ( false ) ; if ( ! $ registration || ! $ registration -> canPay ( ) ) { return $ this -> redirect ( $ this -> Link ( ) ) ; } $ controller = new PaymentController ( $ this , "payment" , $ registration , $ registration -> Total ) ; $ controll... | Payment handling action |
6,672 | public function complete ( ) { $ registration = $ this -> getCurrentRegistration ( false ) ; if ( ! $ registration ) { return $ this -> redirect ( $ this -> Link ( ) ) ; } if ( ! $ registration -> canSubmit ( ) ) { return $ this -> redirect ( $ this -> Link ( 'review' ) ) ; } $ registration -> Status = "Valid" ; $ regi... | Completed registration action |
6,673 | public function getCurrentRegistration ( $ write = true ) { $ registration = null ; if ( $ this -> registration && ! $ this -> registration -> isSubmitted ( ) ) { $ registration = $ this -> registration ; } if ( ! $ registration ) { $ registration = $ this -> regSession -> get ( ) ; } if ( ! $ registration ) { if ( $ w... | Find or make the current registration in the session . |
6,674 | public function getUrlAttribute ( ) { return url ( trim ( ( $ this -> parent ? $ this -> parent -> full_slug : '' ) . '/' . $ this -> slug , '/' ) ) ; } | Returns the Url to this Tree Item |
6,675 | public function manipulate ( \ DOMDocument $ document , LayoutInterface $ layout ) : void { $ head = $ document -> getElementsByTagName ( 'head' ) -> item ( 0 ) ; if ( $ head -> getElementsByTagName ( 'base' ) -> length > 0 ) { $ head -> removeChild ( $ head -> getElementsByTagName ( 'base' ) -> item ( 0 ) ) ; } } | Removes the base tag from document |
6,676 | protected function setKeyType ( ? string $ keyType = null ) : void { if ( $ keyType !== null ) { $ keyType = trim ( $ keyType ) ; } $ this -> keyType = $ keyType ; } | Sets the key type |
6,677 | protected function setValueType ( ? string $ valueType = null ) : void { if ( $ valueType !== null ) { $ valueType = trim ( $ valueType ) ; } $ this -> valueType = $ valueType ; } | Sets the value type |
6,678 | protected function keyTypeError ( string $ method , $ key ) : string { $ keyType = is_object ( $ key ) ? get_class ( $ key ) : gettype ( $ key ) ; return sprintf ( '%s::%s expects key type (%s); received (%s) %s' , static :: class , $ method , $ this -> keyType ( ) , $ keyType , VarPrinter :: toString ( $ key ) ) ; } | Retrieves the key type error message |
6,679 | protected function valueTypeError ( string $ method , $ value ) : string { $ valueType = is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ; return sprintf ( '%s::%s expects value type (%s); received (%s) %s' , static :: class , $ method , $ this -> valueType ( ) , $ valueType , VarPrinter :: toString... | Retrieves the value type error message |
6,680 | public function get ( $ id , $ invalidBehavior = ContainerInterface :: EXCEPTION_ON_INVALID_REFERENCE ) { $ container = $ this -> getKernel ( ) -> getContainer ( ) ; if ( ! isset ( $ container ) ) { throw new \ Exception ( 'Kernel is not bootet, yet' ) ; } return $ container -> get ( $ id , $ invalidBehavior ) ; } | Gets a service from the dependency injection |
6,681 | public function registerRoute ( Route $ route , $ routeIdentifier = null ) { if ( ! $ routeIdentifier ) { $ routeIdentifier = uniqid ( ) ; } $ this -> routes [ $ routeIdentifier ] = $ route ; } | Registers a new Route |
6,682 | public function execute ( Request $ request ) { foreach ( $ this -> routes as $ route ) { if ( $ route -> isValid ( $ request ) ) { return $ route -> execute ( $ request ) ; } } throw new NoMatchingRouteException ( 'No matching route found.' ) ; } | Iterates over stored routes in the order they were registered . Executes the first matching route . |
6,683 | public function redirect ( $ url ) { if ( preg_match ( STATIC_URL_REGEX , $ url ) ) { return $ this -> registerScript ( 'window.location.replace("' . $ url . '");' ) ; } return $ this -> registerScript ( '$.router.replace("' . $ url . '");' ) ; } | Redirection sans inscription dans l historique |
6,684 | public function registerLink ( string $ elmId , string $ uriPattern , array $ uriParams , string $ event = self :: EVENT_CLIC , string $ targetId = null ) { $ selector = '$("#' . $ elmId . '").' ; $ replaces = [ ] ; foreach ( $ uriParams as $ key => $ value ) { $ replaces [ ] = "replace('" . $ key . "', " . $ selector ... | Register an ajax link |
6,685 | public function registerSubmitLink ( string $ elmId , string $ formId = '' , string $ event = self :: EVENT_CLIC , string $ targetId = '' , bool $ preventDefault = true ) { $ linkSelector = '$("#' . $ elmId . '").' ; $ script = $ linkSelector . $ event . '(function(e){' ; $ script .= $ preventDefault ? 'e.preventDefaul... | Register an event to submit a form default is the form before the element which launch the event |
6,686 | public static function buildJsLink ( $ url , $ target = null , bool $ history = true , bool $ replaceTag = false ) { $ targetArg = $ target ? ( $ target [ 0 ] === '$' ? "," . $ target : ",'#" . $ target . "'" ) : '' ; $ targetArg .= $ replaceTag ? ',1' : '' ; if ( ! $ history || $ targetArg ) { return "$.ajaxCall('" . ... | Simple ajax call |
6,687 | public static function makeError ( $ errorCode , $ message , $ data = array ( ) ) { $ error = array ( ) ; $ error [ 'flag' ] = false ; $ error [ 'message' ] = $ message ; $ error [ 'code' ] = $ errorCode ; if ( ! empty ( $ data ) ) $ error [ 'data' ] = $ data ; return $ error ; } | Generates error response object |
6,688 | public function store ( $ key , $ value ) { return $ this -> configService -> store ( $ this -> module , $ key , $ value ) ; } | Stores an item |
6,689 | private function getDecimal ( array $ number ) { if ( $ this -> isStandardBase ( $ this -> source -> getDigitList ( ) ) ) { return gmp_init ( implode ( '' , $ this -> source -> canonizeDigits ( $ number ) ) , $ this -> source -> getRadix ( ) ) ; } $ number = $ this -> source -> getValues ( $ number ) ; $ decimal = gmp_... | Converts the number from source base to a decimal GMP resource . |
6,690 | private function isStandardBase ( array $ digits ) { if ( count ( $ digits ) > strlen ( self :: $ standardBase ) ) { return false ; } return $ digits === str_split ( substr ( self :: $ standardBase , 0 , count ( $ digits ) ) ) ; } | Tells if the list of digits match those used by GMP . |
6,691 | private function getFractionDigitCount ( $ count ) { if ( $ this -> precision > 0 ) { return $ this -> precision ; } $ target = gmp_init ( $ this -> target -> getRadix ( ) ) ; $ maxFraction = gmp_pow ( gmp_init ( $ this -> source -> getRadix ( ) ) , $ count ) ; $ digits = 1 ; while ( gmp_cmp ( gmp_pow ( $ target , $ di... | Determines the number of digits required in the target base . |
6,692 | public function createMessage ( string $ templatePath , array $ context ) : Message { $ template = $ this -> twig -> loadTemplate ( $ templatePath ) ; $ context = $ this -> twig -> mergeGlobals ( $ context ) ; return new Message ( $ this -> renderBlock ( $ template , 'title' , $ context ) , $ this -> renderBlock ( $ te... | Create a new e - mail message from the given template . |
6,693 | protected function createMessageContent ( Twig_Template $ template , array $ context ) : MessageContent { $ mimeType = $ this -> renderBlock ( $ template , 'content_type' , $ context ) ; $ content = $ mimeType === 'text/html' ? new HtmlMessageContent : new GenericMessageContent ( $ mimeType ) ; $ context [ '_content' ]... | Create a message content from the given template and context . |
6,694 | final protected function filterFileInput ( array $ files ) { static $ filter = null ; if ( $ filter === null ) { $ filter = new NameFilter ( new UniqueType ( ) ) ; } $ filter -> filter ( $ files ) ; } | Filters file input names |
6,695 | private function callHydrator ( $ target , array $ args ) { $ callback = array ( $ this , 'toEntity' ) ; return call_user_func_array ( $ callback , array_merge ( array ( $ target ) , $ args ) ) ; } | Calls hydration method |
6,696 | final protected function prepareResults ( ) { $ args = func_get_args ( ) ; $ array = array_shift ( $ args ) ; if ( ! empty ( $ array ) ) { $ result = array ( ) ; foreach ( $ array as $ target ) { array_push ( $ result , $ this -> callHydrator ( $ target , $ args ) ) ; } return $ result ; } else { return array ( ) ; } } | Converts an array to object |
6,697 | final protected function prepareResult ( ) { $ args = func_get_args ( ) ; $ result = array_shift ( $ args ) ; if ( $ result && $ result !== false ) { return $ this -> callHydrator ( $ result , $ args ) ; } else { return false ; } } | Prepares a result |
6,698 | public function removeAll ( ) { if ( ! $ this -> isEmpty ( ) ) { foreach ( $ this -> getAll ( ) as $ key => $ val ) { $ this -> remove ( $ key ) ; } return true ; } else { return false ; } } | Removes all cookies from client machine |
6,699 | public function setEncrypted ( $ key , $ value , $ ttl = TimeHelper :: YEAR , $ path = '/' , $ secure = false , $ httpOnly = false , $ raw = false ) { return $ this -> set ( $ key , $ this -> getCrypter ( ) -> encryptValue ( $ value ) , $ ttl , $ path , $ secure , $ httpOnly , $ raw ) ; } | Sets a encrypted cookie |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.