aders ); } if ( $userAgent ) { $this->setUserAgent( $userAgent ); } // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront' if ( $this->getUserAgent() === 'Amazon CloudFront' ) { $cfHeaders = $this->getCfHeaders(); if ( array_key_exists( 'HTTP_CLOUDFRONT_IS_MOBILE_VIEWER', $cfHeaders ) && $cfHeaders['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER'] === 'true' ) { return true; } } $this->setDetectionType( self::DETECTION_TYPE_MOBILE ); if ( $this->checkHttpHeadersForMobile() ) { return true; } else { return $this->matchDetectionRulesAgainstUA(); } } /** * Check the HTTP headers for signs of mobile. * This is the fastest mobile check possible; it's used * inside isMobile() method. * * @return bool */ public function checkHttpHeadersForMobile() { foreach ( $this->getMobileHeaders() as $mobileHeader => $matchType ) { if ( isset( $this->httpHeaders[ $mobileHeader ] ) ) { if ( is_array( $matchType['matches'] ) ) { foreach ( $matchType['matches'] as $_match ) { if ( strpos( $this->httpHeaders[ $mobileHeader ], $_match ) !== false ) { return true; } } return false; } else { return true; } } } return false; } public function getMobileHeaders() { return self::$mobileHeaders; } /** * Find a detection rule that matches the current User-agent. * * @param null $userAgent deprecated * * @return boolean */ protected function matchDetectionRulesAgainstUA( $userAgent = null ) { // Begin general search. foreach ( $this->getRules() as $_regex ) { if ( empty( $_regex ) ) { continue; } if ( $this->match( $_regex, $userAgent ) ) { return true; } } return false; } /** * This method checks for a certain property in the * userAgent. * @todo: The httpHeaders part is not yet used. * * @param string $key * @param string $userAgent deprecated * @param string $httpHeaders deprecated * * @return bool|int|null */ public function is( $key, $userAgent = null, $httpHeaders = null ) { // Set the UA and HTTP headers only if needed (eg. batch mode). if ( $httpHeaders ) { $this->setHttpHeaders( $httpHeaders ); } if ( $userAgent ) { $this->setUserAgent( $userAgent ); } $this->setDetectionType( self::DETECTION_TYPE_EXTENDED ); return $this->matchUAAgainstKey( $key ); } /** * Check the version of the given property in the User-Agent. * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) * * @param string $propertyName The name of the property. See self::getProperties() array * keys for all possible properties. * @param string $type Either self::VERSION_TYPE_STRING to get a string value or * self::VERSION_TYPE_FLOAT indicating a float value. This parameter * is optional and defaults to self::VERSION_TYPE_STRING. Passing an * invalid parameter will default to the this type as well. * * @return string|float The version of the property we are trying to extract. */ public function version( $propertyName, $type = self::VERSION_TYPE_STRING ) { if ( empty( $propertyName ) ) { return false; } // set the $type to the default if we don't recognize the type if ( $type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT ) { $type = self::VERSION_TYPE_STRING; } $properties = self::getProperties(); // Check if the property exists in the properties array. if ( true === isset( $properties[ $propertyName ] ) ) { // Prepare the pattern to be matched. // Make sure we always deal with an array (string is converted). $properties[ $propertyName ] = (array) $properties[ $propertyName ]; foreach ( $properties[ $propertyName ] as $propertyMatchString ) { $propertyPattern = str_replace( '[VER]', self::VER, $propertyMatchString ); // Identify and extract the version. preg_match( sprintf( '#%s#is', $propertyPattern ), $this->userAgent, $match ); if ( false === empty( $match[1] ) ) { $version = ( $type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo( $match[1] ) : $match[1] ); return $version; } } } return false; } /** * Get the properties array. * * @return array */ public static function getProperties() { return self::$properties; } /** * Prepare the version number. * * @todo Remove the error supression from str_replace() call. * * @param string $ver The string version, like "2.6.21.2152"; * * @return float */ public function prepareVersionNo( $ver ) { $ver = str_replace( array( '_', ' ', '/' ), '.', $ver ); $arrVer = explode( '.', $ver, 2 ); if ( isset( $arrVer[1] ) ) { $arrVer[1] = @str_replace( '.', '', $arrVer[1] ); // @todo: treat strings versions. } return (float) implode( '.', $arrVer ); } }
Fatal error: Uncaught Error: Class 'WCCT_Mobile_Detect' not found in /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite.php:251 Stack trace: #0 /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite.php(220): WCCT_Core->wcct_mobile_check() #1 /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite.php(161): WCCT_Core->load_hooks() #2 /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite.php(328): WCCT_Core->__construct() #3 /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite. in /home/wesuppor/brandaholic.com.pk/wp-content/plugins/finale-woocommerce-sales-countdown-timer-discount/finale-woocommerce-sales-countdown-timer-discount-plugin-lite.php on line 251