<commit_before><?php

require_once 'introtodonateform.civix.php';

/**
 * Implements introtodonateform_civicrm_buildform
 *
 */
function introtodonateform_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Contribute_Form_Contribution_Main') {
    if ($form->getAction() == CRM_Core_Action::ADD) {
      if (!empty($_GET["firstname"])) {
        $defaults['first_name'] = htmlspecialchars($_GET["firstname"]);
      }
      if (!empty($_GET["lastname"])) {
        $defaults['last_name'] = htmlspecialchars($_GET["lastname"]);
      }
      if (!empty($_GET["email"])) {
        $defaults['email-5'] = htmlspecialchars($_GET["email"]);
      }
      print_r($_GET["amount"]);
      print_r($form->_priceSet['fields']);
      die();
      // TODO: make radio buttons change
      if (!empty($_GET["amount"]) && !empty($form->_priceSet['fields'])) {
        $found = FALSE;
        foreach ($form->_priceset['fields'] as $field) {
          if (!empty($field['options'])) {
            foreach ($field['options'] as $option) {
              if (floatval(CRM_Utils_Array::value('amount', $option)) == floatval($_GET["amount"])) {
                //we found the price option that matches the amount
                $defaults['price_' . $field['id']] = $option['id'];
                $RadioId = $field['id'];
                $found = TRUE;
                break 2;
              }
            }
          }
          if ($field['option']['name'] == 'other_amount') {
            $other = $field['option']['id'];
          }
        }
        //handle amount not found
        if (!$found) {
          $defaults['price_' . $RadioId] = 0;
          $defaults['price_' . $other] = $_GET["amount"];
        }
      }
      $form->setDefaults($defaults);<commit_msg>took out dies<commit_after><?php

require_once 'introtodonateform.civix.php';

/**
 * Implements introtodonateform_civicrm_buildform
 *
 */
function introtodonateform_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Contribute_Form_Contribution_Main') {
    if ($form->getAction() == CRM_Core_Action::ADD) {
      if (!empty($_GET["firstname"])) {
        $defaults['first_name'] = htmlspecialchars($_GET["firstname"]);
      }
      if (!empty($_GET["lastname"])) {
        $defaults['last_name'] = htmlspecialchars($_GET["lastname"]);
      }
      if (!empty($_GET["email"])) {
        $defaults['email-5'] = htmlspecialchars($_GET["email"]);
      }
      print_r($_GET["amount"]);
      print_r($form->_priceSet['fields']);
      die();
      // TODO: make radio buttons change
      if (!empty($_GET["amount"]) && !empty($form->_priceSet['fields'])) {
        $found = FALSE;
        foreach ($form->_priceSet['fields'] as $field) {
          if (!empty($field['options'])) {
            foreach ($field['options'] as $option) {
              if (floatval(CRM_Utils_Array::value('amount', $option)) == floatval($_GET["amount"])) {
                //we found the price option that matches the amount
                $defaults['price_' . $field['id']] = $option['id'];
                $RadioId = $field['id'];
                $found = TRUE;
                break 2;
              }
            }
          }
          if ($field['option']['name'] == 'other_amount') {
            $other = $field['option']['id'];
          }
        }
        //handle amount not found
        if (!$found) {
          $defaults['price_' . $RadioId] = 0;
          $defaults['price_' . $other] = $_GET["amount"];
        }
      }
      $form->setDefaults($defaults);
{'fraction_non_alphanumeric': 0.18665158371040724, 'fraction_numerical': 0.0016968325791855204, 'mean_word_length': 2.404234841193455, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '771402', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1051, 'n_words': 179}