<commit_before><?php
/*
Plugin Name: wordgun
Plugin URI: https://github.com/patrickshampine/wordgun
Description: A contact form plugin built using mailgun.
Version: 0.1
Author: <NAME>
Author URI: http://patrickshampine.com
Author Email: <EMAIL>
*/

class wordgun {

  function __construct() {
    add_action('admin_menu', array(&$this,'wordgun_admin_pages'));
    add_action('wp_enqueue_scripts', array(&$this,'wordgun_scripts'));
    add_shortcode('wordgun', array(&$this,'wordgun_shortcode'));
  }

  function wordgun_admin_pages() {
    add_menu_page('WordGun', 'WordGun', 'administrator', 'wordgun', array(&$this, 'wordgun_admin_options'), 'dashicons-email-alt', '102.161');
  }

  function wordgun_admin_options() {
    include_once('admin/wordgun-options.php');
  }

  function wordgun_scripts() {
    if(shortcode_exists('wordgun')) {

      $pluginDIR = plugins_url().'/wordgun/';
      $parameters = array(
        'dir' => $pluginDIR
        );

      wp_enqueue_script('wordgun-ajax', $pluginDIR.'js/ajax.js');
      wp_localize_script('wordgun-ajax', 'wordgun', $parameters );

      if(get_option('wg_bootstrap') === 'enabled') {
        wp_enqueue_style('wordgun-bootstrap', $pluginDIR.'css/bootstrap.min.css');
      }
    }
  }

  function wordgun_shortcode() {

    $wordgun =  '
      <form class="form" role="form" id="wordgun" method="POST">
        <input class="hidden" type="email" name="email_2" value="">
    ';

    if(get_option('wg_name') === 'enabled') {
    
      $name =  '<commit_msg>Only load scripts if shortcode exists in the_content<commit_after><?php
/*
Plugin Name: wordgun
Plugin URI: https://github.com/patrickshampine/wordgun
Description: A contact form plugin built using mailgun.
Version: 0.1
Author: <NAME>
Author URI: http://patrickshampine.com
Author Email: <EMAIL>
*/

class wordgun {

  function __construct() {
    add_action('admin_menu', array(&$this,'wordgun_admin_pages'));
    add_action('wp_enqueue_scripts', array(&$this,'wordgun_scripts'));
    add_shortcode('wordgun', array(&$this,'wordgun_shortcode'));
  }

  function wordgun_admin_pages() {
    add_menu_page('WordGun', 'WordGun', 'administrator', 'wordgun', array(&$this, 'wordgun_admin_options'), 'dashicons-email-alt', '102.161');
  }

  function wordgun_admin_options() {
    include_once('admin/wordgun-options.php');
  }

  function wordgun_scripts() {

    global $post;

    if(shortcode_exists('wordgun') && stripos($post->post_content,'[wordgun]') !== false) {

      $pluginDIR = plugins_url().'/wordgun/';
      $parameters = array(
        'dir' => $pluginDIR
        );

      wp_enqueue_script('wordgun-ajax', $pluginDIR.'js/ajax.js');
      wp_localize_script('wordgun-ajax', 'wordgun', $parameters );

      if(get_option('wg_bootstrap') === 'enabled') {
        wp_enqueue_style('wordgun-bootstrap', $pluginDIR.'css/bootstrap.min.css');
      }

    }

  }

  function wordgun_shortcode() {

    $wordgun =  '
      <form class="form" role="form" id="wordgun" method="POST">
        <input class="hidden" type="email" name="email_2" value="">
    ';

    if(get_option('wg_name') === 'enabled') {
    
      $name =  '
{'fraction_non_alphanumeric': 0.16862496030485868, 'fraction_numerical': 0.0057161003493172435, 'mean_word_length': 4.105348460291734, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 2, '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': '286307', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1030, 'n_words': 175}