idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
1,500 | public function addFields ( array $ pFields ) { $ fields = $ this -> _prefixFields ( $ pFields ) ; $ this -> _fields = array_merge ( $ fields , $ this -> _fields ) ; return $ this ; } | Add fields to the select query . |
1,501 | public function limit ( $ pNb ) { if ( is_array ( $ pNb ) and count ( $ pNb ) == 2 and isset ( $ pNb [ 0 ] ) and isset ( $ pNb [ 1 ] ) and is_int ( $ pNb [ 0 ] ) and is_int ( $ pNb [ 1 ] ) ) { $ nb = $ pNb [ 1 ] ; $ this -> skip ( $ pNb [ 0 ] ) ; } else if ( is_int ( $ pNb ) ) { $ nb = $ pNb ; } else { throw new Except... | Add a limit to the select query . |
1,502 | public static function register ( $ metaTags ) { if ( $ metaTags instanceof \ mrstroz \ wavecms \ metatags \ models \ MetaTags ) { if ( $ metaTags -> meta_title ) { Yii :: $ app -> view -> title = $ metaTags -> meta_title ; } if ( $ metaTags -> meta_description ) { Yii :: $ app -> view -> registerMetaTag ( [ 'name' => ... | Register meta tags |
1,503 | protected function saveInFile ( $ content ) { $ filename = $ this -> config -> get ( 'file_directory' ) . DIRECTORY_SEPARATOR . $ this -> config -> get ( 'file_name' ) ; $ fp = fopen ( $ filename , "a+b" ) ; fwrite ( $ fp , $ content . ";" ) ; fclose ( $ fp ) ; } | Save data in file . |
1,504 | protected function getDataInFile ( ) { $ filename = $ this -> config -> get ( 'file_directory' ) . DIRECTORY_SEPARATOR . $ this -> config -> get ( 'file_name' ) ; if ( ! file_exists ( $ filename ) ) { return array ( ) ; } $ fp = fopen ( $ filename , "rb" ) ; $ contenido = fread ( $ fp , filesize ( $ filename ) ) ; fclo... | Get all data in file . |
1,505 | public function clearAllPersistentData ( ) { $ filename = $ this -> config -> get ( 'file_directory' ) . DIRECTORY_SEPARATOR . $ this -> config -> get ( 'file_name' ) ; unlink ( $ filename ) ; } | Clear all data from the persistent storage |
1,506 | public static function setForcedHost ( $ host = null ) { if ( ! is_string ( $ host ) && ! is_null ( $ host ) ) { throw new InvalidArgumentException ( sprintf ( 'Invalid host provided; must be an string or a null, "%s" received.' , is_object ( $ host ) ? get_class ( $ host ) : gettype ( $ host ) ) ) ; } static :: $ forc... | Sets the host name for forced usage . |
1,507 | public static function retrieve ( array $ server = null ) { if ( empty ( $ server ) ) { $ server = $ _SERVER ; } if ( isset ( $ server [ 'SERVER_NAME' ] ) ) { return $ server [ 'SERVER_NAME' ] ; } $ address = '' ; if ( isset ( $ server [ 'SERVER_ADDR' ] ) ) { $ address = $ server [ 'SERVER_ADDR' ] ; } if ( isset ( $ se... | Retrieves the host name using incoming data ignores a forced host . If unable to retrive the host name try to retrieve server address . |
1,508 | private static function loadIntoCategory ( ) { $ { func_get_arg ( 0 ) -> getNameOfLanguageVariable ( ) } = array ( ) ; require_once func_get_arg ( 1 ) ; if ( ! empty ( $ { func_get_arg ( 0 ) -> getNameOfLanguageVariable ( ) } ) ) { func_get_arg ( 0 ) -> lang [ func_get_arg ( 2 ) ] [ func_get_arg ( 0 ) -> getCategory ( ... | Load the translations into the category from a file by the given path |
1,509 | public function offsetExists ( $ langcode ) { return ( isset ( $ this -> lang [ $ langcode ] [ $ this -> category ] ) or $ this -> isFileExistsInSubDir ( $ langcode ) or $ this -> isFileExistsWithSuffix ( $ langcode ) or $ this -> isFileExistsWithoutSuffix ( $ langcode ) ) ; } | Checking of existence of a language by language code |
1,510 | public function offsetGet ( $ langcode ) { $ noDefaultVersion = $ this -> getDefault ( ) !== $ langcode and ! isset ( $ this -> lang [ $ this -> getDefault ( ) ] [ $ this -> getCategory ( ) ] ) ; if ( ! isset ( $ this -> lang [ $ langcode ] [ $ this -> getCategory ( ) ] ) ) { if ( $ this -> isFileExistsInSubDir ( $ lan... | Get the array of texts by the given language code |
1,511 | public static function fromXml ( \ DOMElement $ xml ) { $ static = new static ( ) ; $ locationId = $ xml -> getElementsByTagName ( 'pickupLocation' ) ; $ static -> locationId = StringLiteral :: fromXml ( $ locationId ) ; $ text = $ xml -> getElementsByTagName ( 'pickupLocationText' ) ; $ static -> text = StringLiteral ... | Builds a PickupLocation object from XML . |
1,512 | public function add ( $ template , array $ data = [ ] , string $ region = "main" , int $ sort = 0 ) : object { $ this -> di -> get ( "view" ) -> add ( $ template , $ data , $ region , $ sort ) ; return $ this ; } | Utility method to add a view to the view collection for later rendering . |
1,513 | public function render ( array $ data = [ ] , int $ status = 200 ) { $ view = $ this -> di -> get ( "view" ) ; $ view -> add ( $ this -> layout , $ data , "layout" ) ; $ body = $ view -> renderBuffered ( "layout" ) ; $ response = $ this -> di -> get ( "response" ) ; $ response -> setBody ( $ body ) ; $ response -> setS... | Add the layout view to the region layout and render all views within the region layout and create a response from it . |
1,514 | public static function assertLooselyInArray ( array $ array , $ value , Throwable $ exception ) : bool { static :: makeAssertion ( \ in_array ( $ value , $ array ) , $ exception ) ; return true ; } | Asserts that the given element exists in the given array with loose comparision . |
1,515 | public static function assertInArray ( array $ array , $ value , Throwable $ exception ) : bool { static :: makeAssertion ( \ in_array ( $ value , $ array , true ) , $ exception ) ; return true ; } | Asserts that the given element exists in the given array with strict comparison . |
1,516 | public function create ( $ name , CredentialsInterface $ credentials , StorageInterface $ storage , $ scopes = [ ] , $ baseApiUri = null , $ apiVersion = null ) { $ name = ucfirst ( $ name ) ; if ( is_null ( $ this -> client ) ) $ this -> client = new CurlClient ( ) ; $ class = '\\LibX\OAuth2\\Service\\' . $ name ; if ... | Create an oauth2 service |
1,517 | public function generateUniqueFilename ( $ originalFilename ) { $ index = 0 ; $ filename = pathinfo ( $ originalFilename , PATHINFO_FILENAME ) ; $ extension = pathinfo ( $ originalFilename , PATHINFO_EXTENSION ) ; while ( $ this -> imageManager -> findByFilename ( $ originalFilename ) ) { $ index ++ ; $ originalFilenam... | Generate unique filename . |
1,518 | private function updateArgumentReferences ( array $ replacements , $ definitionId , array $ arguments ) { foreach ( $ arguments as $ k => $ argument ) { if ( is_array ( $ argument ) ) { $ arguments [ $ k ] = $ this -> updateArgumentReferences ( $ replacements , $ definitionId , $ argument ) ; continue ; } if ( ! $ argu... | Recursively updates references in an array . |
1,519 | protected function addWatermarkFilterIfExists ( & $ set , $ width , $ height ) { if ( isset ( $ set [ 'watermark' ] ) ) { if ( ! empty ( $ set [ 'watermark' ] [ 1 ] ) ) { $ set [ 'filters' ] [ ] = [ 'target' , [ $ set [ 'watermark' ] [ 1 ] ] ] ; } if ( ! empty ( $ set [ 'watermark' ] [ 2 ] ) ) { $ set [ 'filters' ] [ ]... | Protected add watermark filter |
1,520 | protected function getThumbFileName ( $ x , $ y , $ width , $ height ) { return Filesystem :: removeExtension ( $ this -> file ) . $ this -> addPrefixToThumbFileName ( $ x , $ y , $ width , $ height ) . Filesystem :: getExtension ( $ this -> file , true ) ; } | Protected get thumb file name |
1,521 | protected function applyBackgroundTransparency ( $ file , $ width , $ height ) { imagealphablending ( $ file , false ) ; imagesavealpha ( $ file , true ) ; imagefilledrectangle ( $ file , 0 , 0 , $ width , $ height , $ this -> transparentBackground ( $ file ) ) ; } | Protected apply bacground transparency |
1,522 | protected function setThumbPaths ( $ file ) { $ this -> file = $ this -> getOnlyFileName ( $ file ) ; $ this -> thumbPath = $ this -> createThumbDirectory ( $ file ) ; } | Protected New Path |
1,523 | protected function fromFileType ( $ path ) { switch ( Filesystem :: getExtension ( $ path ) ) { case 'png' : return imagecreatefrompng ( $ path ) ; case 'gif' : return imagecreatefromgif ( $ path ) ; case 'jpg' : case 'jpeg' : default : return imagecreatefromjpeg ( $ path ) ; } } | Protected From File Type |
1,524 | protected function isImageFile ( $ file ) { if ( in_array ( MimeTypeFinder :: get ( $ file ) , $ this -> validMimes ) ) { return true ; } else { return false ; } } | Protected Is Image File |
1,525 | protected function extractSettingVariables ( $ file , $ settings ) { $ variables = [ ] ; list ( $ currentWidth , $ currentHeight ) = getimagesize ( $ file ) ; $ variables [ 'x' ] = $ settings [ 'x' ] ?? 0 ; $ variables [ 'y' ] = $ settings [ 'y' ] ?? 0 ; $ variables [ 'quality' ] = $ settings [ 'quality' ] ?? 0 ; $ var... | Protected extract setting variables |
1,526 | public function actionIndex ( ) { list ( $ theme , $ file ) = func_get_args ( ) ; if ( false !== strpos ( $ file , '..' ) ) { throw new Forbidden ; } $ file = realpath ( DOCROOT . '../themes/' . $ theme . '/assets/' . $ file ) ; if ( ! file_exists ( $ file ) ) { throw new NotFound ; } if ( ! is_readable ( $ file ) ) { ... | Catches all calls and handles theme asset requests |
1,527 | protected static function load ( ) { need ( root ( ) . 'app/http/Filter.php' ) ; $ filter = instance ( \ App \ Http \ Filter :: class ) ; self :: $ filters [ 'app' ] = $ filter :: $ middleware ; self :: $ filters [ 'route' ] = $ filter :: $ routeMiddleware ; return self :: $ filters ; } | Set the list of filters used by middleware . |
1,528 | public static function get ( $ name ) { if ( array_has ( self :: $ filters , 'app.' . $ name ) ) { return [ 'app' , array_get ( self :: $ filters , 'app.' . $ name ) ] ; } elseif ( array_has ( self :: $ filters , 'route.' . $ name ) ) { return [ 'route' , array_get ( self :: $ filters , 'route.' . $ name ) ] ; } except... | Get the Middleware by filter . |
1,529 | public function update ( $ table , $ data , $ filter = [ ] ) { $ fields_allowed = $ this -> getTableColumns ( $ table ) ; $ fields = $ this -> filterKeys ( $ fields_allowed , $ data ) ; if ( count ( $ fields ) === 0 ) { throw new PDOException ( 'empty request' ) ; } $ escapedFields = $ this -> quoteIdentifiers ( $ fiel... | Update one or more rows in the database table |
1,530 | public function delete ( $ table , $ filter = [ ] ) { $ whereFields = $ this -> filterKeysForTable ( $ table , $ filter ) ; $ escapedWhereFields = $ this -> quoteIdentifiers ( $ whereFields ) ; $ statement = $ this -> implodeBindFields ( $ escapedWhereFields , ' AND ' ) ; $ whereStatement = $ statement !== false ? ' WH... | Delete rows on a database table |
1,531 | public function quoteIdentifiers ( $ names ) { if ( is_array ( $ names ) ) { foreach ( $ names as $ key => $ value ) { $ var = $ this -> quoteIdentifiers ( $ value ) ; $ names [ $ key ] = $ var ; } return $ names ; } $ result = $ this -> quote . preg_replace ( '#\\\*' . $ this -> quote . '#' , $ this -> quote . $ this ... | Quote one or an array of identifiers with backticks |
1,532 | public function filterKeys ( $ fields_allowed , $ params ) { if ( ! is_array ( $ params ) ) { return [ ] ; } $ params = array_keys ( $ params ) ; return $ this -> filter ( $ fields_allowed , $ params ) ; } | filter the keys of an associative array as column names for a specific table |
1,533 | public function implodeBindFields ( $ escapedFields , $ glue , $ keyPrefix = '' ) { if ( count ( $ escapedFields ) == 0 ) { return false ; } $ statement = '' ; $ first = true ; foreach ( $ escapedFields as $ key => $ value ) { if ( $ first ) { $ first = false ; } else { $ statement .= $ glue ; } $ statement .= $ value ... | insert bind placeholders for a sql statement |
1,534 | public function getTableColumns ( $ table ) { $ driver = $ this -> getDriverName ( ) ; $ bind = [ ] ; if ( $ driver == 'sqlite' ) { $ table = $ this -> quoteIdentifiers ( $ table ) ; $ sql = 'PRAGMA table_info(' . $ table . ');' ; $ key = 'name' ; } elseif ( $ driver == 'mysql' ) { $ table = $ this -> quoteIdentifiers ... | Query the available columns for a database table |
1,535 | public function generateInsertPlaceholder ( $ fieldCount , $ rowCount ) { $ insertPlaceholder = '(' . implode ( ',' , array_fill ( 0 , $ fieldCount , '?' ) ) . ')' ; $ insertPlaceholder = implode ( ',' , array_fill ( 0 , $ rowCount , $ insertPlaceholder ) ) ; return $ insertPlaceholder ; } | generate insert placeholder for parameter binding based on field and row count |
1,536 | public function cache_init ( $ file_path ) { $ cache_key = md5 ( $ file_path ) ; $ cache_path = \ Config :: get ( 'parser.View_Jade.cache_dir' , null ) . substr ( $ cache_key , 0 , 2 ) . DS . substr ( $ cache_key , 2 , 2 ) ; if ( $ cache_path !== null AND ! is_dir ( $ cache_path ) ) { mkdir ( $ cache_path , 0777 , true... | compiled template . |
1,537 | public static function fromString ( $ string ) { \ Assert \ that ( $ string ) -> string ( 'Argument has to be a string' ) -> uuid ( 'String has to be an UUID' ) ; return new static ( Uuid :: fromString ( $ string ) ) ; } | Creates an identifier object from a string . |
1,538 | public function add ( $ title , string $ url = '' , array $ children = [ ] , array $ fields = [ ] ) : Builder { $ this -> menu [ ] = $ this -> parseMenuItems ( $ title , $ url , $ children , $ fields ) ; return $ this ; } | Add new menu item . |
1,539 | public function addChild ( string $ title , string $ url = '' , array $ children = [ ] , array $ fields = [ ] ) : Builder { $ index = count ( $ this -> menu ) - 1 ; if ( $ index < 0 ) { return $ this ; } $ this -> menu [ $ index ] -> appendChild ( $ this -> parseMenuItems ( $ title , $ url , $ children , $ fields ) ) ;... | Add child element to the root menu item . |
1,540 | public function cached ( $ lifetime = null , $ cache_key = null , $ cache_all = true ) { $ this -> _lifetime = $ lifetime ; $ this -> _cache_all = ( bool ) $ cache_all ; is_string ( $ cache_key ) and $ this -> _cache_key = $ cache_key ; return $ this ; } | Enables the query to be cached for a specified amount of time . |
1,541 | public function set_connection ( $ db ) { if ( ! $ db instanceof \ Database_Connection ) { $ db = \ Database_Connection :: instance ( $ db ) ; } $ this -> _connection = $ db ; return $ this ; } | Set a DB connection to use when compiling the SQL |
1,542 | public function compile ( $ db = null ) { if ( ! $ db instanceof \ Database_Connection ) { $ db = $ this -> _connection ? : \ Database_Connection :: instance ( $ db ) ; } $ sql = $ this -> _sql ; if ( ! empty ( $ this -> _parameters ) ) { $ values = array_map ( array ( $ db , 'quote' ) , $ this -> _parameters ) ; $ sql... | Compile the SQL query and return it . Replaces any parameters with their given values . |
1,543 | public function execute ( $ db = null ) { if ( ! is_object ( $ db ) ) { $ db = \ Database_Connection :: instance ( $ db , null , ! $ this instanceof \ Database_Query_Builder_Select ) ; } $ sql = $ this -> compile ( $ db ) ; switch ( strtoupper ( substr ( ltrim ( $ sql , '(' ) , 0 , 6 ) ) ) { case 'SELECT' : $ this -> _... | Execute the current query on the given database . |
1,544 | public static function Ppsp ( array $ a , $ s , array $ b , array & $ apsb ) { $ sb = [ ] ; IAU :: Sxp ( $ s , $ b , $ sb ) ; IAU :: Ppp ( $ a , $ sb , $ apsb ) ; return ; } | - - - - - - - - i a u P p s p - - - - - - - - |
1,545 | public static function create ( ContainerInterface $ container = null , array $ configs = [ ] ) { if ( null === $ container ) { $ container = Factory :: create ( ) ; } return new Cache ( $ container , new SerializerManager ( ) , new CompressorManager ( ) , $ configs ) ; } | create a new cache instance |
1,546 | public function getQueryParams ( ) { if ( is_array ( $ this -> query ) ) { return $ this -> query ; } if ( $ this -> uri === null ) { return [ ] ; } parse_str ( $ this -> uri -> getQuery ( ) , $ this -> query ) ; return $ this -> query ; } | Retrieve query string arguments |
1,547 | public function getParsedBody ( ) { if ( $ this -> parsedBody || ! $ this -> body ) { return $ this -> parsedBody ; } $ type = $ this -> headers -> getContentType ( ) ; $ body = ( string ) $ this -> getBody ( ) ; switch ( $ type ) { case 'application/json' : $ this -> parsedBody = json_decode ( $ body , true ) ; break ... | Retrieve any parameters provided in the request body |
1,548 | protected function addItem ( string $ key , array $ values ) : void { if ( ! array_key_exists ( 'source' , $ values ) || ! array_key_exists ( 'target' , $ values ) ) { throw new \ InvalidArgumentException ( 'Invalid translation array: ' . var_export ( $ values , true ) ) ; } $ this -> translationBuffer [ $ key ] = new ... | Add an element with the passed values . |
1,549 | public function writeFile ( ) { if ( ! empty ( $ this -> fileName ) ) { if ( ! file_exists ( $ this -> destinationPath ) ) { mkdir ( $ this -> destinationPath , 0777 ) ; } $ file = $ this -> file ( ) ; $ fileHandle = fopen ( $ file , 'w+' ) ; fwrite ( $ fileHandle , $ this -> body ) ; fclose ( $ fileHandle ) ; return $... | Write the downloaded file |
1,550 | public function getAvailableTimezones ( ) { $ timezoneNames = DateTimeZone :: listIdentifiers ( DateTimeZone :: ALL ) ; $ timezones = array_map ( function ( $ timezoneName ) { $ timezone = new DateTimeZone ( $ timezoneName ) ; $ offset = $ timezone -> getOffset ( new DateTime ( "now" , $ timezone ) ) / 3600 ; if ( $ of... | Gets all timezones in the world |
1,551 | public static function normalize ( array $ context ) { $ diff = array_diff_key ( $ context , self :: $ defaults ) ; if ( ! empty ( $ diff ) ) { $ errorMessage = 'unknown index ' . implode ( ', ' , array_keys ( $ diff ) ) ; throw new InvalidContext ( $ errorMessage ) ; } if ( ! empty ( $ context [ 'namespace' ] ) ) { if... | Normalizes the context format |
1,552 | protected function connect ( ) { $ db = Config :: config ( ) [ 'user' ] [ 'database' ] ; if ( $ db [ 'enabled' ] ) { switch ( $ db [ 'driver' ] ) { case 'pdo' : $ options = [ Pdo :: ATTR_STATEMENT_CLASS => [ '\Gcs\Framework\Core\Pdo\PdoStatement' , [ ] ] ] ; switch ( $ db [ 'type' ] ) { case 'mysql' : try { $ this -> d... | create the database connection |
1,553 | public static function generate ( string $ text = '' , ? int $ maxLength = null ) : string { $ text = StripTags :: strip ( $ text ) ; $ text = \ strtolower ( \ iconv ( 'UTF-8' , 'ASCII//TRANSLIT' , $ text ) ) ; $ text = \ preg_replace ( '/[^a-z0-9\-\ ]/' , '' , $ text ) ; $ text = \ preg_replace ( '/[\s\-]+/' , '-' , $... | Generates web url |
1,554 | public function add_type ( $ type , $ path = null ) { isset ( $ this -> _asset_paths [ $ type ] ) or $ this -> _asset_paths [ $ type ] = array ( ) ; isset ( $ this -> _path_folders [ $ type ] ) or $ this -> _path_folders [ $ type ] = $ type . '/' ; if ( ! is_null ( $ path ) ) { $ path = $ this -> _unify_path ( $ path )... | Adds a new asset type to the list so we can load files of this type |
1,555 | public function add_path ( $ path , $ type = null ) { is_null ( $ type ) and $ type = $ this -> _path_folders ; empty ( $ path ) and $ path = DOCROOT ; if ( is_array ( $ type ) ) { foreach ( $ type as $ key => $ folder ) { is_numeric ( $ key ) and $ key = $ folder ; $ folder = $ this -> _unify_path ( $ path ) . ltrim (... | Adds the given path to the front of the asset paths array . It adds paths in a way so that asset paths are used First in Last Out . |
1,556 | public function remove_path ( $ path , $ type = null ) { is_null ( $ type ) and $ type = $ this -> _path_folders ; if ( is_array ( $ type ) ) { foreach ( $ type as $ key => $ folder ) { is_numeric ( $ key ) and $ key = $ folder ; $ folder = $ this -> _unify_path ( $ path ) . ltrim ( $ this -> _unify_path ( $ folder ) ,... | Removes the given path from the asset paths array |
1,557 | protected function _unify_path ( $ path , $ ds = null , $ trailing = true ) { $ ds === null and $ ds = DS ; return rtrim ( str_replace ( array ( '\\' , '/' ) , $ ds , $ path ) , $ ds ) . ( $ trailing ? $ ds : '' ) ; } | Unify the path |
1,558 | protected function initialiseCommands ( ) { $ modules = $ this -> kernel -> getModules ( ) ; foreach ( $ modules as $ module ) { if ( ! $ module instanceof ConsoleModuleInterface ) { continue ; } $ module -> registerCommands ( $ this ) ; } } | Initialise commands from modules . |
1,559 | public function isTokenUnique ( $ token ) { $ record = List_Unsubscribe_Token :: where ( 'token' , $ token ) -> first ( ) ; if ( ! $ record ) { return true ; } return false ; } | Is a given token unique in the list_unsubscribe_token database table? |
1,560 | public function createTokenRecord ( $ emailID , $ listID , $ token ) { $ unsubscribe = new List_Unsubscribe_Token ; $ unsubscribe -> email_id = $ emailID ; $ unsubscribe -> list_id = $ listID ; $ unsubscribe -> token = $ token ; $ unsubscribe -> save ( ) ; } | INSERT a token record . |
1,561 | public function isTokenValid ( $ token ) { $ record = List_Unsubscribe_Token :: where ( 'token' , $ token ) -> first ( ) ; if ( ! $ record ) { return false ; } return true ; } | Does a given token exist in the database? |
1,562 | public function get ( $ alias ) { if ( false === $ this -> has ( $ alias ) ) { throw new DataSetContextNotFoundException ( $ alias ) ; } return $ this -> items [ $ alias ] ; } | Returns a dataset s context by its alias |
1,563 | public function getVisibleAttributes ( ) { $ result = $ this -> getAttributes ( ) ; $ hidden = $ this -> getHidden ( ) ; foreach ( $ hidden as $ forHide ) { unset ( $ result [ $ forHide ] ) ; } return $ result ; } | Get visible attributes |
1,564 | protected function _cleanName ( $ name ) { assert ( 'strpos($name, \':\') === false' ) ; if ( strpos ( $ name , ':' ) !== false ) { list ( $ name , ) = explode ( ':' , $ name ) ; } $ name = trim ( $ name ) ; if ( $ name == '' ) { throw new CacheException ( 'Cache-entry name cannot be empty' ) ; } return strtolower ( $ ... | Clean a name for use within the CacheStore . |
1,565 | public function set ( $ name , $ value , $ ttl = 0 ) { $ name = $ this -> _cleanName ( $ name ) ; if ( $ ttl == 0 && $ this -> _ttl !== null ) { $ ttl = $ this -> _ttl ; } return $ this -> _Cache -> set ( "{$this->_store}:$name" , $ value , $ ttl ) ; } | Add an entry to the CacheStore . |
1,566 | public function get ( $ name , & $ error = false ) { try { $ name = $ this -> _cleanName ( $ name ) ; } catch ( CacheException $ e ) { $ error = true ; return null ; } return $ this -> _Cache -> get ( "{$this->_store}:$name" , $ error ) ; } | Get an entry from the CacheStore . |
1,567 | public function delete ( $ name ) { try { $ name = $ this -> _cleanName ( $ name ) ; } catch ( CacheException $ e ) { return false ; } return $ this -> _Cache -> delete ( "{$this->_store}:$name" ) ; } | Delete an entry from the CacheStore . |
1,568 | public function errorMessages ( ) { $ messages = array ( ) ; foreach ( $ this -> errors as $ field => $ errors ) { $ messages [ $ field ] = array ( ) ; foreach ( $ errors as $ validation => $ error ) { $ vars = array_merge ( array ( 'field' => Language :: translate ( $ field ) ) , $ error ) ; unset ( $ vars [ 'message'... | Returns the models errors with proper messages . |
1,569 | public function addError ( $ field , $ validation , $ data ) { if ( ! isset ( $ this -> errors [ $ field ] ) ) { $ this -> errors [ $ field ] = array ( ) ; } $ this -> errors [ $ field ] [ $ validation ] = $ data ; } | Adds an error for the specified field . |
1,570 | public function Connection ( ) { $ this -> _IsPersistent = GetValue ( PDO :: ATTR_PERSISTENT , $ this -> ConnectionOptions , FALSE ) ; if ( ! is_object ( $ this -> _Connection ) ) { try { $ this -> _Connection = new PDO ( strtolower ( $ this -> Engine ) . ':' . $ this -> Dsn , $ this -> User , $ this -> Password , $ th... | Get the PDO connection to the database . |
1,571 | public function QuoteExpression ( $ Expr ) { if ( is_null ( $ Expr ) ) { return 'NULL' ; } elseif ( is_string ( $ Expr ) ) { return '\'' . str_replace ( '\'' , '\\\'' , $ Expr ) . '\'' ; } elseif ( is_object ( $ Expr ) ) { return '?OBJECT?' ; } else { return $ Expr ; } } | Properly quotes and escapes a expression for an sql string . |
1,572 | public function Init ( $ Config = NULL ) { if ( is_null ( $ Config ) ) $ Config = Gdn :: Config ( 'Database' ) ; elseif ( is_string ( $ Config ) ) $ Config = Gdn :: Config ( $ Config ) ; $ DefaultConfig = Gdn :: Config ( 'Database' ) ; if ( is_null ( $ Config ) ) $ Config = array ( ) ; if ( is_null ( $ DefaultConfig ) ... | Initialize the properties of this object . |
1,573 | public function SQL ( ) { if ( is_null ( $ this -> _SQL ) ) { $ Name = $ this -> Engine . 'Driver' ; $ this -> _SQL = Gdn :: Factory ( $ Name ) ; $ this -> _SQL -> Database = $ this ; } return $ this -> _SQL ; } | Get the database driver class for the database . |
1,574 | public function Structure ( ) { if ( is_null ( $ this -> _Structure ) ) { $ Name = $ this -> Engine . 'Structure' ; $ this -> _Structure = Gdn :: Factory ( $ Name ) ; $ this -> _Structure -> Database = $ this ; } return $ this -> _Structure ; } | Get the database structure class for this database . |
1,575 | protected function _setSpec ( $ spec ) { if ( ! is_null ( $ spec ) ) { $ spec = $ this -> _normalizeIterable ( $ spec ) ; } $ this -> spec = $ spec ; } | Assigns a spec to this instance . |
1,576 | public static function dump ( $ var , $ format = null ) { if ( ! static :: isDebug ( ) ) return ; $ dumpers = [ static :: DUMP_HTML => '\\yolk\\debug\\HTMLDumper' , static :: DUMP_TERMINAL => '\\yolk\\debug\\TerminalDumper' , static :: DUMP_TEXT => '\\yolk\\debug\\TextDumper' , ] ; if ( ! isset ( $ dumpers [ $ format ]... | Pretty - print a variable - if running in debug mode . |
1,577 | public static function addHelperMethod ( $ class , $ method ) { $ k = strtolower ( $ method ) ; if ( method_exists ( __CLASS__ , $ method ) ) throw new \ Exception ( sprintf ( "Helper methods cannot override pre-defined Yolk methods - '%s' is reserved" , $ method ) ) ; elseif ( isset ( static :: $ helpers [ $ k ] ) && ... | Register a single static method as a helper . |
1,578 | public static function run ( Callable $ callable ) { try { register_shutdown_function ( [ '\\yolk\\exceptions\\Handler' , 'checkFatal' ] ) ; $ error_handler = set_error_handler ( static :: $ error_handler ) ; $ args = func_get_args ( ) ; array_shift ( $ args ) ; $ result = call_user_func_array ( $ callable , $ args ) ;... | Executes the specified closure wrapping it in Yolk s error and exception handling . |
1,579 | public function method ( $ callable , bool $ testMethod = null ) : string { if ( is_string ( $ callable ) && false !== strstr ( $ callable , '::' ) ) { $ callable = explode ( '::' , $ callable ) ; } if ( ! is_array ( $ callable ) || empty ( $ callable [ 0 ] ) || empty ( $ callable [ 1 ] ) ) { throw new InvalidArgumentE... | Method name helper . |
1,580 | public function onRegister ( ) { $ application = $ this -> application ; \ Route :: add ( "/" , "home" , function ( $ response , $ params = null ) use ( $ application ) { return $ response -> addContent ( "<pre>Welcome to Budkit.\nTo change this page add a new basepath route like so \n\n Route::add('/', function(\$rout... | The package app . register event callback |
1,581 | public function add ( $ typeName , $ args ) { $ args = array_merge_recursive ( array ( 'public' => true , 'supports' => array ( 'title' , 'editor' , 'thumbnail' , 'revisions' , ) , 'has_archive' => true , ) , $ args ) ; $ this -> posttypes [ $ typeName ] = $ args ; return true ; } | Add new posttype |
1,582 | public static function getActivePersonSetingValue ( $ type ) { $ personId = Yii :: app ( ) -> getModule ( 'user' ) -> user ( ) -> profile -> person_id ; $ criteria = [ 'ppxs_pprs_id' => $ personId , 'ppxs_psty_id' => $ type ] ; $ model = PpxsPersonXSetting :: model ( ) -> findByAttributes ( $ criteria ) ; if ( ! $ mode... | atgrie pirmo aktivas personas prasito settingu |
1,583 | public function match ( string $ message ) : bool { if ( $ this -> regexp ) { return ( bool ) preg_match ( $ this -> message , $ message ) ; } return mb_strtolower ( $ this -> message ) === mb_strtolower ( $ message ) ; } | Is message matches? |
1,584 | public function bundleCommand ( string $ packageKey , string $ serverScript = null , string $ clientScript = null ) { $ start = microtime ( true ) ; $ filePathResolver = new FilePathResolver ( ) ; $ package = $ this -> packageManager -> getPackage ( $ packageKey ) ; if ( $ serverScript !== null ) { $ serverScript = $ f... | Prepares a react bundle for a specific package |
1,585 | public function stopProcessesCommand ( bool $ force = false ) { $ count = $ this -> processManager -> killAllProcesses ( $ force ) ; $ this -> outputLine ( ) ; if ( $ force === true ) { $ this -> outputFormatted ( '<comment>force stopped %s</comment>' , [ $ count === 1 ? '1 process' : $ count . ' processes' ] ) ; } els... | Stops all background processes |
1,586 | private static function getReflectionProperties ( $ object ) { $ class = get_class ( $ object ) ; if ( ! isset ( self :: $ reflectionProperties [ $ class ] ) ) { $ reflection = new \ ReflectionClass ( $ object ) ; $ reflectionProperties = array_filter ( $ reflection -> getProperties ( ) , function ( $ property ) { retu... | Returns reflection properties from in - memory cache or load them |
1,587 | public function getRandom ( ) { $ em = $ this -> getEntityManager ( ) ; $ repository = $ em -> getRepository ( 'HarvestCloudCoreBundle:Location' ) ; $ query = $ em -> createQuery ( 'SELECT COUNT(l.id) FROM HarvestCloud\CoreBundle\Entity\Location l' ) ; $ count = $ query -> getSingleScalarResult ( ) ; return $ this -> f... | Get a random Location from the Repository |
1,588 | private function InitForm ( ) { $ this -> AddCategoryField ( ) ; $ this -> AddTitleField ( ) ; $ this -> AddTeaserField ( ) ; $ this -> AddTextField ( ) ; $ this -> AddPublishField ( ) ; $ this -> AddPublishFromDateField ( ) ; $ this -> AddPublishFromHourField ( ) ; $ this -> AddPublishFromMinuteField ( ) ; $ this -> A... | Adds all form fields |
1,589 | private function InitMembers ( ) { $ this -> archive = Archive :: Schema ( ) -> ByID ( Request :: GetData ( 'archive' ) ) ; if ( ! $ this -> archive ) { throw new \ Exception ( "Missing or invalid parameter 'archive'" ) ; } $ this -> article = new Article ( Request :: GetData ( 'article' ) ) ; $ this -> dateFormat = Tr... | Initializes the class members |
1,590 | private function AddCategoryField ( ) { $ name = 'Category' ; $ value = '' ; if ( $ this -> article -> Exists ( ) ) { $ value = $ this -> article -> GetCategory ( ) -> GetID ( ) ; } $ field = new Select ( $ name , $ value ) ; $ field -> AddOption ( '' , Trans ( 'Core.PleaseSelect' ) ) ; $ catList = new CategoryListProv... | Adds the category select box |
1,591 | private function AddTitleField ( ) { $ name = 'Title' ; $ this -> AddField ( Input :: Text ( $ name , $ this -> article -> GetTitle ( ) ) ) ; $ this -> SetRequired ( $ name ) ; } | Adds the title field |
1,592 | private function AddTextField ( ) { $ name = 'Text' ; $ this -> AddRichTextField ( $ name , $ this -> article -> GetText ( ) ) ; $ this -> SetRequired ( $ name ) ; } | Adds the text field |
1,593 | private function AddPublishField ( ) { $ name = 'Publish' ; $ field = new Checkbox ( $ name , '1' , ( bool ) $ this -> article -> GetPublish ( ) ) ; $ this -> AddField ( $ field ) ; } | Adds the publish check box |
1,594 | private function AddPublishFromDateField ( ) { $ name = 'PublishFromDate' ; $ from = $ this -> article -> GetPublishFrom ( ) ; $ field = Input :: Text ( $ name , $ from ? $ from -> ToString ( $ this -> dateFormat ) : '' ) ; $ field -> SetHtmlAttribute ( 'data-type' , 'date' ) ; $ this -> AddField ( $ field ) ; } | Adds the publish from date field |
1,595 | private function AddPublishFromHourField ( ) { $ name = 'PublishFromHour' ; $ from = $ this -> article -> GetPublishFrom ( ) ; $ field = Input :: Text ( $ name , $ from ? $ from -> ToString ( 'H' ) : '' ) ; $ field -> SetHtmlAttribute ( 'data-type' , 'hour' ) ; $ this -> AddField ( $ field ) ; } | Adds the publish from hour field |
1,596 | private function AddPublishToDateField ( ) { $ name = 'PublishToDate' ; $ to = $ this -> article -> GetPublishTo ( ) ; $ field = Input :: Text ( $ name , $ to ? $ to -> ToString ( $ this -> dateFormat ) : '' ) ; $ field -> SetHtmlAttribute ( 'data-type' , 'date' ) ; $ this -> AddField ( $ field ) ; } | Adds the publish to date field |
1,597 | private function AddAuthorField ( ) { $ name = 'Author' ; if ( $ this -> article -> Exists ( ) ) { $ value = $ this -> article -> GetAuthor ( ) ? $ this -> article -> GetAuthor ( ) -> GetID ( ) : '' ; } else { $ value = self :: Guard ( ) -> GetUser ( ) -> GetID ( ) ; } $ field = new Select ( $ name , $ value ) ; $ fiel... | Adds the author field |
1,598 | protected function OnSuccess ( ) { $ this -> article -> SetPublish ( $ this -> Value ( 'Publish' ) ) ; $ this -> article -> SetPublishFrom ( $ this -> PublishDate ( 'PublishFrom' ) ) ; $ this -> article -> SetPublishTo ( $ this -> PublishDate ( 'PublishTo' ) ) ; $ this -> article -> SetCategory ( Category :: Schema ( )... | Saves the article |
1,599 | public function plugin ( $ name , array $ options = [ ] ) { $ plugins = $ this -> getPluginManager ( ) ; return $ plugins -> get ( $ name , $ options ) ; } | Retrieve a filter plugin by name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.