<commit_before><?php

/**
 * Plugin Name: QuantiModo
 * Plugin URI: https://app.quantimo.do
 * Description: A WordPress plugin that allows users to login or register by
 * authenticating with an existing Quantimodo account. Easily
 * drops into new or existing sites, integrates with existing users.
 * Version: 0.3.7
 * Author: QuantiModo
 * Author URI: https://app.quantimo.do
 * License: GPL2
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 */

/** Load composer */
$composer = dirname(__FILE__) . '/vendor/autoload.php';
if (file_exists($composer)) {
    require_once $composer;
}

// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}

require_once('includes/QMWPAuth.php');

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

/*
 * Plugin Class
*/

Class QMWP
{
    // singleton class pattern:
    protected static $instance = NULL;

    /**
     * @return null|QMWP
     */
    public static function get_instance()
    {
        NULL === self::$instance and self::$instance = new self;
        return self::$instance;
    }

    // set a version that we can use for performing plugin updates, this should always match the plugin version:
    const PLUGIN_VERSION = "0.3.7";

    // define the settings used by this plugin; this array will be used for registering settings, applying default values, and deleting them during uninstall:
    private $settings = array(
        'qmwp_show_login_messages' => 0,                                // 0, 1
        'qmwp_login_redirect' => 'home_page',                            // home_page, last_page, specific_page, admin_dashboard, profile_page, custom_url
        'qmwp_login_redirect_page' => 0,                                // any whole number (wordpress page id)
        'qmwp_login_redirect_url' => '',                                // any string (url)
        'qmwp_logout_redirect' => 'home_page',                            // home_page, last_page, specific_page, admin_dashboard, profile_page, custom_url, default_handling
        'qmwp_logout_redirect_page' => 0,                                // any whole number (wordpress page id)
        'qmwp_logout_redirect_url' => '',                                // any string (url)
        'qmwp_logout_inactive_users' => 0,                                // any whole number (minutes)
        'qmwp_hide_wordpress_login_form' => 0,                            // 0, 1
        'qmwp_logo_links_to_site' => 0,                                    // 0, 1
        'qmwp_logo_image' => '',                                        // any string (image url)
        'qmwp_bg_image' => '',                                            // any string (image url)
        'qmwp_login_form_show_login_screen' => 'Login Screen',            // any string (name of a custom login form shortcode design)
        'qmwp_login_form_show_profile_page' => 'Profile Page',            // any string (name of a custom login form shortcode design)
        'qmwp_login_form_show_comments_section' => 'None',                // any string (name of a custom login form shortcode design)
        'qmwp_login_form_designs' => array(                                // array of shortcode designs to be included by default; same array signature as the shortcode function uses
            'Login Screen' => array(
                'icon_set' => 'none',
                'layout' => 'buttons-column',
                'align' => 'center',
                'show_login' => 'conditional',
                'show_logout' => 'conditional',
                'button_prefix' => 'Login with',
                'logged_out_title' => '',
                'logged_in_title' => 'You are already logged in.',
                'logging_in_title' => 'Logging in...',
                'logging_out_title' => 'Logging out...',
                'style' => '',
                'class' => '',
            ),
            'Profile Page' => array(
                'icon_set' => 'none',
                'layout' => 'buttons-row',
                'align' => 'left',
                'show_login' => 'conditional',
                'show_logout' => 'never',
                'button_prefix' => 'Link',
                'logged_out_title' => 'Select a provider:',
                'logged_in_title' => 'Select a provider:',
                'logging_in_title' => 'Authenticating...',
                'logging_out_title' => 'Logging out...',
                'style' => '',
                'class' => '',
            ),
        ),
        'qmwp_suppress_welcome_email' => 0,                                // 0, 1
        'qmwp_new_user_role' => 'contributor',                            // role
        'qmwp_google_api_enabled' => 0,                                    // 0, 1
        'qmwp_google_api_id' => '',                                        // any string
        'qmwp_google_api_secret' => '',                                    // any string
        'qmwp_quantimodo_api_enabled' => 0,                                    // 0, 1
        'qmwp_quantimodo_api_id' => '',                                        // any string
        'qmwp_quantimodo_api_secret' => '',                                    // any string
        'qmwp_x_mashape_key' => '',                                     //any string
        'qmwp_http_util' => 'curl',                                        // curl, stream-context
        'qmwp_http_util_verify_ssl' => 1,                                // 0, 1
        'qmwp_restore_default_settings' => 0,                            // 0, 1
        'qmwp_delete_settings_on_uninstall' => 0,                        // 0, 1
        'qmwp_default_outcome_variable' => 'Overall Mood',
        'qmwp_default_outcome_variable_undesirable' => 'false',
        'qmwp_add_login_logout_nav_items' => 0,
        'qmwp_plugin_pages' => array(
            'Predictors/Outcomes Search (List)' => '[qmwp_search_correlations]',
            'Strongest Predictors of Mood (List)' => '[qmwp_search_correlations examined_variable_name="Overall Mood" show_predictors_or_outcomes="predictors"]',
            'Track Mood (Faces)' => '[qmwp_rating_faces tracked_variable_name="Overall Mood" negative="false"]',
            'Import Data' => '[qmwp_connectors]',
            'Predictors/Outcomes Analysis Charts' => '[qmwp_bargraph_scatterplot_timeline]',
            'Mood Over Time' => '[qmwp_timeline examined_variable_names="overall mood"]',
            'Timeline Chart' => '[qmwp_timeline]',
            'Track Anything' => '[qmwp_add_measurement]',
            'Track Emotions' => '[qmwp_add_measurement category="Mood"]',
            //'Track Physique' => '[qmwp_add_measurement category="Physique"]',
            'Track Physical Activity' => '[qmwp_add_measurement category="Physical Activity"]',<commit_msg>Use emotions instead of Mood category<commit_after><?php

/**
 * Plugin Name: QuantiModo
 * Plugin URI: https://app.quantimo.do
 * Description: A WordPress plugin that allows users to login or register by
 * authenticating with an existing Quantimodo account. Easily
 * drops into new or existing sites, integrates with existing users.
 * Version: 0.3.7
 * Author: QuantiModo
 * Author URI: https://app.quantimo.do
 * License: GPL2
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 */

/** Load composer */
$composer = dirname(__FILE__) . '/vendor/autoload.php';
if (file_exists($composer)) {
    require_once $composer;
}

// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}

require_once('includes/QMWPAuth.php');

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

/*
 * Plugin Class
*/

Class QMWP
{
    // singleton class pattern:
    protected static $instance = NULL;

    /**
     * @return null|QMWP
     */
    public static function get_instance()
    {
        NULL === self::$instance and self::$instance = new self;
        return self::$instance;
    }

    // set a version that we can use for performing plugin updates, this should always match the plugin version:
    const PLUGIN_VERSION = "0.3.7";

    // define the settings used by this plugin; this array will be used for registering settings, applying default values, and deleting them during uninstall:
    private $settings = array(
        'qmwp_show_login_messages' => 0,                                // 0, 1
        'qmwp_login_redirect' => 'home_page',                            // home_page, last_page, specific_page, admin_dashboard, profile_page, custom_url
        'qmwp_login_redirect_page' => 0,                                // any whole number (wordpress page id)
        'qmwp_login_redirect_url' => '',                                // any string (url)
        'qmwp_logout_redirect' => 'home_page',                            // home_page, last_page, specific_page, admin_dashboard, profile_page, custom_url, default_handling
        'qmwp_logout_redirect_page' => 0,                                // any whole number (wordpress page id)
        'qmwp_logout_redirect_url' => '',                                // any string (url)
        'qmwp_logout_inactive_users' => 0,                                // any whole number (minutes)
        'qmwp_hide_wordpress_login_form' => 0,                            // 0, 1
        'qmwp_logo_links_to_site' => 0,                                    // 0, 1
        'qmwp_logo_image' => '',                                        // any string (image url)
        'qmwp_bg_image' => '',                                            // any string (image url)
        'qmwp_login_form_show_login_screen' => 'Login Screen',            // any string (name of a custom login form shortcode design)
        'qmwp_login_form_show_profile_page' => 'Profile Page',            // any string (name of a custom login form shortcode design)
        'qmwp_login_form_show_comments_section' => 'None',                // any string (name of a custom login form shortcode design)
        'qmwp_login_form_designs' => array(                                // array of shortcode designs to be included by default; same array signature as the shortcode function uses
            'Login Screen' => array(
                'icon_set' => 'none',
                'layout' => 'buttons-column',
                'align' => 'center',
                'show_login' => 'conditional',
                'show_logout' => 'conditional',
                'button_prefix' => 'Login with',
                'logged_out_title' => '',
                'logged_in_title' => 'You are already logged in.',
                'logging_in_title' => 'Logging in...',
                'logging_out_title' => 'Logging out...',
                'style' => '',
                'class' => '',
            ),
            'Profile Page' => array(
                'icon_set' => 'none',
                'layout' => 'buttons-row',
                'align' => 'left',
                'show_login' => 'conditional',
                'show_logout' => 'never',
                'button_prefix' => 'Link',
                'logged_out_title' => 'Select a provider:',
                'logged_in_title' => 'Select a provider:',
                'logging_in_title' => 'Authenticating...',
                'logging_out_title' => 'Logging out...',
                'style' => '',
                'class' => '',
            ),
        ),
        'qmwp_suppress_welcome_email' => 0,                                // 0, 1
        'qmwp_new_user_role' => 'contributor',                            // role
        'qmwp_google_api_enabled' => 0,                                    // 0, 1
        'qmwp_google_api_id' => '',                                        // any string
        'qmwp_google_api_secret' => '',                                    // any string
        'qmwp_quantimodo_api_enabled' => 0,                                    // 0, 1
        'qmwp_quantimodo_api_id' => '',                                        // any string
        'qmwp_quantimodo_api_secret' => '',                                    // any string
        'qmwp_x_mashape_key' => '',                                     //any string
        'qmwp_http_util' => 'curl',                                        // curl, stream-context
        'qmwp_http_util_verify_ssl' => 1,                                // 0, 1
        'qmwp_restore_default_settings' => 0,                            // 0, 1
        'qmwp_delete_settings_on_uninstall' => 0,                        // 0, 1
        'qmwp_default_outcome_variable' => 'Overall Mood',
        'qmwp_default_outcome_variable_undesirable' => 'false',
        'qmwp_add_login_logout_nav_items' => 0,
        'qmwp_plugin_pages' => array(
            'Predictors/Outcomes Search (List)' => '[qmwp_search_correlations]',
            'Strongest Predictors of Mood (List)' => '[qmwp_search_correlations examined_variable_name="Overall Mood" show_predictors_or_outcomes="predictors"]',
            'Track Mood (Faces)' => '[qmwp_rating_faces tracked_variable_name="Overall Mood" negative="false"]',
            'Import Data' => '[qmwp_connectors]',
            'Predictors/Outcomes Analysis Charts' => '[qmwp_bargraph_scatterplot_timeline]',
            'Mood Over Time' => '[qmwp_timeline examined_variable_names="overall mood"]',
            'Timeline Chart' => '[qmwp_timeline]',
            'Track Anything' => '[qmwp_add_measurement]',
            'Track Emotions' => '[qmwp_add_measurement category="Emotions"]',
            //'Track Physique' => '[qmwp_add_measurement category="Physique"]',
            'Track Physical Activity' => '[qmwp_add_measurement category="Physical Activity"]',
{'fraction_non_alphanumeric': 0.11795774647887323, 'fraction_numerical': 0.005868544600938967, 'mean_word_length': 1.6826052735143644, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 143, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6655278', 'n_tokens_mistral': 3934, 'n_tokens_neox': 3725, 'n_words': 882}