idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
40,300 | private function _googleSoap ( $ query , $ start = 0 , $ max = 10 , $ filter = false , $ restrict = "" , $ safe = false , $ lr = "" , $ ie = "" , $ oe = "" ) { $ wsdl = new SOAP_WSDL ( 'http://api.google.com/GoogleSearch.wsdl' ) ; $ soapclient = $ wsdl -> getProxy ( ) ; if ( get_class ( $ soapclient ) != "SOAP_Fault" )... | Makes SOAP request to google |
40,301 | function AddRecipient ( $ email , $ name = "" , $ recipientType = "" ) { if ( $ this -> DecodeEntities ) { $ email = $ this -> DecodeEntities ( $ email ) ; $ name = $ this -> DecodeEntities ( $ name ) ; } $ email = str_replace ( "," , ";" , $ email ) ; $ emails = explode ( ";" , $ email ) ; $ name = str_replace ( "," ,... | Adds a recipient to the email message |
40,302 | function GetPhpType ( ) { $ rt = $ this -> Type ; switch ( $ this -> Type ) { case "smallint" : case "bigint" : case "tinyint" : case "mediumint" : $ rt = "int" ; break ; case "varchar" : case "text" : case "tinytext" : $ rt = "string" ; break ; case "date" : case "datetime" : $ rt = "date" ; break ; case "decimal" : c... | Return the PHP variable type that most closely matches this column type |
40,303 | function GetSqliteType ( ) { $ rt = $ this -> Type ; switch ( $ this -> Type ) { case "int" : $ rt = "integer" ; break ; case "smallint" : $ rt = "integer" ; break ; case "tinyint" : $ rt = "integer" ; break ; case "varchar" : $ rt = "text" ; break ; case "text" : $ rt = "text" ; break ; case "tinytext" : $ rt = "text"... | Get the SQLite type that most closely matches this column type |
40,304 | public static function register ( $ prepend = false ) { if ( version_compare ( phpversion ( ) , '5.3.0' , '>=' ) ) { spl_autoload_register ( array ( __CLASS__ , 'autoload' ) , true , $ prepend ) ; } else { spl_autoload_register ( array ( __CLASS__ , 'autoload' ) ) ; } } | Registers Twig_Autoloader as an SPL autoloader . |
40,305 | function rowcolToCell ( $ row , $ col ) { if ( $ col > 255 ) { return new PEAR_Error ( "Maximum column value exceeded: $col" ) ; } $ int = ( int ) ( $ col / 26 ) ; $ frac = $ col % 26 ; $ chr1 = '' ; if ( $ int > 0 ) { $ chr1 = chr ( ord ( 'A' ) + $ int - 1 ) ; } $ chr2 = chr ( ord ( 'A' ) + $ frac ) ; $ row ++ ; retur... | Utility function for writing formulas Converts a cell s coordinates to the A1 format . |
40,306 | public function deleteServer ( $ consumer_key , $ user_id , $ user_is_admin = false ) { if ( $ user_is_admin ) { $ this -> query ( ' DELETE FROM oauth_consumer_registry WHERE ocr_consumer_key = \'%s\' AND (ocr_usa_id_ref = %d OR ocr_usa_id_ref IS NULL) ' , $ consumer_key , $ user_id ) ; } else { $ thi... | Delete a server key . This removes access to that site . |
40,307 | public function deleteServerToken ( $ consumer_key , $ token , $ user_id , $ user_is_admin = false ) { if ( $ user_is_admin ) { $ this -> query ( ' DELETE oauth_consumer_token FROM oauth_consumer_token JOIN oauth_consumer_registry ON oct_ocr_id_ref = ocr_id WHERE ocr_consumer_key = \'%s\' AND o... | Delete a token we obtained from a server . |
40,308 | public function deleteConsumerAccessToken ( $ token , $ user_id , $ user_is_admin = false ) { if ( $ user_is_admin ) { $ this -> query ( ' DELETE FROM oauth_server_token WHERE ost_token = \'%s\' AND ost_token_type = \'access\' ' , $ token ) ; } else { $ this -> query ( ' DELETE FROM oauth_s... | Delete a consumer access token . |
40,309 | public function populateCompiledFilepath ( Smarty_Template_Compiled $ compiled , Smarty_Internal_Template $ _template ) { $ compiled -> filepath = false ; $ compiled -> timestamp = false ; $ compiled -> exists = false ; } | populate compiled object with compiled filepath |
40,310 | protected function optimizePrintNode ( Twig_NodeInterface $ node , Twig_Environment $ env ) { if ( ! $ node instanceof Twig_Node_Print ) { return $ node ; } if ( $ node -> getNode ( 'expr' ) instanceof Twig_Node_Expression_BlockReference || $ node -> getNode ( 'expr' ) instanceof Twig_Node_Expression_Parent ) { $ node ... | Optimizes print nodes . |
40,311 | protected function optimizeRawFilter ( Twig_NodeInterface $ node , Twig_Environment $ env ) { if ( $ node instanceof Twig_Node_Expression_Filter && 'raw' == $ node -> getNode ( 'filter' ) -> getAttribute ( 'value' ) ) { return $ node -> getNode ( 'node' ) ; } return $ node ; } | Removes raw filters . |
40,312 | public function setDateFormat ( $ format = null , $ dateIntervalFormat = null ) { if ( null !== $ format ) { $ this -> dateFormats [ 0 ] = $ format ; } if ( null !== $ dateIntervalFormat ) { $ this -> dateFormats [ 1 ] = $ dateIntervalFormat ; } } | Sets the default format to be used by the date filter . |
40,313 | public function getTimezone ( ) { if ( null === $ this -> timezone ) { $ this -> timezone = new DateTimeZone ( date_default_timezone_get ( ) ) ; } return $ this -> timezone ; } | Gets the default timezone to be used by the date filter . |
40,314 | protected function GetConnectionString ( ) { $ cstring = new DBConnectionString ( ) ; $ cstring -> Host = RequestUtil :: Get ( 'host' ) ; $ cstring -> Port = RequestUtil :: Get ( 'port' ) ; $ cstring -> Username = RequestUtil :: Get ( 'username' ) ; $ cstring -> Password = RequestUtil :: Get ( 'password' ) ; $ cstring ... | Get connection string based on request variables |
40,315 | public function LoadDriver ( ) { if ( $ this -> _driver == null ) { require_once ( "verysimple/IO/Includer.php" ) ; switch ( $ this -> ConnectionSetting -> Type ) { case "mysql" : include_once ( "verysimple/DB/DataDriver/MySQL.php" ) ; $ this -> _driver = new DataDriverMySQL ( ) ; break ; case "mysqli" : include_once (... | Load the data driver |
40,316 | function Open ( ) { $ this -> Observe ( "DataAdapter ($this->_label) Opening Connection..." , OBSERVE_DEBUG ) ; if ( $ this -> _dbopen ) { $ this -> Observe ( "DataAdapter ($this->_label) Connection Already Open" , OBSERVE_WARN ) ; } else { if ( ! $ this -> _driver ) $ this -> LoadDriver ( ) ; try { $ this -> _dbconn =... | Opens a connection to the data server and selects the specified database |
40,317 | function Close ( ) { $ this -> Observe ( "DataAdapter ($this->_label) Closing Connection..." , OBSERVE_DEBUG ) ; if ( $ this -> _dbopen ) { $ this -> _driver -> Close ( $ this -> _dbconn ) ; $ this -> _dbopen = false ; $ this -> Observe ( "DataAdapter ($this->_label) Connection Closed" , OBSERVE_DEBUG ) ; } else { $ th... | Closing the connection to the data Server |
40,318 | function Select ( $ sql ) { $ this -> RequireConnection ( true ) ; $ this -> Observe ( "DataAdapter ($this->_label) (DataAdapter.Select) " . $ sql , OBSERVE_QUERY ) ; try { $ rs = $ this -> _driver -> Query ( $ this -> _dbconn , $ sql ) ; $ this -> _num_retries = 0 ; } catch ( Exception $ ex ) { if ( $ this -> _num_ret... | Executes a SQL select statement and returns a resultset that can be read using Fetch |
40,319 | function Execute ( $ sql ) { $ result = null ; if ( $ this -> ConnectionSetting -> IsReadOnlySlave ) { if ( ! $ this -> _masterAdapter ) { if ( $ this -> ConnectionSetting -> MasterConnectionDelegate ) { $ this -> Observe ( "DataAdapter ($this->_label) (DataAdapter.Execute) Delegating write operation from Slave to Mast... | Executes a SQL query that does not return a resultset |
40,320 | function StartTransaction ( ) { if ( $ this -> IsTransactionInProgress ( ) ) throw new Exception ( 'Transaction is already in progress. Commit or rollback must be called before beginning a new transaction' ) ; if ( $ this -> ConnectionSetting -> IsReadOnlySlave ) throw new Exception ( 'Transactions are not allowed on ... | Start a DB transaction disabling auto - commit if necessar ) |
40,321 | function CommitTransaction ( ) { if ( $ this -> ConnectionSetting -> IsReadOnlySlave ) throw new Exception ( 'Transactions are not allowed on a read-only slave' ) ; $ this -> RequireConnection ( true ) ; $ this -> Observe ( "DataAdapter ($this->_label) (DataAdapter.CommitTransaction)" , OBSERVE_QUERY ) ; $ this -> _tra... | Commit the current DB transaction and re - enable auto - commit if necessary |
40,322 | public function GetTableNames ( $ ommitEmptyTables = false ) { return $ this -> _driver -> GetTableName ( $ this -> _dbconn , $ this -> GetDBName ( ) , $ ommitEmptyTables ) ; } | Returns an array of all table names in the current database |
40,323 | public function OptimizeTables ( ) { if ( $ this -> ConnectionSetting -> IsReadOnlySlave ) throw new Exception ( 'Optimizing tables is allowed on a read-only slave' ) ; $ results = array ( ) ; $ table_names = $ this -> _driver -> GetTableNames ( $ this -> _dbconn , $ this -> GetDBName ( ) ) ; foreach ( $ table_names as... | Runs OPTIMIZE TABLE on all tables in the current database |
40,324 | function GetLastInsertId ( ) { $ id = null ; if ( $ this -> ConnectionSetting -> IsReadOnlySlave && $ this -> _masterAdapter ) { $ id = $ this -> _masterAdapter -> GetLastInsertId ( ) ; } else { $ this -> RequireConnection ( ) ; $ this -> Observe ( "DataAdapter ($this->_label) GetLastInsertId" , OBSERVE_QUERY ) ; $ id ... | Returns last auto - inserted Id . If this is a read - only slave and a write operation was made to a Master Delegate then the last insert id from that connection will be returned |
40,325 | function Fetch ( $ rs ) { $ this -> RequireConnection ( ) ; $ this -> Observe ( "DataAdapter ($this->_label) Fetching next result as array" , OBSERVE_DEBUG ) ; return $ this -> _driver -> Fetch ( $ this -> _dbconn , $ rs ) ; } | Moves the database curser forward and returns the current row as an associative array the resultset passed in must have been created by the same database driver that was connected when Select was called |
40,326 | function Release ( $ rs ) { $ this -> RequireConnection ( ) ; $ this -> Observe ( "DataAdapter ($this->_label) Releasing result resources" , OBSERVE_DEBUG ) ; $ this -> _driver -> Release ( $ this -> _dbconn , $ rs ) ; } | Releases the resources for the given resultset . the resultset must have been created by the same database driver |
40,327 | public static function Escape ( $ val ) { if ( DataAdapter :: $ ADAPTER_INSTANCE ) DataAdapter :: $ ADAPTER_INSTANCE -> LoadDriver ( ) ; if ( ! DataAdapter :: $ DRIVER_INSTANCE ) throw new Exception ( "DataAdapter must be instantiated before Escape can be called" ) ; if ( get_magic_quotes_runtime ( ) || get_magic_quote... | Removes any illegal chars from a value to prepare it for use in SQL |
40,328 | public static function GetQuotedSql ( $ val ) { if ( DataAdapter :: $ ADAPTER_INSTANCE ) DataAdapter :: $ ADAPTER_INSTANCE -> LoadDriver ( ) ; if ( ! DataAdapter :: $ DRIVER_INSTANCE ) throw new Exception ( "DataAdapter must be instantiated before Escape can be called" ) ; return DataAdapter :: $ DRIVER_INSTANCE -> Get... | Quote and escape value to prepare it for use in SQL |
40,329 | public function getColumnByOffset ( $ pColumnOffset = 0 ) { list ( $ rangeStart , $ rangeEnd ) = PHPExcel_Cell :: rangeBoundaries ( $ this -> _range ) ; $ pColumn = PHPExcel_Cell :: stringFromColumnIndex ( $ rangeStart [ 0 ] + $ pColumnOffset - 1 ) ; return $ this -> getColumn ( $ pColumn ) ; } | Get a specified AutoFilter Column by it s offset |
40,330 | public function shiftColumn ( $ fromColumn = NULL , $ toColumn = NULL ) { $ fromColumn = strtoupper ( $ fromColumn ) ; $ toColumn = strtoupper ( $ toColumn ) ; if ( ( $ fromColumn !== NULL ) && ( isset ( $ this -> _columns [ $ fromColumn ] ) ) && ( $ toColumn !== NULL ) ) { $ this -> _columns [ $ fromColumn ] -> setPar... | Shift an AutoFilter Column Rule to a different column |
40,331 | private static function _getTimezoneTransitions ( $ objTimezone , $ timestamp ) { $ allTransitions = $ objTimezone -> getTransitions ( ) ; $ transitions = array ( ) ; foreach ( $ allTransitions as $ key => $ transition ) { if ( $ transition [ 'ts' ] > $ timestamp ) { $ transitions [ ] = ( $ key > 0 ) ? $ allTransitions... | Return the Timezone transition for the specified timezone and timestamp |
40,332 | public function append_by_ref ( $ tpl_var , & $ value , $ merge = false ) { $ this -> appendByRef ( $ tpl_var , $ value , $ merge ) ; } | wrapper for append_by_ref |
40,333 | public function valid ( ) { $ columnCount = PHPExcel_Cell :: columnIndexFromString ( $ this -> _subject -> getHighestColumn ( ) ) ; if ( $ this -> _onlyExistingCells ) { while ( $ this -> _position < $ columnCount && ! $ this -> _subject -> cellExistsByColumnAndRow ( $ this -> _position , $ this -> _rowIndex ) ) { ++ $... | Are there any more PHPExcel_Cell instances available? |
40,334 | public static function exists ( $ view , $ return_path = false ) { if ( starts_with ( $ view , 'name: ' ) and array_key_exists ( $ name = substr ( $ view , 6 ) , static :: $ names ) ) { $ view = static :: $ names [ $ name ] ; } list ( $ bundle , $ view ) = Bundle :: parse ( $ view ) ; $ view = str_replace ( '.' , '/' ,... | Determine if the given view exists . |
40,335 | public static function file ( $ bundle , $ view , $ directory ) { $ directory = str_finish ( $ directory , DS ) ; if ( file_exists ( $ path = $ directory . $ view . EXT ) ) { return $ path ; } elseif ( file_exists ( $ path = $ directory . $ view . BLADE_EXT ) ) { return $ path ; } } | Get the path to a view using the default folder convention . |
40,336 | public static function composer ( $ views , $ composer ) { $ views = ( array ) $ views ; foreach ( $ views as $ view ) { Event :: listen ( "laravel.composing: {$view}" , $ composer ) ; } } | Register a view composer with the Event class . |
40,337 | public function render ( ) { Event :: fire ( "laravel.composing: {$this->view}" , array ( $ this ) ) ; if ( Event :: listeners ( static :: engine ) ) { $ result = Event :: until ( static :: engine , array ( $ this ) ) ; if ( ! is_null ( $ result ) ) return $ result ; } return $ this -> get ( ) ; } | Get the evaluated string content of the view . |
40,338 | protected function load ( ) { static :: $ last = array ( 'name' => $ this -> view , 'path' => $ this -> path ) ; if ( isset ( static :: $ cache [ $ this -> path ] ) ) { return static :: $ cache [ $ this -> path ] ; } else { return static :: $ cache [ $ this -> path ] = file_get_contents ( $ this -> path ) ; } } | Get the contents of the view file from disk . |
40,339 | public function data ( ) { $ data = array_merge ( $ this -> data , static :: $ shared ) ; foreach ( $ data as $ key => $ value ) { if ( $ value instanceof View or $ value instanceof Response ) { $ data [ $ key ] = $ value -> render ( ) ; } } return $ data ; } | Get the array of view data for the view instance . |
40,340 | static function GetColumnLetter ( $ columnNumber ) { $ colNum = $ columnNumber + 1 ; $ code = "" ; if ( $ colNum > 26 ) { $ left = floor ( $ columnNumber / 26 ) ; $ right = 1 + ( $ columnNumber % 26 ) ; if ( $ left > 26 ) throw new Exception ( "Columns exceed supported amount" ) ; $ code = chr ( $ left + 64 ) . chr ( $... | Given a zero - based column number the approriate Excel column letter is returned ie A B AB CJ etc . max supported is ZZ higher than that will throw an exception . |
40,341 | public function Get ( $ controller , $ method , $ params = "" , $ strip_api = true , $ delim = "&" ) { $ this -> stripApi = $ strip_api ; $ this -> delim = $ delim ; return $ this -> GetUrl ( $ controller , $ method , $ params ) ; } | Backwards compatibility for Phreeze 2 . 0 |
40,342 | public function nextIf ( $ primary , $ secondary = null ) { if ( $ this -> tokens [ $ this -> current ] -> test ( $ primary , $ secondary ) ) { return $ this -> next ( ) ; } } | Tests a token sets the pointer to the next one and returns it or throws a syntax error . |
40,343 | public function getContent ( Smarty_Template_Source $ source ) { $ t = '' ; $ fp = fopen ( $ source -> filepath , 'r+' ) ; if ( $ fp ) { while ( ! feof ( $ fp ) && ( $ current_line = fgets ( $ fp ) ) !== false ) { $ t .= $ current_line ; } fclose ( $ fp ) ; return $ t ; } else { return false ; } } | Load template s source from stream into current template object |
40,344 | public function hash ( $ input ) { $ hash = crypt ( $ input , $ this -> getSalt ( ) ) ; if ( strlen ( $ hash ) > 13 ) return $ hash ; return false ; } | generate a hash |
40,345 | private function getSalt ( ) { $ salt = sprintf ( '$2a$%02d$' , $ this -> rounds ) ; $ bytes = $ this -> getRandomBytes ( 16 ) ; $ salt .= $ this -> encodeBytes ( $ bytes ) ; return $ salt ; } | return an ascii - encoded 16 char salt |
40,346 | private function getRandomBytes ( $ count ) { $ bytes = '' ; if ( function_exists ( 'openssl_random_pseudo_bytes' ) && ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) !== 'WIN' ) ) { $ bytes = openssl_random_pseudo_bytes ( $ count ) ; } if ( $ bytes === '' && is_readable ( '/dev/urandom' ) && ( $ hRand = @ fopen ( '/dev/ura... | get random bytes to be used in random salts |
40,347 | public function generateKey ( $ unique = false ) { $ key = md5 ( uniqid ( rand ( ) , true ) ) ; if ( $ unique ) { list ( $ usec , $ sec ) = explode ( ' ' , microtime ( ) ) ; $ key .= dechex ( $ usec ) . dechex ( $ sec ) ; } return $ key ; } | Generate a unique key |
40,348 | protected function makeUTF8 ( $ s ) { if ( function_exists ( 'iconv' ) ) { do { $ ok = true ; $ text = @ iconv ( 'UTF-8' , 'UTF-8//TRANSLIT' , $ s ) ; if ( strlen ( $ text ) != strlen ( $ s ) ) { $ s = $ text . '.' . substr ( $ s , strlen ( $ text ) + 1 ) ; $ ok = false ; } } while ( ! $ ok ) ; } return $ s ; } | Make a string utf8 replacing all non - utf8 chars with a . |
40,349 | protected function Require401Authentication ( IAuthenticatable $ authenticatable , $ realm = "Login Required" , $ qs_username_field = "" , $ qs_password_field = "" ) { require_once ( "verysimple/Authentication/Auth401.php" ) ; $ user = $ this -> Get401Authentication ( $ authenticatable , $ qs_username_field , $ qs_pass... | Requires 401 Authentication . If authentication fails this function terminates with a 401 header . If success sets CurrentUser and returns null . |
40,350 | protected function GetCSRFToken ( ) { $ token = $ this -> Context -> Get ( 'X-CSRFToken' ) ; if ( ! $ token ) { $ token = md5 ( rand ( 1111111111 , 9999999999 ) . microtime ( ) ) ; $ this -> Context -> Set ( 'X-CSRFToken' , $ token ) ; } return $ token ; } | Returns a stored CSRF Token from the session . If no token exists then generate one and save it to the session . |
40,351 | protected function VerifyCSRFToken ( $ headerName = 'X-CSRFToken' ) { $ headers = RequestUtil :: GetHeaders ( ) ; $ headers = array_change_key_case ( $ headers , CASE_LOWER ) ; $ headerName = strtolower ( $ headerName ) ; if ( array_key_exists ( $ headerName , $ headers ) ) { if ( $ this -> GetCSRFToken ( ) != $ header... | Verify that X - CSRFToken was sent in the request headers and matches the session token If not an Exception with be thrown . If no exception is thrown then the token is verified . |
40,352 | protected function StartObserving ( $ observer = null , $ with_styles = true ) { if ( $ observer == null ) { require_once "ObserveToBrowser.php" ; $ observer = new ObserveToBrowser ( ) ; } if ( $ with_styles ) { $ this -> PrintOut ( "<style>.debug, .query, .info {font-family: courier new; border-bottom: solid 1px #999;... | Start observing messages from Phreeze . If no observer is provided then an ObserveToBrowser will be used and debug messages will be output to the browser |
40,353 | protected function Get401AuthUsername ( $ qs_username_field = "" ) { $ qsv = $ qs_username_field ? RequestUtil :: Get ( $ qs_username_field ) : '' ; return $ qsv ? $ qsv : Auth401 :: GetUsername ( ) ; } | accept username passed in either headers or querystring . if a querystring parameter name is provided that will be checked first before the 401 auth headers |
40,354 | protected function Get401AuthPassword ( $ qs_password_field = "" ) { $ qsv = $ qs_password_field ? RequestUtil :: Get ( $ qs_password_field ) : '' ; return $ qsv ? $ qsv : Auth401 :: GetPassword ( ) ; } | accept password passed in either headers or querystring . if a querystring parameter name is provided that will be checked first before the 401 auth headers |
40,355 | protected function PrintOut ( $ text , $ contentType = null ) { if ( $ this -> CaptureOutputMode ) { $ this -> DebugOutput .= $ text ; } else { if ( $ contentType ) header ( "Content-type: " . $ contentType ) ; print $ text ; } } | Use as an alterative to print in order to capture debug output |
40,356 | public function ListAll ( ) { if ( ! $ this -> ModelName ) { throw new Exception ( "ModelName must be defined in " . get_class ( $ this ) . "::ListAll" ) ; } if ( $ this -> CaptureOutputMode ) { $ this -> DebugOutput = $ this -> RenderEngine -> fetch ( "View" . $ this -> ModelName . "ListAll.tpl" ) ; } else { $ this ->... | Displays the ListAll view for the primary model object . Because the datagrid is populated via ajax no model data is populated here |
40,357 | protected function _ListAll ( Criteria $ criteria , $ current_page , $ limit ) { if ( ! $ this -> ModelName ) { throw new Exception ( "ModelName must be defined in " . get_class ( $ this ) . "::_ListAll." ) ; } $ page = $ this -> Phreezer -> Query ( $ this -> ModelName , $ criteria ) -> GetDataPage ( $ current_page , $... | Displays the ListAll view for the primary model object in the event that ajax will not be used . The model data is populated |
40,358 | protected function RenderRSS ( Array $ feedItems , $ feedTitle = "RSS Feed" , $ feedDescription = "RSS Feed" ) { require_once ( 'verysimple/RSS/Writer.php' ) ; require_once ( 'verysimple/RSS/IRSSFeedItem.php' ) ; $ baseUrl = RequestUtil :: GetBaseURL ( ) ; $ rssWriter = new RSS_Writer ( $ feedTitle , $ baseUrl , $ feed... | Render an array of IRSSFeedItem objects as an RSS feed |
40,359 | function ValidateInput ( ) { require_once ( "ValidationResponse.php" ) ; $ vr = new ValidationResponse ( ) ; $ save = RequestUtil :: Get ( "SaveInline" ) ; $ obj = $ this -> LoadFromForm ( ) ; if ( ! is_object ( $ obj ) ) { $ vr -> Success = false ; $ vr -> Errors = array ( "Unknown" => "LoadFromForm does not appear to... | This method calls LoadFromForm to retrieve a model object populated with user input . The input is validated and a ValidationResponse is rendered in JSON format |
40,360 | protected function GetColumns ( ) { if ( ! $ this -> ModelName ) { throw new Exception ( "ModelName must be defined in " . get_class ( $ this ) . "::GetColumns" ) ; } $ counter = 0 ; $ props = array ( ) ; foreach ( get_class_vars ( $ this -> ModelName ) as $ var => $ val ) { $ props [ $ counter ++ ] = $ var ; } return ... | Returns an array of all property names in the primary model |
40,361 | protected function SetCurrentUser ( IAuthenticatable $ user ) { $ this -> _cu = $ user ; Authenticator :: SetCurrentUser ( $ user , $ this -> GUID ) ; $ this -> Assign ( "CURRENT_USER" , $ this -> GetCurrentUser ( ) ) ; } | Sets the given user as the authenticatable user for this session . |
40,362 | protected function GetCurrentUser ( ) { if ( ! $ this -> _cu ) { require_once ( "verysimple/Authentication/Authenticator.php" ) ; $ this -> Phreezer -> Observe ( "Loading CurrentUser from Session" ) ; $ this -> _cu = Authenticator :: GetCurrentUser ( $ this -> GUID ) ; if ( $ this -> _cu ) { if ( get_class ( $ this -> ... | Returns the currently authenticated user or null if a user has not been authenticated . |
40,363 | protected function Render ( $ view = "" , $ format = null ) { $ isSmarty = ( strpos ( get_class ( $ this -> RenderEngine ) , "Smarty" ) > - 1 ) ; if ( $ isSmarty && $ format == null ) $ format = self :: $ SmartyViewPrefix ; if ( $ format == null ) $ format = '' ; if ( $ view == "" ) { $ backtrace = debug_backtrace ( ) ... | Renders the specified view |
40,364 | protected function RenderJSON ( $ var , $ callback = "" , $ useSimpleObject = false , $ options = null , $ forceUTF8 = 0 ) { $ obj = null ; if ( is_a ( $ var , 'DataSet' ) || is_a ( $ var , 'DataPage' ) ) { $ obj = $ var -> ToObjectArray ( $ useSimpleObject , $ options ) ; } else if ( $ useSimpleObject ) { if ( is_arra... | Renders the given value as JSON |
40,365 | protected function Crash ( $ errmsg = "Unknown Error" , $ code = 0 , $ exception = null ) { $ ex = $ exception ? $ exception : new Exception ( $ errmsg , $ code ) ; throw $ ex ; } | Send a crash message to the browser and terminate |
40,366 | protected function Redirect ( $ action , $ feedback = null , $ params = "" , $ mode = "" ) { if ( ! $ mode ) $ mode = self :: $ DefaultRedirectMode ; $ params = is_array ( $ params ) ? $ params : array ( ) ; if ( $ feedback != null ) { $ this -> Context -> Set ( "feedback" , $ feedback ) ; } list ( $ controller , $ met... | Redirect to the appropriate page based on the action . This function will call exit so do not put any code that you wish to execute after Redirect |
40,367 | private function _readPropertySets ( ) { $ offset = 0 ; $ entryLen = strlen ( $ this -> entry ) ; while ( $ offset < $ entryLen ) { $ d = substr ( $ this -> entry , $ offset , self :: PROPERTY_STORAGE_BLOCK_SIZE ) ; $ nameSize = ord ( $ d [ self :: SIZE_OF_NAME_POS ] ) | ( ord ( $ d [ self :: SIZE_OF_NAME_POS + 1 ] ) <... | Read entries in the directory stream . |
40,368 | private static function _GetInt4d ( $ data , $ pos ) { $ _or_24 = ord ( $ data [ $ pos + 3 ] ) ; if ( $ _or_24 >= 128 ) { $ _ord_24 = - abs ( ( 256 - $ _or_24 ) << 24 ) ; } else { $ _ord_24 = ( $ _or_24 & 127 ) << 24 ; } return ord ( $ data [ $ pos ] ) | ( ord ( $ data [ $ pos + 1 ] ) << 8 ) | ( ord ( $ data [ $ pos + ... | Read 4 bytes of data at specified position |
40,369 | private function get_lines ( ) { $ data = "" ; while ( $ str = @ fgets ( $ this -> smtp_conn , 515 ) ) { if ( $ this -> do_debug >= 4 ) { echo "SMTP -> get_lines(): \$data was \"$data\"" . $ this -> CRLF . '<br />' ; echo "SMTP -> get_lines(): \$str is \"$str\"" . $ this -> CRLF . '<br />' ; } $ data .= $ str ; if ( $ ... | Read in as many lines as possible either before eof or socket timeout occurs on the operation . With SMTP we can tell if we have more lines to read if the 4th character is - symbol . If it is a space then we don t need to read anything else . |
40,370 | private function _readStyle ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; if ( ! $ this -> _readDataOnly ) { $ ixfe = self :: _GetInt2d ( $ recordData , 0 ) ; $ xfIndex = ( 0x0FFF... | Read STYLE record |
40,371 | private function _readPalette ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; if ( ! $ this -> _readDataOnly ) { $ nm = self :: _GetInt2d ( $ recordData , 0 ) ; for ( $ i = 0 ; $ i ... | Read PALETTE record |
40,372 | private function _readMsoDrawingGroup ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ splicedRecordData = $ this -> _getSplicedRecordData ( ) ; $ recordData = $ splicedRecordData [ 'recordData' ] ; $ this -> _drawingGroupData .= $ recordData ; } | Read MSODRAWINGGROUP record |
40,373 | private function _readPrintGridlines ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; if ( $ this -> _version == self :: XLS_BIFF8 && ! $ this -> _readDataOnly ) { $ printGridlines =... | Read PRINTGRIDLINES record |
40,374 | private function _readFooter ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; if ( ! $ this -> _readDataOnly ) { if ( $ recordData ) { if ( $ this -> _version == self :: XLS_BIFF8 ) ... | Read FOOTER record |
40,375 | private function _readVcenter ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; if ( ! $ this -> _readDataOnly ) { $ isVerticalCentered = ( bool ) self :: _GetInt2d ( $ recordData , 0... | Read VCENTER record |
40,376 | private function _readNumber ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; $ row = self :: _GetInt2d ( $ recordData , 0 ) ; $ column = self :: _GetInt2d ( $ recordData , 2 ) ; $ c... | Read NUMBER record This record represents a cell that contains a floating - point value . |
40,377 | private function _readLabel ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 4 , $ length ) ; $ this -> _pos += 4 + $ length ; $ row = self :: _GetInt2d ( $ recordData , 0 ) ; $ column = self :: _GetInt2d ( $ recordData , 2 ) ; $ co... | Read LABEL record This record represents a cell that contains a string . In BIFF8 it is usually replaced by the LABELSST record . Excel still uses this record if it copies unformatted text cells to the clipboard . |
40,378 | private function _readMsoDrawing ( ) { $ length = self :: _GetInt2d ( $ this -> _data , $ this -> _pos + 2 ) ; $ splicedRecordData = $ this -> _getSplicedRecordData ( ) ; $ recordData = $ splicedRecordData [ 'recordData' ] ; $ this -> _drawingData .= $ recordData ; } | Read MSODRAWING record |
40,379 | private function _readBIFF8CellRangeAddressB ( $ subData , $ baseCell = 'A1' ) { list ( $ baseCol , $ baseRow ) = PHPExcel_Cell :: coordinateFromString ( $ baseCell ) ; $ baseCol = PHPExcel_Cell :: columnIndexFromString ( $ baseCol ) - 1 ; $ frIndex = self :: _GetInt2d ( $ subData , 0 ) ; $ lrIndex = self :: _GetInt2d ... | Reads a cell range address in BIFF8 for shared formulas . Uses positive and negative values for row and column to indicate offsets from a base cell section 3 . 3 . 4 |
40,380 | private function _GetLangPath ( ) { $ lang_path = "" ; $ paths = explode ( PATH_SEPARATOR , get_include_path ( ) ) ; foreach ( $ paths as $ path ) { if ( file_exists ( $ path . '/language/phpmailer.lang-en.php' ) ) { $ lang_path = $ path . '/language/' ; } } return $ lang_path ; } | This function attempts to locate the language file path for PHPMailer because it s a whiney - ass bitch about finding it s language file during unit testing |
40,381 | function QuickSend ( $ to , $ from , $ subject , $ body , $ format = MESSAGE_FORMAT_TEXT ) { $ message = new EmailMessage ( ) ; $ message -> SetFrom ( $ from ) ; $ message -> AddRecipient ( $ to ) ; $ message -> Subject = $ subject ; $ message -> Body = $ body ; $ message -> Format = $ format ; return $ this -> Send ( ... | Utility method to send a simple text email message |
40,382 | public function createStringTable ( $ pSheet = null , $ pExistingTable = null ) { if ( $ pSheet !== NULL ) { $ aStringTable = array ( ) ; $ cellCollection = null ; $ aFlippedStringTable = null ; if ( ( $ pExistingTable !== NULL ) && is_array ( $ pExistingTable ) ) { $ aStringTable = $ pExistingTable ; } $ aFlippedStrin... | Create worksheet stringtable |
40,383 | public function writeStringTable ( $ pStringTable = null ) { if ( $ pStringTable !== NULL ) { $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK , $ this -> getParentWriter ( ) -> getDiskCachingDire... | Write string table to XML format |
40,384 | public function disconnectWorksheets ( ) { $ worksheet = NULL ; foreach ( $ this -> _workSheetCollection as $ k => & $ worksheet ) { $ worksheet -> disconnectCells ( ) ; $ this -> _workSheetCollection [ $ k ] = null ; } unset ( $ worksheet ) ; $ this -> _workSheetCollection = array ( ) ; } | Disconnect all worksheets from this PHPExcel workbook object typically so that the PHPExcel object can be unset |
40,385 | public function removeSheetByIndex ( $ pIndex = 0 ) { $ numSheets = count ( $ this -> _workSheetCollection ) ; if ( $ pIndex > $ numSheets - 1 ) { throw new PHPExcel_Exception ( "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ) ; } else { array_splice ( ... | Remove sheet by index |
40,386 | public function getSheetByName ( $ pName = '' ) { $ worksheetCount = count ( $ this -> _workSheetCollection ) ; for ( $ i = 0 ; $ i < $ worksheetCount ; ++ $ i ) { if ( $ this -> _workSheetCollection [ $ i ] -> getTitle ( ) === $ pName ) { return $ this -> _workSheetCollection [ $ i ] ; } } return NULL ; } | Get sheet by name |
40,387 | public function removeNamedRange ( $ namedRange , PHPExcel_Worksheet $ pSheet = null ) { if ( $ pSheet === NULL ) { if ( isset ( $ this -> _namedRanges [ $ namedRange ] ) ) { unset ( $ this -> _namedRanges [ $ namedRange ] ) ; } } else { if ( isset ( $ this -> _namedRanges [ $ pSheet -> getTitle ( ) . '!' . $ namedRang... | Remove named range |
40,388 | public function removeCellXfByIndex ( $ pIndex = 0 ) { if ( $ pIndex > count ( $ this -> _cellXfCollection ) - 1 ) { throw new PHPExcel_Exception ( "CellXf index is out of bounds." ) ; } else { array_splice ( $ this -> _cellXfCollection , $ pIndex , 1 ) ; foreach ( $ this -> _workSheetCollection as $ worksheet ) { fore... | Remove cellXf by index . It is ensured that all cells get their xf index updated . |
40,389 | public function garbageCollect ( ) { $ countReferencesCellXf = array ( ) ; foreach ( $ this -> _cellXfCollection as $ index => $ cellXf ) { $ countReferencesCellXf [ $ index ] = 0 ; } foreach ( $ this -> getWorksheetIterator ( ) as $ sheet ) { foreach ( $ sheet -> getCellCollection ( false ) as $ cellID ) { $ cell = $ ... | Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells and columns in the workbook |
40,390 | public static function factory ( $ driver ) { if ( isset ( static :: $ registrar [ $ driver ] ) ) { $ resolver = static :: $ registrar [ $ driver ] ; return $ resolver ( ) ; } switch ( $ driver ) { case 'apc' : return new Session \ Drivers \ APC ( Cache :: driver ( 'apc' ) ) ; case 'cookie' : return new Session \ Drive... | Create a new session driver instance . |
40,391 | public static function IncludeException ( $ code , $ string , $ file , $ line , $ context ) { if ( error_reporting ( ) == 0 ) return ; $ tmp1 = explode ( ")" , $ string ) ; $ tmp2 = explode ( "(" , $ tmp1 [ 0 ] ) ; $ mfile = isset ( $ tmp2 [ 1 ] ) ? $ tmp2 [ 1 ] : "" ; $ msg = "Error $code: " . ( $ mfile ? "Unable to i... | Handler for catching file - not - found errors and throwing an IncludeException |
40,392 | function Open ( $ user , $ pass , $ host , $ port = "110" , $ mbtype = "pop3" , $ mbfolder = "INBOX" , $ options = null , $ retries = 1 ) { $ this -> mbox = imap_open ( "{" . $ host . ":" . $ port . "/" . $ mbtype . "/notls}" . $ mbfolder . "" , $ user , $ pass , $ options , $ retries ) ; } | Opens a connection to the mail server |
40,393 | function Close ( $ empty_trash = true ) { if ( $ this -> do_delete && $ empty_trash ) { imap_expunge ( $ this -> mbox ) ; } imap_close ( $ this -> mbox ) ; } | Close the connection to the mail server |
40,394 | function GetAttachments ( $ msgno , $ include_raw_data = true ) { $ struct = imap_fetchstructure ( $ this -> mbox , $ msgno ) ; $ contentParts = count ( $ struct -> parts ) ; $ attachments = array ( ) ; if ( $ contentParts >= 2 ) { for ( $ i = 2 ; $ i <= $ contentParts ; $ i ++ ) { $ att [ $ i - 2 ] = imap_bodystruct (... | Returns an array containing all files attached to message |
40,395 | function GetAttachmentRawData ( $ msgno , $ partnum , $ encoding_id = 0 ) { $ content = imap_fetchbody ( $ this -> mbox , $ msgno , $ partnum ) ; if ( $ encoding_id == 3 ) { return imap_base64 ( $ content ) ; } elseif ( $ encoding_id == 4 ) { return imap_qprint ( $ content ) ; } return $ content ; } | Returns the raw data for an attachment . The raw data is the actual file contents of an attachment . |
40,396 | function GetMessageBody ( $ msgnum , $ prefer_html = true ) { if ( $ prefer_html ) { $ body = $ this -> GetPart ( $ msgnum , "TEXT/HTML" ) ; $ body = $ body ? $ body : $ this -> GetPart ( $ msgnum , "TEXT/PLAIN" ) ; } else { $ body = $ this -> GetPart ( $ msgnum , "TEXT/PLAIN" ) ; $ body = $ body ? $ body : $ this -> G... | Returns what is best determined to be the body text of the messages |
40,397 | function GetPart ( $ msg_number , $ mime_type , $ structure = false , $ part_number = false ) { $ stream = $ this -> mbox ; $ prefix = "" ; $ structure = $ structure ? $ structure : imap_fetchstructure ( $ stream , $ msg_number ) ; if ( $ structure ) { if ( $ mime_type == $ this -> GetMimeType ( $ structure ) ) { $ par... | Returns a single part of a message |
40,398 | public function setPosition ( $ position = self :: POSITION_RIGHT ) { if ( ! in_array ( $ position , self :: $ _positionXLref ) ) { return false ; } $ this -> _position = $ position ; return true ; } | Get legend position using an excel string value |
40,399 | static function IsValidCreditCard ( $ cc_num , $ type = "" ) { if ( $ type == "American" ) { $ denum = "American Express" ; } elseif ( $ type == "Dinners" ) { $ denum = "Diner's Club" ; } elseif ( $ type == "Discover" ) { $ denum = "Discover" ; } elseif ( $ type == "Master" ) { $ denum = "Master Card" ; } elseif ( $ ty... | Returns true if the provided credit card appears to be valid . If type is provided then the validation makes sure it is valid for that specific type otherwise it just makes sure it is valid for any type |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.