idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
39,800 | public function getCMSFields ( ) { $ this -> beforeUpdateCMSFields ( function ( FieldList $ fields ) { $ fields -> fieldByName ( 'Root.Main.HTML' ) -> setTitle ( _t ( __CLASS__ . '.ContentLabel' , 'Content' ) ) ; } ) ; return parent :: getCMSFields ( ) ; } | Re - title the HTML field to Content |
39,801 | public function updateSearchForm ( Form $ form ) { $ filterField = $ form -> Fields ( ) -> fieldByName ( 'Search__FilterClass' ) ; if ( $ filterField ) { $ filterField -> setEmptyString ( '' ) -> setHasEmptyDefault ( false ) ; } } | Remove the empty default string on the class filter which adds All pages again . This is already added by ElementSiteTreeFilterSearch . |
39,802 | public function performReadonlyTransformation ( ) { $ field = $ this ; if ( ! $ this -> readonly ) { $ field = parent :: performReadonlyTransformation ( ) ; $ field -> setTemplate ( CompositeField :: class ) ; $ field -> setTitle ( 'Title' ) ; $ field -> replaceField ( 'Title' , LiteralField :: create ( 'Title' , $ fie... | Don t use the custom template for readonly states |
39,803 | public function onBeforeWrite ( ) { parent :: onBeforeWrite ( ) ; if ( ! $ this -> Sort ) { if ( $ this -> hasExtension ( Versioned :: class ) ) { $ records = Versioned :: get_by_stage ( BaseElement :: class , Versioned :: DRAFT ) ; } else { $ records = BaseElement :: get ( ) ; } $ records = $ records -> filter ( 'Pare... | Increment the sort order if one hasn t been already defined . This ensures that new elements are created at the end of the list by default . |
39,804 | public function updateFromFormData ( $ data ) { $ cmsFields = $ this -> getCMSFields ( ) ; foreach ( $ data as $ field => $ datum ) { $ field = $ cmsFields -> dataFieldByName ( $ field ) ; if ( ! $ field ) { continue ; } $ field -> setSubmittedValue ( $ datum ) ; $ field -> saveInto ( $ this ) ; } } | Given form data ( wit |
39,805 | public function getAnchor ( ) { if ( $ this -> anchor !== null ) { return $ this -> anchor ; } $ anchorTitle = '' ; if ( ! $ this -> config ( ) -> disable_pretty_anchor_name ) { if ( $ this -> hasMethod ( 'getAnchorTitle' ) ) { $ anchorTitle = $ this -> getAnchorTitle ( ) ; } elseif ( $ this -> config ( ) -> enable_tit... | Get a unique anchor name |
39,806 | public function getAreaRelationName ( ) { if ( isset ( $ this -> cacheData [ 'area_relation_name' ] ) ) { return $ this -> cacheData [ 'area_relation_name' ] ; } $ page = $ this -> getPage ( ) ; $ result = 'ElementalArea' ; if ( $ page ) { $ has_one = $ page -> config ( ) -> get ( 'has_one' ) ; $ area = $ this -> Paren... | Retrieve a elemental area relation for creating cms links |
39,807 | public function getIcon ( ) { $ data = ArrayData :: create ( [ ] ) ; $ iconClass = $ this -> config ( ) -> get ( 'icon' ) ; if ( $ iconClass ) { $ data -> IconClass = $ iconClass ; if ( $ this -> hasExtension ( Versioned :: class ) ) { $ data -> IsVersioned = true ; if ( $ this -> isOnDraftOnly ( ) ) { $ data -> Versio... | Generate markup for element type icons suitable for use in GridFields . |
39,808 | public function getTypeNice ( ) { $ description = $ this -> getDescription ( ) ; $ desc = ( $ description ) ? ' <span class="element__note"> — ' . $ description . '</span>' : '' ; return DBField :: create_field ( 'HTMLVarchar' , $ this -> getType ( ) . $ desc ) ; } | Generate markup for element type with description suitable for use in GridFields . |
39,809 | public function getStyleVariant ( ) { $ style = $ this -> Style ; $ styles = $ this -> config ( ) -> get ( 'styles' ) ; if ( isset ( $ styles [ $ style ] ) ) { $ style = strtolower ( $ style ) ; } else { $ style = '' ; } $ this -> extend ( 'updateStyleVariant' , $ style ) ; return $ style ; } | Get a user defined style variant for this element if available |
39,810 | public function getElementalTypes ( ) { $ config = $ this -> owner -> config ( ) ; if ( is_array ( $ config -> get ( 'allowed_elements' ) ) ) { if ( $ config -> get ( 'stop_element_inheritance' ) ) { $ availableClasses = $ config -> get ( 'allowed_elements' , Config :: UNINHERITED ) ; } else { $ availableClasses = $ co... | Get the available element types for this page type |
39,811 | public function getElementalRelations ( ) { $ hasOnes = $ this -> owner -> hasOne ( ) ; if ( ! $ hasOnes ) { return false ; } $ elementalAreaRelations = [ ] ; foreach ( $ hasOnes as $ hasOneName => $ hasOneClass ) { if ( $ hasOneName === 'Parent' || $ hasOneName === 'ParentID' ) { continue ; } if ( $ hasOneClass == Ele... | Returns an array of the relation names to ElementAreas . Ignores any has_one fields named Parent as that would indicate that this is child of an existing area |
39,812 | public function updateCMSFields ( FieldList $ fields ) { if ( ! $ this -> supportsElemental ( ) ) { return ; } $ fields -> replaceField ( 'Content' , new LiteralField ( 'Content' , '' ) ) ; $ elementalAreaRelations = $ this -> owner -> getElementalRelations ( ) ; foreach ( $ elementalAreaRelations as $ eaRelationship )... | Setup the CMS Fields |
39,813 | public function onBeforeWrite ( ) { parent :: onBeforeWrite ( ) ; if ( ! $ this -> supportsElemental ( ) ) { return ; } $ elementalAreaRelations = $ this -> owner -> getElementalRelations ( ) ; $ this -> ensureElementalAreasExist ( $ elementalAreaRelations ) ; if ( Config :: inst ( ) -> get ( self :: class , 'clear_con... | Make sure there is always an ElementalArea for adding Elements |
39,814 | public function ensureElementalAreasExist ( $ elementalAreaRelations ) { foreach ( $ elementalAreaRelations as $ eaRelationship ) { $ areaID = $ eaRelationship . 'ID' ; if ( ! $ this -> owner -> $ areaID ) { $ area = ElementalArea :: create ( ) ; $ area -> OwnerClassName = get_class ( $ this -> owner ) ; $ area -> writ... | Set all has_one relationships to an ElementalArea to a valid ID if they re unset |
39,815 | public function getElementsForSearch ( ) { $ oldThemes = SSViewer :: get_themes ( ) ; SSViewer :: set_themes ( SSViewer :: config ( ) -> get ( 'themes' ) ) ; try { $ output = [ ] ; foreach ( $ this -> owner -> hasOne ( ) as $ key => $ class ) { if ( $ class !== ElementalArea :: class ) { continue ; } $ area = $ this ->... | Returns the contents of each ElementalArea has_one s markup for use in Solr or Elastic search indexing |
39,816 | protected function getElementTypes ( ) { $ classes = ClassInfo :: subclassesFor ( BaseElement :: class ) ; $ output = [ ] ; foreach ( $ classes as $ className ) { if ( $ className === BaseElement :: class ) { continue ; } $ output [ ] = $ className ; } return $ output ; } | Return an array of all valid classes that extend BaseElement |
39,817 | public function apiSaveForm ( HTTPRequest $ request ) { if ( ! isset ( $ this -> urlParams [ 'ID' ] ) ) { $ this -> jsonError ( 400 ) ; return null ; } $ data = Convert :: json2array ( $ request -> getBody ( ) ) ; if ( empty ( $ data ) ) { $ this -> jsonError ( 400 ) ; return null ; } foreach ( $ data as $ key => $ val... | Save an inline edit form for a block |
39,818 | public function formAction ( HTTPRequest $ request ) { $ formName = $ request -> param ( 'FormName' ) ; $ id = substr ( $ formName , strlen ( sprintf ( self :: FORM_NAME_TEMPLATE , '' ) ) ) ; $ form = $ this -> getElementForm ( $ id ) ; $ field = $ form -> getRequestHandler ( ) -> handleField ( $ request ) ; return $ f... | Provides action control for form fields that are request handlers when they re used in an in - line edit form . |
39,819 | public static function removeNamespacesFromFields ( array $ data , $ elementID ) { $ output = [ ] ; $ template = sprintf ( EditFormFactory :: FIELD_NAMESPACE_TEMPLATE , $ elementID , '' ) ; foreach ( $ data as $ key => $ value ) { if ( substr ( $ key , 0 , strlen ( $ template ) ) !== $ template ) { continue ; } $ field... | Remove the pseudo namespaces that were added to form fields by the form factory |
39,820 | protected function applyDefaultFilters ( $ query ) { if ( empty ( $ this -> params [ 'Term' ] ) ) { return parent :: applyDefaultFilters ( $ query ) ; } $ siteTrees = $ query -> filterByCallback ( function ( SiteTree $ siteTree ) { if ( ! $ siteTree -> hasExtension ( ElementalPageExtension :: class ) ) { return false ;... | We can t use ORM filtering for PHP methods so we ll perform our own PHP search and get a list of matching SiteTree record IDs then add that to the original ORM query . |
39,821 | public function registerElement ( $ elementClass ) { $ singleton = singleton ( $ elementClass ) ; if ( ! $ singleton instanceof BaseElement ) { throw new LogicException ( 'Only elements that extend ' . BaseElement :: class . ' can be registered' ) ; } $ typeName = StaticSchema :: inst ( ) -> typeNameForDataObject ( $ e... | Register an element type with this registry |
39,822 | public function getDefinition ( $ instanceOrClass ) { if ( $ instanceOrClass instanceof BaseElement ) { $ instanceOrClass = get_class ( $ instanceOrClass ) ; } if ( ! is_string ( $ instanceOrClass ) ) { throw new InvalidArgumentException ( sprintf ( 'Given argument to %s is not an instance of a class extending %s and i... | Get the element type data for the given instance or class name of an element . |
39,823 | public static function generate ( ) { $ registry = static :: create ( ) ; if ( static :: $ cache && ( $ types = static :: $ cache -> get ( self :: CACHE_KEY ) ) ) { $ registry -> elementTypes = $ types ; return $ registry ; } $ classNames = ClassInfo :: getValidSubClasses ( BaseElement :: class ) ; foreach ( $ classNam... | Create a registry and attempt to fill it by resolving element types by introspecting class hierarchy |
39,824 | public function Breadcrumbs ( ) { $ ownerClassName = $ this -> OwnerClassName ; if ( $ owner = $ ownerClassName :: get ( ) -> filter ( 'ElementalAreaID' , $ this -> ID ) -> first ( ) ) { return DBField :: create_field ( 'HTMLText' , sprintf ( '<a href="%s">%s</a>' , $ owner -> CMSEditLink ( ) , $ owner -> Title ) ) ; }... | Necessary to display results in CMS site search . |
39,825 | public function setStatus ( $ status ) { if ( ! empty ( $ status ) && ctype_print ( $ status ) ) { $ this -> status = trim ( $ status ) ; } return $ this ; } | Set the status for this instruction |
39,826 | final public static function generate ( ) { if ( null !== self :: $ finHash ) { return self :: $ finHash ; } self :: $ finHash = '' ; self :: $ sigData = array ( ) ; $ serverVariables = array ( 'server_software' , 'server_name' , 'server_addr' , 'server_port' , 'document_root' , ) ; foreach ( $ _SERVER as $ k => $ v ) ... | Generates a string of environment information and takes the hash of that value to use as the env fingerprint . |
39,827 | public function setAccountId ( $ id ) { if ( ! empty ( $ id ) && ctype_print ( $ id ) ) { $ this -> account_id = $ id ; } return $ this ; } | Set Account Id - Bitpays account ID for the payout . |
39,828 | public function updateInstruction ( $ index , $ function , $ argument ) { if ( ! empty ( $ argument ) && ctype_print ( $ argument ) ) { $ this -> instructions [ $ index ] -> $ function ( $ argument ) ; } return $ this ; } | Update Instruction - Supply an index of the instruction to update plus the function and single argument to do something to an instruction . |
39,829 | public function setPricingMethod ( $ pricingMethod ) { if ( ! empty ( $ pricingMethod ) && ctype_print ( $ pricingMethod ) ) { $ this -> pricingMethod = trim ( $ pricingMethod ) ; } return $ this ; } | Set the pricing method for this payout request |
39,830 | public function setReference ( $ reference ) { if ( ! empty ( $ reference ) && ctype_print ( $ reference ) ) { $ this -> reference = trim ( $ reference ) ; } return $ this ; } | Set the payroll providers reference for this payout |
39,831 | public function setHeader ( $ header , $ value ) { if ( is_array ( $ value ) ) { throw new \ Exception ( 'Could not set the header: ' . $ header ) ; } $ this -> headers [ $ header ] = $ value ; } | Set a http header for the request |
39,832 | public function setBody ( $ body ) { $ this -> body = $ body ; $ this -> setHeader ( 'Content-Length' , strlen ( $ body ) ) ; return $ this ; } | The the body of the request |
39,833 | private function getCurlDefaultOptions ( RequestInterface $ request ) { return array ( CURLOPT_URL => $ request -> getUri ( ) , CURLOPT_PORT => $ request -> getPort ( ) , CURLOPT_CUSTOMREQUEST => $ request -> getMethod ( ) , CURLOPT_HTTPHEADER => $ request -> getHeaderFields ( ) , CURLOPT_TIMEOUT => 10 , CURLOPT_SSL_VE... | Returns an array of default curl settings to use |
39,834 | public static function sha256ripe160 ( $ data ) { return bin2hex ( self :: ripe160 ( self :: sha256 ( $ data , true ) , true ) ) ; } | Returns a SHA256 hash of a RIPEMD160 hash of a value . |
39,835 | public static function twoSha256 ( $ data , $ binary = false ) { return self :: sha256 ( self :: sha256 ( $ data , $ binary ) , $ binary ) ; } | Returns a double SHA256 hash of a value . |
39,836 | public static function guid ( ) { return sprintf ( '%s-%s-%s-%s-%s' , bin2hex ( openssl_random_pseudo_bytes ( 4 ) ) , bin2hex ( openssl_random_pseudo_bytes ( 2 ) ) , bin2hex ( openssl_random_pseudo_bytes ( 2 ) ) , bin2hex ( openssl_random_pseudo_bytes ( 2 ) ) , bin2hex ( openssl_random_pseudo_bytes ( 6 ) ) ) ; } | Returns a GUID for use in REST calls . |
39,837 | public static function checkRequirements ( ) { $ requirements = array ( ) ; if ( ! defined ( 'PHP_VERSION_ID' ) ) { $ version = explode ( '.' , PHP_VERSION ) ; define ( 'PHP_VERSION_ID' , ( $ version [ 0 ] * 10000 + $ version [ 1 ] * 100 + $ version [ 2 ] ) ) ; } if ( PHP_VERSION_ID < 50400 ) { $ requirements [ 'PHP' ]... | Checks dependencies for the library |
39,838 | public function generate ( ) { if ( ! empty ( $ this -> hex ) ) { return $ this ; } do { $ privateKey = \ Bitpay \ Util \ SecureRandom :: generateRandom ( 32 ) ; $ this -> hex = strtolower ( bin2hex ( $ privateKey ) ) ; } while ( Math :: cmp ( '0x' . $ this -> hex , '1' ) <= 0 || Math :: cmp ( '0x' . $ this -> hex , '0... | Generates an EC private key |
39,839 | protected function prepareRequestHeaders ( RequestInterface $ request ) { $ request -> setHeader ( 'User-Agent' , sprintf ( '%s/%s (PHP %s)' , self :: NAME , self :: VERSION , phpversion ( ) ) ) ; $ request -> setHeader ( 'X-BitPay-Plugin-Info' , sprintf ( '%s/%s' , self :: NAME , self :: VERSION ) ) ; $ request -> set... | Prepares the request object by adding additional headers |
39,840 | protected function addKeyStorageNode ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'key_storage' , 'scalar' ) ; $ node -> info ( 'Class that is used to store your keys' ) -> defaultValue ( 'Bitpay\Storage\EncryptedFilesystemStorage' ) -> validate ( ) -> always ( ) -> then ( function ( $ value ) {... | Adds the key_storage node with validation rules |
39,841 | protected function initializeContainer ( $ config ) { $ this -> container = $ this -> buildContainer ( $ config ) ; $ this -> container -> compile ( ) ; } | Initialize the container |
39,842 | protected function buildContainer ( $ config ) { $ container = new ContainerBuilder ( new ParameterBag ( $ this -> getParameters ( ) ) ) ; $ this -> prepareContainer ( $ container ) ; $ this -> getContainerLoader ( $ container ) -> load ( $ config ) ; return $ container ; } | Build the container of services and parameters |
39,843 | final public function generateKeypair ( $ keybits = 512 , $ digest_alg = 'sha512' ) { try { if ( function_exists ( 'openssl_pkey_new' ) ) { $ keypair = array ( ) ; if ( ( int ) $ keybits < 384 ) { $ keybits = 384 ; } if ( ! isset ( $ digest_alg ) || trim ( $ digest_alg ) == '' ) { $ digest_alg = 'sha512' ; } $ config =... | Function to generate a new RSA keypair . This is not used for point derivation or for generating signatures . Only used for assymetric data encryption as needed . |
39,844 | final public function randomNumber ( $ bytes = 32 ) { $ random_data = openssl_random_pseudo_bytes ( $ bytes , $ cstrong ) ; if ( ! $ cstrong || ! $ random_data ) { return false ; } else { return bin2hex ( $ random_data ) ; } } | Generates a high - quality random number suitable for use in cryptographic functions and returns hex value . |
39,845 | public function generate ( PrivateKey $ privateKey = null ) { if ( $ privateKey instanceof PrivateKey ) { $ this -> setPrivateKey ( $ privateKey ) ; } if ( ! empty ( $ this -> hex ) ) { return $ this ; } if ( is_null ( $ this -> privateKey ) ) { throw new \ Exception ( 'Please `setPrivateKey` before you generate a publ... | Generates an uncompressed and compressed EC public key . |
39,846 | public function isValid ( ) { return ( ( ! empty ( $ this -> hex ) && ctype_xdigit ( $ this -> hex ) ) && ( ! empty ( $ this -> dec ) && ctype_digit ( $ this -> dec ) ) ) ; } | Checks to see if the public key is not blank and contains valid decimal and hex valules for this - > hex & this - > dec |
39,847 | public static function autoload ( $ class ) { if ( 0 === strpos ( $ class , 'Bitpay\\' ) ) { $ classname = substr ( $ class , 7 ) ; $ file = __DIR__ . DIRECTORY_SEPARATOR . str_replace ( '\\' , DIRECTORY_SEPARATOR , $ classname ) . '.php' ; if ( is_file ( $ file ) && is_readable ( $ file ) ) { require_once $ file ; ret... | Give a class name and it will require the file . |
39,848 | protected function checkPriceFormat ( $ price ) { if ( $ price === '0' ) { return ; } $ converted = ( float ) $ price ; if ( $ converted == 0 ) { throw new \ Bitpay \ Client \ ArgumentException ( "Price must be formatted as a float " . $ converted ) ; } } | Checks the new price to include BTC & BCH values with more than 6 decimals . |
39,849 | function _remove_type_callback ( & $ mime , $ ext_type , $ type_info ) { $ matched = false ; list ( $ ext , $ type ) = $ ext_type ; if ( $ type_info [ 'wildcard' ] ) { if ( substr ( $ type , 0 , strpos ( $ type , '/' ) ) == $ type_info [ 'type' ] ) { $ matched = true ; } } elseif ( $ type == $ type_info [ 'type' ] ) { ... | Remove type callback |
39,850 | function sign ( $ usr_id = 0 , $ secrets = null , $ name = '' , $ token_type = null ) { $ url = $ this -> getRequestUrl ( ) ; if ( empty ( $ secrets ) ) { $ secrets = $ this -> store -> getSecretsForSignature ( $ url , $ usr_id , $ name ) ; } if ( empty ( $ secrets ) ) { throw new OAuthException2 ( 'No OAuth relation w... | Sign our message in the way the server understands . Set the needed oauth_xxxx parameters . |
39,851 | function getAuthorizationHeader ( ) { if ( ! $ this -> signed ) { $ this -> sign ( $ this -> usr_id ) ; } $ h = array ( ) ; $ h [ ] = 'Authorization: OAuth realm=""' ; foreach ( $ this -> param as $ name => $ value ) { if ( strncmp ( $ name , 'oauth_' , 6 ) == 0 || strncmp ( $ name , 'xoauth_' , 7 ) == 0 ) { $ h [ ] = ... | Builds the Authorization header for the request . Adds all oauth_ and xoauth_ parameters to the Authorization header . |
39,852 | static function Write ( $ message , $ width = 250 , $ height = 150 , $ backgroundColor = null , $ fontColor = null , $ fontId = 1 ) { if ( $ backgroundColor == null ) $ backgroundColor = array ( 255 , 255 , 255 ) ; if ( $ backgroundColor == null ) $ backgroundColor = array ( 0 , 0 , 0 ) ; $ im = self :: GetErrorImage (... | Output a png image to the browser including headers |
39,853 | static function GetErrorImage ( $ message , $ width = 250 , $ height = 150 , $ backgroundColor = null , $ fontColor = null , $ fontId = 1 ) { if ( $ backgroundColor == null ) $ backgroundColor = array ( 255 , 255 , 255 ) ; if ( $ backgroundColor == null ) $ backgroundColor = array ( 0 , 0 , 0 ) ; $ msg = str_replace ( ... | Given text returns an image reference with the text included in the image |
39,854 | public function writeWorkbookRelationships ( PHPExcel $ pPHPExcel = null ) { $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK , $ this -> getParentWriter ( ) -> getDiskCachingDirectory ( ) ) ; } e... | Write workbook relationships to XML format |
39,855 | public static function sharpen ( ) { Event :: listen ( View :: engine , function ( $ view ) { if ( ! str_contains ( $ view -> path , BLADE_EXT ) ) { return ; } $ compiled = Blade :: compiled ( $ view -> path ) ; if ( ! file_exists ( $ compiled ) or Blade :: expired ( $ view -> view , $ view -> path ) ) { file_put_conte... | Register the Blade view engine with Laravel . |
39,856 | public static function compile_string ( $ value , $ view = null ) { foreach ( static :: $ compilers as $ compiler ) { $ method = "compile_{$compiler}" ; $ value = static :: $ method ( $ value , $ view ) ; } return $ value ; } | Compiles the given string containing Blade pseudo - code into valid PHP . |
39,857 | protected static function compile_forelse ( $ value ) { preg_match_all ( '/(\s*)@forelse(\s*\(.*\))(\s*)/' , $ value , $ matches ) ; foreach ( $ matches [ 0 ] as $ forelse ) { preg_match ( '/\s*\(\s*(\S*)\s/' , $ forelse , $ variable ) ; $ if = "<?php if (count({$variable[1]}) > 0): ?>" ; $ search = '/(\s*)@forelse(\s*... | Rewrites Blade for else statements into valid PHP . |
39,858 | static public function requestIsSigned ( ) { if ( isset ( $ _REQUEST [ 'oauth_signature' ] ) ) { $ signed = true ; } else { $ hs = OAuthRequestLogger :: getAllHeaders ( ) ; if ( isset ( $ hs [ 'Authorization' ] ) && strpos ( $ hs [ 'Authorization' ] , 'oauth_signature' ) !== false ) { $ signed = true ; } else { $ signe... | See if the current request is signed with OAuth |
39,859 | public function verifyIfSigned ( $ token_type = 'access' ) { if ( $ this -> getParam ( 'oauth_consumer_key' ) ) { OAuthRequestLogger :: start ( $ this ) ; $ this -> verify ( $ token_type ) ; $ signed = true ; OAuthRequestLogger :: flush ( ) ; } else { $ signed = false ; } return $ signed ; } | Verify the request if it seemed to be signed . |
39,860 | public function verifyExtended ( $ token_type = 'access' ) { $ consumer_key = $ this -> getParam ( 'oauth_consumer_key' ) ; $ token = $ this -> getParam ( 'oauth_token' ) ; $ user_id = false ; $ secrets = array ( ) ; if ( $ consumer_key && ( $ token_type === false || $ token ) ) { $ secrets = $ this -> store -> getSecr... | Verify the request |
39,861 | public function verifySignature ( $ consumer_secret , $ token_secret , $ token_type = 'access' ) { $ required = array ( 'oauth_consumer_key' , 'oauth_signature_method' , 'oauth_timestamp' , 'oauth_nonce' , 'oauth_signature' ) ; if ( $ token_type !== false ) { $ required [ ] = 'oauth_token' ; } foreach ( $ required as $... | Verify the signature of the request using the method in oauth_signature_method . The signature is returned encoded in the form as used in the url . So the base64 and urlencoding has been done . |
39,862 | public function verifyDataSignature ( $ data , $ consumer_secret , $ token_secret , $ signature_method , $ signature ) { if ( is_null ( $ data ) ) { $ data = '' ; } $ sig = $ this -> getSignatureMethod ( $ signature_method ) ; if ( ! $ sig -> verify ( $ this , $ data , $ consumer_secret , $ token_secret , $ signature )... | Verify the signature of a string . |
39,863 | public function IsNumeric ( ) { return ( $ this -> FieldType == FM_TYPE_DECIMAL || $ this -> FieldType == FM_TYPE_INT || $ this -> FieldType == FM_TYPE_SMALLINT || $ this -> FieldType == FM_TYPE_TINYINT || $ this -> FieldType == FM_TYPE_MEDIUMINT || $ this -> FieldType == FM_TYPE_BIGINT || $ this -> FieldType == FM_TYP... | Return true if this column is a numeric type |
39,864 | private function _writeTitle ( PHPExcel_Chart_Title $ title = null , $ objWriter ) { if ( is_null ( $ title ) ) { return ; } $ objWriter -> startElement ( 'c:title' ) ; $ objWriter -> startElement ( 'c:tx' ) ; $ objWriter -> startElement ( 'c:rich' ) ; $ objWriter -> startElement ( 'a:bodyPr' ) ; $ objWriter -> endElem... | Write Chart Title |
39,865 | private function _writePlotSeriesLabel ( $ plotSeriesLabel , $ objWriter ) { if ( is_null ( $ plotSeriesLabel ) ) { return ; } $ objWriter -> startElement ( 'c:f' ) ; $ objWriter -> writeRawData ( $ plotSeriesLabel -> getDataSource ( ) ) ; $ objWriter -> endElement ( ) ; $ objWriter -> startElement ( 'c:strCache' ) ; $... | Write Plot Series Label |
39,866 | private function _writePrintSettings ( $ objWriter ) { $ objWriter -> startElement ( 'c:printSettings' ) ; $ objWriter -> startElement ( 'c:headerFooter' ) ; $ objWriter -> endElement ( ) ; $ objWriter -> startElement ( 'c:pageMargins' ) ; $ objWriter -> writeAttribute ( 'footer' , 0.3 ) ; $ objWriter -> writeAttribute... | Write Printer Settings |
39,867 | public function GetRoute ( $ uri = "" ) { $ match = '' ; $ qs = $ uri ? $ uri : ( array_key_exists ( 'QUERY_STRING' , $ _SERVER ) ? $ _SERVER [ 'QUERY_STRING' ] : '' ) ; $ parsed = explode ( '&' , $ qs , 2 ) ; $ action = $ parsed [ 0 ] ; if ( strpos ( $ action , '=' ) > - 1 || ! $ action ) { $ match = $ this -> default... | Returns the controller and method for the given URI |
39,868 | protected function query_all_assoc ( $ sql ) { $ sql = $ this -> sql_printf ( func_get_args ( ) ) ; if ( ! ( $ res = pg_query ( $ this -> conn , $ sql ) ) ) { $ this -> sql_errcheck ( $ sql ) ; } $ rs = array ( ) ; while ( $ row = pg_fetch_assoc ( $ res ) ) { $ rs [ ] = $ row ; } pg_free_result ( $ res ) ; return $ rs ... | Perform a query return all rows |
39,869 | protected function query_insert_id ( $ tableName , $ primaryKey = null ) { $ sequenceName = $ tableName ; if ( $ primaryKey ) { $ sequenceName .= "_$primaryKey" ; } $ sequenceName .= '_seq' ; $ sql = " SELECT CURRVAL('%s') " ; $ args = array ( $ sql , $ sequenceName ) ; $ sql = ... | Return the id of the last inserted row |
39,870 | function OnSave ( $ is_insert ) { if ( $ is_insert || $ this -> PasswordWasChanged ( ) ) { $ this -> _phreezer -> Observe ( "Account->OnSave: The password has changed" ) ; $ this -> Password = base64_encode ( crypt ( $ this -> Password , $ this -> Username ) ) ; } else { $ this -> Password = $ this -> _original_pass... | if the password has changed since load then we want to crypt it otherwise we don t want to touch it because it is already crypted |
39,871 | public function getOPT ( $ property ) { if ( isset ( $ this -> _OPT [ $ property ] ) ) { return $ this -> _OPT [ $ property ] ; } return null ; } | Get an option for the drawing group |
39,872 | public static function start_cache ( $ template ) { $ key = self :: get_key ( $ template ) ; self :: $ template_data [ $ key ] [ 'start_time' ] = microtime ( true ) ; } | Start logging of cache time |
39,873 | public function getCacheFilename ( $ name ) { if ( false === $ this -> cache ) { return false ; } $ class = substr ( $ this -> getTemplateClass ( $ name ) , strlen ( $ this -> templateClassPrefix ) ) ; return $ this -> getCache ( ) . '/' . substr ( $ class , 0 , 2 ) . '/' . substr ( $ class , 2 , 2 ) . '/' . substr ( $... | Gets the cache filename for a given template . |
39,874 | public function loadTemplate ( $ name , $ index = null ) { $ cls = $ this -> getTemplateClass ( $ name , $ index ) ; if ( isset ( $ this -> loadedTemplates [ $ cls ] ) ) { return $ this -> loadedTemplates [ $ cls ] ; } if ( ! class_exists ( $ cls , false ) ) { if ( false === $ cache = $ this -> getCacheFilename ( $ nam... | Loads a template by name . |
39,875 | public function resolveTemplate ( $ names ) { if ( ! is_array ( $ names ) ) { $ names = array ( $ names ) ; } foreach ( $ names as $ name ) { if ( $ name instanceof Twig_Template ) { return $ name ; } try { return $ this -> loadTemplate ( $ name ) ; } catch ( Twig_Error_Loader $ e ) { } } if ( 1 === count ( $ names ) )... | Tries to load a template consecutively from an array . |
39,876 | public function clearCacheFiles ( ) { if ( false === $ this -> cache ) { return ; } foreach ( new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ this -> cache ) , RecursiveIteratorIterator :: LEAVES_ONLY ) as $ file ) { if ( $ file -> isFile ( ) ) { @ unlink ( $ file -> getPathname ( ) ) ; } } } | Clears the template cache files on the filesystem . |
39,877 | public function getLexer ( ) { if ( null === $ this -> lexer ) { $ this -> lexer = new Twig_Lexer ( $ this ) ; } return $ this -> lexer ; } | Gets the Lexer instance . |
39,878 | public function getParser ( ) { if ( null === $ this -> parser ) { $ this -> parser = new Twig_Parser ( $ this ) ; } return $ this -> parser ; } | Gets the Parser instance . |
39,879 | public function getCompiler ( ) { if ( null === $ this -> compiler ) { $ this -> compiler = new Twig_Compiler ( $ this ) ; } return $ this -> compiler ; } | Gets the Compiler instance . |
39,880 | public function compileSource ( $ source , $ name = null ) { try { return $ this -> compile ( $ this -> parse ( $ this -> tokenize ( $ source , $ name ) ) ) ; } catch ( Twig_Error $ e ) { $ e -> setTemplateFile ( $ name ) ; throw $ e ; } catch ( Exception $ e ) { throw new Twig_Error_Syntax ( sprintf ( 'An exception ha... | Compiles a template source code . |
39,881 | public function initRuntime ( ) { $ this -> runtimeInitialized = true ; foreach ( $ this -> getExtensions ( ) as $ extension ) { $ extension -> initRuntime ( $ this ) ; } } | Initializes the runtime environment . |
39,882 | public function getExtension ( $ name ) { if ( ! isset ( $ this -> extensions [ $ name ] ) ) { throw new Twig_Error_Runtime ( sprintf ( 'The "%s" extension is not enabled.' , $ name ) ) ; } return $ this -> extensions [ $ name ] ; } | Gets an extension by name . |
39,883 | public function addExtension ( Twig_ExtensionInterface $ extension ) { if ( $ this -> extensionInitialized ) { throw new LogicException ( sprintf ( 'Unable to register extension "%s" as extensions have already been initialized.' , $ extension -> getName ( ) ) ) ; } $ this -> extensions [ $ extension -> getName ( ) ] = ... | Registers an extension . |
39,884 | public function removeExtension ( $ name ) { if ( $ this -> extensionInitialized ) { throw new LogicException ( sprintf ( 'Unable to remove extension "%s" as extensions have already been initialized.' , $ name ) ) ; } unset ( $ this -> extensions [ $ name ] ) ; } | Removes an extension by name . |
39,885 | public function addTokenParser ( Twig_TokenParserInterface $ parser ) { if ( $ this -> extensionInitialized ) { throw new LogicException ( 'Unable to add a token parser as extensions have already been initialized.' ) ; } $ this -> staging -> addTokenParser ( $ parser ) ; } | Registers a Token Parser . |
39,886 | public function getTags ( ) { $ tags = array ( ) ; foreach ( $ this -> getTokenParsers ( ) -> getParsers ( ) as $ parser ) { if ( $ parser instanceof Twig_TokenParserInterface ) { $ tags [ $ parser -> getTag ( ) ] = $ parser ; } } return $ tags ; } | Gets registered tags . |
39,887 | public function addNodeVisitor ( Twig_NodeVisitorInterface $ visitor ) { if ( $ this -> extensionInitialized ) { throw new LogicException ( 'Unable to add a node visitor as extensions have already been initialized.' ) ; } $ this -> staging -> addNodeVisitor ( $ visitor ) ; } | Registers a Node Visitor . |
39,888 | public function addFilter ( $ name , $ filter = null ) { if ( ! $ name instanceof Twig_SimpleFilter && ! ( $ filter instanceof Twig_SimpleFilter || $ filter instanceof Twig_FilterInterface ) ) { throw new LogicException ( 'A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter' ) ; } if ( $ name inst... | Registers a Filter . |
39,889 | public function getFilter ( $ name ) { if ( ! $ this -> extensionInitialized ) { $ this -> initExtensions ( ) ; } if ( isset ( $ this -> filters [ $ name ] ) ) { return $ this -> filters [ $ name ] ; } foreach ( $ this -> filters as $ pattern => $ filter ) { $ pattern = str_replace ( '\\*' , '(.*?)' , preg_quote ( $ pa... | Get a filter by name . |
39,890 | public function addFunction ( $ name , $ function = null ) { if ( ! $ name instanceof Twig_SimpleFunction && ! ( $ function instanceof Twig_SimpleFunction || $ function instanceof Twig_FunctionInterface ) ) { throw new LogicException ( 'A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction' ) ... | Registers a Function . |
39,891 | public function getFunction ( $ name ) { if ( ! $ this -> extensionInitialized ) { $ this -> initExtensions ( ) ; } if ( isset ( $ this -> functions [ $ name ] ) ) { return $ this -> functions [ $ name ] ; } foreach ( $ this -> functions as $ pattern => $ function ) { $ pattern = str_replace ( '\\*' , '(.*?)' , preg_qu... | Get a function by name . |
39,892 | public function addGlobal ( $ name , $ value ) { if ( $ this -> extensionInitialized || $ this -> runtimeInitialized ) { if ( null === $ this -> globals ) { $ this -> globals = $ this -> initGlobals ( ) ; } } if ( $ this -> extensionInitialized || $ this -> runtimeInitialized ) { $ this -> globals [ $ name ] = $ value ... | Registers a Global . |
39,893 | public function getGlobals ( ) { if ( ! $ this -> runtimeInitialized && ! $ this -> extensionInitialized ) { return $ this -> initGlobals ( ) ; } if ( null === $ this -> globals ) { $ this -> globals = $ this -> initGlobals ( ) ; } return $ this -> globals ; } | Gets the registered Globals . |
39,894 | public function mergeGlobals ( array $ context ) { foreach ( $ this -> getGlobals ( ) as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ context ) ) { $ context [ $ key ] = $ value ; } } return $ context ; } | Merges a context with the defined globals . |
39,895 | public function addXfWriter ( $ style , $ isStyleXf = false ) { $ xfWriter = new PHPExcel_Writer_Excel5_Xf ( $ style ) ; $ xfWriter -> setIsStyleXf ( $ isStyleXf ) ; $ fontIndex = $ this -> _addFont ( $ style -> getFont ( ) ) ; $ xfWriter -> setFontIndex ( $ fontIndex ) ; $ xfWriter -> setFgColor ( $ this -> _addColor ... | Add a new XF writer |
39,896 | public function _addFont ( PHPExcel_Style_Font $ font ) { $ fontHashCode = $ font -> getHashCode ( ) ; if ( isset ( $ this -> _addedFonts [ $ fontHashCode ] ) ) { $ fontIndex = $ this -> _addedFonts [ $ fontHashCode ] ; } else { $ countFonts = count ( $ this -> _fontWriters ) ; $ fontIndex = ( $ countFonts < 4 ) ? $ co... | Add a font to added fonts |
39,897 | private function _addColor ( $ rgb ) { if ( ! isset ( $ this -> _colors [ $ rgb ] ) ) { if ( count ( $ this -> _colors ) < 57 ) { $ colorIndex = 8 + count ( $ this -> _colors ) ; $ this -> _palette [ $ colorIndex ] = array ( hexdec ( substr ( $ rgb , 0 , 2 ) ) , hexdec ( substr ( $ rgb , 2 , 2 ) ) , hexdec ( substr ( $... | Alter color palette adding a custom color |
39,898 | private function _writeDefinedNameBiff8 ( $ name , $ formulaData , $ sheetIndex = 0 , $ isBuiltIn = false ) { $ record = 0x0018 ; $ options = $ isBuiltIn ? 0x20 : 0x00 ; $ nlen = PHPExcel_Shared_String :: CountCharacters ( $ name ) ; $ name = substr ( PHPExcel_Shared_String :: UTF8toBIFF8UnicodeLong ( $ name ) , 2 ) ; ... | Write a DEFINEDNAME record for BIFF8 using explicit binary formula data |
39,899 | private function _writeCodepage ( ) { $ record = 0x0042 ; $ length = 0x0002 ; $ cv = $ this -> _codepage ; $ header = pack ( 'vv' , $ record , $ length ) ; $ data = pack ( 'v' , $ cv ) ; $ this -> _append ( $ header . $ data ) ; } | Stores the CODEPAGE biff record . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.