idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
40,100
public function setOperator ( $ pOperator = self :: AUTOFILTER_COLUMN_RULE_EQUAL ) { if ( empty ( $ pOperator ) ) $ pOperator = self :: AUTOFILTER_COLUMN_RULE_EQUAL ; if ( ( ! in_array ( $ pOperator , self :: $ _operators ) ) && ( ! in_array ( $ pOperator , self :: $ _topTenValue ) ) ) { throw new PHPExcel_Exception ( ...
Set AutoFilter Rule Operator
40,101
public function setGrouping ( $ pGrouping = NULL ) { if ( ( $ pGrouping !== NULL ) && ( ! in_array ( $ pGrouping , self :: $ _dateTimeGroups ) ) && ( ! in_array ( $ pGrouping , self :: $ _dynamicTypes ) ) && ( ! in_array ( $ pGrouping , self :: $ _topTenType ) ) ) { throw new PHPExcel_Exception ( 'Invalid rule type for...
Set AutoFilter Rule Grouping
40,102
public function setRule ( $ pOperator = self :: AUTOFILTER_COLUMN_RULE_EQUAL , $ pValue = '' , $ pGrouping = NULL ) { $ this -> setOperator ( $ pOperator ) ; $ this -> setValue ( $ pValue ) ; if ( $ pGrouping !== NULL ) $ this -> setGrouping ( $ pGrouping ) ; return $ this ; }
Set AutoFilter Rule
40,103
public function SelectAdapter ( $ key = null ) { if ( $ key ) { $ this -> Observe ( "Selecting DataAdapter with key '$key'" , OBSERVE_DEBUG ) ; if ( ! array_key_exists ( $ key , $ this -> DataAdapters ) ) throw new Exception ( "No DataAdapter with key '$key' is available" ) ; $ this -> DataAdapter = $ this -> DataAdapt...
SelectAdapter will change the DataAdapter allowing the application to query from multiple data sources . The connection strings for each database should be passed in an array during construction of the Phreezer object .
40,104
public function SetLevel2CacheProvider ( ICache $ cache , $ lockFilePath = "" ) { $ this -> _level2Cache = $ cache ; $ this -> LockFilePath = $ lockFilePath ; }
Sets a cache provider for the level 1 cache
40,105
public function SetValueCache ( $ key , $ val , $ timeout = null ) { if ( is_null ( $ timeout ) ) $ timeout = $ this -> ValueCacheTimeout ; if ( $ timeout <= 0 ) return false ; if ( strlen ( $ key ) > 250 ) $ key = substr ( $ key , 0 , 150 ) . md5 ( $ key ) ; $ this -> _level1Cache -> Set ( md5 ( $ key ) , $ val , 0 , ...
ValueCache is a utility method allowing any object or value to be stored in the cache . The timout is specified by ValueCacheTimeout . This
40,106
public function GetValueCache ( $ key ) { if ( $ this -> ValueCacheTimeout <= 0 ) return null ; if ( strlen ( $ key ) > 250 ) $ key = substr ( $ key , 0 , 150 ) . md5 ( $ key ) ; $ obj = $ this -> _level1Cache -> Get ( md5 ( $ key ) ) ; return $ obj ? $ obj : $ this -> _level2Cache -> Get ( $ key ) ; }
Retreives an object or value that was persisted using SetValueCache
40,107
public function DeleteCache ( $ objectclass , $ id ) { $ this -> _level1Cache -> Delete ( $ objectclass . "_" . $ id ) ; $ this -> _level2Cache -> Delete ( $ objectclass . "_" . $ id ) ; $ this -> Observe ( "Deleted TYPE='$objectclass' ID='$id' from Cache" , OBSERVE_DEBUG ) ; }
Deletes a value from the cache
40,108
public function SetCache ( $ objectclass , $ id , Phreezable $ val , $ includeCacheLevel2 = true , $ timeout = null ) { if ( is_null ( $ timeout ) ) $ timeout = $ this -> ObjectCacheTimeout ; if ( $ val -> NoCache ( ) || $ timeout <= 0 ) return false ; $ obj = $ this -> _level1Cache -> Get ( $ objectclass . "_" . $ id ...
Sets value in the cache
40,109
public function GetCache ( $ objectclass , $ id ) { if ( $ this -> ObjectCacheTimeout <= 0 ) return null ; $ cachekey = $ objectclass . "_" . $ id ; $ this -> IncludeModel ( $ objectclass ) ; $ obj = $ this -> _level1Cache -> Get ( $ cachekey ) ; if ( $ obj ) { $ this -> Observe ( "Retrieved TYPE='$objectclass' ID='$id...
Retrieves a value from the cache
40,110
public function AttachObserver ( $ observer ) { parent :: AttachObserver ( $ observer ) ; foreach ( $ this -> DataAdapters as $ adapter ) { $ adapter -> AttachObserver ( $ observer ) ; } }
Override of the base AttachObserver so that when an observer is attached it will also be attached to all child objects . Note that some initialization messages won t be observed unless you provide it in the Phreezer constructor
40,111
public function GetByCriteria ( $ objectclass , $ criteria , $ crash_if_multiple_found = true , $ cache_timeout = null ) { if ( is_null ( $ cache_timeout ) ) $ cache_timeout = $ this -> ValueCacheTimeout ; if ( strlen ( $ objectclass ) < 1 ) { throw new Exception ( "\$objectclass argument is required" ) ; } $ obj = nul...
Get one instance of an object based on criteria . If multiple records are found only the first is returned . If no matches are found an exception is thrown
40,112
public function Query ( $ objectclass , $ criteria = null , $ cache_timeout = null ) { if ( is_null ( $ cache_timeout ) ) $ cache_timeout = $ this -> ValueCacheTimeout ; if ( strlen ( $ objectclass ) < 1 ) { throw new Exception ( "\$objectclass argument is required" ) ; } if ( is_null ( $ criteria ) ) { $ criteria = ne...
Query for a specific type of object
40,113
public function Get ( $ objectclass , $ id , $ cache_timeout = null ) { if ( is_null ( $ cache_timeout ) ) $ cache_timeout = $ this -> ObjectCacheTimeout ; if ( strlen ( $ objectclass ) < 1 ) { throw new Exception ( "\$objectclass argument is required" ) ; } if ( strlen ( $ id ) < 1 ) { throw new Exception ( "\$id argu...
Get one instance of an object based on it s primary key value
40,114
public function Delete ( $ obj ) { $ objectclass = get_class ( $ obj ) ; if ( ! $ obj -> OnBeforeDelete ( ) ) { $ this -> Observe ( "Delete was cancelled because OnBeforeDelete did not return true" ) ; return 0 ; } $ fms = $ this -> GetFieldMaps ( $ objectclass ) ; $ pk = $ obj -> GetPrimaryKeyName ( ) ; $ id = $ obj -...
Delete the given object from the data store
40,115
public function DeleteAll ( $ obj ) { $ fms = $ this -> GetFieldMaps ( get_class ( $ obj ) ) ; $ pk = $ obj -> GetPrimaryKeyName ( ) ; $ table = $ fms [ $ pk ] -> TableName ; $ sql = "delete from `$table`" ; $ returnval = $ this -> DataAdapter -> Execute ( $ sql ) ; $ obj -> OnDelete ( ) ; return $ returnval ; }
Delete all objects from the datastore used by the given object
40,116
public function GetFieldMaps ( $ objectclass ) { $ fms = $ this -> _mapCache -> Get ( $ objectclass . "FieldMaps" ) ; if ( $ fms ) return $ fms ; $ this -> IncludeModel ( $ objectclass ) ; if ( ! class_exists ( $ objectclass . "Map" ) ) throw new Exception ( $ objectclass . " must either implement GetCustomQuery or '" ...
Returns all FieldMaps for the given object class
40,117
public function GetCustomQuery ( $ objectclass , $ criteria ) { $ this -> IncludeModel ( $ objectclass ) ; $ sql = call_user_func ( array ( $ objectclass , "GetCustomQuery" ) , $ criteria ) ; return $ sql ; }
Returns the custom query for the given object class if it is defined
40,118
public function GetCustomCountQuery ( $ objectclass , $ criteria ) { $ this -> IncludeModel ( $ objectclass ) ; $ sql = call_user_func ( array ( $ objectclass , "GetCustomCountQuery" ) , $ criteria ) ; return $ sql ; }
Returns the custom counter query for the given object class if it is defined
40,119
public function GetKeyMaps ( $ objectclass ) { $ kms = $ this -> _mapCache -> Get ( $ objectclass . "KeyMaps" ) ; if ( $ kms ) return $ kms ; $ this -> IncludeModel ( $ objectclass ) ; if ( ! class_exists ( $ objectclass . "Map" ) ) throw new Exception ( "Class '" . $ objectclass . "Map' is not defined." ) ; $ kms = ca...
Returns all KeyMaps for the given object class
40,120
public function GetColumnName ( $ objectclass , $ propertyname ) { $ fm = $ this -> GetFieldMap ( $ objectclass , $ propertyname ) ; return $ fm -> ColumnName ; }
Returns the name of the DB column associted with the given property
40,121
public function GetTableName ( $ objectclass , $ propertyname ) { $ fm = $ this -> GetFieldMap ( $ objectclass , $ propertyname ) ; return $ fm -> TableName ; }
Returns the name of the DB Table associted with the given property
40,122
public function GetPrimaryKeyMap ( $ objectclass ) { $ fms = $ this -> GetFieldMaps ( $ objectclass ) ; foreach ( $ fms as $ fm ) { if ( $ fm -> IsPrimaryKey ) { return $ fm ; } } }
Return the KeyMap for the primary key for the given object class
40,123
public function GetOneToMany ( $ parent , $ keyname , $ criteria ) { $ km = $ this -> GetKeyMap ( get_class ( $ parent ) , $ keyname ) ; $ parent_prop = $ km -> KeyProperty ; $ key_value = $ parent -> $ parent_prop ; if ( ! $ criteria ) { $ foreign_table = $ this -> GetTableName ( $ km -> ForeignObject , $ km -> Foreig...
Query for a child objects in a one - to - many relationship
40,124
public function GetManyToOne ( $ parent , $ keyname ) { $ km = $ this -> GetKeyMap ( get_class ( $ parent ) , $ keyname ) ; $ objectclass = $ km -> ForeignObject ; $ parent_prop = $ km -> KeyProperty ; $ key_value = $ parent -> $ parent_prop ; $ obj = $ this -> Get ( $ km -> ForeignObject , $ key_value ) ; return $ obj...
Query for a parent object in a many - to - one relationship
40,125
public function SetLoadType ( $ objectclass , $ keyname , $ load_type = KM_LOAD_EAGER ) { $ this -> GetKeyMap ( $ objectclass , $ keyname ) -> LoadType = $ load_type ; }
Dynamically override the LoadType for a KeyMap . This is useful for eager fetching for a particular query . One set this configuration will be used until the end of the page context or it is changed .
40,126
public function isFile ( $ index ) { if ( isset ( $ this -> _list [ $ index ] ) ) { return ( $ this -> _list [ $ index ] -> Type == self :: OLE_PPS_TYPE_FILE ) ; } return false ; }
Checks whether a PPS is a File PPS or not . If there is no PPS for the index given it will return false .
40,127
public function isRoot ( $ index ) { if ( isset ( $ this -> _list [ $ index ] ) ) { return ( $ this -> _list [ $ index ] -> Type == self :: OLE_PPS_TYPE_ROOT ) ; } return false ; }
Checks whether a PPS is a Root PPS or not . If there is no PPS for the index given it will return false .
40,128
public function getData ( $ index , $ position , $ length ) { if ( ! isset ( $ this -> _list [ $ index ] ) || ( $ position >= $ this -> _list [ $ index ] -> Size ) || ( $ position < 0 ) ) { return '' ; } $ fh = $ this -> getStream ( $ this -> _list [ $ index ] ) ; $ data = stream_get_contents ( $ fh , $ length , $ posi...
Gets data from a PPS If there is no PPS for the index given it will return an empty string .
40,129
public function getDataLength ( $ index ) { if ( isset ( $ this -> _list [ $ index ] ) ) { return $ this -> _list [ $ index ] -> Size ; } return 0 ; }
Gets the data length from a PPS If there is no PPS for the index given it will return 0 .
40,130
public static function Asc2Ucs ( $ ascii ) { $ rawname = '' ; for ( $ i = 0 ; $ i < strlen ( $ ascii ) ; ++ $ i ) { $ rawname .= $ ascii { $ i } . "\x00" ; } return $ rawname ; }
Utility function to transform ASCII text to Unicode
40,131
public static function LocalDate2OLE ( $ date = null ) { if ( ! isset ( $ date ) ) { return "\x00\x00\x00\x00\x00\x00\x00\x00" ; } $ factor = pow ( 2 , 32 ) ; $ days = 134774 ; $ big_date = $ days * 24 * 3600 + gmmktime ( date ( "H" , $ date ) , date ( "i" , $ date ) , date ( "s" , $ date ) , date ( "m" , $ date ) , da...
Utility function Returns a string for the OLE container with the date given
40,132
public static function OLE2LocalDate ( $ string ) { if ( strlen ( $ string ) != 8 ) { return new PEAR_Error ( "Expecting 8 byte string" ) ; } $ factor = pow ( 2 , 32 ) ; list ( , $ high_part ) = unpack ( 'V' , substr ( $ string , 4 , 4 ) ) ; list ( , $ low_part ) = unpack ( 'V' , substr ( $ string , 0 , 4 ) ) ; $ big_d...
Returns a timestamp from an OLE container s date
40,133
public function AddFieldMap ( $ fm ) { $ tablealias = $ fm -> TableName ; if ( ! array_key_exists ( $ tablealias , $ this -> Tables ) ) $ this -> Tables [ $ tablealias ] = $ fm -> TableName ; $ this -> Columns [ $ tablealias . "-" . $ fm -> ColumnName ] = $ fm -> FieldType == FM_CALCULATION ? $ fm -> ColumnName : "`" ....
Adds a field map to the queue which will be used later when the SQL is generated
40,134
public function RecurseFieldMaps ( $ typename , $ fms ) { if ( isset ( $ this -> _keymapcache [ $ typename ] ) ) { throw new Exception ( "A circular EAGER join was detected while parsing `$typename`. This is possibly due to an EAGER join with `" . $ this -> _prevkeymap . "` Please edit your Map so that at least one s...
Each Model that is to be included in this query is recursed where all fields are added to the queue and then looks for eager joins to recurse through
40,135
private function GetTableJoinSQL ( $ criteria ) { $ sql = "" ; $ tablenames = array_keys ( $ this -> Tables ) ; if ( count ( $ tablenames ) > 1 ) { $ sql .= " from `" . $ tablenames [ 0 ] . "`" ; for ( $ i = 1 ; $ i < count ( $ tablenames ) ; $ i ++ ) { try { $ sql .= $ this -> Joins [ $ tablenames [ $ i ] ] ; } catch ...
Determines what tables need to be included in the query based on the mapping
40,136
private function RemoveWherePrefix ( $ sql ) { $ sql = trim ( $ sql ) ; while ( substr ( $ sql , 0 , 1 ) == "(" && substr ( $ sql , 0 , - 1 ) == ")" ) { $ sql = trim ( substr ( $ sql , 1 , - 1 ) ) ; } while ( strtolower ( substr ( $ sql , 0 , 5 ) ) == "where" ) { $ sql = trim ( substr ( $ sql , 5 ) ) ; } return $ sql ;...
Removes the where from the beginning of a statement
40,137
private function GetWhereSQL ( $ criteria ) { $ ands = $ criteria -> GetAnds ( ) ; $ ors = $ criteria -> GetOrs ( ) ; $ where = $ this -> RemoveWherePrefix ( $ criteria -> GetWhere ( ) ) ; if ( count ( $ ands ) ) { $ wdelim = ( $ where ) ? " and " : "" ; foreach ( $ ands as $ c ) { $ tmp = $ c -> GetWhere ( ) ; $ buff ...
Returns the where part of the query based on the criteria parameters
40,138
public function GetSQL ( $ criteria ) { $ sql = "select " . $ this -> GetColumnNames ( ) . "" ; $ sql .= $ this -> GetTableJoinSQL ( $ criteria ) ; $ sql .= $ criteria -> GetJoin ( ) ; $ sql .= $ this -> GetWhereSQL ( $ criteria ) ; $ sql .= $ criteria -> GetOrder ( ) ; $ criteria -> Reset ( ) ; return $ sql ; }
Builds a SQL statement from the given criteria object and resets the Criteria
40,139
public function GetCountSQL ( $ criteria ) { $ sql = "select count(1) as counter " ; $ sql .= $ this -> GetTableJoinSQL ( $ criteria ) ; $ sql .= $ criteria -> GetJoin ( ) ; $ sql .= $ this -> GetWhereSQL ( $ criteria ) ; $ criteria -> Reset ( ) ; return $ sql ; }
Builds a SQL statement from the given criteria object to count the results and resets the Criteria
40,140
private function Load ( ) { $ sql = "show tables" ; $ rs = $ this -> Server -> Connection -> Select ( $ sql ) ; while ( $ row = $ this -> Server -> Connection -> Next ( $ rs ) ) { $ this -> Tables [ $ row [ "Tables_in_" . $ this -> Name ] ] = new DBTable ( $ this , $ row ) ; } foreach ( $ this -> Tables as $ table ) { ...
Inspects the current schema and loads all tables keys etc .
40,141
private static function _cleanComplex ( $ complexNumber ) { if ( $ complexNumber { 0 } == '+' ) $ complexNumber = substr ( $ complexNumber , 1 ) ; if ( $ complexNumber { 0 } == '0' ) $ complexNumber = substr ( $ complexNumber , 1 ) ; if ( $ complexNumber { 0 } == '.' ) $ complexNumber = '0' . $ complexNumber ; if ( $ c...
Cleans the leading characters in a complex number string
40,142
public static function getConversionGroups ( ) { $ conversionGroups = array ( ) ; foreach ( self :: $ _conversionUnits as $ conversionUnit ) { $ conversionGroups [ ] = $ conversionUnit [ 'Group' ] ; } return array_merge ( array_unique ( $ conversionGroups ) ) ; }
getConversionGroups Returns a list of the different conversion groups for UOM conversions
40,143
public static function getConversionGroupUnits ( $ group = NULL ) { $ conversionGroups = array ( ) ; foreach ( self :: $ _conversionUnits as $ conversionUnit => $ conversionGroup ) { if ( ( is_null ( $ group ) ) || ( $ conversionGroup [ 'Group' ] == $ group ) ) { $ conversionGroups [ $ conversionGroup [ 'Group' ] ] [ ]...
getConversionGroupUnits Returns an array of units of measure for a specified conversion group or for all groups
40,144
public static function typeToEnglish ( $ type ) { switch ( $ type ) { case self :: EOF_TYPE : return 'end of template' ; case self :: TEXT_TYPE : return 'text' ; case self :: BLOCK_START_TYPE : return 'begin of statement block' ; case self :: VAR_START_TYPE : return 'begin of print statement' ; case self :: BLOCK_END_T...
Returns the english representation of a given type .
40,145
public function compile ( Twig_NodeInterface $ node , $ indentation = 0 ) { $ this -> lastLine = null ; $ this -> source = '' ; $ this -> sourceOffset = 0 ; $ this -> sourceLine = 1 ; $ this -> indentation = $ indentation ; if ( $ node instanceof Twig_Node_Module ) { $ this -> filename = $ node -> getAttribute ( 'filen...
Compiles a node .
40,146
public function write ( ) { $ strings = func_get_args ( ) ; foreach ( $ strings as $ string ) { $ this -> addIndentation ( ) ; $ this -> source .= $ string ; } return $ this ; }
Writes a string to the compiled code by adding indentation .
40,147
public function addDebugInfo ( Twig_NodeInterface $ node ) { if ( $ node -> getLine ( ) != $ this -> lastLine ) { $ this -> write ( sprintf ( "// line %d\n" , $ node -> getLine ( ) ) ) ; if ( ( ( int ) ini_get ( 'mbstring.func_overload' ) ) & 2 ) { $ this -> sourceLine += mb_substr_count ( mb_substr ( $ this -> source ...
Adds debugging information .
40,148
public function listServerTokens ( $ user_id ) { $ sql = "BEGIN SP_LIST_SERVER_TOKENS(:P_USER_ID, :P_ROWS, :P_RESULT); END;" ; $ stmt = oci_parse ( $ this -> conn , $ sql ) or die ( 'Can not parse query' ) ; oci_bind_by_name ( $ stmt , ':P_USER_ID' , $ user_id , 40 ) ; oci_bind_by_name ( $ stmt , ':P_RESULT' , $ result...
Get a list of all server token this user has access to .
40,149
public function countServerTokens ( $ consumer_key ) { $ count = 0 ; $ sql = "BEGIN SP_COUNT_SERVICE_TOKENS(:P_CONSUMER_KEY, :P_COUNT, :P_RESULT); END;" ; $ stmt = oci_parse ( $ this -> conn , $ sql ) or die ( 'Can not parse query' ) ; oci_bind_by_name ( $ stmt , ':P_CONSUMER_KEY' , $ consumer_key , 255 ) ; oci_bind_by...
Count how many tokens we have for the given server
40,150
public function getConsumerRequestToken ( $ token ) { $ sql = "BEGIN SP_GET_CONSUMER_REQUEST_TOKEN(:P_TOKEN, :P_ROWS, :P_RESULT); END;" ; $ stmt = oci_parse ( $ this -> conn , $ sql ) or die ( 'Can not parse query' ) ; oci_bind_by_name ( $ stmt , ':P_TOKEN' , $ token , 255 ) ; oci_bind_by_name ( $ stmt , ':P_RESULT' , ...
Fetch the consumer request token by request token .
40,151
public function deleteConsumerRequestToken ( $ token ) { $ sql = "BEGIN SP_DEL_CONSUMER_REQUEST_TOKEN(:P_TOKEN, :P_RESULT); END;" ; $ stmt = oci_parse ( $ this -> conn , $ sql ) or die ( 'Can not parse query' ) ; oci_bind_by_name ( $ stmt , ':P_TOKEN' , $ token , 255 ) ; oci_bind_by_name ( $ stmt , ':P_RESULT' , $ resu...
Delete a consumer token . The token must be a request or authorized token .
40,152
public function requestToken ( ) { OAuthRequestLogger :: start ( $ this ) ; try { $ this -> verify ( false ) ; $ options = array ( ) ; $ ttl = $ this -> getParam ( 'xoauth_token_ttl' , false ) ; if ( $ ttl ) { $ options [ 'token_ttl' ] = $ ttl ; } $ cbUrl = $ this -> getParam ( 'oauth_callback' , true ) ; if ( $ cbUrl ...
Handle the request_token request . Returns the new request token and request token secret .
40,153
public function authorizeFinish ( $ authorized , $ user_id ) { OAuthRequestLogger :: start ( $ this ) ; $ token = $ this -> getParam ( 'oauth_token' , true ) ; $ verifier = null ; if ( $ this -> session -> get ( 'verify_oauth_token' ) == $ token ) { $ store = OAuthStore :: instance ( ) ; $ referrer_host = '' ; $ oauth_...
Overrule this method when you want to display a nice page when the authorization is finished . This function does not know if the authorization was succesfull you need to check the token in the database .
40,154
public function accessToken ( ) { OAuthRequestLogger :: start ( $ this ) ; try { $ this -> verify ( 'request' ) ; $ options = array ( ) ; $ ttl = $ this -> getParam ( 'xoauth_token_ttl' , false ) ; if ( $ ttl ) { $ options [ 'token_ttl' ] = $ ttl ; } $ verifier = $ this -> getParam ( 'oauth_verifier' , false ) ; if ( $...
Exchange a request token for an access token . The exchange is only succesful iff the request token has been authorized .
40,155
private function _readBSE ( ) { $ recInstance = ( 0xFFF0 & PHPExcel_Reader_Excel5 :: _GetInt2d ( $ this -> _data , $ this -> _pos ) ) >> 4 ; $ length = PHPExcel_Reader_Excel5 :: _GetInt4d ( $ this -> _data , $ this -> _pos + 4 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 8 , $ length ) ; $ this -> _po...
Read BSE record
40,156
private function _readTertiaryOPT ( ) { $ recInstance = ( 0xFFF0 & PHPExcel_Reader_Excel5 :: _GetInt2d ( $ this -> _data , $ this -> _pos ) ) >> 4 ; $ length = PHPExcel_Reader_Excel5 :: _GetInt4d ( $ this -> _data , $ this -> _pos + 4 ) ; $ recordData = substr ( $ this -> _data , $ this -> _pos + 8 , $ length ) ; $ thi...
Read TertiaryOPT record
40,157
public function setLogger ( ApnsPHP_Log_Interface $ logger ) { if ( ! is_object ( $ logger ) ) { throw new ApnsPHP_Exception ( "The logger should be an instance of 'ApnsPHP_Log_Interface'" ) ; } if ( ! ( $ logger instanceof ApnsPHP_Log_Interface ) ) { throw new ApnsPHP_Exception ( "Unable to use an instance of '" . get...
Set the Logger instance to use for logging purpose .
40,158
public function disconnect ( ) { if ( is_resource ( $ this -> _hSocket ) ) { $ this -> _log ( 'INFO: Disconnected.' ) ; return fclose ( $ this -> _hSocket ) ; } return false ; }
Disconnects from Apple Push Notifications service server .
40,159
protected function _log ( $ sMessage ) { if ( ! isset ( $ this -> _logger ) ) { $ this -> _logger = new ApnsPHP_Log_Embedded ( ) ; } $ this -> _logger -> log ( $ sMessage ) ; }
Logs a message through the Logger .
40,160
function _calcSize ( & $ raList ) { list ( $ iSBDcnt , $ iBBcnt , $ iPPScnt ) = array ( 0 , 0 , 0 ) ; $ iSmallLen = 0 ; $ iSBcnt = 0 ; for ( $ i = 0 ; $ i < count ( $ raList ) ; $ i ++ ) { if ( $ raList [ $ i ] -> Type == OLE_PPS_TYPE_FILE ) { $ raList [ $ i ] -> Size = $ raList [ $ i ] -> _DataLen ( ) ; if ( $ raList ...
Calculate some numbers
40,161
function _saveHeader ( $ iSBDcnt , $ iBBcnt , $ iPPScnt ) { $ FILE = $ this -> _FILEH_ ; $ iBlCnt = $ this -> _BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE ; $ i1stBdL = ( $ this -> _BIG_BLOCK_SIZE - 0x4C ) / OLE_LONG_INT_SIZE ; $ iBdExL = 0 ; $ iAll = $ iBBcnt + $ iPPScnt + $ iSBDcnt ; $ iAllW = $ iAll ; $ iBdCntW = floor ( $ i...
Save OLE header
40,162
function _savePps ( & $ raList ) { for ( $ i = 0 ; $ i < count ( $ raList ) ; $ i ++ ) { fwrite ( $ this -> _FILEH_ , $ raList [ $ i ] -> _getPpsWk ( ) ) ; } $ iCnt = count ( $ raList ) ; $ iBCnt = $ this -> _BIG_BLOCK_SIZE / OLE_PPS_SIZE ; if ( $ iCnt % $ iBCnt ) { for ( $ i = 0 ; $ i < ( ( $ iBCnt - ( $ iCnt % $ iBCn...
Saves all the PPS s WKs
40,163
public function ToXML ( $ base64 = true ) { return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n" . "<file>\r\n" . "<name>" . $ this -> Name . "</name>\r\n" . "<size>" . $ this -> Size . "</size>\r\n" . "<type>" . $ this -> Type . "</type>\r\n" . "<Extension>" . $ this -> Extension . "</Extension>\r\n" . "<encod...
Returns a file upload as xml that is ready to save to a file or database
40,164
public function SaveTo ( $ path , $ alternate_name = "" , $ chmod = true ) { $ name = $ alternate_name ? $ alternate_name : $ this -> Name ; $ fullpath = $ path . $ name ; $ handle = fopen ( $ fullpath , "w" ) ; fwrite ( $ handle , $ this -> Data ) ; fclose ( $ handle ) ; if ( $ chmod ) @ chmod ( $ fullpath , 0666 ) ; ...
Saves the file upload to the given path
40,165
public function removeTokenParser ( Twig_TokenParserInterface $ parser ) { $ name = $ parser -> getTag ( ) ; if ( isset ( $ this -> parsers [ $ name ] ) && $ parser === $ this -> parsers [ $ name ] ) { unset ( $ this -> parsers [ $ name ] ) ; } }
Removes a TokenParser .
40,166
public function removeTokenParserBroker ( Twig_TokenParserBroker $ broker ) { if ( false !== $ pos = array_search ( $ broker , $ this -> brokers ) ) { unset ( $ this -> brokers [ $ pos ] ) ; } }
Removes a TokenParserBroker .
40,167
public function getTokenParser ( $ tag ) { if ( isset ( $ this -> parsers [ $ tag ] ) ) { return $ this -> parsers [ $ tag ] ; } $ broker = end ( $ this -> brokers ) ; while ( false !== $ broker ) { $ parser = $ broker -> getTokenParser ( $ tag ) ; if ( null !== $ parser ) { return $ parser ; } $ broker = prev ( $ this...
Gets a suitable TokenParser for a tag .
40,168
public function isTrustedPhpFunction ( $ function_name , $ compiler ) { if ( isset ( $ this -> php_functions ) && ( empty ( $ this -> php_functions ) || in_array ( $ function_name , $ this -> php_functions ) ) ) { return true ; } $ compiler -> trigger_template_error ( "PHP function '{$function_name}' not allowed by sec...
Check if PHP function is trusted .
40,169
public function isTrustedStaticClass ( $ class_name , $ compiler ) { if ( isset ( $ this -> static_classes ) && ( empty ( $ this -> static_classes ) || in_array ( $ class_name , $ this -> static_classes ) ) ) { return true ; } $ compiler -> trigger_template_error ( "access to static class '{$class_name}' not allowed by...
Check if static class is trusted .
40,170
public function isTrustedPhpModifier ( $ modifier_name , $ compiler ) { if ( isset ( $ this -> php_modifiers ) && ( empty ( $ this -> php_modifiers ) || in_array ( $ modifier_name , $ this -> php_modifiers ) ) ) { return true ; } $ compiler -> trigger_template_error ( "modifier '{$modifier_name}' not allowed by securit...
Check if PHP modifier is trusted .
40,171
public function isTrustedStream ( $ stream_name ) { if ( isset ( $ this -> streams ) && ( empty ( $ this -> streams ) || in_array ( $ stream_name , $ this -> streams ) ) ) { return true ; } throw new SmartyException ( "stream '{$stream_name}' not allowed by security setting" ) ; }
Check if stream is trusted .
40,172
public function Observe ( $ obj , $ ltype = OBSERVE_INFO ) { foreach ( $ this -> _observers as $ observer ) { $ observer -> Observe ( $ obj , $ ltype ) ; } }
Fires and observable event . All registered observers will be notified
40,173
public function mustCompile ( ) { if ( ! $ this -> source -> exists ) { if ( $ this -> parent instanceof Smarty_Internal_Template ) { $ parent_resource = " in '$this->parent->template_resource}'" ; } else { $ parent_resource = '' ; } throw new SmartyException ( "Unable to load template {$this->source->type} '{$this->so...
Returns if the current template must be compiled by the Smarty compiler
40,174
public function setupInlineSubTemplate ( $ template , $ cache_id , $ compile_id , $ caching , $ cache_lifetime , $ data , $ parent_scope , $ hash ) { $ tpl = new $ this -> smarty -> template_class ( $ template , $ this -> smarty , $ this , $ cache_id , $ compile_id , $ caching , $ cache_lifetime ) ; $ tpl -> properties...
Template code runtime function to set up an inline subtemplate
40,175
public function & getScope ( $ scope ) { if ( $ scope == Smarty :: SCOPE_PARENT && ! empty ( $ this -> parent ) ) { return $ this -> parent -> tpl_vars ; } elseif ( $ scope == Smarty :: SCOPE_ROOT && ! empty ( $ this -> parent ) ) { $ ptr = $ this -> parent ; while ( ! empty ( $ ptr -> parent ) ) { $ ptr = $ ptr -> par...
Template code runtime function to get pointer to template variable array of requested scope
40,176
public function getScopePointer ( $ scope ) { if ( $ scope == Smarty :: SCOPE_PARENT && ! empty ( $ this -> parent ) ) { return $ this -> parent ; } elseif ( $ scope == Smarty :: SCOPE_ROOT && ! empty ( $ this -> parent ) ) { $ ptr = $ this -> parent ; while ( ! empty ( $ ptr -> parent ) ) { $ ptr = $ ptr -> parent ; }...
Get parent or root of template parent chain
40,177
public function clearCache ( $ exp_time = null ) { Smarty_CacheResource :: invalidLoadedCache ( $ this -> smarty ) ; return $ this -> cached -> handler -> clear ( $ this -> smarty , $ this -> template_name , $ this -> cache_id , $ this -> compile_id , $ exp_time ) ; }
Empty cache for this template
40,178
public function registerCacheResource ( $ type , Smarty_CacheResource $ callback ) { $ this -> smarty -> registered_cache_resources [ $ type ] = $ callback ; return $ this ; }
Registers a cache resource to cache a template s output
40,179
public function unregisterObject ( $ name ) { if ( isset ( $ this -> smarty -> registered_objects [ $ name ] ) ) { unset ( $ this -> smarty -> registered_objects [ $ name ] ) ; } return $ this ; }
unregister an object
40,180
public function unloadFilter ( $ type , $ name ) { $ _filter_name = "smarty_{$type}filter_{$name}" ; if ( isset ( $ this -> smarty -> registered_filters [ $ type ] [ $ _filter_name ] ) ) { unset ( $ this -> smarty -> registered_filters [ $ type ] [ $ _filter_name ] ) ; } return $ this ; }
unload a filter of specified type and name
40,181
public static function getDistanceX ( PHPExcel_Worksheet $ sheet , $ startColumn = 'A' , $ startOffsetX = 0 , $ endColumn = 'A' , $ endOffsetX = 0 ) { $ distanceX = 0 ; $ startColumnIndex = PHPExcel_Cell :: columnIndexFromString ( $ startColumn ) - 1 ; $ endColumnIndex = PHPExcel_Cell :: columnIndexFromString ( $ endCo...
Get the horizontal distance in pixels between two anchors The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets
40,182
public function IsLoaded ( $ value = null ) { if ( $ value != null ) $ this -> _isLoaded = $ value ; return $ this -> _isLoaded ; }
Returns true if the current object has been loaded
40,183
public function IsPartiallyLoaded ( $ value = null ) { if ( $ value != null ) $ this -> _isPartiallyLoaded = $ value ; return $ this -> _isPartiallyLoaded ; }
Returns true if the current object has been partially loaded
40,184
public function CacheLevel ( $ value = null ) { if ( $ value != null ) $ this -> _cacheLevel = $ value ; return $ this -> _cacheLevel ; }
Returns 0 if this was loaded from the DB 1 if from 1st level cache and 2 if 2nd level cache
40,185
public function NoCache ( $ value = null ) { if ( $ value != null ) $ this -> _noCache = $ value ; return $ this -> _noCache ; }
Returns true if the current object should never be cached
40,186
function serialize ( ) { $ propvals = array ( ) ; $ ro = new ReflectionObject ( $ this ) ; foreach ( $ ro -> getProperties ( ) as $ rp ) { $ propname = $ rp -> getName ( ) ; if ( ! in_array ( $ propname , self :: $ NoCacheProperties ) ) { if ( method_exists ( $ rp , "setAccessible" ) ) { $ rp -> setAccessible ( true ) ...
When serializing make sure that we ommit certain properties that should never be cached or serialized .
40,187
function unserialize ( $ data ) { $ propvals = unserialize ( $ data ) ; $ ro = new ReflectionObject ( $ this ) ; foreach ( $ ro -> getProperties ( ) as $ rp ) { $ propname = $ rp -> name ; if ( array_key_exists ( $ propname , $ propvals ) ) { if ( method_exists ( $ rp , "setAccessible" ) ) { $ rp -> setAccessible ( tru...
Reload the object when it awakes from serialization
40,188
public function GetPublicProperties ( ) { $ className = get_class ( $ this ) ; if ( ! array_key_exists ( $ className , self :: $ PublicPropCache ) ) { $ props = array ( ) ; $ ro = new ReflectionObject ( $ this ) ; foreach ( $ ro -> getProperties ( ) as $ rp ) { $ propname = $ rp -> getName ( ) ; if ( ! in_array ( $ pro...
Returns an array with all public properties excluding any internal properties used by the Phreeze framework . This is cached for performance when enumerating through large numbers of the same class
40,189
function ToObject ( $ options = null ) { if ( $ options === null ) $ options = array ( ) ; $ props = array_key_exists ( 'props' , $ options ) ? $ options [ 'props' ] : $ this -> GetPublicProperties ( ) ; $ omit = array_key_exists ( 'omit' , $ options ) ? $ options [ 'omit' ] : array ( ) ; $ camelCase = array_key_exists...
Return an object with a limited number of properties from this Phreezable object . This can be used if not all properties are necessary for example rendering as JSON
40,190
function Refresh ( Phreezer $ phreezer , $ row = null ) { $ this -> _phreezer = $ phreezer ; if ( $ row ) { $ this -> Load ( $ row ) ; } $ this -> OnRefresh ( ) ; }
Restores the object s connection to the datastore for example after serialization
40,191
function GetArray ( ) { $ fms = $ this -> _phreezer -> GetFieldMaps ( get_class ( $ this ) ) ; $ cols = Array ( ) ; foreach ( $ fms as $ fm ) { $ prop = $ fm -> PropertyName ; $ cols [ $ fm -> ColumnName ] = $ this -> $ prop ; } return $ cols ; }
Returns this object as an associative array with properties as keys and values as values
40,192
function GetSchema ( ) { $ this -> Connection -> Connect ( ) ; $ schema = new DBSchema ( $ this ) ; $ this -> Connection -> Disconnect ( ) ; return $ schema ; }
Return the schema with the given name from this server
40,193
static function FormatWithDashes ( $ cc_num ) { $ dashSeparatedNumber = "" ; if ( strlen ( $ cc_num ) == 15 ) { $ firstFour = substr ( $ cc_num , 0 , 4 ) ; $ secondSix = substr ( $ cc_num , 4 , 6 ) ; $ thirdFive = substr ( $ cc_num , 10 , 5 ) ; $ dashSeparatedNumber = $ firstFour . "-" . $ secondSix . "-" . $ thirdFive...
Formats the given credit card number with dashes .
40,194
public function add ( $ key , $ message ) { if ( $ this -> unique ( $ key , $ message ) ) $ this -> messages [ $ key ] [ ] = $ message ; }
Add a message to the collector .
40,195
public function first ( $ key = null , $ format = null ) { $ format = ( $ format === null ) ? $ this -> format : $ format ; $ messages = is_null ( $ key ) ? $ this -> all ( $ format ) : $ this -> get ( $ key , $ format ) ; return ( count ( $ messages ) > 0 ) ? $ messages [ 0 ] : '' ; }
Get the first message from the container for a given key .
40,196
public function all ( $ format = null ) { $ format = ( $ format === null ) ? $ this -> format : $ format ; $ all = array ( ) ; foreach ( $ this -> messages as $ messages ) { $ all = array_merge ( $ all , $ this -> transform ( $ messages , $ format ) ) ; } return $ all ; }
Get all of the messages for every key in the container .
40,197
public static function flush ( $ queue ) { foreach ( static :: $ flushers [ $ queue ] as $ flusher ) { if ( ! isset ( static :: $ queued [ $ queue ] ) ) continue ; foreach ( static :: $ queued [ $ queue ] as $ key => $ payload ) { array_unshift ( $ payload , $ key ) ; call_user_func_array ( $ flusher , $ payload ) ; } ...
Flush an event queue firing the flusher for each payload .
40,198
static function TextToHtml ( $ txt ) { while ( ! ( strpos ( $ txt , ' ' ) === FALSE ) ) $ txt = str_replace ( ' ' , ' ' , $ txt ) ; $ txt = str_replace ( ' >' , '>' , $ txt ) ; $ txt = str_replace ( '< ' , '<' , $ txt ) ; $ txt = htmlentities ( $ txt ) ; $ txt = str_replace ( '&quot;' , '"' , $ txt ) ; $ txt = str_re...
Transforms plain text into formatted HTML .
40,199
static function MergeRegEx ( $ template , $ values , $ ldelim = "{{" , $ rdelim = "}}" ) { self :: $ _MERGE_TEMPLATE_VALUES = $ values ; if ( $ ldelim != "{{" || $ rdelim != "}}" ) throw new Exception ( "Custom delimiters are not yet implemented. Sorry!" ) ; $ results = preg_replace_callback ( '!\{\{(\w+)\}\}!' , 'Simp...
Used internally by Merge or may be called directly . If a placeholder is in the template but there is no matching value it will be replaced with empty string and will NOT appear in the output .