<commit_before><?php
namespace Ank91\Plugins\Ank_Google_Map;
/**
 * Class Ank_Google_Map_Frontend
 * @package Ank91\Ank_Google_Map_Plugin
 */
class Ank_Google_Map_Frontend
{

    private $db_options = array();

    function __construct()
    {

        /* Register our short-code [ank_google_map] */
        add_shortcode('ank_google_map', array($this, 'process_shortcode'));
        /* Store database options for later use */
        $this->db_options = get_option('ank_google_map');
    }


    /**
     * Returns dynamic javascript options to be used by frontend js
     * @return array
     */
    private function get_js_options()
    {
        $options = $this->db_options;

        $map_type_array = array(
            1 => 'ROADMAP',
            2 => 'SATELLITE',
            3 => 'HYBRID',
            4 => 'TERRAIN',
        );

        $marker_anim_array = array(
            1 => 'NONE',
            2 => 'BOUNCE',
            3 => 'DROP',
        );

        $return_array = array(
            'map' => array(
                'lat' => $options['map_Lat'],
                'lng' => $options['map_Lng'],
                'zoom' => $options['map_zoom'],
                'type' => $map_type_array[$options['map_type']],
            ),
            'marker' => array(
                'enabled' => absint($options['marker_on']),
                'animation' => esc_js($marker_anim_array[$options['marker_anim']]),
                'title' => esc_js($options['marker_title']),
                'color' => $this->get_marker_url($options['marker_color']),
            ),
            'info_window' => array(
                'enabled' => absint($options['info_on']),
                'text' => wp_unslash($options['info_text']),
                'state' => absint($options['info_state']),
            ),
            //disabled controls, 1=disabled
            'controls' => array(
                'zoomControl' => absint($options['map_control_2']),
                'mapTypeControl' => absint($options['map_control_3']),
                'streetViewControl' => absint($options['map_control_4']),
            ),
            'mobile' => array(
                'scrollwheel' => absint($options['disable_mouse_wheel']),
                'draggable' => absint($options['disable_drag_mobile']),
            )
        );

        return $return_array;
    }


    /**
     * Function runs behind our short-code
     * Does not accept any parameters
     * @return string
     */
    function process_shortcode()
    {

        ob_start();// ob_start is here for a reason
        $options = $this->db_options;

        //Write canvas html always
        $w_unit = ($options["div_width_unit"] === 1) ? 'px' : '%';
        $b_color = ($options["div_border_color"] === '') ? '' : 'border:1px solid ' . esc_attr($options["div_border_color"]);
        echo '<div id="agm_map_canvas" style="margin: 0 auto;width:' . esc_attr($options["div_width"]) . $w_unit . ';height:' . esc_attr($options["div_height"]) . 'px;' . $b_color . '"></div>';


        //Decide language code
        $lang_code = (esc_attr($options['map_lang_code']) === '') ? '' : '&language=' . esc_attr($options['map_lang_code']);
        //Decide API key
        $api_key = $this->getAPIKey() ? '&key=' . $this->getAPIKey() : '';
        // Enqueue google map api
        wp_enqueue_script('agm-google-map-api', "https://maps.googleapis.com/maps/api/js?v=3.24" . $lang_code . $api_key, array(), null, true);

        // Enqueue frontend js file
        $is_min = (WP_DEBUG == 1) ? '' : '.min';
        wp_enqueue_script('agm-frontend-js', plugins_url('js/frontend' . $is_min . '.js', AGM_BASE_FILE), array('agm-google-map-api'), AGM_PLUGIN_VERSION, true);

        //wp inbuilt hack to print js options object just before this script
        wp_localize_script('agm-frontend-js', '_agm_opt', $this->get_js_options());
        return ob_get_clean();
    }


    /**
     * We depends on Google server for maker images
     * @source http://ex-ample.blogspot.in/2011/08/all-url-of-markers-used-by-google-maps.html
     */
    private function get_marker_url($id)
    {

        $base_url = 'https://maps.gstatic.com/intl/en_us/mapfiles/';
        $path = array(
            /* 1 is reserved for default */
            '2' => $base_url . 'marker.png',
            '3' => $base_url . 'marker_black.png',
            '4' => $base_url . 'marker_grey.png',
            '5' => $base_url . 'marker_orange.png',
            '6' => $base_url . 'marker_white.png',
            '7' => $base_url . 'marker_yellow.png',
            '8' => $base_url . 'marker_purple.png',
            '9' => $base_url . 'marker_green.png',
        );
        if (array_key_exists($id, $path)) {
            return $path[$id];
        } else {
            return false;
        }

    }

    /**
     * Check if user has defined the constant or not and return the constant value
     * @return bool|string
     */
    private function getAPIKey()
    {
        if (defined('AGM_API_KEY')) {
            if (!empty(AGM_API_KEY)) {
                return trim(AGM_API_KEY);
            }
        }
        return false;
    }


}<commit_msg>Fix 'T_PAAMAYIM_NEKOTAYIM' parse error<commit_after><?php
namespace Ank91\Plugins\Ank_Google_Map;
/**
 * Class Ank_Google_Map_Frontend
 * @package Ank91\Ank_Google_Map_Plugin
 */
