/**
  * Handle the plugin configuration form.
  */
 public static function hookConfig()
 {
     // Gregorian / Julian Prefix switch
     $prevUseGregJulPrexifes = (int) (bool) get_option('date_search_use_gregjul_prefixes');
     $newUseGregJulPrexifes = (int) (bool) $_POST['date_search_use_gregjul_prefixes'];
     set_option('date_search_use_gregjul_prefixes', $newUseGregJulPrexifes);
     // Search All Fields switch
     $prevSearchAllFields = (int) (bool) get_option('date_search_search_all_fields');
     $newSearchAllFields = (int) (bool) $_POST['date_search_search_all_fields'];
     set_option('date_search_search_all_fields', $newSearchAllFields);
     // Limit Fields list (in case "Search All Fields" is false
     $oldLimitFields = get_option('date_search_limit_fields');
     $newLimitFields = array();
     $postIds = false;
     if (isset($_POST["date_search_limit_fields"])) {
         $postIds = $_POST["date_search_limit_fields"];
     }
     if (is_array($postIds)) {
         foreach ($postIds as $postId) {
             $postId = intval($postId);
             if ($postId) {
                 $newLimitFields[] = $postId;
             }
         }
     }
     sort($newLimitFields);
     $newLimitFields = json_encode($newLimitFields);
     set_option('date_search_limit_fields', $newLimitFields);
     // Search Relationship Comments switch
     $prevSearchRelComments = (int) (bool) get_option('date_search_search_rel_comments');
     $newSearchRelComments = (int) (bool) $_POST['date_search_search_rel_comments'];
     set_option('date_search_search_rel_comments', $newSearchRelComments);
     $reprocess = false;
     $reprocess = ($reprocess or $prevUseGregJulPrexifes != $newUseGregJulPrexifes);
     $reprocess = ($reprocess or $prevSearchAllFields != $newSearchAllFields);
     $reprocess = ($reprocess or !$newSearchAllFields && $oldLimitFields != $newLimitFields);
     $reprocess = ($reprocess or !$newSearchAllFields && $prevSearchRelComments != $newSearchRelComments);
     if ($reprocess) {
         SELF::_batchProcessExistingItems();
     }
     # echo "<pre>"; print_r($_POST); echo "</pre>"; die();
 }
 /**
  * Handle the plugin configuration form.
  */
 public static function hookConfig()
 {
     // Gregorian / Julian Prefix switch
     $useGregJulPrefixes = intval($_POST['date_search_use_gregjul_prefixes']);
     set_option('date_search_use_gregjul_prefixes', $useGregJulPrefixes);
     // Search All Fields switch
     $searchAllFields = (int) (bool) $_POST['date_search_search_all_fields'];
     set_option('date_search_search_all_fields', $searchAllFields);
     // Limit Fields list (in case "Search All Fields" is false
     $limitFields = array();
     $postIds = false;
     if (isset($_POST["date_search_limit_fields"])) {
         $postIds = $_POST["date_search_limit_fields"];
     }
     if (is_array($postIds)) {
         foreach ($postIds as $postId) {
             $postId = intval($postId);
             if ($postId) {
                 $limitFields[] = $postId;
             }
         }
     }
     sort($limitFields);
     $limitFields = json_encode($limitFields);
     set_option('date_search_limit_fields', $limitFields);
     // Search Relationship Comments switch
     $searchRelComments = (int) (bool) $_POST['date_search_search_rel_comments'];
     set_option('date_search_search_rel_comments', $searchRelComments);
     // Debug Output switch -- if present
     $debugOutput = 0;
     // Sanity
     if (isset($_POST['date_search_debug_output'])) {
         $debugOutput = (int) (bool) $_POST['date_search_debug_output'];
     }
     set_option('date_search_debug_output', $debugOutput);
     $reprocess = (int) (bool) $_POST['date_search_trigger_reindex'];
     if ($reprocess) {
         SELF::_batchProcessExistingItems();
     }
     # echo "<pre>"; print_r($_POST); echo "</pre>"; die();
 }
 /**
  * Handle the plugin configuration form.
  */
 public static function hookConfig()
 {
     // Unit configuration
     $measurementSearchUnits = SELF::_encodeUnitsFromTextArea($_POST['measurement_search_units']);
     set_option('measurement_search_units', $measurementSearchUnits);
     // Search All Fields switch
     $searchAllFields = (int) (bool) $_POST['measurement_search_search_all_fields'];
     set_option('measurement_search_search_all_fields', $searchAllFields);
     // Limit Fields list (in case "Search All Fields" is false
     $limitFields = array();
     $postIds = false;
     if (isset($_POST["measurement_search_limit_fields"])) {
         $postIds = $_POST["measurement_search_limit_fields"];
     }
     if (is_array($postIds)) {
         foreach ($postIds as $postId) {
             $postId = intval($postId);
             if ($postId) {
                 $limitFields[] = $postId;
             }
         }
     }
     sort($limitFields);
     $limitFields = json_encode($limitFields);
     set_option('measurement_search_limit_fields', $limitFields);
     // Search Relationship Comments switch
     $searchRelComments = (int) (bool) $_POST['measurement_search_search_rel_comments'];
     set_option('measurement_search_search_rel_comments', $searchRelComments);
     // Debug Output switch -- if present
     $debugOutput = 0;
     // Sanity
     if (isset($_POST['measurement_search_debug_output'])) {
         $debugOutput = (int) (bool) $_POST['measurement_search_debug_output'];
     }
     set_option('measurement_search_debug_output', $debugOutput);
     $reprocess = (int) (bool) $_POST['measurement_search_trigger_reindex'];
     if ($reprocess) {
         SELF::_batchProcessExistingItems();
     }
     # echo "<pre>"; print_r($_POST); echo "</pre>"; die();
 }