<commit_before><?php

if (!class_exists('WMobilePack_Detect')) {

    /**
     *
     * WMobilePack_Detect
     *
     * Main class for detecting the user's device and browser.
     *
     */
    class WMobilePack_Detect {


        /* ----------------------------------*/
        /* Methods							 */
        /* ----------------------------------*/

        /**
         *
         * Create a premium management object and return it
         *
         * @return object
         *
         */
        protected function get_premium_manager()
        {
            // attempt to load the settings json
            if (!class_exists('WMobilePack_Premium')) {
                require_once(WMP_PLUGIN_PATH . 'inc/class-wmp-premium.php');
            }

            return new WMobilePack_Premium();
        }


        /**
         * Check if we have tablet themes support
         *
         * @return int
         */
        protected function is_allowed_tablets(){

            if (WMobilePack_Options::get_setting('premium_active') == 1 && WMobilePack_Options::get_setting('premium_api_key') != ''){

                $premium_manager = $this->get_premium_manager();
                $arr_config_premium = $premium_manager->get_premium_config();

                if ($arr_config_premium !== null && array_key_exists('tablet', $arr_config_premium))
                    return 1;
            }

            return 0;
        }


        /**
         * Detect IE tablet
         *
         * @return bool
         */
        protected function is_IE_tablet(){

            // Check user agent only for not detected devices (should exclude Windows phones)
            if (isset($_SERVER['HTTP_USER_AGENT'])){

                // Check if user agent is IE v>10 ex: Trident/6.0 or Trident/7.0 (for IE11) with Touch
                preg_match("@Trident/([0-9]{1,}[\.0-9]{0,}); Touch@", $_SERVER['HTTP_USER_AGENT'], $matches);

                // if IE version is equal or more than 10
                if (isset($matches[1]) && $matches[1] >= 6)
                    return true;
            }

            return false;
        }



        /**
         *
         * Check the browser's user agent and return true if the device is a supported smartphone<commit_msg>Load theme on tablets if acces is enabled<commit_after><?php

if (!class_exists('WMobilePack_Detect')) {

    /**
     *
     * WMobilePack_Detect
     *
     * Main class for detecting the user's device and browser.
     *
     */
    class WMobilePack_Detect {


        /* ----------------------------------*/
        /* Methods							 */
        /* ----------------------------------*/

        /**
         *
         * Create a premium management object and return it
         *
         * @return object
         *
         */
        protected function get_premium_manager()
        {
            // attempt to load the settings json
            if (!class_exists('WMobilePack_Premium')) {
                require_once(WMP_PLUGIN_PATH . 'inc/class-wmp-premium.php');
            }

            return new WMobilePack_Premium();
        }


        /**
         * Check if we have tablet themes support
         *
         * @return int
         */
        protected function is_allowed_tablets(){

            if (WMobilePack_Options::get_setting('premium_active') == 1 && WMobilePack_Options::get_setting('premium_api_key') != ''){

                $premium_manager = $this->get_premium_manager();
                $arr_config_premium = $premium_manager->get_premium_config();

                if ($arr_config_premium !== null && array_key_exists('tablet', $arr_config_premium)){
                    return 1;
				}

            } elseif (WMobilePack_Options::get_setting('enable_tablets') == 1) {
				return 1;
			}

            return 0;
        }


        /**
         * Detect IE tablet
         *
         * @return bool
         */
        protected function is_IE_tablet(){

            // Check user agent only for not detected devices (should exclude Windows phones)
            if (isset($_SERVER['HTTP_USER_AGENT'])){

                // Check if user agent is IE v>10 ex: Trident/6.0 or Trident/7.0 (for IE11) with Touch
                preg_match("@Trident/([0-9]{1,}[\.0-9]{0,}); Touch@", $_SERVER['HTTP_USER_AGENT'], $matches);

                // if IE version is equal or more than 10
                if (isset($matches[1]) && $matches[1] >= 6)
                    return true;
            }

            return false;
        }



        /**
         *
         * Check the browser's user agent and return true if the device is a supported smartphone
{'fraction_non_alphanumeric': 0.13659905049633148, 'fraction_numerical': 0.009926629261976695, 'mean_word_length': 1.4510840824960338, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4194880', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1207, 'n_words': 299}