class Ank_Google_Map_Frontend
{

    private $db_options = array();

    function __construct()
    {

        /* Register our short-code [ank_google_map] */
        add_shortcode('ank_google_map', array($this, 'process_shortcode'));
        /* Store database options for later use */
        $this->db_options = get_option('ank_google_map');
    }


    /**
     * Returns dynamic javascript options to be used by frontend js
     * @return array
     */
    private function get_js_options()
    {
        $options = $this->db_options;

        $map_type_array = array(
            1 => 'ROADMAP',
            2 => 'SATELLITE',
            3 => 'HYBRID',
            4 => 'TERRAIN',
        );

        $marker_anim_array = array(
            1 => 'NONE',
            2 => 'BOUNCE',
            3 => 'DROP',
        );

        $return_array = array(
            'map' => array(
                'lat' => $options['map_Lat'],
                'lng' => $options['map_Lng'],
                'zoom' => $options['map_zoom'],
                'type' => $map_type_array[$options['map_type']],
            ),
            'marker' => array(
                'enabled' => absint($options['marker_on']),
                'animation' => esc_js($marker_anim_array[$options['marker_anim']]),
                'title' => esc_js($options['marker_title']),
                'color' => $this->get_marker_url($options['marker_color']),
            ),
            'info_window' => array(
                'enabled' => absint($options['info_on']),
                'text' => wp_unslash($options['info_text']),
                'state' => absint($options['info_state']),
            ),
            //disabled controls, 1=disabled
            'controls' => array(
                'zoomControl' => absint($options['map_control_2']),
                'mapTypeControl' => absint($options['map_control_3']),
                'streetViewControl' => absint($options['map_control_4']),
            ),
            'mobile' => array(
                'scrollwheel' => absint($options['disable_mouse_wheel']),
                'draggable' => absint($options['disable_drag_mobile']),
            )
        );

        return $return_array;
    }


    /**
     * Function runs behind our short-code
     * Does not accept any parameters
     * @return string
     */
    function process_shortcode()
    {

        ob_start();// ob_start is here for a reason
        $options = $this->db_options;

        //Write canvas html always
        $w_unit = ($options["div_width_unit"] === 1) ? 'px' : '%';
        $b_color = ($options["div_border_color"] === '') ? '' : 'border:1px solid ' . esc_attr($options["div_border_color"]);
        echo '<div id="agm_map_canvas" style="margin: 0 auto;width:' . esc_attr($options["div_width"]) . $w_unit . ';height:' . esc_attr($options["div_height"]) . 'px;' . $b_color . '"></div>';


        //Decide language code
        $lang_code = (esc_attr($options['map_lang_code']) === '') ? '' : '&language=' . esc_attr($options['map_lang_code']);
        //Decide API key
        $api_key = $this->getAPIKey() ? '&key=' . $this->getAPIKey() : '';
        // Enqueue google map api
        wp_enqueue_script('agm-google-map-api', "https://maps.googleapis.com/maps/api/js?v=3.24" . $lang_code . $api_key, array(), null, true);

        // Enqueue frontend js file
        $is_min = (WP_DEBUG == 1) ? '' : '.min';
        wp_enqueue_script('agm-frontend-js', plugins_url('js/frontend' . $is_min . '.js', AGM_BASE_FILE), array('agm-google-map-api'), AGM_PLUGIN_VERSION, true);

        //wp inbuilt hack to print js options object just before this script
        wp_localize_script('agm-frontend-js', '_agm_opt', $this->get_js_options());
        return ob_get_clean();
    }


    /**
     * We depends on Google server for maker images
     * @source http://ex-ample.blogspot.in/2011/08/all-url-of-markers-used-by-google-maps.html
     */
    private function get_marker_url($id)
    {

        $base_url = 'https://maps.gstatic.com/intl/en_us/mapfiles/';
        $path = array(
            /* 1 is reserved for default */
            '2' => $base_url . 'marker.png',
            '3' => $base_url . 'marker_black.png',
            '4' => $base_url . 'marker_grey.png',
            '5' => $base_url . 'marker_orange.png',
            '6' => $base_url . 'marker_white.png',
            '7' => $base_url . 'marker_yellow.png',
            '8' => $base_url . 'marker_purple.png',
            '9' => $base_url . 'marker_green.png',
        );
        if (array_key_exists($id, $path)) {
            return $path[$id];
        } else {
            return false;
        }

    }

    /**
     * Check if user has defined the constant or not and return the constant value
     * @return bool|string
     */
    private function getAPIKey()
    {
        if (defined('AGM_API_KEY')) {
            return trim(AGM_API_KEY);
        }
        return false;
    }


}
{'fraction_non_alphanumeric': 0.16075949367088607, 'fraction_numerical': 0.0072054527750730285, 'mean_word_length': 2.045966785290629, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 93, 'https://': 4, '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': '883333', 'n_tokens_mistral': 3298, 'n_tokens_neox': 3164, 'n_words': 603}