idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
40,600 | public function formatByIntl ( $ locale = null , Currencies $ currencies = null , $ style = NumberFormatter :: CURRENCY ) { $ numberFormatter = new NumberFormatter ( $ locale ? : static :: getLocale ( ) , $ style ) ; $ formatter = new IntlMoneyFormatter ( $ numberFormatter , $ currencies ? : static :: getCurrencies ( )... | Format by intl . |
40,601 | public function formatByIntlLocalizedDecimal ( $ locale = null , Currencies $ currencies = null , $ style = NumberFormatter :: CURRENCY ) { $ numberFormatter = new NumberFormatter ( $ locale ? : static :: getLocale ( ) , $ style ) ; $ formatter = new IntlLocalizedDecimalFormatter ( $ numberFormatter , $ currencies ? : ... | Format by intl localized decimal . |
40,602 | public function generateSessionKey ( ) { if ( ! isset ( $ this -> cryptParams [ 'keysize' ] ) ) { throw new Exception ( 'Unknown key size for type "' . $ this -> type . '".' ) ; } $ keysize = $ this -> cryptParams [ 'keysize' ] ; $ key = openssl_random_pseudo_bytes ( $ keysize ) ; if ( $ this -> type === self :: TRIPLE... | Generates a session key using the openssl - extension . In case of using DES3 - CBC the key is checked for a proper parity bits set . |
40,603 | public static function getRawThumbprint ( $ cert ) { $ arCert = explode ( "\n" , $ cert ) ; $ data = '' ; $ inData = false ; foreach ( $ arCert as $ curData ) { if ( ! $ inData ) { if ( strncmp ( $ curData , '-----BEGIN CERTIFICATE' , 22 ) == 0 ) { $ inData = true ; } } else { if ( strncmp ( $ curData , '-----END CERTI... | Get the raw thumbprint of a certificate |
40,604 | public function loadKey ( $ key , $ isCert = false ) { if ( is_file ( $ key ) ) { $ this -> key = file_get_contents ( $ key ) ; } else { $ this -> key = $ key ; } if ( $ isCert ) { $ this -> key = openssl_x509_read ( $ this -> key ) ; openssl_x509_export ( $ this -> key , $ str_cert ) ; $ this -> x509Certificate = $ st... | Loads the given key or - with isFile set true - the key from the keyfile . |
40,605 | private function padISO10126 ( $ data , $ blockSize ) { if ( $ blockSize > 256 ) { throw new Exception ( 'Block size higher than 256 not allowed' ) ; } $ padChr = $ blockSize - ( strlen ( $ data ) % $ blockSize ) ; $ pattern = chr ( $ padChr ) ; return $ data . str_repeat ( $ pattern , $ padChr ) ; } | ISO 10126 Padding |
40,606 | private function unpadISO10126 ( $ data ) { $ padChr = substr ( $ data , - 1 ) ; $ padLen = ord ( $ padChr ) ; return substr ( $ data , 0 , - $ padLen ) ; } | Remove ISO 10126 Padding |
40,607 | public static function fromEncryptedKeyElement ( DOMElement $ element ) { $ objenc = new XMLSecEnc ( ) ; $ objenc -> setNode ( $ element ) ; if ( ! $ objKey = $ objenc -> locateKey ( ) ) { throw new Exception ( "Unable to locate algorithm for this Encrypted Key" ) ; } $ objKey -> isEncrypted = true ; $ objKey -> encryp... | Create key from an EncryptedKey - element . |
40,608 | public function insertSignature ( $ node , $ beforeNode = null ) { $ document = $ node -> ownerDocument ; $ signatureElement = $ document -> importNode ( $ this -> sigNode , true ) ; if ( $ beforeNode == null ) { $ node -> insertBefore ( $ signatureElement ) ; } else { $ node -> insertBefore ( $ signatureElement , $ be... | This function inserts the signature element . |
40,609 | public function addTransactionDetail ( $ amount , $ buyOrder , $ commerceCode = null ) { $ detail = new TransactionDetail ( ) ; $ detail -> amount = $ amount ; $ detail -> buyOrder = $ buyOrder ; $ detail -> commerceCode = $ commerceCode ? $ commerceCode : SecurityHelper :: getCommonName ( $ this -> service -> getCerti... | Add transactions details |
40,610 | public function addInscriptionInfo ( $ serviceId , $ rut , $ firstName , $ lastName1 , $ lastName2 , $ clientEmail , $ phoneNumber , $ expirationDate , $ commerceMail , $ uf = false ) { $ detail = new DetailInput ( ) ; $ detail -> serviceId = $ serviceId ; $ detail -> cardHolderId = $ rut ; $ detail -> cardHolderName =... | Add customer and subscription information |
40,611 | public function validateParametersBasedOnTransactionType ( $ transactionType , $ buyOrder , $ commerceCode , $ input ) { if ( $ transactionType == self :: TIENDA_MALL ) { if ( ! $ commerceCode ) { $ commerceCode = SecurityHelper :: getCommonName ( $ this -> service -> getCertificationBag ( ) -> getClientCertificate ( )... | Validates parameters based on transaction type |
40,612 | public function validateResponseCertificate ( ) { $ xmlResponse = $ this -> getLastRawResponse ( ) ; $ soapValidation = new SoapValidation ( $ xmlResponse , $ this -> certificationBag -> getServerCertificate ( ) ) ; $ validation = $ soapValidation -> getValidationResult ( ) ; if ( $ validation !== true ) { $ msg = 'Tra... | Verifies the authenticity of the last SOAP response |
40,613 | protected function callSoapMethod ( $ method ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; LogHandler :: log ( $ args , LoggerInterface :: LEVEL_INFO , 'request_object' ) ; try { $ response = call_user_func_array ( [ $ this -> getSoapClient ( ) , $ method ] , $ args ) ; LogHandler :: log ( $ response , Logg... | Call to SOAP client methods and validate their response |
40,614 | public function getWsdlUrl ( CertificationBag $ certificationBag , $ url = null ) { if ( $ url ) { return $ url ; } if ( $ certificationBag -> getEnvironment ( ) == CertificationBag :: PRODUCTION ) { return static :: PRODUCTION_WSDL ; } return static :: INTEGRATION_WSDL ; } | Get the WSDL URL |
40,615 | public function log ( $ data , $ level = self :: LEVEL_INFO , $ type = null ) { if ( ! is_string ( $ data ) ) { $ data = print_r ( $ data , true ) ; } file_put_contents ( $ this -> getLogDirectory ( ) . '/' . $ this -> getLogFilename ( ) , $ this -> getLogMessage ( $ data , $ level , $ type ) , FILE_APPEND ) ; } | Write or print a log |
40,616 | public static function oneclick ( CertificationBag $ certificationBag , $ wsdlUrl = null ) { $ service = new WebpayOneClickWebService ( $ certificationBag , $ wsdlUrl ) ; return new WebpayOneClick ( $ service ) ; } | Create a WebpayOneClick instance |
40,617 | public static function patpass ( CertificationBag $ certificationBag , $ wsdlUrl = null ) { $ service = new WebpayStandardWebService ( $ certificationBag , $ wsdlUrl ) ; return new WebpayPatPass ( $ service ) ; } | Create a WebpayPatPass instance |
40,618 | public static function normal ( CertificationBag $ certificationBag , $ wsdlUrl = null ) { $ service = new WebpayStandardWebService ( $ certificationBag , $ wsdlUrl ) ; return new WebpayNormal ( $ service ) ; } | Create a WebpayNormal instance |
40,619 | public static function mall ( CertificationBag $ certificationBag , $ wsdlUrl = null ) { $ service = new WebpayStandardWebService ( $ certificationBag , $ wsdlUrl ) ; return new WebpayMall ( $ service ) ; } | Create a WebpayMall instance |
40,620 | public static function integrationOneClick ( ) { $ private_key = dirname ( __FILE__ ) . '/certs/webpay-oneclick-integration/597020000547.key' ; $ client_certificate = dirname ( __FILE__ ) . '/certs/webpay-oneclick-integration/597020000547.crt' ; return new CertificationBag ( $ private_key , $ client_certificate , null ... | Create an instance of Webpay OneClick keys and certificates |
40,621 | public static function integrationWebpayNormal ( ) { $ private_key = dirname ( __FILE__ ) . '/certs/webpay-plus-integration/597020000541.key' ; $ client_certificate = dirname ( __FILE__ ) . '/certs/webpay-plus-integration/597020000541.crt' ; return new CertificationBag ( $ private_key , $ client_certificate , null , Ce... | Create an instance of Webpay Normal keys and certificates |
40,622 | public static function integrationPatPass ( ) { $ private_key = dirname ( __FILE__ ) . '/certs/webpay-patpass-integration/597020000548.key' ; $ client_certificate = dirname ( __FILE__ ) . '/certs/webpay-patpass-integration/597020000548.crt' ; return new CertificationBag ( $ private_key , $ client_certificate , null , C... | Create an instance of Webpay PatPass keys and certificates |
40,623 | public static function production ( $ client_private_key , $ client_certificate , $ server_certificate = null ) { $ env = CertificationBag :: PRODUCTION ; return new CertificationBag ( $ client_private_key , $ client_certificate , $ server_certificate , $ env ) ; } | Create a production instance of keys and certificates |
40,624 | public static function create ( $ client_private_key , $ client_certificate , $ server_certificate = null , $ environment = CertificationBag :: INTEGRATION ) { return new CertificationBag ( $ client_private_key , $ client_certificate , $ server_certificate , $ environment ) ; } | Create a generic instance of keys and certificates |
40,625 | public function initTransaction ( $ returnURL , $ finalURL , $ sessionId = null ) { return parent :: initTransaction ( $ returnURL , $ finalURL , $ sessionId , self :: PATPASS ) ; } | Initializes a paid subscription transaction |
40,626 | public static function redirectHTML ( $ url , $ token = '' , $ field_name = 'TBK_TOKEN' ) { if ( ! $ token ) { $ token = $ _POST [ 'token_ws' ] ; } return self :: addHtmlWrapper ( self :: getForm ( $ url , $ token , $ field_name ) ) ; } | Redirect to Webpay |
40,627 | public static function getForm ( $ url , $ token , $ field_name ) { $ rand = uniqid ( ) ; return ' <form action="' . $ url . '" id="webpay-form-' . $ rand . '" method="POST"> <input type="hidden" name="' . $ field_name . '" value="' . $ token . '" /> </form> <script>document.getElementBy... | Create a HTML form |
40,628 | public function initTransaction ( $ returnURL , $ finalURL , $ buyOrder , $ sessionId = null , $ commerceCode = null ) { return parent :: initTransaction ( $ returnURL , $ finalURL , $ sessionId , self :: TIENDA_MALL , $ buyOrder , $ commerceCode ) ; } | Initialize a Mall transaction on Webpay |
40,629 | public function __doRequest ( $ request , $ location , $ action , $ version , $ oneWay = 0 ) { LogHandler :: log ( [ 'location' => $ location , 'xml' => $ request ] , LoggerInterface :: LEVEL_INFO , 'unsigned_request_raw' ) ; $ doc = new DOMDocument ( '1.0' ) ; $ doc -> loadXML ( $ request ) ; $ objWSSE = new WSSESoap ... | Execute SOAP request |
40,630 | public static function getCommonName ( $ X509Cert ) { if ( is_file ( $ X509Cert ) ) { $ handler = fopen ( $ X509Cert , "r" ) ; $ cert = fread ( $ handler , 8192 ) ; fclose ( $ handler ) ; } else { $ cert = $ X509Cert ; } $ cert_as_array = openssl_x509_parse ( $ cert ) ; return $ cert_as_array [ 'subject' ] [ 'CN' ] ; } | Get the common name of the certificate |
40,631 | public function collect ( ) { ksort ( $ this -> bundles , SORT_FLAG_CASE | SORT_STRING ) ; return new Value \ SymfonyKernelSystemInfo ( [ 'environment' => $ this -> kernel -> getEnvironment ( ) , 'debugMode' => $ this -> kernel -> isDebug ( ) , 'version' => Kernel :: VERSION , 'bundles' => $ this -> bundles , 'rootDir'... | Collects information about the Symfony kernel . |
40,632 | public function collect ( ) { if ( $ this -> value ) { return $ this -> value ; } if ( ! file_exists ( $ this -> lockFile ) ) { throw new Exception \ ComposerLockFileNotFoundException ( $ this -> lockFile ) ; } $ packages = [ ] ; $ rootAliases = [ ] ; $ lockData = json_decode ( file_get_contents ( $ this -> lockFile ) ... | Collects information about installed composer packages . |
40,633 | public function process ( ContainerBuilder $ container ) { if ( ! $ container -> has ( 'support_tools.system_info.collector_registry' ) ) { return ; } $ infoCollectorsTagged = $ container -> findTaggedServiceIds ( 'support_tools.system_info.collector' ) ; $ infoCollectors = [ ] ; foreach ( $ infoCollectorsTagged as $ i... | Registers the SystemInfoCollector into the system info collector registry . |
40,634 | public function process ( ContainerBuilder $ container ) { if ( ! $ container -> has ( 'ezpublish.view_builder.registry' ) ) { return ; } $ viewBuilderRegistry = $ container -> findDefinition ( 'ezpublish.view_builder.registry' ) ; $ viewBuilders = [ $ container -> findDefinition ( 'support_tools.view.system_info_view_... | Registers the SystemInfoViewBuilder into the view builder registry . |
40,635 | public function collect ( ) { return new Value \ HardwareSystemInfo ( [ 'cpuType' => $ this -> ezcSystemInfo -> cpuType , 'cpuSpeed' => $ this -> ezcSystemInfo -> cpuSpeed , 'cpuCount' => $ this -> ezcSystemInfo -> cpuCount , 'memorySize' => $ this -> ezcSystemInfo -> memorySize , ] ) ; } | Collects information about the hardware eZ Platform is installed on . - cpu information - memory size . |
40,636 | public function collect ( ) { $ properties = [ 'version' => PHP_VERSION , 'acceleratorEnabled' => false , ] ; if ( $ this -> ezcSystemInfo -> phpAccelerator ) { $ properties = array_merge ( $ properties , [ 'acceleratorEnabled' => $ this -> ezcSystemInfo -> phpAccelerator -> isEnabled , 'acceleratorName' => $ this -> e... | Collects information about the PHP installation eZ Platform is using . - php version - php accelerator info . |
40,637 | public function process ( ContainerBuilder $ container ) { if ( ! $ container -> has ( 'support_tools.system_info.output_registry' ) ) { return ; } $ outputFormattersTagged = $ container -> findTaggedServiceIds ( 'support_tools.system_info.output_format' ) ; $ outputFormatters = [ ] ; foreach ( $ outputFormattersTagged... | Registers the OutputFormat tagged services into the output format registry . |
40,638 | public function collect ( ) { return new Value \ DatabaseSystemInfo ( [ 'type' => $ this -> connection -> getDatabasePlatform ( ) -> getName ( ) , 'name' => $ this -> connection -> getDatabase ( ) , 'host' => $ this -> connection -> getHost ( ) , 'username' => $ this -> connection -> getUsername ( ) , ] ) ; } | Collects information about the database eZ Platform is using . - type - name - host - username . |
40,639 | public function isTrelloWebhook ( Request $ request ) { if ( ! $ request -> getMethod ( ) === 'POST' ) { return false ; } if ( ! $ request -> headers -> has ( 'X-Trello-Webhook' ) ) { return false ; } return true ; } | Checks whether a given request is a Trello webhook |
40,640 | public function update ( $ id , $ itemId , array $ data ) { $ this -> validateRequiredParameters ( array ( 'name' , 'state' ) , $ data ) ; $ this -> remove ( $ id , $ itemId ) ; return $ this -> create ( $ id , $ data [ 'name' ] , $ data [ 'state' ] , $ data ) ; } | Update an item in the given checklist |
40,641 | protected function update ( ) { $ this -> preUpdate ( ) ; $ this -> data = $ this -> api -> update ( $ this -> id , $ this -> data ) ; $ this -> postUpdate ( ) ; return $ this ; } | Update the object through API |
40,642 | protected function create ( ) { $ this -> preCreate ( ) ; $ this -> data = $ this -> api -> create ( $ this -> data ) ; $ this -> id = $ this -> data [ 'id' ] ; $ this -> postCreate ( ) ; return $ this ; } | Create the object through API |
40,643 | public function api ( $ name ) { switch ( $ name ) { case 'action' : case 'actions' : $ api = new Api \ Action ( $ this ) ; break ; case 'board' : case 'boards' : $ api = new Api \ Board ( $ this ) ; break ; case 'card' : case 'cards' : $ api = new Api \ Card ( $ this ) ; break ; case 'checklist' : case 'checklists' : ... | Get an API by name |
40,644 | public function getField ( $ id , $ field ) { if ( ! in_array ( $ field , static :: $ fields ) ) { throw new InvalidArgumentException ( sprintf ( 'There is no field named %s.' , $ field ) ) ; } $ response = $ this -> get ( $ this -> path . '/' . rawurlencode ( $ id ) . '/' . rawurlencode ( $ field ) ) ; return isset ( ... | Get a field value by field name |
40,645 | protected function createParametersBody ( array $ parameters ) { foreach ( $ parameters as $ name => $ parameter ) { if ( is_bool ( $ parameter ) ) { $ parameters [ $ name ] = $ parameter ? 'true' : 'false' ; } elseif ( is_array ( $ parameter ) ) { foreach ( $ parameter as $ subName => $ subParameter ) { if ( is_bool (... | Prepare request parameters . |
40,646 | protected function validateRequiredParameters ( array $ required , array $ params ) { foreach ( $ required as $ param ) { if ( ! isset ( $ params [ $ param ] ) ) { throw new MissingArgumentException ( sprintf ( 'The "%s" parameter is required.' , $ param ) ) ; } } } | Validate parameters array |
40,647 | protected function validateAllowedParameters ( array $ allowed , $ params , $ paramName ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } foreach ( $ params as $ param ) { if ( ! in_array ( $ param , $ allowed ) ) { throw new InvalidArgumentException ( sprintf ( 'The "%s" parameter may contain only... | Validate allowed parameters array Checks whether the passed parameters are allowed |
40,648 | protected function validateAtLeastOneOf ( array $ atLeastOneOf , array $ params ) { foreach ( $ atLeastOneOf as $ param ) { if ( isset ( $ params [ $ param ] ) ) { return true ; } } throw new MissingArgumentException ( sprintf ( 'You need to provide at least one of the following parameters "%s".' , implode ( '", "' , $... | Validate that the params array includes at least one of the keys in a given array |
40,649 | public function status ( $ args ) { if ( isset ( $ args [ 0 ] ) ) { $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ errors = $ theme -> errors ( ) ; if ( is_wp_error ( $ errors ) ) { $ message = $ errors -> get_error_message ( ) ; WP_CLI :: error ( $ message ) ; } } parent :: status ( $ args ) ; } | Reveals the status of one or all themes . |
40,650 | public function activate ( $ args = array ( ) ) { $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ errors = $ theme -> errors ( ) ; if ( is_wp_error ( $ errors ) ) { $ message = $ errors -> get_error_message ( ) ; WP_CLI :: error ( $ message ) ; } $ name = $ theme -> get ( 'Name' ) ; if ( 'active' === $ th... | Activates a theme . |
40,651 | public function enable ( $ args , $ assoc_args ) { if ( ! is_multisite ( ) ) { WP_CLI :: error ( 'This is not a multisite installation.' ) ; } $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ name = $ theme -> get ( 'Name' ) ; $ _site = ! empty ( $ assoc_args [ 'network' ] ) ? '_site' : '' ; $ allowed_them... | Enables a theme on a WordPress multisite install . |
40,652 | public function path ( $ args , $ assoc_args ) { if ( empty ( $ args ) ) { $ path = WP_CONTENT_DIR . '/themes' ; } else { $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ path = $ theme -> get_stylesheet_directory ( ) ; if ( ! Utils \ get_flag_value ( $ assoc_args , 'dir' ) ) { $ path .= '/style.css' ; } }... | Gets the path to a theme or to the theme directory . |
40,653 | public function install ( $ args , $ assoc_args ) { $ theme_root = get_theme_root ( ) ; if ( $ theme_root && ! is_dir ( $ theme_root ) ) { wp_mkdir_p ( $ theme_root ) ; register_theme_directory ( $ theme_root ) ; } parent :: install ( $ args , $ assoc_args ) ; } | Installs one or more themes . |
40,654 | public function get ( $ args , $ assoc_args ) { $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ errors = $ theme -> errors ( ) ; if ( is_wp_error ( $ errors ) ) { $ message = $ errors -> get_error_message ( ) ; WP_CLI :: error ( $ message ) ; } $ theme_vars = [ 'name' , 'title' , 'version' , 'parent_theme... | Gets details about a theme . |
40,655 | public function update ( $ args , $ assoc_args ) { $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all ) ; if ( ! $ args ) { return ; } if ( isset ( $ assoc_args [ 'version' ] ) ) { foreach ( $ this -> fetcher -> get_many ( $ args ) as $ them... | Updates one or more themes . |
40,656 | public function is_installed ( $ args , $ assoc_args = array ( ) ) { $ theme = wp_get_theme ( $ args [ 0 ] ) ; if ( $ theme -> exists ( ) ) { WP_CLI :: halt ( 0 ) ; } else { WP_CLI :: halt ( 1 ) ; } } | Checks if a given theme is installed . |
40,657 | public function is_active ( $ args , $ assoc_args = array ( ) ) { $ theme = wp_get_theme ( $ args [ 0 ] ) ; if ( ! $ theme -> exists ( ) ) { WP_CLI :: halt ( 1 ) ; } $ this -> is_active_theme ( $ theme ) ? WP_CLI :: halt ( 0 ) : WP_CLI :: halt ( 1 ) ; } | Checks if a given theme is active . |
40,658 | public function delete ( $ args , $ assoc_args ) { $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all , 'delete' ) ; if ( ! $ args ) { return ; } $ force = Utils \ get_flag_value ( $ assoc_args , 'force' , false ) ; $ successes = 0 ; $ error... | Deletes one or more themes . |
40,659 | private static function get_template_path ( $ template ) { $ command_root = Utils \ phar_safe_path ( dirname ( __DIR__ ) ) ; $ template_path = "{$command_root}/templates/{$template}" ; if ( ! file_exists ( $ template_path ) ) { WP_CLI :: error ( "Couldn't find {$template}" ) ; } return $ template_path ; } | Gets the template path based on installation type . |
40,660 | protected function is_theme_version_valid ( $ slug , $ version ) { $ theme_info = themes_api ( 'theme_information' , array ( 'slug' => $ slug ) ) ; if ( is_wp_error ( $ theme_info ) ) { return '' ; } return ! version_compare ( $ version , $ theme_info -> version , '>' ) ; } | Check if current version of the theme is higher than the one available at WP . org . |
40,661 | protected static function alter_api_response ( $ response , $ version ) { if ( $ response -> version === $ version ) { return ; } $ response -> download_link = str_replace ( 'http://' , 'https://' , $ response -> download_link ) ; list ( $ link ) = explode ( $ response -> slug , $ response -> download_link ) ; if ( fal... | Prepare an API response for downloading a particular version of an item . |
40,662 | protected function has_update ( $ slug ) { $ update_list = get_site_transient ( $ this -> upgrade_transient ) ; return isset ( $ update_list -> response [ $ slug ] ) ; } | Check whether an item has an update available or not . |
40,663 | private function get_minor_or_patch_updates ( $ items , $ type ) { foreach ( $ items as $ i => $ item ) { $ wporg_url = sprintf ( 'https://api.wordpress.org/plugins/info/1.0/%s.json' , $ item [ 'name' ] ) ; $ response = Utils \ http_request ( 'GET' , $ wporg_url ) ; if ( 20 !== absint ( substr ( $ response -> status_co... | Get the minor or patch version for plugins with available updates |
40,664 | private function parse_url_host_component ( $ url , $ component ) { return function_exists ( 'wp_parse_url' ) ? wp_parse_url ( $ url , $ component ) : parse_url ( $ url , $ component ) ; } | Retrieves PHP_URL_HOST component from URL . |
40,665 | public function get ( $ args = array ( ) , $ assoc_args = array ( ) ) { if ( ! \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) && empty ( $ args ) ) { WP_CLI :: error ( 'You must specify at least one mod or use --all.' ) ; } if ( \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) ) { $ args = array (... | Gets one or more theme mods . |
40,666 | public function remove ( $ args = array ( ) , $ assoc_args = array ( ) ) { if ( ! \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) && empty ( $ args ) ) { WP_CLI :: error ( 'You must specify at least one mod or use --all.' ) ; } if ( \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'all' ) ) { remove_theme_... | Removes one or more theme mods . |
40,667 | public function set ( $ args = array ( ) , $ assoc_args = array ( ) ) { list ( $ mod , $ value ) = $ args ; set_theme_mod ( $ mod , $ value ) ; if ( get_theme_mod ( $ mod ) === $ value ) { WP_CLI :: success ( "Theme mod {$mod} set to {$value}." ) ; } else { WP_CLI :: success ( "Could not update theme mod {$mod}." ) ; }... | Sets the value of a theme mod . |
40,668 | public function activate ( $ args , $ assoc_args = array ( ) ) { $ network_wide = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all ) ; if ( ! $ args ) { return ; } $ successes = 0 ; $ e... | Activates one or more plugins . |
40,669 | public function deactivate ( $ args , $ assoc_args = array ( ) ) { $ network_wide = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; $ disable_all = Utils \ get_flag_value ( $ assoc_args , 'all' ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ disable_all ) ; if ( ! $ args ) { return ; } $ successes... | Deactivates one or more plugins . |
40,670 | public function toggle ( $ args , $ assoc_args = array ( ) ) { $ network_wide = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; $ successes = 0 ; $ errors = 0 ; $ plugins = $ this -> fetcher -> get_many ( $ args ) ; if ( count ( $ plugins ) < count ( $ args ) ) { $ errors = count ( $ args ) - count ( $ plugins ) ... | Toggles a plugin s activation state . |
40,671 | public function path ( $ args , $ assoc_args ) { $ path = untrailingslashit ( WP_PLUGIN_DIR ) ; if ( ! empty ( $ args ) ) { $ plugin = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ path .= '/' . $ plugin -> file ; if ( Utils \ get_flag_value ( $ assoc_args , 'dir' ) ) { $ path = dirname ( $ path ) ; } } WP_CLI ::... | Gets the path to a plugin or to the plugin directory . |
40,672 | public function update ( $ args , $ assoc_args ) { $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all ) ; if ( ! $ args ) { return ; } if ( isset ( $ assoc_args [ 'version' ] ) ) { foreach ( $ this -> fetcher -> get_many ( $ args ) as $ plug... | Updates one or more plugins . |
40,673 | public function install ( $ args , $ assoc_args ) { if ( ! is_dir ( WP_PLUGIN_DIR ) ) { wp_mkdir_p ( WP_PLUGIN_DIR ) ; } parent :: install ( $ args , $ assoc_args ) ; } | Installs one or more plugins . |
40,674 | public function get ( $ args , $ assoc_args ) { $ plugin = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ file = $ plugin -> file ; $ plugin_data = get_plugin_data ( WP_PLUGIN_DIR . '/' . $ file , false , false ) ; $ plugin_obj = ( object ) [ 'name' => Utils \ get_plugin_name ( $ file ) , 'title' => $ plugin_data ... | Gets details about an installed plugin . |
40,675 | public function uninstall ( $ args , $ assoc_args = array ( ) ) { $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all , 'uninstall' ) ; if ( ! $ args ) { return ; } $ successes = 0 ; $ errors = 0 ; $ plugins = $ this -> fetcher -> get_many ( ... | Uninstalls one or more plugins . |
40,676 | public function is_installed ( $ args , $ assoc_args = array ( ) ) { if ( $ this -> fetcher -> get ( $ args [ 0 ] ) ) { WP_CLI :: halt ( 0 ) ; } else { WP_CLI :: halt ( 1 ) ; } } | Checks if a given plugin is installed . |
40,677 | public function is_active ( $ args , $ assoc_args = array ( ) ) { $ network_wide = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; $ plugin = $ this -> fetcher -> get ( $ args [ 0 ] ) ; if ( ! $ plugin ) { WP_CLI :: halt ( 1 ) ; } $ this -> check_active ( $ plugin -> file , $ network_wide ) ? WP_CLI :: halt ( 0 )... | Checks if a given plugin is active . |
40,678 | public function delete ( $ args , $ assoc_args = array ( ) ) { $ all = Utils \ get_flag_value ( $ assoc_args , 'all' , false ) ; $ args = $ this -> check_optional_args_and_all ( $ args , $ all , 'delete' ) ; if ( ! $ args ) { return ; } $ successes = 0 ; $ errors = 0 ; foreach ( $ this -> fetcher -> get_many ( $ args )... | Deletes plugin files without deactivating or uninstalling . |
40,679 | private function get_details ( $ file ) { $ plugin_folder = get_plugins ( '/' . plugin_basename ( dirname ( $ file ) ) ) ; $ plugin_file = Utils \ basename ( $ file ) ; return $ plugin_folder [ $ plugin_file ] ; } | Gets the details of a plugin . |
40,680 | public function get ( $ name ) { foreach ( apply_filters ( 'all_plugins' , get_plugins ( ) ) as $ file => $ _ ) { if ( "$name.php" === $ file || ( $ name && $ file === $ name ) || ( dirname ( $ file ) === $ name && '.' !== $ name ) ) { return ( object ) compact ( 'name' , 'file' ) ; } } return false ; } | Get a plugin object by name |
40,681 | public function setAttributionInfo ( $ jsonEncoded ) { $ decoded = json_decode ( $ jsonEncoded , $ assoc = true ) ; if ( ! is_array ( $ decoded ) ) { throw new Exception ( "setAttributionInfo() is expecting a JSON encoded string, $jsonEncoded given" ) ; } $ this -> attributionInfo = $ decoded ; return $ this ; } | Sets the attribution information to the visit so that subsequent Goal conversions are properly attributed to the right Referrer URL timestamp Campaign Name & Keyword . |
40,682 | public function getCustomVariable ( $ id , $ scope = 'visit' ) { if ( $ scope == 'page' ) { return isset ( $ this -> pageCustomVar [ $ id ] ) ? $ this -> pageCustomVar [ $ id ] : false ; } elseif ( $ scope == 'event' ) { return isset ( $ this -> eventCustomVar [ $ id ] ) ? $ this -> eventCustomVar [ $ id ] : false ; } ... | Returns the currently assigned Custom Variable . |
40,683 | public function setNewVisitorId ( ) { $ this -> randomVisitorId = substr ( md5 ( uniqid ( rand ( ) , true ) ) , 0 , self :: LENGTH_VISITOR_ID ) ; $ this -> userId = false ; $ this -> forcedVisitorId = false ; $ this -> cookieVisitorId = false ; return $ this ; } | Sets the current visitor ID to a random new one . |
40,684 | public function enableCookies ( $ domain = '' , $ path = '/' ) { $ this -> configCookiesDisabled = false ; $ this -> configCookieDomain = self :: domainFixup ( $ domain ) ; $ this -> configCookiePath = $ path ; } | Enable Cookie Creation - this will cause a first party VisitorId cookie to be set when the VisitorId is set or reset |
40,685 | protected static function domainFixup ( $ domain ) { if ( strlen ( $ domain ) > 0 ) { $ dl = strlen ( $ domain ) - 1 ; if ( $ domain { $ dl } === '.' ) { $ domain = substr ( $ domain , 0 , $ dl ) ; } if ( substr ( $ domain , 0 , 2 ) === '*.' ) { $ domain = substr ( $ domain , 1 ) ; } } return $ domain ; } | Fix - up domain |
40,686 | protected function getCookieName ( $ cookieName ) { $ hash = substr ( sha1 ( ( $ this -> configCookieDomain == '' ? self :: getCurrentHost ( ) : $ this -> configCookieDomain ) . $ this -> configCookiePath ) , 0 , 4 ) ; return self :: FIRST_PARTY_COOKIES_PREFIX . $ cookieName . '.' . $ this -> idSite . '.' . $ hash ; } | Get cookie name with prefix and domain hash |
40,687 | public function doTrackEvent ( $ category , $ action , $ name = false , $ value = false ) { $ url = $ this -> getUrlTrackEvent ( $ category , $ action , $ name , $ value ) ; return $ this -> sendRequest ( $ url ) ; } | Tracks an event |
40,688 | public function doTrackContentImpression ( $ contentName , $ contentPiece = 'Unknown' , $ contentTarget = false ) { $ url = $ this -> getUrlTrackContentImpression ( $ contentName , $ contentPiece , $ contentTarget ) ; return $ this -> sendRequest ( $ url ) ; } | Tracks a content impression |
40,689 | public function doTrackSiteSearch ( $ keyword , $ category = '' , $ countResults = false ) { $ url = $ this -> getUrlTrackSiteSearch ( $ keyword , $ category , $ countResults ) ; return $ this -> sendRequest ( $ url ) ; } | Tracks an internal Site Search query and optionally tracks the Search Category and Search results Count . These are used to populate reports in Actions > Site Search . |
40,690 | public function doTrackGoal ( $ idGoal , $ revenue = 0.0 ) { $ url = $ this -> getUrlTrackGoal ( $ idGoal , $ revenue ) ; return $ this -> sendRequest ( $ url ) ; } | Records a Goal conversion |
40,691 | public function doTrackAction ( $ actionUrl , $ actionType ) { $ url = $ this -> getUrlTrackAction ( $ actionUrl , $ actionType ) ; return $ this -> sendRequest ( $ url ) ; } | Tracks a download or outlink |
40,692 | public function addEcommerceItem ( $ sku , $ name = '' , $ category = '' , $ price = 0.0 , $ quantity = 1 ) { if ( empty ( $ sku ) ) { throw new Exception ( "You must specify a SKU for the Ecommerce item" ) ; } $ price = $ this -> forceDotAsSeparatorForDecimalPoint ( $ price ) ; $ this -> ecommerceItems [ ] = array ( $... | Adds an item in the Ecommerce order . |
40,693 | public function doBulkTrack ( ) { if ( empty ( $ this -> storedTrackingActions ) ) { throw new Exception ( "Error: you must call the function doTrackPageView or doTrackGoal from this class, before calling this method doBulkTrack()" ) ; } $ data = array ( 'requests' => $ this -> storedTrackingActions ) ... | Sends all stored tracking actions at once . Only has an effect if bulk tracking is enabled . |
40,694 | public function doTrackEcommerceOrder ( $ orderId , $ grandTotal , $ subTotal = 0.0 , $ tax = 0.0 , $ shipping = 0.0 , $ discount = 0.0 ) { $ url = $ this -> getUrlTrackEcommerceOrder ( $ orderId , $ grandTotal , $ subTotal , $ tax , $ shipping , $ discount ) ; return $ this -> sendRequest ( $ url ) ; } | Tracks an Ecommerce order . |
40,695 | public function doPing ( ) { $ url = $ this -> getRequest ( $ this -> idSite ) ; $ url .= '&ping=1' ; return $ this -> sendRequest ( $ url ) ; } | Sends a ping request . |
40,696 | protected function getUrlTrackEcommerce ( $ grandTotal , $ subTotal = 0.0 , $ tax = 0.0 , $ shipping = 0.0 , $ discount = 0.0 ) { if ( ! is_numeric ( $ grandTotal ) ) { throw new Exception ( "You must specifiy a grandTotal for the Ecommerce order (or Cart update)" ) ; } $ url = $ this -> getRequest ( $ this -> idSite )... | Returns URL used to track Ecommerce orders |
40,697 | public function getUrlTrackPageView ( $ documentTitle = '' ) { $ url = $ this -> getRequest ( $ this -> idSite ) ; if ( strlen ( $ documentTitle ) > 0 ) { $ url .= '&action_name=' . urlencode ( $ documentTitle ) ; } return $ url ; } | Builds URL to track a page view . |
40,698 | public function getUrlTrackEvent ( $ category , $ action , $ name = false , $ value = false ) { $ url = $ this -> getRequest ( $ this -> idSite ) ; if ( strlen ( $ category ) == 0 ) { throw new Exception ( "You must specify an Event Category name (Music, Videos, Games...)." ) ; } if ( strlen ( $ action ) == 0 ) { throw... | Builds URL to track a custom event . |
40,699 | public function getUrlTrackSiteSearch ( $ keyword , $ category , $ countResults ) { $ url = $ this -> getRequest ( $ this -> idSite ) ; $ url .= '&search=' . urlencode ( $ keyword ) ; if ( strlen ( $ category ) > 0 ) { $ url .= '&search_cat=' . urlencode ( $ category ) ; } if ( ! empty ( $ countResults ) || $ countResu... | Builds URL to track a site search . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.