From c9052f1b2912d855e9d31ca32268a8968847bebe Mon Sep 17 00:00:00 2001 From: James K Date: Thu, 29 Jun 2023 00:21:37 -0400 Subject: [PATCH 001/226] Resolve an issue with wp admin improperly handling migrations during plugin update. --- src/TouchPoint-WP/TouchPointWP.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index d2ce4ea3..3976187c 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -493,7 +493,7 @@ public function parseRequest($continue, $wp, $extraVars): bool */ public static function currentUserIsAdmin(): bool { - if (!function_exists('current_user_can')) + if (!function_exists('current_user_can') || !function_exists('wp_get_current_user')) return false; return current_user_can('manage_options'); } From 202e8453e4d5a3296ece0b868d7bbcb48aa94c66 Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 18 Jul 2023 18:23:24 -0400 Subject: [PATCH 002/226] Adding check that plugin has only been initialized once. --- src/TouchPoint-WP/TouchPointWP.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 3976187c..7cc82f36 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -710,9 +710,22 @@ public static function load($file): TouchPointWP return $instance; } + /** + * @var bool True of the init process has run. False if not. Prevents things from happening twice, which can cause errors. + */ + private static bool $_hasBeenInited = false; + + /** + * Initialize the plugin. + * + * @return void + */ public static function init(): void { - self::instance()->loadLocalizations(); + if (self::$_hasBeenInited) + return; + + self::instance()->loadLocalizations(); self::instance()->registerTaxonomies(); @@ -722,6 +735,8 @@ public static function init(): void // If the scripts need to be updated, do that. self::instance()->updateDeployedScripts(); + self::$_hasBeenInited = true; + self::requireScript("base"); do_action(self::INIT_ACTION_HOOK); From 097f352ba80346335eeea7a599d787a9944a5d79 Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 10:12:08 -0400 Subject: [PATCH 003/226] Style improvement for "sign in with TouchPoint" link --- src/TouchPoint-WP/Auth.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/TouchPoint-WP/Auth.php b/src/TouchPoint-WP/Auth.php index 9b94f057..598d5c3c 100644 --- a/src/TouchPoint-WP/Auth.php +++ b/src/TouchPoint-WP/Auth.php @@ -129,18 +129,17 @@ public static function footer() */ public static function printLoginLink() { - $html = '

'; + $html = '

'; + $url = self::getLoginUrl(); /** @noinspection HtmlUnknownTarget */ - $html .= ''; + $html .= ""; $html .= sprintf( // translators: %s is "what you call TouchPoint at your church", which is a setting __('Sign in with your %s account', 'TouchPoint-WP'), htmlentities(TouchPointWP::instance()->settings->system_name) ); - printf( - $html, - self::getLoginUrl() - ); + $html .= '

'; + echo $html; } /** From a615cd2d74c411f5c274b077dfc5b2c7c4418dad Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 11:49:06 -0400 Subject: [PATCH 004/226] Significant performance improvement by reducing db queries. Also, better error reporting in python. --- src/TouchPoint-WP/TouchPointWP.php | 542 +++++++++++--------- src/TouchPoint-WP/TouchPointWP_AdminAPI.php | 2 +- src/TouchPoint-WP/TouchPointWP_Settings.php | 48 +- src/python/WebApi.py | 10 +- 4 files changed, 346 insertions(+), 256 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 7cc82f36..1c8ad335 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -450,7 +450,7 @@ public function parseRequest($continue, $wp, $extraVars): bool return $continue; } } - + // Auth endpoints if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_AUTH && $this->settings->enable_authentication === "on" @@ -623,14 +623,44 @@ public function loadLocalizations() load_plugin_textdomain('TouchPoint-WP', false, $dir . '/i18n/'); } + /** + * Create or update database tables + */ + protected function createTables(): void + { + global $wpdb; + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + + // IP Geo Caching table + $tableName = $wpdb->base_prefix . TouchPointWP::TABLE_IP_GEO; + $sql = "CREATE TABLE $tableName ( + id int(10) unsigned NOT NULL auto_increment, + ip varbinary(16) NOT NULL UNIQUE, + updatedDT datetime DEFAULT NOW(), + data text NOT NULL, + PRIMARY KEY (id) + )"; + dbDelta($sql); + } + /** * Compare the version numbers to determine if a migration is needed. */ - public function checkMigrations(): void + public function migrate($force = false): void { - if ($this->settings->version !== self::VERSION) { - $this->settings->migrate(); + if ($this->settings->version === self::VERSION && !$force) { + return; } + + $this->createTables(); + + if (self::$_hasBeenInited) { + $this->insertTerms(); + } else { + add_action(self::INIT_ACTION_HOOK, [$this, 'insertTerms']); + } + + $this->settings->migrate(); } /** @@ -647,7 +677,7 @@ public static function load($file): TouchPointWP if (is_null($instance->settings)) { $instance->settings = TouchPointWP_Settings::instance($instance); if (is_admin()) { - $instance->checkMigrations(); + $instance->migrate(); } } @@ -702,7 +732,7 @@ public static function load($file): TouchPointWP // Load Reports (feature is always enabled) $instance->reports = Report::load(); - add_action('init', [self::class, 'init']); + add_action('init', [self::class, 'init'], 10); add_filter('the_content', [self::class, 'capitalPyScript'], 11); add_filter('widget_text_content', [self::class, 'capitalPyScript'], 11); @@ -742,6 +772,12 @@ public static function init(): void do_action(self::INIT_ACTION_HOOK); } + /** + * Prints the inline 'base' script. This is meant to be called in the wp_head and admin_head, and should only be + * called once on a page, but that is not automatically validated. + * + * @return void + */ public static function renderBaseInlineScript(): void { include self::instance()->assets_dir . '/js/base-inline.php'; @@ -765,7 +801,10 @@ public function registerScriptsAndStyles(): void self::VERSION, true ); - wp_set_script_translations(self::SHORTCODE_PREFIX . 'base-defer', 'TouchPoint-WP', $this->getJsLocalizationDir()); + wp_set_script_translations( + self::SHORTCODE_PREFIX . 'base-defer', + 'TouchPoint-WP', $this->getJsLocalizationDir() + ); wp_register_script( self::SHORTCODE_PREFIX . 'swal2-defer', @@ -1234,7 +1273,7 @@ function getLabels(string $singular, string $plural): array $resCodeTypesToApply = Involvement_PostTypeSettings::getPostTypesWithGeoEnabled(); } $resCodeTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_RESCODE, $resCodeTypesToApply, [ @@ -1257,28 +1296,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ($this->getResCodes() as $rc) { - if ($rc->name !== null && ! Utilities::termExists($rc->name, self::TAX_RESCODE)) { - $term = Utilities::insertTerm( - $rc->name, - self::TAX_RESCODE, - [ - 'description' => $rc->name, - 'slug' => sanitize_title($rc->name) - ] - ); - if (is_wp_error($term)) { - new TouchPointWP_WPError($term); - } else { - update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $rc->id); - } - - self::queueFlushRewriteRules(); - } - } - // TODO remove defunct res codes - } + // Terms inserted via insertTerms method // Campuses if ($this->settings->enable_campuses === "on") { @@ -1287,7 +1305,7 @@ function getLabels(string $singular, string $plural): array $campusesTypesToApply = Involvement_PostTypeSettings::getPostTypes(); } $campusesTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_CAMPUS, $campusesTypesToApply, [ @@ -1307,29 +1325,8 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ($this->getCampuses() as $c) { - if ($c->name !== null && ! Utilities::termExists($c->name, self::TAX_CAMPUS)) { - $term = Utilities::insertTerm( - $c->name, - self::TAX_CAMPUS, - [ - 'description' => $c->name, - 'slug' => sanitize_title($c->code) - ] - ); - if (is_wp_error($term)) { - new TouchPointWP_WPError($term); - } else { - update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $c->id); - } - - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } - // TODO remove defunct campuses (including all of them, if disabled) // Divisions & Programs $divisionTypesToApply = []; @@ -1338,7 +1335,7 @@ function getLabels(string $singular, string $plural): array } // TODO allow this taxonomy to be applied to other post types as an option. if (count($divisionTypesToApply) > 0) { - $rt = register_taxonomy( + register_taxonomy( self::TAX_DIV, $divisionTypesToApply, [ @@ -1359,75 +1356,13 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - $enabledDivisions = $this->settings->dv_divisions; - foreach ($this->getDivisions() as $d) { - if (in_array('div' . $d->id, $enabledDivisions)) { - // Program - $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); - if ($pTermInfo === null && $d->pName !== null) { - $pTermInfo = Utilities::insertTerm( - $d->pName, - self::TAX_DIV, - [ - 'description' => $d->pName, - 'slug' => sanitize_title($d->pName) - ] - ); - if (is_wp_error($pTermInfo)) { - new TouchPointWP_WPError($pTermInfo); - } else { - update_term_meta($pTermInfo['term_id'], self::SETTINGS_PREFIX . 'programId', $d->proId); - } - - self::queueFlushRewriteRules(); - } - - // Division - $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); - if ($dTermInfo === null && $d->dName !== null) { - $dTermInfo = Utilities::insertTerm( - $d->dName, - self::TAX_DIV, - [ - 'description' => $d->dName, - 'parent' => $pTermInfo['term_id'], - 'slug' => sanitize_title($d->dName) - ] - ); - if (is_wp_error($dTermInfo)) { - new TouchPointWP_WPError($dTermInfo); - } else { - update_term_meta($dTermInfo['term_id'], self::SETTINGS_PREFIX . 'divId', $d->id); - } - - self::queueFlushRewriteRules(); - } - } else { - // Remove terms that are disabled from importing. - - // Delete disabled divisions. Get program, so we delete the right division. - $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); - if ($pTermInfo !== null) { - $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); - if ($dTermInfo !== null) { - wp_delete_term($dTermInfo['term_id'], self::TAX_DIV); - self::queueFlushRewriteRules(); - } - } - - // Program - // TODO remove programs that no longer have a division selected for use as a term. - // TODO remove program & div terms that are no longer present in TouchPoint - } - } - } + // Terms inserted via insertTerms method } if ($this->settings->enable_involvements === "on") { // Weekdays - $rt = register_taxonomy( + register_taxonomy( self::TAX_WEEKDAY, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1447,25 +1382,10 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - for ($di = 0; $di < 7; $di++) { - $name = Utilities::getPluralDayOfWeekNameForNumber_noI18n($di); - if ( ! Utilities::termExists($name, self::TAX_WEEKDAY)) { - Utilities::insertTerm( - $name, - self::TAX_WEEKDAY, - [ - 'description' => $name, - 'slug' => Utilities::getDayOfWeekShortForNumber_noI18n($di) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Tenses - $rt = register_taxonomy( + register_taxonomy( self::TAX_TENSE, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1485,31 +1405,11 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ( - [ - TouchPointWP::TAX_TENSE_FUTURE => 'Upcoming', - TouchPointWP::TAX_TENSE_PRESENT => 'Current', - TouchPointWP::TAX_TENSE_PAST => 'Past', - ] as $slug => $name - ) { - if ( ! Utilities::termExists($slug, self::TAX_TENSE)) { - Utilities::insertTerm( - $name, - self::TAX_TENSE, - [ - 'description' => $name, - 'slug' => $slug - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Time of Day /** @noinspection SpellCheckingInspection */ - $rt = register_taxonomy( + register_taxonomy( self::TAX_DAYTIME, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1529,32 +1429,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - $timesOfDay = [ - 'Late Night', - 'Early Morning', - 'Morning', - 'Midday', - 'Afternoon', - 'Evening', - 'Night' - ]; - foreach ($timesOfDay as $tod) { - if ( ! Utilities::termExists($tod, self::TAX_WEEKDAY)) { - $slug = str_replace(" ", "", $tod); - $slug = strtolower($slug); - Utilities::insertTerm( - $tod, - self::TAX_DAYTIME, - [ - 'description' => $tod, - 'slug' => $slug - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } // Age Groups @@ -1563,7 +1438,7 @@ function getLabels(string $singular, string $plural): array $ageGroupTypesToApply = Involvement_PostTypeSettings::getPostTypes(); } $ageGroupTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_AGEGROUP, $ageGroupTypesToApply, [ @@ -1583,26 +1458,12 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach (["20s", "30s", "40s", "50s", "60s", "70+"] as $ag) { - if ( ! Utilities::termExists($ag, self::TAX_AGEGROUP)) { - Utilities::insertTerm( - $ag, - self::TAX_AGEGROUP, - [ - 'description' => $ag, - 'slug' => sanitize_title($ag) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Involvement Marital Status if ($this->settings->enable_involvements === "on") { - $rt = register_taxonomy( + register_taxonomy( self::TAX_INV_MARITAL, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1622,21 +1483,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach (['mostly_single', 'mostly_married'] as $ms) { - if ( ! Utilities::termExists($ms, self::TAX_INV_MARITAL)) { - Utilities::insertTerm( - $ms, - self::TAX_INV_MARITAL, - [ - 'description' => $ms, - 'slug' => sanitize_title($ms) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } // Global Partner Category @@ -1672,6 +1519,245 @@ function getLabels(string $singular, string $plural): array } } + /** + * For the taxonomies that are based on Lookups in the TouchPoint database, insert or update the terms. + * + * @param object[] $list + * @param string $taxonomy + * @param bool $forceIdUpdate + * + * @return void + */ + protected function insertTermsForLookupBasedTaxonomy(array $list, string $taxonomy, bool $forceIdUpdate) + { + foreach ($list as $i) { + if ($i->name === null) { + continue; + } + // In addition to making sure term exists, make sure it has the correct meta id, too. + $term = Utilities::termExists($i->name, $taxonomy); + $idUpdate = $forceIdUpdate; + if (!$term) { + $term = Utilities::insertTerm( + $i->name, + $taxonomy, + [ + 'description' => $i->name, + 'slug' => sanitize_title($i->name) + ] + ); + if (is_wp_error($term)) { + new TouchPointWP_WPError($term); + $term = null; + } + $idUpdate = true; + } + if ($term !== null && isset($term['term_id']) && $idUpdate) { + update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $i->id); + } + if ($idUpdate) { + self::queueFlushRewriteRules(); + } + } + } + + public static bool $forceTermLookupIdUpdate = false; + + /** + * Insert the terms for the registered taxonomies. (This is supposed to happen a while after the taxonomies are + * loaded.) + * + * @return void + */ + public function insertTerms() + { + // Resident Codes + $this->insertTermsForLookupBasedTaxonomy( + $this->getResCodes(), + self::TAX_RESCODE, + self::$forceTermLookupIdUpdate + ); + // TODO remove defunct res codes + + // Campuses + if ($this->settings->enable_campuses === "on") { + $this->insertTermsForLookupBasedTaxonomy( + $this->getCampuses(), + self::TAX_CAMPUS, + self::$forceTermLookupIdUpdate + ); + } + // TODO remove defunct campuses (including all of them, if disabled) + + // Age Groups + foreach (["20s", "30s", "40s", "50s", "60s", "70+"] as $ag) { + if ( ! Utilities::termExists($ag, self::TAX_AGEGROUP)) { + Utilities::insertTerm( + $ag, + self::TAX_AGEGROUP, + [ + 'description' => $ag, + 'slug' => sanitize_title($ag) + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Involvements and TODO Events + $postTypesToApply = []; + if ($this->settings->enable_involvements === "on") { + $postTypesToApply = Involvement_PostTypeSettings::getPostTypes(); + } + if (count($postTypesToApply) > 0) { + + // Divisions & Programs + $enabledDivisions = $this->settings->dv_divisions; + foreach ($this->getDivisions() as $d) { + if (in_array('div' . $d->id, $enabledDivisions)) { + // Program + $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); + if ($pTermInfo === null && $d->pName !== null) { + $pTermInfo = Utilities::insertTerm( + $d->pName, + self::TAX_DIV, + [ + 'description' => $d->pName, + 'slug' => sanitize_title($d->pName) + ] + ); + if (is_wp_error($pTermInfo)) { + new TouchPointWP_WPError($pTermInfo); + } else { + update_term_meta($pTermInfo['term_id'], self::SETTINGS_PREFIX . 'programId', $d->proId); + } + + self::queueFlushRewriteRules(); + } + + // Division + $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); + if ($dTermInfo === null && $d->dName !== null) { + $dTermInfo = Utilities::insertTerm( + $d->dName, + self::TAX_DIV, + [ + 'description' => $d->dName, + 'parent' => $pTermInfo['term_id'], + 'slug' => sanitize_title($d->dName) + ] + ); + if (is_wp_error($dTermInfo)) { + new TouchPointWP_WPError($dTermInfo); + } else { + update_term_meta($dTermInfo['term_id'], self::SETTINGS_PREFIX . 'divId', $d->id); + } + + self::queueFlushRewriteRules(); + } + } else { + // Remove terms that are disabled from importing. + + // Delete disabled divisions. Get program, so we delete the right division. + $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); + if ($pTermInfo !== null) { + $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); + if ($dTermInfo !== null) { + wp_delete_term($dTermInfo['term_id'], self::TAX_DIV); + self::queueFlushRewriteRules(); + } + } + + // Program + // TODO remove programs that no longer have a division selected for use as a term. + // TODO remove program & div terms that are no longer present in TouchPoint + } + } + + // Weekdays + for ($di = 0; $di < 7; $di++) { + $name = Utilities::getPluralDayOfWeekNameForNumber_noI18n($di); + if ( ! Utilities::termExists($name, self::TAX_WEEKDAY)) { + Utilities::insertTerm( + $name, + self::TAX_WEEKDAY, + [ + 'description' => $name, + 'slug' => Utilities::getDayOfWeekShortForNumber_noI18n($di) + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Tense + foreach ( + [ + TouchPointWP::TAX_TENSE_FUTURE => 'Upcoming', + TouchPointWP::TAX_TENSE_PRESENT => 'Current', + TouchPointWP::TAX_TENSE_PAST => 'Past', + ] as $slug => $name + ) { + if ( ! Utilities::termExists($slug, self::TAX_TENSE)) { + Utilities::insertTerm( + $name, + self::TAX_TENSE, + [ + 'description' => $name, + 'slug' => $slug + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Time of Day + $timesOfDay = [ + 'Late Night', + 'Early Morning', + 'Morning', + 'Midday', + 'Afternoon', + 'Evening', + 'Night' + ]; + foreach ($timesOfDay as $tod) { + if ( ! Utilities::termExists($tod, self::TAX_WEEKDAY)) { + $slug = str_replace(" ", "", $tod); + $slug = strtolower($slug); + Utilities::insertTerm( + $tod, + self::TAX_DAYTIME, + [ + 'description' => $tod, + 'slug' => $slug + ] + ); + self::queueFlushRewriteRules(); + } + } + } + + // Involvements + if ($this->settings->enable_involvements === "on") { + + // Involvement Marital Status + foreach (['mostly_single', 'mostly_married'] as $ms) { + if ( ! Utilities::termExists($ms, self::TAX_INV_MARITAL)) { + Utilities::insertTerm( + $ms, + self::TAX_INV_MARITAL, + [ + 'description' => $ms, + 'slug' => sanitize_title($ms) + ] + ); + self::queueFlushRewriteRules(); + } + } + } + } + private static array $divisionTerms = []; /** @@ -1749,9 +1835,7 @@ public function activation() { self::queueFlushRewriteRules(); - $this->createTables(); - - $this->settings->migrate(); + $this->migrate(true); } /** @@ -1793,26 +1877,6 @@ protected static function clearScheduledHooks(): void wp_clear_scheduled_hook(Report::CRON_HOOK); } - /** - * Create or update database tables - */ - protected function createTables(): void - { - global $wpdb; - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - - // IP Geo Caching table - $tableName = $wpdb->base_prefix . self::TABLE_IP_GEO; - $sql = "CREATE TABLE $tableName ( - id int(10) unsigned NOT NULL auto_increment, - ip varbinary(16) NOT NULL UNIQUE, - updatedDT datetime DEFAULT NOW(), - data text NOT NULL, - PRIMARY KEY (id) - )"; - dbDelta($sql); - } - /** * Drop database tables at uninstallation. */ @@ -1835,7 +1899,7 @@ protected static function dropTables(): void */ private function _log_version_number() { - update_option(self::TOKEN . '_version', self::VERSION, false); + update_option(self::TOKEN . '_version', self::VERSION, true); } /** diff --git a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php index 24a5c86a..9452cac0 100644 --- a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php +++ b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php @@ -88,7 +88,7 @@ public static function api(array $uri): bool if (!TouchPointWP::currentUserIsAdmin()) { return false; } - TouchPointWP::instance()->settings->migrate(); + TouchPointWP::instance()->migrate(true); exit; } diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 7bf47ed0..0f9e8dfc 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -180,6 +180,31 @@ public function hasValidApiSettings(): bool $this->getWithoutDefault('api_pass') === TouchPointWP_Settings::UNDEFINED_PLACEHOLDER); } + /** + * Used internally to determine if a particular setting should be auto-loaded. + * + * @param string $settingName + * + * @return bool + */ + private function settingShouldBeAutoLoaded(string $settingName): bool + { + if (str_contains($settingName, '_cron_last_run')) { + return true; + } + foreach (self::settingsFields() as $page) { + foreach ($page['fields'] as $f) { + if ($f['id'] === $settingName) { + if (isset($f['autoload'])) { + return !!$f['autoload']; + } + return false; + } + } + } + return false; + } + /** * Build settings fields * @@ -213,6 +238,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, 'callback' => fn($new) => $this->validation_updateScriptsIfChanged($new, 'enable_authentication'), ], [ @@ -221,6 +247,7 @@ private function settingsFields($includeDetail = false): array 'description' => __('Add a crazy-simple RSVP button to WordPress event pages.', 'TouchPoint-WP'), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_involvements', @@ -231,6 +258,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_people_lists', @@ -241,6 +269,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_global', @@ -251,6 +280,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_campuses', @@ -261,6 +291,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'system_name', @@ -1174,16 +1205,18 @@ protected function getWithoutDefault(string $what, $default = self::UNDEFINED_PL /** * @param string $what * @param mixed $value - * @param bool $autoload + * @param ?bool $autoload * * @return false|mixed */ - public function set(string $what, $value, bool $autoload = false): bool + public function set(string $what, $value, ?bool $autoload = null): bool { + if ($autoload === null) { + $autoload = $this->settingShouldBeAutoLoaded($what); + } return update_option(TouchPointWP::SETTINGS_PREFIX . $what, $value, $autoload); // TODO MULTI } - /** * Migrate settings from version to version. This may be called even when a migration isn't necessary. */ @@ -1314,14 +1347,7 @@ public function migrate(): void // 0.0.31 - Add lookup IDs to ResCodes - foreach (TouchPointWP::instance()->getResCodes() as $rc) { - $term = Utilities::termExists($rc->name, TouchPointWP::TAX_RESCODE); - if ($term !== null && isset($term['term_id'])) { - if (update_term_meta($term['term_id'], TouchPointWP::TAXMETA_LOOKUP_ID, $rc->id)) { - TouchPointWP::queueFlushRewriteRules(); - } - } - } + TouchPointWP::$forceTermLookupIdUpdate = true; // Update version string diff --git a/src/python/WebApi.py b/src/python/WebApi.py index f70ee4cf..13542342 100644 --- a/src/python/WebApi.py +++ b/src/python/WebApi.py @@ -18,8 +18,7 @@ def print_exception(): # From https://stackoverflow.com/a/20264059/2339939 lineno = tb.tb_lineno filename = f.f_code.co_filename linecache.checkcache(filename) - line = linecache.getline(filename, lineno, f.f_globals) - print('EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj)) + print('{} (L{})'.format(exc_obj, lineno)) def get_person_info_for_sync(person_obj): @@ -1166,6 +1165,9 @@ def get_person_info_for_sync(person_obj): model.Title = "Login" model.Header = "Processing..." + if response == "": + raise Exception("Could not communicate with WordPress server.") + response = json.loads(response) if "error" in response: @@ -1199,10 +1201,8 @@ def get_person_info_for_sync(person_obj): print("

Please email the following error message to " + model.Setting("AdminMail", "the church staff") + ".

")
             print(response)
-            print("
") - print("") + print("") if not apiCalled: model.Title = "Invalid Request" From a5510aa262e8e325dbed0f05d3bb21c85cbb615d Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 22:49:32 -0400 Subject: [PATCH 005/226] Further updates to which options are autoloaded. --- src/TouchPoint-WP/TouchPointWP.php | 1 + src/TouchPoint-WP/TouchPointWP_Settings.php | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 1c8ad335..a8df67c8 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -1552,6 +1552,7 @@ protected function insertTermsForLookupBasedTaxonomy(array $list, string $taxono } $idUpdate = true; } + // Update the term meta if term is new, or if id update is forced. if ($term !== null && isset($term['term_id']) && $idUpdate) { update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $i->id); } diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 0f9e8dfc..1b57163e 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -189,7 +189,10 @@ public function hasValidApiSettings(): bool */ private function settingShouldBeAutoLoaded(string $settingName): bool { - if (str_contains($settingName, '_cron_last_run')) { + if (str_contains($settingName, '_cron_last_run') + || $settingName === "DEBUG" + || $settingName === "meta_familyEvFields" // because it's used when registering the taxonomies on every init. + ) { return true; } foreach (self::settingsFields() as $page) { @@ -313,6 +316,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => 'mychurch.tpsdb.com', 'callback' => [$this, 'validation_lowercase'] ], @@ -338,6 +342,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => '', ], [ @@ -349,6 +354,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text_secret', 'default' => '', + 'autoload' => true, 'placeholder' => $this->passwordPlaceholder('api_pass'), 'callback' => fn($new) => $this->validation_secret($new, 'api_pass') ], @@ -361,6 +367,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'WebApi', + 'autoload' => true, 'placeholder' => '', ], [ @@ -372,6 +379,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => '', ], [ @@ -389,7 +397,8 @@ private function settingsFields($includeDetail = false): array ]; // Add Script generation section if necessary settings are established. - if ($this->getWithoutDefault('system_name') !== self::UNDEFINED_PLACEHOLDER + if ($includeDetail + && $this->getWithoutDefault('system_name') !== self::UNDEFINED_PLACEHOLDER && $this->hasValidApiSettings()) { /** @noinspection HtmlUnknownTarget */ $this->settings['basic']['fields'][] = [ @@ -535,6 +544,7 @@ private function settingsFields($includeDetail = false): array 'type' => 'textarea', 'label' => __('Involvement Post Types', 'TouchPoint-WP'), 'default' => '[]', + 'autoload' => true, 'hidden' => true, 'description' => !$includeThis ? "" : function() { TouchPointWP::requireScript("base"); @@ -617,6 +627,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'partners', + 'autoload' => true, 'placeholder' => 'partners', 'callback' => fn($new) => $this->validation_slug($new, 'global_slug') ], @@ -708,6 +719,7 @@ private function settingsFields($includeDetail = false): array 'type' => 'select', 'options' => $includeThis ? $this->parent->getFamilyEvFieldsAsKVArray('code', true) : [], 'default' => [], + 'autoload' => true, ], ], ]; @@ -764,6 +776,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Divisions', + 'autoload' => true, 'placeholder' => 'Divisions' ], [ @@ -775,6 +788,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Division', + 'autoload' => true, 'placeholder' => 'Division' ], [ @@ -786,6 +800,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'div', + 'autoload' => true, 'placeholder' => 'div', 'callback' => fn($new) => $this->validation_slug($new, 'dv_slug') ], @@ -844,6 +859,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Campuses', + 'autoload' => true, 'placeholder' => 'Campuses' ], [ @@ -855,6 +871,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Campus', + 'autoload' => true, 'placeholder' => 'Campus' ], [ @@ -866,6 +883,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'campus', + 'autoload' => true, 'placeholder' => 'campus', 'callback' => fn($new) => $this->validation_slug($new, 'camp_slug') ] @@ -886,6 +904,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Resident Codes', + 'autoload' => true, 'placeholder' => 'Resident Codes' ], [ @@ -897,6 +916,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Resident Code', + 'autoload' => true, 'placeholder' => 'Resident Code' ], [ @@ -908,6 +928,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'rescodes', + 'autoload' => true, 'placeholder' => 'rescodes', 'callback' => fn($new) => $this->validation_slug($new, 'rc_slug') ] From a1e48b71ef9c1b72d18b63d978e3c18a112a82d2 Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 8 Aug 2023 07:24:16 -0400 Subject: [PATCH 006/226] Adding filter for report classes --- src/TouchPoint-WP/Report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/Report.php b/src/TouchPoint-WP/Report.php index 837ac966..7d01c0e3 100644 --- a/src/TouchPoint-WP/Report.php +++ b/src/TouchPoint-WP/Report.php @@ -35,6 +35,8 @@ class Report implements api, module, JsonSerializable, updatesViaCron public const NAME_META_KEY = self::META_PREFIX . "name"; public const P1_META_KEY = self::META_PREFIX . "p1"; public const DEFAULT_CONTENT = ''; + public const FIGURE_CLASS_FILTER = TouchPointWP::SETTINGS_PREFIX . "rpt_figure_class"; + public const FIGURE_CLASS_DEFAULT = "TouchPoint-report"; public static bool $_isLoaded = false; @@ -286,7 +288,8 @@ public static function reportShortcode($params = [], string $content = ""): stri // Add Figure elt with a unique ID $idAttr = "id=\"" . wp_unique_id('tp-report-') . "\""; - $rc = "
\n\t" . str_replace("\n", "\n\t", $rc); + $class = apply_filters(self::FIGURE_CLASS_FILTER, self::FIGURE_CLASS_DEFAULT); + $rc = "
\n\t" . str_replace("\n", "\n\t", $rc); // If desired, add a caption that indicates when the table was last updated. if ($params['showupdated']) { From d963685cb10ec34e23abf807893401d2cf7a0e7b Mon Sep 17 00:00:00 2001 From: James K Date: Thu, 10 Aug 2023 15:57:38 -0400 Subject: [PATCH 007/226] Updates related to changed dev environment --- .gitignore | 3 ++- .idea/misc.xml | 1 - .idea/php.xml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0380c8f9..2f612cad 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ node_modules package-lock.json /build/ -/touchpoint-wp.zip \ No newline at end of file +/touchpoint-wp.zip +/composer.phar diff --git a/.idea/misc.xml b/.idea/misc.xml index 591fc5ab..691dd2ff 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - @noinspection diff --git a/.idea/php.xml b/.idea/php.xml index 05d47f11..299cb8ee 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -13,6 +13,7 @@ + From 19b15cff9b64f3f05f4533da0cd79c149802c7c2 Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 24 Aug 2023 22:14:55 -0400 Subject: [PATCH 008/226] Resolving an issue with how settings are defined --- src/TouchPoint-WP/TouchPointWP_Settings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 1b57163e..707ca003 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -1401,7 +1401,7 @@ public function updateDeployedScripts(): void */ public function registerSettings(): void { - $currentSection = false; + $currentSection = 'basic'; // basic is the default. if (isset($_POST['tab']) && $_POST['tab']) { $currentSection = $_POST['tab']; } elseif (isset($_GET['tab']) && $_GET['tab']) { @@ -1411,7 +1411,7 @@ public function registerSettings(): void $this->settings = $this->settingsFields($currentSection); foreach ($this->settings as $section => $data) { // Check posted/selected tab. - if ($currentSection && $currentSection !== $section) { + if ($currentSection !== $section) { continue; } From 9c9d71560e6815691be19d0b37828fd5eda9b969 Mon Sep 17 00:00:00 2001 From: James K Date: Mon, 14 Aug 2023 22:29:41 -0400 Subject: [PATCH 009/226] Reworking build procedure to maintain a local build directory during development. --- .gitignore | 4 +--- build.sh | 19 +++++++++---------- generateI18n_1forTranslation.ps1 | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 2f612cad..236fe5d4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ composer.lock /assets/images/people /TouchPointWP_ErrorLog.txt /.phpdoc/ -/phpDocumentor.phar -/wp-cli.phar +*.phar /.idea/workspace.xml /.idea/usage.statistics.xml @@ -24,4 +23,3 @@ package-lock.json /build/ /touchpoint-wp.zip -/composer.phar diff --git a/build.sh b/build.sh index b69c25e7..772b2e07 100644 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js cp -r assets build cd ./build || exit -zip -r ../touchpoint-wp.zip assets +#zip -r ../touchpoint-wp.zip assets cd .. @@ -35,15 +35,14 @@ cp -r ./i18n ./build/i18n php ./wp-cli.phar i18n make-json ./build/i18n php ./wp-cli.phar i18n make-mo ./build/i18n -cd ./build || exit -zip -r ../touchpoint-wp.zip i18n -cd .. -zip -r touchpoint-wp.zip ./ext -zip -r touchpoint-wp.zip ./src +cp -r ./ext ./build/ext +cp -r ./src ./build/src -find . -maxdepth 1 -iname "*.php" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.md" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.json" -exec zip touchpoint-wp.zip {} \; +find . -maxdepth 1 -iname "*.php" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.md" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.json" -exec cp {} build/ \; -rm -r build \ No newline at end of file +cd ./build || exit +find . -exec zip ../touchpoint-wp.zip {} \; +cd .. diff --git a/generateI18n_1forTranslation.ps1 b/generateI18n_1forTranslation.ps1 index cc5a901d..e23662c6 100644 --- a/generateI18n_1forTranslation.ps1 +++ b/generateI18n_1forTranslation.ps1 @@ -7,5 +7,5 @@ if (!(test-path $pharFile -newerThan $compareDt)) Invoke-WebRequest https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile $pharFile } -php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot +php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot --exclude=build php .\wp-cli.phar i18n update-po i18n/TouchPoint-WP.pot \ No newline at end of file From 27601ab876b62d99647a63339427070ec3188cb1 Mon Sep 17 00:00:00 2001 From: James K Date: Mon, 14 Aug 2023 22:30:57 -0400 Subject: [PATCH 010/226] Adding jetbrains run profiles --- .idea/runConfigurations/Build__WSL_.xml | 17 +++++++++++++++++ .../i18n__1_for_Translation.xml | 17 +++++++++++++++++ .idea/runConfigurations/i18n__2_for_Publish.xml | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .idea/runConfigurations/Build__WSL_.xml create mode 100644 .idea/runConfigurations/i18n__1_for_Translation.xml create mode 100644 .idea/runConfigurations/i18n__2_for_Publish.xml diff --git a/.idea/runConfigurations/Build__WSL_.xml b/.idea/runConfigurations/Build__WSL_.xml new file mode 100644 index 00000000..d2225246 --- /dev/null +++ b/.idea/runConfigurations/Build__WSL_.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/i18n__1_for_Translation.xml b/.idea/runConfigurations/i18n__1_for_Translation.xml new file mode 100644 index 00000000..8f161b58 --- /dev/null +++ b/.idea/runConfigurations/i18n__1_for_Translation.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/i18n__2_for_Publish.xml b/.idea/runConfigurations/i18n__2_for_Publish.xml new file mode 100644 index 00000000..30b2968d --- /dev/null +++ b/.idea/runConfigurations/i18n__2_for_Publish.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file From 8bd438ac43d57cc2c17271179b2b139a12c51d1e Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 15 Aug 2023 15:25:10 -0400 Subject: [PATCH 011/226] build improvements --- .github/workflows/releases.yml | 4 ++-- .idea/misc.xml | 3 ++- build.sh | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 5b1c26a6..5d315037 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,10 +1,10 @@ +name: Create Release + on: push: tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -name: Create Release - jobs: build: name: Create Release diff --git a/.idea/misc.xml b/.idea/misc.xml index 691dd2ff..ec30493f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,7 @@ + @noinspection - + \ No newline at end of file diff --git a/build.sh b/build.sh index 772b2e07..1f1eb7ad 100644 --- a/build.sh +++ b/build.sh @@ -24,12 +24,13 @@ uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js cp -r assets build cd ./build || exit -#zip -r ../touchpoint-wp.zip assets cd .. # compile translations -wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +if [ ! -f wp-cli.phar ]; then + wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +fi cp -r ./i18n ./build/i18n From 136e61ea2f893efa0c660f0f72e8b70a8f8e2a12 Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 24 Aug 2023 22:46:18 -0400 Subject: [PATCH 012/226] Added an endpoint to spit out phpinfo. --- src/TouchPoint-WP/TouchPointWP_AdminAPI.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php index 24a5c86a..ae6bc5a7 100644 --- a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php +++ b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php @@ -90,6 +90,13 @@ public static function api(array $uri): bool } TouchPointWP::instance()->settings->migrate(); exit; + + case "phpinfo": + if (!TouchPointWP::currentUserIsAdmin()) { + return false; + } + phpinfo(); + exit; } return false; From 44da8de7f598e10aca4e2f52542b0a2268260760 Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 24 Aug 2023 22:46:44 -0400 Subject: [PATCH 013/226] Som very, VERY minor memory improvements --- src/TouchPoint-WP/Involvement.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index 58bbb603..ff43e69e 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -364,6 +364,7 @@ public static function updateFromTouchPoint(bool $verbose = false) $count += $update; } } + unset($type); if ($success && $count !== 0) { TouchPointWP::instance()->settings->set('inv_cron_last_run', time()); @@ -2087,6 +2088,7 @@ final protected static function updateInvolvementPostsForType( } catch (TouchPointWP_Exception $e) { return false; } + unset($qOpts); $invData = $response->invs ?? []; // null coalesce for case where there is no data. @@ -2512,8 +2514,10 @@ final protected static function updateInvolvementPostsForType( if ($verbose) { echo "
"; } - } + unset($post); + } + unset($inv); ////////////////// //// Removals //// From 7f4805ca612588bc2127d60b970120832bd0421c Mon Sep 17 00:00:00 2001 From: "James K." Date: Fri, 25 Aug 2023 12:51:10 -0400 Subject: [PATCH 014/226] A few diagnostic tools for involvement syncing --- .idea/misc.xml | 1 - src/TouchPoint-WP/Involvement.php | 26 ++++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 591fc5ab..691dd2ff 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - @noinspection diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index ff43e69e..535687c3 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -345,7 +345,14 @@ public static function updateFromTouchPoint(bool $verbose = false) $verbose &= TouchPointWP::currentUserIsAdmin(); - foreach (self::allTypeSettings() as $type) { + foreach (self::allTypeSettings() as $k => $type) { + + // TODO this is temp debugging code to allow only one post type to be synced during a force-sync. + if ($verbose && isset($_GET['type'])) { + if (intval($k) !== intval($_GET['type'])) + continue; + } + if (count($type->importDivs) < 1) { // Don't update if there aren't any divisions selected yet. if ($verbose) { @@ -356,7 +363,14 @@ public static function updateFromTouchPoint(bool $verbose = false) // Divisions $divs = Utilities::idArrayToIntArray($type->importDivs, false); - $update = self::updateInvolvementPostsForType($type, $divs, $verbose); + try { + $update = self::updateInvolvementPostsForType($type, $divs, $verbose); + } catch (Exception $e) { + if ($verbose) { + echo "An exception occurred while syncing $type->namePlural: " . $e->getMessage(); + } + continue; + } if ($update === false) { $success = false; @@ -2108,13 +2122,21 @@ final protected static function updateInvolvementPostsForType( return false; } + $count = 0; foreach ($invData as $inv) { set_time_limit(15); + $count++; if ($verbose) { var_dump($inv); } + // TODO this is temp debugging code to allow only one post type to be synced during a force-sync. + if ($verbose && isset($_GET['limit'])) { + if ($count > intval($_GET['limit'])) + continue; + } + //////////////////////// // Standardize Inputs // From cf64126d4650ec83437ca0a3a01adf8743683006 Mon Sep 17 00:00:00 2001 From: James K Date: Mon, 14 Aug 2023 22:29:41 -0400 Subject: [PATCH 015/226] Reworking build procedure to maintain a local build directory during development. --- .gitignore | 5 ++--- build.sh | 19 +++++++++---------- generateI18n_1forTranslation.ps1 | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 0380c8f9..236fe5d4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ composer.lock /assets/images/people /TouchPointWP_ErrorLog.txt /.phpdoc/ -/phpDocumentor.phar -/wp-cli.phar +*.phar /.idea/workspace.xml /.idea/usage.statistics.xml @@ -23,4 +22,4 @@ node_modules package-lock.json /build/ -/touchpoint-wp.zip \ No newline at end of file +/touchpoint-wp.zip diff --git a/build.sh b/build.sh index b69c25e7..772b2e07 100644 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js cp -r assets build cd ./build || exit -zip -r ../touchpoint-wp.zip assets +#zip -r ../touchpoint-wp.zip assets cd .. @@ -35,15 +35,14 @@ cp -r ./i18n ./build/i18n php ./wp-cli.phar i18n make-json ./build/i18n php ./wp-cli.phar i18n make-mo ./build/i18n -cd ./build || exit -zip -r ../touchpoint-wp.zip i18n -cd .. -zip -r touchpoint-wp.zip ./ext -zip -r touchpoint-wp.zip ./src +cp -r ./ext ./build/ext +cp -r ./src ./build/src -find . -maxdepth 1 -iname "*.php" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.md" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.json" -exec zip touchpoint-wp.zip {} \; +find . -maxdepth 1 -iname "*.php" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.md" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.json" -exec cp {} build/ \; -rm -r build \ No newline at end of file +cd ./build || exit +find . -exec zip ../touchpoint-wp.zip {} \; +cd .. diff --git a/generateI18n_1forTranslation.ps1 b/generateI18n_1forTranslation.ps1 index cc5a901d..e23662c6 100644 --- a/generateI18n_1forTranslation.ps1 +++ b/generateI18n_1forTranslation.ps1 @@ -7,5 +7,5 @@ if (!(test-path $pharFile -newerThan $compareDt)) Invoke-WebRequest https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile $pharFile } -php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot +php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot --exclude=build php .\wp-cli.phar i18n update-po i18n/TouchPoint-WP.pot \ No newline at end of file From 41bd37d02d01cb3cfc04b6ce18ccbd6e0ffeb8c5 Mon Sep 17 00:00:00 2001 From: James K Date: Thu, 29 Jun 2023 00:21:37 -0400 Subject: [PATCH 016/226] Resolve an issue with wp admin improperly handling migrations during plugin update. --- src/TouchPoint-WP/TouchPointWP.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 41016a12..1ecb1308 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -493,7 +493,7 @@ public function parseRequest($continue, $wp, $extraVars): bool */ public static function currentUserIsAdmin(): bool { - if (!function_exists('current_user_can')) + if (!function_exists('current_user_can') || !function_exists('wp_get_current_user')) return false; return current_user_can('manage_options'); } From 8ecc5c2bf40722918b33d3a86faeb08386e64340 Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 18 Jul 2023 18:23:24 -0400 Subject: [PATCH 017/226] Adding check that plugin has only been initialized once. --- src/TouchPoint-WP/TouchPointWP.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 1ecb1308..8e837589 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -710,9 +710,22 @@ public static function load($file): TouchPointWP return $instance; } + /** + * @var bool True of the init process has run. False if not. Prevents things from happening twice, which can cause errors. + */ + private static bool $_hasBeenInited = false; + + /** + * Initialize the plugin. + * + * @return void + */ public static function init(): void { - self::instance()->loadLocalizations(); + if (self::$_hasBeenInited) + return; + + self::instance()->loadLocalizations(); self::instance()->registerTaxonomies(); @@ -722,6 +735,8 @@ public static function init(): void // If the scripts need to be updated, do that. self::instance()->updateDeployedScripts(); + self::$_hasBeenInited = true; + self::requireScript("base"); do_action(self::INIT_ACTION_HOOK); From 032c1ecf169cecb0f887c0e4da42bc72ca1e2186 Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 10:12:08 -0400 Subject: [PATCH 018/226] Style improvement for "sign in with TouchPoint" link --- src/TouchPoint-WP/Auth.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/TouchPoint-WP/Auth.php b/src/TouchPoint-WP/Auth.php index 9b94f057..598d5c3c 100644 --- a/src/TouchPoint-WP/Auth.php +++ b/src/TouchPoint-WP/Auth.php @@ -129,18 +129,17 @@ public static function footer() */ public static function printLoginLink() { - $html = '

'; + $html = '

'; + $url = self::getLoginUrl(); /** @noinspection HtmlUnknownTarget */ - $html .= ''; + $html .= ""; $html .= sprintf( // translators: %s is "what you call TouchPoint at your church", which is a setting __('Sign in with your %s account', 'TouchPoint-WP'), htmlentities(TouchPointWP::instance()->settings->system_name) ); - printf( - $html, - self::getLoginUrl() - ); + $html .= '

'; + echo $html; } /** From eb6fbc60d89903fd6b727b6f6d277b956f39343d Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 11:49:06 -0400 Subject: [PATCH 019/226] Significant performance improvement by reducing db queries. Also, better error reporting in python. --- src/TouchPoint-WP/TouchPointWP.php | 542 +++++++++++--------- src/TouchPoint-WP/TouchPointWP_AdminAPI.php | 2 +- src/TouchPoint-WP/TouchPointWP_Settings.php | 48 +- src/python/WebApi.py | 10 +- 4 files changed, 346 insertions(+), 256 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 8e837589..a1485e9a 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -450,7 +450,7 @@ public function parseRequest($continue, $wp, $extraVars): bool return $continue; } } - + // Auth endpoints if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_AUTH && $this->settings->enable_authentication === "on" @@ -623,14 +623,44 @@ public function loadLocalizations() load_plugin_textdomain('TouchPoint-WP', false, $dir . '/i18n/'); } + /** + * Create or update database tables + */ + protected function createTables(): void + { + global $wpdb; + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + + // IP Geo Caching table + $tableName = $wpdb->base_prefix . TouchPointWP::TABLE_IP_GEO; + $sql = "CREATE TABLE $tableName ( + id int(10) unsigned NOT NULL auto_increment, + ip varbinary(16) NOT NULL UNIQUE, + updatedDT datetime DEFAULT NOW(), + data text NOT NULL, + PRIMARY KEY (id) + )"; + dbDelta($sql); + } + /** * Compare the version numbers to determine if a migration is needed. */ - public function checkMigrations(): void + public function migrate($force = false): void { - if ($this->settings->version !== self::VERSION) { - $this->settings->migrate(); + if ($this->settings->version === self::VERSION && !$force) { + return; } + + $this->createTables(); + + if (self::$_hasBeenInited) { + $this->insertTerms(); + } else { + add_action(self::INIT_ACTION_HOOK, [$this, 'insertTerms']); + } + + $this->settings->migrate(); } /** @@ -647,7 +677,7 @@ public static function load($file): TouchPointWP if (is_null($instance->settings)) { $instance->settings = TouchPointWP_Settings::instance($instance); if (is_admin()) { - $instance->checkMigrations(); + $instance->migrate(); } } @@ -702,7 +732,7 @@ public static function load($file): TouchPointWP // Load Reports (feature is always enabled) $instance->reports = Report::load(); - add_action('init', [self::class, 'init']); + add_action('init', [self::class, 'init'], 10); add_filter('the_content', [self::class, 'capitalPyScript'], 11); add_filter('widget_text_content', [self::class, 'capitalPyScript'], 11); @@ -742,6 +772,12 @@ public static function init(): void do_action(self::INIT_ACTION_HOOK); } + /** + * Prints the inline 'base' script. This is meant to be called in the wp_head and admin_head, and should only be + * called once on a page, but that is not automatically validated. + * + * @return void + */ public static function renderBaseInlineScript(): void { include self::instance()->assets_dir . '/js/base-inline.php'; @@ -765,7 +801,10 @@ public function registerScriptsAndStyles(): void self::VERSION, true ); - wp_set_script_translations(self::SHORTCODE_PREFIX . 'base-defer', 'TouchPoint-WP', $this->getJsLocalizationDir()); + wp_set_script_translations( + self::SHORTCODE_PREFIX . 'base-defer', + 'TouchPoint-WP', $this->getJsLocalizationDir() + ); wp_register_script( self::SHORTCODE_PREFIX . 'swal2-defer', @@ -1234,7 +1273,7 @@ function getLabels(string $singular, string $plural): array $resCodeTypesToApply = Involvement_PostTypeSettings::getPostTypesWithGeoEnabled(); } $resCodeTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_RESCODE, $resCodeTypesToApply, [ @@ -1257,28 +1296,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ($this->getResCodes() as $rc) { - if ($rc->name !== null && ! Utilities::termExists($rc->name, self::TAX_RESCODE)) { - $term = Utilities::insertTerm( - $rc->name, - self::TAX_RESCODE, - [ - 'description' => $rc->name, - 'slug' => sanitize_title($rc->name) - ] - ); - if (is_wp_error($term)) { - new TouchPointWP_WPError($term); - } else { - update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $rc->id); - } - - self::queueFlushRewriteRules(); - } - } - // TODO remove defunct res codes - } + // Terms inserted via insertTerms method // Campuses if ($this->settings->enable_campuses === "on") { @@ -1287,7 +1305,7 @@ function getLabels(string $singular, string $plural): array $campusesTypesToApply = Involvement_PostTypeSettings::getPostTypes(); } $campusesTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_CAMPUS, $campusesTypesToApply, [ @@ -1307,29 +1325,8 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ($this->getCampuses() as $c) { - if ($c->name !== null && ! Utilities::termExists($c->name, self::TAX_CAMPUS)) { - $term = Utilities::insertTerm( - $c->name, - self::TAX_CAMPUS, - [ - 'description' => $c->name, - 'slug' => sanitize_title($c->code) - ] - ); - if (is_wp_error($term)) { - new TouchPointWP_WPError($term); - } else { - update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $c->id); - } - - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } - // TODO remove defunct campuses (including all of them, if disabled) // Divisions & Programs $divisionTypesToApply = []; @@ -1338,7 +1335,7 @@ function getLabels(string $singular, string $plural): array } // TODO allow this taxonomy to be applied to other post types as an option. if (count($divisionTypesToApply) > 0) { - $rt = register_taxonomy( + register_taxonomy( self::TAX_DIV, $divisionTypesToApply, [ @@ -1359,75 +1356,13 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - $enabledDivisions = $this->settings->dv_divisions; - foreach ($this->getDivisions() as $d) { - if (in_array('div' . $d->id, $enabledDivisions)) { - // Program - $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); - if ($pTermInfo === null && $d->pName !== null) { - $pTermInfo = Utilities::insertTerm( - $d->pName, - self::TAX_DIV, - [ - 'description' => $d->pName, - 'slug' => sanitize_title($d->pName) - ] - ); - if (is_wp_error($pTermInfo)) { - new TouchPointWP_WPError($pTermInfo); - } else { - update_term_meta($pTermInfo['term_id'], self::SETTINGS_PREFIX . 'programId', $d->proId); - } - - self::queueFlushRewriteRules(); - } - - // Division - $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); - if ($dTermInfo === null && $d->dName !== null) { - $dTermInfo = Utilities::insertTerm( - $d->dName, - self::TAX_DIV, - [ - 'description' => $d->dName, - 'parent' => $pTermInfo['term_id'], - 'slug' => sanitize_title($d->dName) - ] - ); - if (is_wp_error($dTermInfo)) { - new TouchPointWP_WPError($dTermInfo); - } else { - update_term_meta($dTermInfo['term_id'], self::SETTINGS_PREFIX . 'divId', $d->id); - } - - self::queueFlushRewriteRules(); - } - } else { - // Remove terms that are disabled from importing. - - // Delete disabled divisions. Get program, so we delete the right division. - $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); - if ($pTermInfo !== null) { - $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); - if ($dTermInfo !== null) { - wp_delete_term($dTermInfo['term_id'], self::TAX_DIV); - self::queueFlushRewriteRules(); - } - } - - // Program - // TODO remove programs that no longer have a division selected for use as a term. - // TODO remove program & div terms that are no longer present in TouchPoint - } - } - } + // Terms inserted via insertTerms method } if ($this->settings->enable_involvements === "on") { // Weekdays - $rt = register_taxonomy( + register_taxonomy( self::TAX_WEEKDAY, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1447,25 +1382,10 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - for ($di = 0; $di < 7; $di++) { - $name = Utilities::getPluralDayOfWeekNameForNumber_noI18n($di); - if ( ! Utilities::termExists($name, self::TAX_WEEKDAY)) { - Utilities::insertTerm( - $name, - self::TAX_WEEKDAY, - [ - 'description' => $name, - 'slug' => Utilities::getDayOfWeekShortForNumber_noI18n($di) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Tenses - $rt = register_taxonomy( + register_taxonomy( self::TAX_TENSE, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1485,31 +1405,11 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach ( - [ - TouchPointWP::TAX_TENSE_FUTURE => 'Upcoming', - TouchPointWP::TAX_TENSE_PRESENT => 'Current', - TouchPointWP::TAX_TENSE_PAST => 'Past', - ] as $slug => $name - ) { - if ( ! Utilities::termExists($slug, self::TAX_TENSE)) { - Utilities::insertTerm( - $name, - self::TAX_TENSE, - [ - 'description' => $name, - 'slug' => $slug - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Time of Day /** @noinspection SpellCheckingInspection */ - $rt = register_taxonomy( + register_taxonomy( self::TAX_DAYTIME, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1529,32 +1429,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - $timesOfDay = [ - 'Late Night', - 'Early Morning', - 'Morning', - 'Midday', - 'Afternoon', - 'Evening', - 'Night' - ]; - foreach ($timesOfDay as $tod) { - if ( ! Utilities::termExists($tod, self::TAX_WEEKDAY)) { - $slug = str_replace(" ", "", $tod); - $slug = strtolower($slug); - Utilities::insertTerm( - $tod, - self::TAX_DAYTIME, - [ - 'description' => $tod, - 'slug' => $slug - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } // Age Groups @@ -1563,7 +1438,7 @@ function getLabels(string $singular, string $plural): array $ageGroupTypesToApply = Involvement_PostTypeSettings::getPostTypes(); } $ageGroupTypesToApply[] = 'user'; - $rt = register_taxonomy( + register_taxonomy( self::TAX_AGEGROUP, $ageGroupTypesToApply, [ @@ -1583,26 +1458,12 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach (["20s", "30s", "40s", "50s", "60s", "70+"] as $ag) { - if ( ! Utilities::termExists($ag, self::TAX_AGEGROUP)) { - Utilities::insertTerm( - $ag, - self::TAX_AGEGROUP, - [ - 'description' => $ag, - 'slug' => sanitize_title($ag) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method // Involvement Marital Status if ($this->settings->enable_involvements === "on") { - $rt = register_taxonomy( + register_taxonomy( self::TAX_INV_MARITAL, Involvement_PostTypeSettings::getPostTypes(), [ @@ -1622,21 +1483,7 @@ function getLabels(string $singular, string $plural): array ], ] ); - if (! is_wp_error($rt)) { - foreach (['mostly_single', 'mostly_married'] as $ms) { - if ( ! Utilities::termExists($ms, self::TAX_INV_MARITAL)) { - Utilities::insertTerm( - $ms, - self::TAX_INV_MARITAL, - [ - 'description' => $ms, - 'slug' => sanitize_title($ms) - ] - ); - self::queueFlushRewriteRules(); - } - } - } + // Terms inserted via insertTerms method } // Global Partner Category @@ -1672,6 +1519,245 @@ function getLabels(string $singular, string $plural): array } } + /** + * For the taxonomies that are based on Lookups in the TouchPoint database, insert or update the terms. + * + * @param object[] $list + * @param string $taxonomy + * @param bool $forceIdUpdate + * + * @return void + */ + protected function insertTermsForLookupBasedTaxonomy(array $list, string $taxonomy, bool $forceIdUpdate) + { + foreach ($list as $i) { + if ($i->name === null) { + continue; + } + // In addition to making sure term exists, make sure it has the correct meta id, too. + $term = Utilities::termExists($i->name, $taxonomy); + $idUpdate = $forceIdUpdate; + if (!$term) { + $term = Utilities::insertTerm( + $i->name, + $taxonomy, + [ + 'description' => $i->name, + 'slug' => sanitize_title($i->name) + ] + ); + if (is_wp_error($term)) { + new TouchPointWP_WPError($term); + $term = null; + } + $idUpdate = true; + } + if ($term !== null && isset($term['term_id']) && $idUpdate) { + update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $i->id); + } + if ($idUpdate) { + self::queueFlushRewriteRules(); + } + } + } + + public static bool $forceTermLookupIdUpdate = false; + + /** + * Insert the terms for the registered taxonomies. (This is supposed to happen a while after the taxonomies are + * loaded.) + * + * @return void + */ + public function insertTerms() + { + // Resident Codes + $this->insertTermsForLookupBasedTaxonomy( + $this->getResCodes(), + self::TAX_RESCODE, + self::$forceTermLookupIdUpdate + ); + // TODO remove defunct res codes + + // Campuses + if ($this->settings->enable_campuses === "on") { + $this->insertTermsForLookupBasedTaxonomy( + $this->getCampuses(), + self::TAX_CAMPUS, + self::$forceTermLookupIdUpdate + ); + } + // TODO remove defunct campuses (including all of them, if disabled) + + // Age Groups + foreach (["20s", "30s", "40s", "50s", "60s", "70+"] as $ag) { + if ( ! Utilities::termExists($ag, self::TAX_AGEGROUP)) { + Utilities::insertTerm( + $ag, + self::TAX_AGEGROUP, + [ + 'description' => $ag, + 'slug' => sanitize_title($ag) + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Involvements and TODO Events + $postTypesToApply = []; + if ($this->settings->enable_involvements === "on") { + $postTypesToApply = Involvement_PostTypeSettings::getPostTypes(); + } + if (count($postTypesToApply) > 0) { + + // Divisions & Programs + $enabledDivisions = $this->settings->dv_divisions; + foreach ($this->getDivisions() as $d) { + if (in_array('div' . $d->id, $enabledDivisions)) { + // Program + $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); + if ($pTermInfo === null && $d->pName !== null) { + $pTermInfo = Utilities::insertTerm( + $d->pName, + self::TAX_DIV, + [ + 'description' => $d->pName, + 'slug' => sanitize_title($d->pName) + ] + ); + if (is_wp_error($pTermInfo)) { + new TouchPointWP_WPError($pTermInfo); + } else { + update_term_meta($pTermInfo['term_id'], self::SETTINGS_PREFIX . 'programId', $d->proId); + } + + self::queueFlushRewriteRules(); + } + + // Division + $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); + if ($dTermInfo === null && $d->dName !== null) { + $dTermInfo = Utilities::insertTerm( + $d->dName, + self::TAX_DIV, + [ + 'description' => $d->dName, + 'parent' => $pTermInfo['term_id'], + 'slug' => sanitize_title($d->dName) + ] + ); + if (is_wp_error($dTermInfo)) { + new TouchPointWP_WPError($dTermInfo); + } else { + update_term_meta($dTermInfo['term_id'], self::SETTINGS_PREFIX . 'divId', $d->id); + } + + self::queueFlushRewriteRules(); + } + } else { + // Remove terms that are disabled from importing. + + // Delete disabled divisions. Get program, so we delete the right division. + $pTermInfo = Utilities::termExists($d->pName, self::TAX_DIV, 0); + if ($pTermInfo !== null) { + $dTermInfo = Utilities::termExists($d->dName, self::TAX_DIV, $pTermInfo['term_id']); + if ($dTermInfo !== null) { + wp_delete_term($dTermInfo['term_id'], self::TAX_DIV); + self::queueFlushRewriteRules(); + } + } + + // Program + // TODO remove programs that no longer have a division selected for use as a term. + // TODO remove program & div terms that are no longer present in TouchPoint + } + } + + // Weekdays + for ($di = 0; $di < 7; $di++) { + $name = Utilities::getPluralDayOfWeekNameForNumber_noI18n($di); + if ( ! Utilities::termExists($name, self::TAX_WEEKDAY)) { + Utilities::insertTerm( + $name, + self::TAX_WEEKDAY, + [ + 'description' => $name, + 'slug' => Utilities::getDayOfWeekShortForNumber_noI18n($di) + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Tense + foreach ( + [ + TouchPointWP::TAX_TENSE_FUTURE => 'Upcoming', + TouchPointWP::TAX_TENSE_PRESENT => 'Current', + TouchPointWP::TAX_TENSE_PAST => 'Past', + ] as $slug => $name + ) { + if ( ! Utilities::termExists($slug, self::TAX_TENSE)) { + Utilities::insertTerm( + $name, + self::TAX_TENSE, + [ + 'description' => $name, + 'slug' => $slug + ] + ); + self::queueFlushRewriteRules(); + } + } + + // Time of Day + $timesOfDay = [ + 'Late Night', + 'Early Morning', + 'Morning', + 'Midday', + 'Afternoon', + 'Evening', + 'Night' + ]; + foreach ($timesOfDay as $tod) { + if ( ! Utilities::termExists($tod, self::TAX_WEEKDAY)) { + $slug = str_replace(" ", "", $tod); + $slug = strtolower($slug); + Utilities::insertTerm( + $tod, + self::TAX_DAYTIME, + [ + 'description' => $tod, + 'slug' => $slug + ] + ); + self::queueFlushRewriteRules(); + } + } + } + + // Involvements + if ($this->settings->enable_involvements === "on") { + + // Involvement Marital Status + foreach (['mostly_single', 'mostly_married'] as $ms) { + if ( ! Utilities::termExists($ms, self::TAX_INV_MARITAL)) { + Utilities::insertTerm( + $ms, + self::TAX_INV_MARITAL, + [ + 'description' => $ms, + 'slug' => sanitize_title($ms) + ] + ); + self::queueFlushRewriteRules(); + } + } + } + } + private static array $divisionTerms = []; /** @@ -1749,9 +1835,7 @@ public function activation() { self::queueFlushRewriteRules(); - $this->createTables(); - - $this->settings->migrate(); + $this->migrate(true); } /** @@ -1793,26 +1877,6 @@ protected static function clearScheduledHooks(): void wp_clear_scheduled_hook(Report::CRON_HOOK); } - /** - * Create or update database tables - */ - protected function createTables(): void - { - global $wpdb; - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - - // IP Geo Caching table - $tableName = $wpdb->base_prefix . self::TABLE_IP_GEO; - $sql = "CREATE TABLE $tableName ( - id int(10) unsigned NOT NULL auto_increment, - ip varbinary(16) NOT NULL UNIQUE, - updatedDT datetime DEFAULT NOW(), - data text NOT NULL, - PRIMARY KEY (id) - )"; - dbDelta($sql); - } - /** * Drop database tables at uninstallation. */ @@ -1835,7 +1899,7 @@ protected static function dropTables(): void */ private function _log_version_number() { - update_option(self::TOKEN . '_version', self::VERSION, false); + update_option(self::TOKEN . '_version', self::VERSION, true); } /** diff --git a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php index ae6bc5a7..4fc95411 100644 --- a/src/TouchPoint-WP/TouchPointWP_AdminAPI.php +++ b/src/TouchPoint-WP/TouchPointWP_AdminAPI.php @@ -88,7 +88,7 @@ public static function api(array $uri): bool if (!TouchPointWP::currentUserIsAdmin()) { return false; } - TouchPointWP::instance()->settings->migrate(); + TouchPointWP::instance()->migrate(true); exit; case "phpinfo": diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 7bf47ed0..0f9e8dfc 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -180,6 +180,31 @@ public function hasValidApiSettings(): bool $this->getWithoutDefault('api_pass') === TouchPointWP_Settings::UNDEFINED_PLACEHOLDER); } + /** + * Used internally to determine if a particular setting should be auto-loaded. + * + * @param string $settingName + * + * @return bool + */ + private function settingShouldBeAutoLoaded(string $settingName): bool + { + if (str_contains($settingName, '_cron_last_run')) { + return true; + } + foreach (self::settingsFields() as $page) { + foreach ($page['fields'] as $f) { + if ($f['id'] === $settingName) { + if (isset($f['autoload'])) { + return !!$f['autoload']; + } + return false; + } + } + } + return false; + } + /** * Build settings fields * @@ -213,6 +238,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, 'callback' => fn($new) => $this->validation_updateScriptsIfChanged($new, 'enable_authentication'), ], [ @@ -221,6 +247,7 @@ private function settingsFields($includeDetail = false): array 'description' => __('Add a crazy-simple RSVP button to WordPress event pages.', 'TouchPoint-WP'), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_involvements', @@ -231,6 +258,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_people_lists', @@ -241,6 +269,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_global', @@ -251,6 +280,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'enable_campuses', @@ -261,6 +291,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'checkbox', 'default' => '', + 'autoload' => true, ], [ 'id' => 'system_name', @@ -1174,16 +1205,18 @@ protected function getWithoutDefault(string $what, $default = self::UNDEFINED_PL /** * @param string $what * @param mixed $value - * @param bool $autoload + * @param ?bool $autoload * * @return false|mixed */ - public function set(string $what, $value, bool $autoload = false): bool + public function set(string $what, $value, ?bool $autoload = null): bool { + if ($autoload === null) { + $autoload = $this->settingShouldBeAutoLoaded($what); + } return update_option(TouchPointWP::SETTINGS_PREFIX . $what, $value, $autoload); // TODO MULTI } - /** * Migrate settings from version to version. This may be called even when a migration isn't necessary. */ @@ -1314,14 +1347,7 @@ public function migrate(): void // 0.0.31 - Add lookup IDs to ResCodes - foreach (TouchPointWP::instance()->getResCodes() as $rc) { - $term = Utilities::termExists($rc->name, TouchPointWP::TAX_RESCODE); - if ($term !== null && isset($term['term_id'])) { - if (update_term_meta($term['term_id'], TouchPointWP::TAXMETA_LOOKUP_ID, $rc->id)) { - TouchPointWP::queueFlushRewriteRules(); - } - } - } + TouchPointWP::$forceTermLookupIdUpdate = true; // Update version string diff --git a/src/python/WebApi.py b/src/python/WebApi.py index 2e76ee39..a6622d74 100644 --- a/src/python/WebApi.py +++ b/src/python/WebApi.py @@ -18,8 +18,7 @@ def print_exception(): # From https://stackoverflow.com/a/20264059/2339939 lineno = tb.tb_lineno filename = f.f_code.co_filename linecache.checkcache(filename) - line = linecache.getline(filename, lineno, f.f_globals) - print('EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj)) + print('{} (L{})'.format(exc_obj, lineno)) def get_person_info_for_sync(person_obj): @@ -1166,6 +1165,9 @@ def get_person_info_for_sync(person_obj): model.Title = "Login" model.Header = "Processing..." + if response == "": + raise Exception("Could not communicate with WordPress server.") + response = json.loads(response) if "error" in response: @@ -1199,10 +1201,8 @@ def get_person_info_for_sync(person_obj): print("

Please email the following error message to " + model.Setting("AdminMail", "the church staff") + ".

")
             print(response)
-            print("
") - print("") + print("") if not apiCalled: model.Title = "Invalid Request" From 61188fee1fac77d8619b4dbdb09cd10aec7ef7a7 Mon Sep 17 00:00:00 2001 From: James K Date: Fri, 21 Jul 2023 22:49:32 -0400 Subject: [PATCH 020/226] Further updates to which options are autoloaded. --- src/TouchPoint-WP/TouchPointWP.php | 1 + src/TouchPoint-WP/TouchPointWP_Settings.php | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index a1485e9a..0ea5b308 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -1552,6 +1552,7 @@ protected function insertTermsForLookupBasedTaxonomy(array $list, string $taxono } $idUpdate = true; } + // Update the term meta if term is new, or if id update is forced. if ($term !== null && isset($term['term_id']) && $idUpdate) { update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $i->id); } diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 0f9e8dfc..1b57163e 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -189,7 +189,10 @@ public function hasValidApiSettings(): bool */ private function settingShouldBeAutoLoaded(string $settingName): bool { - if (str_contains($settingName, '_cron_last_run')) { + if (str_contains($settingName, '_cron_last_run') + || $settingName === "DEBUG" + || $settingName === "meta_familyEvFields" // because it's used when registering the taxonomies on every init. + ) { return true; } foreach (self::settingsFields() as $page) { @@ -313,6 +316,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => 'mychurch.tpsdb.com', 'callback' => [$this, 'validation_lowercase'] ], @@ -338,6 +342,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => '', ], [ @@ -349,6 +354,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text_secret', 'default' => '', + 'autoload' => true, 'placeholder' => $this->passwordPlaceholder('api_pass'), 'callback' => fn($new) => $this->validation_secret($new, 'api_pass') ], @@ -361,6 +367,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'WebApi', + 'autoload' => true, 'placeholder' => '', ], [ @@ -372,6 +379,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', + 'autoload' => true, 'placeholder' => '', ], [ @@ -389,7 +397,8 @@ private function settingsFields($includeDetail = false): array ]; // Add Script generation section if necessary settings are established. - if ($this->getWithoutDefault('system_name') !== self::UNDEFINED_PLACEHOLDER + if ($includeDetail + && $this->getWithoutDefault('system_name') !== self::UNDEFINED_PLACEHOLDER && $this->hasValidApiSettings()) { /** @noinspection HtmlUnknownTarget */ $this->settings['basic']['fields'][] = [ @@ -535,6 +544,7 @@ private function settingsFields($includeDetail = false): array 'type' => 'textarea', 'label' => __('Involvement Post Types', 'TouchPoint-WP'), 'default' => '[]', + 'autoload' => true, 'hidden' => true, 'description' => !$includeThis ? "" : function() { TouchPointWP::requireScript("base"); @@ -617,6 +627,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'partners', + 'autoload' => true, 'placeholder' => 'partners', 'callback' => fn($new) => $this->validation_slug($new, 'global_slug') ], @@ -708,6 +719,7 @@ private function settingsFields($includeDetail = false): array 'type' => 'select', 'options' => $includeThis ? $this->parent->getFamilyEvFieldsAsKVArray('code', true) : [], 'default' => [], + 'autoload' => true, ], ], ]; @@ -764,6 +776,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Divisions', + 'autoload' => true, 'placeholder' => 'Divisions' ], [ @@ -775,6 +788,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Division', + 'autoload' => true, 'placeholder' => 'Division' ], [ @@ -786,6 +800,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'div', + 'autoload' => true, 'placeholder' => 'div', 'callback' => fn($new) => $this->validation_slug($new, 'dv_slug') ], @@ -844,6 +859,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Campuses', + 'autoload' => true, 'placeholder' => 'Campuses' ], [ @@ -855,6 +871,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Campus', + 'autoload' => true, 'placeholder' => 'Campus' ], [ @@ -866,6 +883,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'campus', + 'autoload' => true, 'placeholder' => 'campus', 'callback' => fn($new) => $this->validation_slug($new, 'camp_slug') ] @@ -886,6 +904,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Resident Codes', + 'autoload' => true, 'placeholder' => 'Resident Codes' ], [ @@ -897,6 +916,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'Resident Code', + 'autoload' => true, 'placeholder' => 'Resident Code' ], [ @@ -908,6 +928,7 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'rescodes', + 'autoload' => true, 'placeholder' => 'rescodes', 'callback' => fn($new) => $this->validation_slug($new, 'rc_slug') ] From 6016dcc603736026e2fc64449d763bbeb24a4911 Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 8 Aug 2023 07:24:16 -0400 Subject: [PATCH 021/226] Adding filter for report classes --- src/TouchPoint-WP/Report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/Report.php b/src/TouchPoint-WP/Report.php index 837ac966..7d01c0e3 100644 --- a/src/TouchPoint-WP/Report.php +++ b/src/TouchPoint-WP/Report.php @@ -35,6 +35,8 @@ class Report implements api, module, JsonSerializable, updatesViaCron public const NAME_META_KEY = self::META_PREFIX . "name"; public const P1_META_KEY = self::META_PREFIX . "p1"; public const DEFAULT_CONTENT = ''; + public const FIGURE_CLASS_FILTER = TouchPointWP::SETTINGS_PREFIX . "rpt_figure_class"; + public const FIGURE_CLASS_DEFAULT = "TouchPoint-report"; public static bool $_isLoaded = false; @@ -286,7 +288,8 @@ public static function reportShortcode($params = [], string $content = ""): stri // Add Figure elt with a unique ID $idAttr = "id=\"" . wp_unique_id('tp-report-') . "\""; - $rc = "
\n\t" . str_replace("\n", "\n\t", $rc); + $class = apply_filters(self::FIGURE_CLASS_FILTER, self::FIGURE_CLASS_DEFAULT); + $rc = "
\n\t" . str_replace("\n", "\n\t", $rc); // If desired, add a caption that indicates when the table was last updated. if ($params['showupdated']) { From 117a69b4e51be03c6dcae169ee8ea6456caab4ff Mon Sep 17 00:00:00 2001 From: James K Date: Thu, 10 Aug 2023 15:57:38 -0400 Subject: [PATCH 022/226] Updates related to changed dev environment --- .gitignore | 3 ++- .idea/misc.xml | 1 - .idea/php.xml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0380c8f9..2f612cad 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ node_modules package-lock.json /build/ -/touchpoint-wp.zip \ No newline at end of file +/touchpoint-wp.zip +/composer.phar diff --git a/.idea/misc.xml b/.idea/misc.xml index 591fc5ab..691dd2ff 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - @noinspection diff --git a/.idea/php.xml b/.idea/php.xml index 05d47f11..299cb8ee 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -13,6 +13,7 @@ + From 8ef8f5e60a95562f868a6970e7c7f6b66dd5fd1f Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 24 Aug 2023 22:14:55 -0400 Subject: [PATCH 023/226] Resolving an issue with how settings are defined --- src/TouchPoint-WP/TouchPointWP_Settings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 1b57163e..707ca003 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -1401,7 +1401,7 @@ public function updateDeployedScripts(): void */ public function registerSettings(): void { - $currentSection = false; + $currentSection = 'basic'; // basic is the default. if (isset($_POST['tab']) && $_POST['tab']) { $currentSection = $_POST['tab']; } elseif (isset($_GET['tab']) && $_GET['tab']) { @@ -1411,7 +1411,7 @@ public function registerSettings(): void $this->settings = $this->settingsFields($currentSection); foreach ($this->settings as $section => $data) { // Check posted/selected tab. - if ($currentSection && $currentSection !== $section) { + if ($currentSection !== $section) { continue; } From 2d2e31ad4a5822628b1c8d6fe5edfaeb2e3bf770 Mon Sep 17 00:00:00 2001 From: "James K." Date: Fri, 25 Aug 2023 17:23:17 -0400 Subject: [PATCH 024/226] Merging buxfixes and optimizations from Next --- src/TouchPoint-WP/TouchPointWP.php | 2 +- src/TouchPoint-WP/TouchPointWP_Settings.php | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 0ea5b308..de450c2c 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -1552,7 +1552,7 @@ protected function insertTermsForLookupBasedTaxonomy(array $list, string $taxono } $idUpdate = true; } - // Update the term meta if term is new, or if id update is forced. + // Update the term meta if term is new, or if id update is forced. if ($term !== null && isset($term['term_id']) && $idUpdate) { update_term_meta($term['term_id'], self::TAXMETA_LOOKUP_ID, $i->id); } diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 707ca003..1a38ecd4 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -316,7 +316,6 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', - 'autoload' => true, 'placeholder' => 'mychurch.tpsdb.com', 'callback' => [$this, 'validation_lowercase'] ], @@ -342,7 +341,6 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', - 'autoload' => true, 'placeholder' => '', ], [ @@ -354,7 +352,6 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text_secret', 'default' => '', - 'autoload' => true, 'placeholder' => $this->passwordPlaceholder('api_pass'), 'callback' => fn($new) => $this->validation_secret($new, 'api_pass') ], @@ -367,7 +364,6 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => 'WebApi', - 'autoload' => true, 'placeholder' => '', ], [ @@ -379,7 +375,6 @@ private function settingsFields($includeDetail = false): array ), 'type' => 'text', 'default' => '', - 'autoload' => true, 'placeholder' => '', ], [ @@ -719,7 +714,6 @@ private function settingsFields($includeDetail = false): array 'type' => 'select', 'options' => $includeThis ? $this->parent->getFamilyEvFieldsAsKVArray('code', true) : [], 'default' => [], - 'autoload' => true, ], ], ]; From 8ac7869ff927be5f4db23d81c735a9f7a9d607e1 Mon Sep 17 00:00:00 2001 From: James K Date: Mon, 14 Aug 2023 22:29:41 -0400 Subject: [PATCH 025/226] Reworking build procedure to maintain a local build directory during development. --- .gitignore | 4 +--- build.sh | 19 +++++++++---------- generateI18n_1forTranslation.ps1 | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 2f612cad..236fe5d4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ composer.lock /assets/images/people /TouchPointWP_ErrorLog.txt /.phpdoc/ -/phpDocumentor.phar -/wp-cli.phar +*.phar /.idea/workspace.xml /.idea/usage.statistics.xml @@ -24,4 +23,3 @@ package-lock.json /build/ /touchpoint-wp.zip -/composer.phar diff --git a/build.sh b/build.sh index b69c25e7..772b2e07 100644 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js cp -r assets build cd ./build || exit -zip -r ../touchpoint-wp.zip assets +#zip -r ../touchpoint-wp.zip assets cd .. @@ -35,15 +35,14 @@ cp -r ./i18n ./build/i18n php ./wp-cli.phar i18n make-json ./build/i18n php ./wp-cli.phar i18n make-mo ./build/i18n -cd ./build || exit -zip -r ../touchpoint-wp.zip i18n -cd .. -zip -r touchpoint-wp.zip ./ext -zip -r touchpoint-wp.zip ./src +cp -r ./ext ./build/ext +cp -r ./src ./build/src -find . -maxdepth 1 -iname "*.php" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.md" -exec zip touchpoint-wp.zip {} \; -find . -maxdepth 1 -iname "*.json" -exec zip touchpoint-wp.zip {} \; +find . -maxdepth 1 -iname "*.php" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.md" -exec cp {} build/ \; +find . -maxdepth 1 -iname "*.json" -exec cp {} build/ \; -rm -r build \ No newline at end of file +cd ./build || exit +find . -exec zip ../touchpoint-wp.zip {} \; +cd .. diff --git a/generateI18n_1forTranslation.ps1 b/generateI18n_1forTranslation.ps1 index cc5a901d..e23662c6 100644 --- a/generateI18n_1forTranslation.ps1 +++ b/generateI18n_1forTranslation.ps1 @@ -7,5 +7,5 @@ if (!(test-path $pharFile -newerThan $compareDt)) Invoke-WebRequest https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile $pharFile } -php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot +php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot --exclude=build php .\wp-cli.phar i18n update-po i18n/TouchPoint-WP.pot \ No newline at end of file From 00facce0819283efd340a85baa46511a29257465 Mon Sep 17 00:00:00 2001 From: James K Date: Mon, 14 Aug 2023 22:30:57 -0400 Subject: [PATCH 026/226] Adding jetbrains run profiles --- .idea/runConfigurations/Build__WSL_.xml | 17 +++++++++++++++++ .../i18n__1_for_Translation.xml | 17 +++++++++++++++++ .idea/runConfigurations/i18n__2_for_Publish.xml | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .idea/runConfigurations/Build__WSL_.xml create mode 100644 .idea/runConfigurations/i18n__1_for_Translation.xml create mode 100644 .idea/runConfigurations/i18n__2_for_Publish.xml diff --git a/.idea/runConfigurations/Build__WSL_.xml b/.idea/runConfigurations/Build__WSL_.xml new file mode 100644 index 00000000..d2225246 --- /dev/null +++ b/.idea/runConfigurations/Build__WSL_.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/i18n__1_for_Translation.xml b/.idea/runConfigurations/i18n__1_for_Translation.xml new file mode 100644 index 00000000..8f161b58 --- /dev/null +++ b/.idea/runConfigurations/i18n__1_for_Translation.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/i18n__2_for_Publish.xml b/.idea/runConfigurations/i18n__2_for_Publish.xml new file mode 100644 index 00000000..30b2968d --- /dev/null +++ b/.idea/runConfigurations/i18n__2_for_Publish.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file From 1d0588c0d661dfbd4de5bc21f30a54e332cf2e71 Mon Sep 17 00:00:00 2001 From: James K Date: Tue, 15 Aug 2023 15:25:10 -0400 Subject: [PATCH 027/226] build improvements --- .github/workflows/releases.yml | 4 ++-- .idea/misc.xml | 3 ++- build.sh | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 5b1c26a6..5d315037 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,10 +1,10 @@ +name: Create Release + on: push: tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -name: Create Release - jobs: build: name: Create Release diff --git a/.idea/misc.xml b/.idea/misc.xml index 691dd2ff..ec30493f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,7 @@ + @noinspection - + \ No newline at end of file diff --git a/build.sh b/build.sh index 772b2e07..1f1eb7ad 100644 --- a/build.sh +++ b/build.sh @@ -24,12 +24,13 @@ uglifyjs -o build/assets/js/meeting-defer.min.js -- assets/js/meeting-defer.js uglifyjs -o build/assets/js/partner-defer.min.js -- assets/js/partner-defer.js cp -r assets build cd ./build || exit -#zip -r ../touchpoint-wp.zip assets cd .. # compile translations -wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +if [ ! -f wp-cli.phar ]; then + wget -O wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +fi cp -r ./i18n ./build/i18n From d27cbf2f9e628278e89db2fbaef1f8ba52d1e768 Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 24 Aug 2023 22:12:14 -0400 Subject: [PATCH 028/226] Settings for Meeting Calendars --- .idea/misc.xml | 1 - i18n/TouchPoint-WP-es_ES.po | 390 ++++++++++--------- i18n/TouchPoint-WP.pot | 392 +++++++++++--------- src/TouchPoint-WP/TouchPointWP_Settings.php | 74 +++- 4 files changed, 504 insertions(+), 353 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index ec30493f..d436a9a5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - @noinspection diff --git a/i18n/TouchPoint-WP-es_ES.po b/i18n/TouchPoint-WP-es_ES.po index cb174921..dc3f5a94 100644 --- a/i18n/TouchPoint-WP-es_ES.po +++ b/i18n/TouchPoint-WP-es_ES.po @@ -50,7 +50,7 @@ msgid "Slug" msgstr "Slug" #: src/templates/admin/invKoForm.php:47 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:763 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:865 msgid "Divisions to Import" msgstr "Divisiones a Importar" @@ -118,13 +118,13 @@ msgstr "Género" #: src/templates/admin/invKoForm.php:169 #: src/TouchPoint-WP/Involvement.php:1419 -#: src/TouchPoint-WP/TouchPointWP.php:1422 +#: src/TouchPoint-WP/TouchPointWP.php:1372 msgid "Weekday" msgstr "Día laborable" #: src/templates/admin/invKoForm.php:173 #: src/TouchPoint-WP/Involvement.php:1445 -#: src/TouchPoint-WP/TouchPointWP.php:1504 +#: src/TouchPoint-WP/TouchPointWP.php:1419 msgid "Time of Day" msgstr "Hora del día" @@ -133,7 +133,7 @@ msgid "Prevailing Marital Status" msgstr "Estado civil prevaleciente" #: src/templates/admin/invKoForm.php:181 -#: src/TouchPoint-WP/TouchPointWP.php:1558 +#: src/TouchPoint-WP/TouchPointWP.php:1448 msgid "Age Group" msgstr "Grupo de edad" @@ -177,19 +177,19 @@ msgid "%s will be imported overnight for the first time." msgstr "%s se importarán durante la noche por primera vez." #. translators: %s is "what you call TouchPoint at your church", which is a setting -#: src/TouchPoint-WP/Auth.php:137 +#: src/TouchPoint-WP/Auth.php:138 msgid "Sign in with your %s account" msgstr "Inicie sesión con su cuenta de %s" -#: src/TouchPoint-WP/Auth.php:392 +#: src/TouchPoint-WP/Auth.php:391 msgid "Your login token expired." msgstr "Su token de inicio de sesión caducó." -#: src/TouchPoint-WP/Auth.php:407 +#: src/TouchPoint-WP/Auth.php:406 msgid "Your login token is invalid." msgstr "Su token de inicio de sesión no es válido." -#: src/TouchPoint-WP/Auth.php:419 +#: src/TouchPoint-WP/Auth.php:418 msgid "Session could not be validated." msgstr "No se pudo validar la sesión." @@ -303,110 +303,110 @@ msgstr "Contacta" msgid "RSVP" msgstr "RSVP" -#: src/TouchPoint-WP/TouchPointWP.php:2404 +#: src/TouchPoint-WP/TouchPointWP.php:2484 msgid "Unknown Type" msgstr "Tipo desconocido" -#: src/TouchPoint-WP/TouchPointWP.php:2458 +#: src/TouchPoint-WP/TouchPointWP.php:2538 msgid "Your Searches" msgstr "Tus búsquedas" -#: src/TouchPoint-WP/TouchPointWP.php:2461 +#: src/TouchPoint-WP/TouchPointWP.php:2541 msgid "Public Searches" msgstr "Búsquedas públicas" -#: src/TouchPoint-WP/TouchPointWP.php:2464 +#: src/TouchPoint-WP/TouchPointWP.php:2544 msgid "Status Flags" msgstr "Indicadores de Estado" -#: src/TouchPoint-WP/TouchPointWP.php:2469 -#: src/TouchPoint-WP/TouchPointWP.php:2470 +#: src/TouchPoint-WP/TouchPointWP.php:2549 +#: src/TouchPoint-WP/TouchPointWP.php:2550 msgid "Current Value" msgstr "Valor actual" -#: src/TouchPoint-WP/TouchPointWP.php:2597 -#: src/TouchPoint-WP/TouchPointWP.php:2635 +#: src/TouchPoint-WP/TouchPointWP.php:2677 +#: src/TouchPoint-WP/TouchPointWP.php:2715 msgid "Invalid or incomplete API Settings." msgstr "Configuración de API no válida o incompleta." -#: src/TouchPoint-WP/TouchPointWP.php:2605 -#: src/TouchPoint-WP/TouchPointWP.php:2642 +#: src/TouchPoint-WP/TouchPointWP.php:2685 +#: src/TouchPoint-WP/TouchPointWP.php:2722 msgid "Host appears to be missing from TouchPoint-WP configuration." msgstr "Parece que falta el host en la configuración de TouchPoint-WP." -#: src/TouchPoint-WP/TouchPointWP.php:2762 +#: src/TouchPoint-WP/TouchPointWP.php:2842 msgid "People Query Failed" msgstr "Consulta de registros de personas fallida" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:204 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:235 msgid "Basic Settings" msgstr "Ajustes básicos" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:205 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:236 msgid "Connect to TouchPoint and choose which features you wish to use." msgstr "Conéctese a TouchPoint y elija qué funciones desea usar." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:209 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:240 msgid "Enable Authentication" msgstr "Habilitar autenticación" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:210 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:241 msgid "Allow TouchPoint users to sign into this website with TouchPoint." msgstr "Permita que los usuarios de TouchPoint inicien sesión en este sitio web con TouchPoint." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:220 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:252 msgid "Enable RSVP Tool" msgstr "Habilitar la herramienta RSVP" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:221 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:253 msgid "Add a crazy-simple RSVP button to WordPress event pages." msgstr "Agregue un botón RSVP muy simple a las páginas de eventos de WordPress." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:227 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:260 msgid "Enable Involvements" msgstr "Habilitar Participaciones" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:228 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:261 msgid "Load Involvements from TouchPoint for involvement listings and entries native in your website." msgstr "Cargue participaciones desde TouchPoint para obtener listas de participación y entradas nativas en su sitio web." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:237 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:271 msgid "Enable Public People Lists" msgstr "Habilitar listas de personas públicas" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:238 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:272 msgid "Import public people listings from TouchPoint (e.g. staff or elders)" msgstr "Importe listados públicos de personas desde TouchPoint (por ejemplo, personal o ancianos)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:247 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:282 msgid "Enable Global Partner Listings" msgstr "Habilitar listados de Socios Globales" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:248 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:283 msgid "Import ministry partners from TouchPoint to list publicly." msgstr "Importe socios ministeriales de TouchPoint para incluirlos en una lista pública." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:267 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:304 msgid "Display Name" msgstr "Nombre para mostrar" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:268 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:305 msgid "What your church calls your TouchPoint database." msgstr "Lo que su iglesia llama su base de datos TouchPoint." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:278 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:315 msgid "TouchPoint Host Name" msgstr "Nombre de host del TouchPoint" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:279 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:316 msgid "The domain for your TouchPoint database, without the https or any slashes." msgstr "El dominio de su base de datos TouchPoint, sin https ni barras." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:290 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:328 msgid "Custom Mobile App Deeplink Host Name" msgstr "Nombre de host de enlace profundo de aplicación móvil personalizada" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:291 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:329 msgid "" "The domain for your mobile app deeplinks, without the https or any slashes. If you aren't \r\n" " using the custom mobile app, leave this blank." @@ -414,48 +414,48 @@ msgstr "" "El dominio de los enlaces profundos de su aplicación móvil, sin https ni barras oblicuas. \r\n" "Si no está utilizando la aplicación móvil personalizada, déjelo en blanco." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:303 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:341 msgid "TouchPoint API Username" msgstr "Nombre de usuario de la API de TouchPoint" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:314 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:353 msgid "TouchPoint API User Password" msgstr "Contraseña de usuario de la API de TouchPoint" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:315 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:354 msgid "The password of a user account in TouchPoint with API permissions." msgstr "La contraseña de una cuenta de usuario en TouchPoint con permisos de API." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:326 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:366 msgid "TouchPoint API Script Name" msgstr "Nombre de la secuencia de comandos de la API de TouchPoint" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:327 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:367 msgid "The name of the Python script loaded into TouchPoint. Don't change this unless you know what you're doing." msgstr "El nombre de la secuencia de comandos de Python cargada en TouchPoint. No cambies esto a menos que sepas lo que estás haciendo." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:337 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:378 msgid "Google Maps Javascript API Key" msgstr "Clave de la API de Javascript de Google Maps" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:338 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:379 msgid "Required for embedding maps." msgstr "Necesario para incrustar mapas." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:348 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:390 msgid "Google Maps Geocoding API Key" msgstr "Clave API de codificación geográfica de Google Maps" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:349 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:391 msgid "Optional. Allows for reverse geocoding of user locations." msgstr "Opcional. Permite la geocodificación inversa de las ubicaciones de los usuarios." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:366 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:372 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:409 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:415 msgid "Generate Scripts" msgstr "Generar secuencias de comandos" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:369 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:412 msgid "" "Once your settings on this page are set and saved, use this tool to generate\r\n" "the scripts needed for TouchPoint in a convenient installation package. " @@ -463,369 +463,369 @@ msgstr "" "Una vez que haya configurado y guardado su configuración en esta página, \r\n" "use esta herramienta para generar los scripts necesarios para TouchPoint en un conveniente paquete de instalación." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:371 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:414 msgid "Upload the package to {tpName} here" msgstr "Sube el paquete a {tpName} aquí" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:386 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:429 msgid "People" msgstr "Gente" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:387 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:430 msgid "Manage how people are synchronized between TouchPoint and WordPress." msgstr "Administre cómo se sincronizan las personas entre TouchPoint y WordPress." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:391 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:434 msgid "Contact Keywords" msgstr "Palabras clave de contacto" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:392 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:435 msgid "These keywords will be used when someone clicks the \"Contact\" button on a Person's listing or profile." msgstr "Estas palabras clave se utilizarán cuando alguien haga clic en el botón \"Contactar\" en la lista o el perfil de una Persona." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:403 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:446 msgid "Extra Value for WordPress User ID" msgstr "Valor Adicional para la ID de usuario de WordPress" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:404 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:447 msgid "The name of the extra value to use for the WordPress User ID. If you are using multiple WordPress instances with one TouchPoint database, you will need these values to be unique between WordPress instances. In most cases, the default is fine." msgstr "El nombre del valor adicional que se usará para el ID de usuario de WordPress. Si está utilizando varias instancias de WordPress con una base de datos de TouchPoint, necesitará que estos valores sean únicos entre las instancias de WordPress. En la mayoría de los casos, el valor predeterminado está bien." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:414 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:457 msgid "Extra Value: Biography" msgstr "Valor Adicional: Biografía" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:415 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:458 msgid "Import a Bio from a Person Extra Value field. Can be an HTML or Text Extra Value. This will overwrite any values set by WordPress. Leave blank to not import." msgstr "Importe una biografía desde un campo de Valor Adicional de Persona. Puede ser un Valor Adicional HTML o de texto. Esto sobrescribirá cualquier valor establecido por WordPress. Dejar en blanco para no importar." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:425 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:660 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:468 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:705 msgid "Extra Values to Import" msgstr "Valor Adicional para importar" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:426 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:469 msgid "Import People Extra Value fields as User Meta data." msgstr "Importe campos de valor extra de personas como metadatos de usuario." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:442 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:485 msgid "Authentication" msgstr "Autenticación" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:443 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:486 msgid "Allow users to log into WordPress using TouchPoint." msgstr "Permita que los usuarios inicien sesión en WordPress usando TouchPoint." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:447 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:490 msgid "Make TouchPoint the default authentication method." msgstr "Haga que TouchPoint sea el método de autenticación predeterminado." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:448 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:491 msgid "By checking this box, the TouchPoint login page will become the default. To prevent the redirect and reach the standard TouchPoint login page, add '" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:457 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:500 msgid "Enable Auto-Provisioning" msgstr "Habilitar el aprovisionamiento automático" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:458 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:501 msgid "Automatically create WordPress users, if needed, to match authenticated TouchPoint users." msgstr "Cree automáticamente usuarios de WordPress, si es necesario, para que coincidan con los usuarios autenticados de TouchPoint." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:467 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:510 msgid "Change 'Edit Profile' links" msgstr "Cambiar los enlaces 'Editar perfil'" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:468 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:511 msgid "\"Edit Profile\" links will take the user to their TouchPoint profile, instead of their WordPress profile." msgstr "Los enlaces \"Editar perfil\" llevarán al usuario a su perfil de TouchPoint, en lugar de a su perfil de WordPress." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:477 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:520 msgid "Enable full logout" msgstr "Habilitar cierre de sesión completo" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:478 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:521 msgid "Logout of TouchPoint when logging out of WordPress." msgstr "Cierre sesión en TouchPoint al cerrar sesión en WordPress." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:484 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:527 msgid "Prevent Subscriber Admin Bar" msgstr "Prevenir la barra de administración de suscriptores" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:485 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:528 msgid "By enabling this option, users who can't edit anything won't see the Admin bar." msgstr "Al habilitar esta opción, los usuarios que no pueden editar nada no verán la barra de administración." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:499 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:542 msgid "Involvements" msgstr "Involucramientos" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:500 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:543 msgid "Import Involvements from TouchPoint to list them on your website, for Small Groups, Classes, and more. Select the division(s) that immediately correspond to the type of Involvement you want to list. For example, if you want a Small Group list and have a Small Group Division, only select the Small Group Division. If you want Involvements to be filterable by additional Divisions, select those Divisions on the Divisions tab, not here." msgstr "Importe participaciones desde TouchPoint para enumerarlas en su sitio web, para grupos pequeños, clases y más. Seleccione la(s) división(es) que corresponda(n) inmediatamente al tipo de participación que desea enumerar. Por ejemplo, si desea una lista de grupos pequeños y tiene una división de grupos pequeños, solo seleccione la división de grupos pequeños. Si desea que las participaciones se puedan filtrar por divisiones adicionales, seleccione esas divisiones en la pestaña Divisiones, no aquí." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:505 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:548 msgid "Involvement Post Types" msgstr "Tipos de publicaciones de Involucramientos" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:533 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:577 msgid "Global Partners" msgstr "Misioneros" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:534 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:578 msgid "Manage how global partners are imported from TouchPoint for listing on WordPress. Partners are grouped by family, and content is provided through Family Extra Values. This works for both People and Business records." msgstr "Administre cómo se importan los socios globales desde TouchPoint para incluirlos en WordPress. Los socios se agrupan por familia y el contenido se proporciona a través de Valor Extra Familiar. Esto funciona tanto para registros de personas como de empresas." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:538 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:582 msgid "Global Partner Name (Plural)" msgstr "Nombre de los misioneros (plural)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:539 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:583 msgid "What you call Global Partners at your church" msgstr "Lo que llamas los Misioneros en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:549 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:593 msgid "Global Partner Name (Singular)" msgstr "Nombre de un misionero (singular)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:550 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:594 msgid "What you call a Global Partner at your church" msgstr "Lo que llamas un Misionero en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:560 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:604 msgid "Global Partner Name for Secure Places (Plural)" msgstr "Nombre de los misioneros para lugares seguros (plural)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:561 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:605 msgid "What you call Secure Global Partners at your church" msgstr "Lo que llamas un Misionero seguro en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:571 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:615 msgid "Global Partner Name for Secure Places (Singular)" msgstr "Nombre de un misionero para lugares seguros (singular)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:572 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:616 msgid "What you call a Secure Global Partner at your church" msgstr "Lo que llamas los Misioneros seguros en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:582 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:626 msgid "Global Partner Slug" msgstr "Slug de Socio Global" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:583 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:627 msgid "The root path for Global Partner posts" msgstr "La ruta raíz para las publicaciones de Socios Globales" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:594 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:639 msgid "Saved Search" msgstr "Búsqueda Guardada" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:595 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:640 msgid "Anyone who is included in this saved search will be included in the listing." msgstr "Cualquiera que esté incluido en esta búsqueda guardada se incluirá en la lista." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:605 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:650 msgid "Extra Value: Description" msgstr "Valor Adicional: Descripción" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:606 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:651 msgid "Import a description from a Family Extra Value field. Can be an HTML or Text Extra Value. This becomes the body of the Global Partner post." msgstr "Importe una descripción de un campo de Valor Extra Familiar. Puede ser un valor adicional HTML o de texto. Esto se convierte en el cuerpo de la publicación del socio global." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:616 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:661 msgid "Extra Value: Summary" msgstr "Valor Adicional: Resumen" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:617 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:662 msgid "Optional. Import a short description from a Family Extra Value field. Can be an HTML or Text Extra Value. If not provided, the full bio will be truncated." msgstr "Opcional. Importe una breve descripción de un campo de Valor Extra Familiar. Puede ser un Valor Adicional HTML o de texto. Si no se proporciona, la biografía completa se truncará." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:627 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:672 msgid "Latitude Override" msgstr "Anulación de latitud" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:628 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:673 msgid "Designate a text Family Extra Value that will contain a latitude that overrides any locations on the partner's profile for the partner map. Both latitude and longitude must be provided for an override to take place." msgstr "Designe un Valor Familiar Adicional de texto que contenga una latitud que anule cualquier ubicación en el perfil del socio para el mapa de socios. Tanto la latitud como la longitud deben proporcionarse para que se produzca una anulación." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:638 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:683 msgid "Longitude Override" msgstr "Anulación de longitud" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:639 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:684 msgid "Designate a text Family Extra Value that will contain a longitude that overrides any locations on the partner's profile for the partner map. Both latitude and longitude must be provided for an override to take place." msgstr "Designe un Valor Familiar Adicional de texto que contenga una longitud que anule cualquier ubicación en el perfil del socio para el mapa de socios. Tanto la latitud como la longitud deben proporcionarse para que se produzca una anulación." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:649 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:694 msgid "Public Location" msgstr "Ubicación Pública" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:650 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:695 msgid "Designate a text Family Extra Value that will contain the partner's location, as you want listed publicly. For partners who have DecoupleLocation enabled, this field will be associated with the map point, not the list entry." msgstr "Designe un Valor Adicional Familiar de texto que contendrá la ubicación del socio, como desea que se enumere públicamente. Para los socios que tienen DecoupleLocation habilitado, este campo se asociará con el punto del mapa, no con la entrada de la lista." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:661 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:706 msgid "Import Family Extra Value fields as Meta data on the partner's post" msgstr "Importe campos de Valor Adicional Familiar como Metadatos en la publicación del socio" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:672 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:717 msgid "Primary Taxonomy" msgstr "Taxonomía Primaria" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:673 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:718 msgid "Import a Family Extra Value as the primary means by which partners are organized." msgstr "Importe un Valor Adicional Familiar como el medio principal por el cual se organizan los socios." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:688 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:734 msgid "Events Calendar" msgstr "Calendario de eventos" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:689 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:735 msgid "Integrate with The Events Calendar from ModernTribe." msgstr "Integre con el calendario de eventos de ModernTribe." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:693 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:739 msgid "Events for Custom Mobile App" msgstr "Eventos para la aplicación móvil personalizada" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:696 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:742 msgid "To use your Events Calendar events in the Custom mobile app, set the Provider to Wordpress Plugin - Modern Tribe and use this url:" msgstr "Para usar los eventos de su calendario de eventos en la aplicación móvil personalizada, configure el proveedor en Wordpress Plugin - Modern Tribe y use esta URL:" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:698 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:744 msgid "Preview" msgstr "Preestrena" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:713 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:759 msgid "Use Standardizing Stylesheet" msgstr "Usar hoja de estilo de estandarización" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:714 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:760 msgid "Inserts some basic CSS into the events feed to clean up display" msgstr "Inserta algo de CSS básico en el feed de eventos para limpiar la pantalla" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:724 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:823 msgid "Divisions" msgstr "Divisiones" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:725 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:824 msgid "Import Divisions from TouchPoint to your website as a taxonomy. These are used to classify users and involvements." msgstr "Importe Divisiones desde TouchPoint a su sitio web como una taxonomía. Estos se utilizan para clasificar a los usuarios y las participaciones." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:729 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:828 msgid "Division Name (Plural)" msgstr "Nombre de la División (plural)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:730 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:829 msgid "What you call Divisions at your church" msgstr "Lo que llamas Divisiones en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:740 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:840 msgid "Division Name (Singular)" msgstr "Nombre de la División (Singular)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:741 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:841 msgid "What you call a Division at your church" msgstr "Lo que llamas una división en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:751 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:852 msgid "Division Slug" msgstr "Slug de División" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:752 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:853 msgid "The root path for the Division Taxonomy" msgstr "La ruta raíz para la Taxonomía de División" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:764 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:866 msgid "These Divisions will be imported for the taxonomy" msgstr "Estas Divisiones se importarán para la taxonomía" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:801 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:903 msgid "Campuses" msgstr "Campus" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:802 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:904 msgid "Import Campuses from TouchPoint to your website as a taxonomy. These are used to classify users and involvements." msgstr "Importe Campus desde TouchPoint a su sitio web como una taxonomía. Estos se utilizan para clasificar a los usuarios y las participaciones." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:809 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:911 msgid "Campus Name (Plural)" msgstr "Nombre del Campus (Plural)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:810 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:912 msgid "What you call Campuses at your church" msgstr "Lo que llamas Campus en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:820 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:923 msgid "Campus Name (Singular)" msgstr "Nombre del Campus (Singular)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:821 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:924 msgid "What you call a Campus at your church" msgstr "Lo que llamas un Campus en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:831 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:935 msgid "Campus Slug" msgstr "Slug de Campus" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:832 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:936 msgid "The root path for the Campus Taxonomy" msgstr "El camino raíz para la Taxonomía del Campus" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:846 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:951 msgid "Resident Codes" msgstr "Códigos de Residentes" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:847 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:952 msgid "Import Resident Codes from TouchPoint to your website as a taxonomy. These are used to classify users and involvements that have locations." msgstr "Importe Códigos de Residentes desde TouchPoint a su sitio web como una taxonomía. Estos se utilizan para clasificar los usuarios y las participaciones que tienen ubicaciones." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:851 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:956 msgid "Resident Code Name (Plural)" msgstr "Nombre de Código de Tesidente (Plural)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:852 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:957 msgid "What you call Resident Codes at your church" msgstr "Lo que llamas Códigos de Residente en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:862 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:968 msgid "Resident Code Name (Singular)" msgstr "Nombre de Código de Residente (singular)" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:863 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:969 msgid "What you call a Resident Code at your church" msgstr "Lo que llamas un Código de Residencia en tu iglesia" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:873 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:980 msgid "Resident Code Slug" msgstr "Slug de Código Residente" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:874 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:981 msgid "The root path for the Resident Code Taxonomy" msgstr "La ruta raíz para la Taxonomía del Código de Residente" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1030 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1138 msgid "password saved" msgstr "contraseña guardada" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1086 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1087 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1194 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1195 msgid "TouchPoint-WP" msgstr "TouchPoint-WP" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1118 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1226 msgid "Settings" msgstr "Ajustes" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1346 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1449 msgid "Script Update Failed" msgstr "Actualización de secuencia de comandos fallida" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1462 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1578 msgid "TouchPoint-WP Settings" msgstr "Configuración de TouchPoint-WP" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1513 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1629 msgid "Save Settings" msgstr "Guardar ajustes" @@ -993,7 +993,7 @@ msgstr "Enviar" msgid "Nothing to submit." msgstr "Nada que enviar." -#: src/TouchPoint-WP/TouchPointWP.php:2703 +#: src/TouchPoint-WP/TouchPointWP.php:2783 msgid "The scripts on TouchPoint that interact with this plugin are out-of-date, and an automatic update failed." msgstr "Los scripts en TouchPoint que interactúan con este complemento están desactualizados y falló una actualización automática." @@ -1049,7 +1049,7 @@ msgid "Next" msgstr "Siguiente" #: src/TouchPoint-WP/Involvement.php:1467 -#: src/TouchPoint-WP/TouchPointWP.php:1597 +#: src/TouchPoint-WP/TouchPointWP.php:1473 msgid "Marital Status" msgstr "Estado civil" @@ -1175,12 +1175,12 @@ msgstr "Añade una ubicación" msgid "The Campus" msgstr "El campus" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:777 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:783 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:879 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:885 msgid "Locations" msgstr "Ubicaciones" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:778 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:880 msgid "Locations are physical places, probably campuses. None are required, but they can help present geographic information clearly." msgstr "Las ubicaciones son lugares físicos, probablemente campus. No se requiere ninguno, pero pueden ayudar a presentar la información geográfica con claridad." @@ -1284,7 +1284,7 @@ msgctxt "miles. Unit is appended to a number. %2.1f is the number, so %2.1fmi l msgid "%2.1fmi" msgstr "%2.1fmi" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:304 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:342 msgid "The username of a user account in TouchPoint with API permissions." msgstr "El nombre de usuario de una cuenta de usuario en TouchPoint con permisos de API." @@ -1309,7 +1309,7 @@ msgid "Could not locate." msgstr "No se pudo localizar." #: src/TouchPoint-WP/Meeting.php:86 -#: src/TouchPoint-WP/TouchPointWP.php:907 +#: src/TouchPoint-WP/TouchPointWP.php:961 msgid "Only GET requests are allowed." msgstr "Solo se permiten solicitudes GET." @@ -1328,115 +1328,115 @@ msgstr "Datos proporcionados no válidos." msgid "Invalid Post Type." msgstr "Tipo de publicación no válida." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:257 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:293 msgid "Enable Campuses" msgstr "Habilitar Campus" -#: src/TouchPoint-WP/TouchPointWP.php:1228 +#: src/TouchPoint-WP/TouchPointWP.php:1282 msgid "Classify posts by their general locations." msgstr "clasificar las publicaciones por sus ubicaciones generales." -#: src/TouchPoint-WP/TouchPointWP.php:1281 +#: src/TouchPoint-WP/TouchPointWP.php:1314 msgid "Classify posts by their church campus." msgstr "Clasifique las publicaciones por el campus." #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1333 +#: src/TouchPoint-WP/TouchPointWP.php:1345 msgid "Classify things by %s." msgstr "Clasifica las cosas por %s." -#: src/TouchPoint-WP/TouchPointWP.php:1421 +#: src/TouchPoint-WP/TouchPointWP.php:1371 msgid "Classify involvements by the day on which they meet." msgstr "Clasificar las participaciones por el día en que se reúnen." -#: src/TouchPoint-WP/TouchPointWP.php:1422 +#: src/TouchPoint-WP/TouchPointWP.php:1372 msgid "Weekdays" msgstr "Días de semana" -#: src/TouchPoint-WP/TouchPointWP.php:1459 +#: src/TouchPoint-WP/TouchPointWP.php:1394 msgid "Classify involvements by tense (present, future, past)" msgstr "Clasificar las implicaciones por tiempo (presente, futuro, pasado)" -#: src/TouchPoint-WP/TouchPointWP.php:1460 +#: src/TouchPoint-WP/TouchPointWP.php:1395 msgid "Tense" msgstr "Tiempo" -#: src/TouchPoint-WP/TouchPointWP.php:1460 +#: src/TouchPoint-WP/TouchPointWP.php:1395 msgid "Tenses" msgstr "Tiempos" -#: src/TouchPoint-WP/TouchPointWP.php:1503 +#: src/TouchPoint-WP/TouchPointWP.php:1418 msgid "Classify involvements by the portion of the day in which they meet." msgstr "Clasifique las participaciones por la parte del día en que se reúnen." -#: src/TouchPoint-WP/TouchPointWP.php:1504 +#: src/TouchPoint-WP/TouchPointWP.php:1419 msgid "Times of Day" msgstr "Tiempos del Día" -#: src/TouchPoint-WP/TouchPointWP.php:1557 +#: src/TouchPoint-WP/TouchPointWP.php:1447 msgid "Classify involvements and users by their age groups." msgstr "Clasifica las implicaciones y los usuarios por sus grupos de edad." -#: src/TouchPoint-WP/TouchPointWP.php:1558 +#: src/TouchPoint-WP/TouchPointWP.php:1448 msgid "Age Groups" msgstr "Grupos de Edad" -#: src/TouchPoint-WP/TouchPointWP.php:1596 +#: src/TouchPoint-WP/TouchPointWP.php:1472 msgid "Classify involvements by whether participants are mostly single or married." msgstr "Clasifique las participaciones según si los participantes son en su mayoría solteros o casados." -#: src/TouchPoint-WP/TouchPointWP.php:1597 +#: src/TouchPoint-WP/TouchPointWP.php:1473 msgid "Marital Statuses" msgstr "Estados Civiles" -#: src/TouchPoint-WP/TouchPointWP.php:1641 +#: src/TouchPoint-WP/TouchPointWP.php:1503 msgid "Classify Partners by category chosen in settings." msgstr "Clasifique a los ministeriales por categoría elegida en la configuración." -#: src/TouchPoint-WP/TouchPointWP_Settings.php:258 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:294 msgid "Import campuses as a taxonomy. (You probably want to do this if you're multi-campus.)" msgstr "Importar campus como taxonomía. (Probablemente quieras hacer esto si tienes varios campus)." #. translators: %s: taxonomy name, plural -#: src/TouchPoint-WP/TouchPointWP.php:1201 +#: src/TouchPoint-WP/TouchPointWP.php:1255 msgid "Search %s" msgstr "Buscar %s" #. translators: %s: taxonomy name, plural -#: src/TouchPoint-WP/TouchPointWP.php:1203 +#: src/TouchPoint-WP/TouchPointWP.php:1257 msgid "All %s" msgstr "Todos los %s" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1205 +#: src/TouchPoint-WP/TouchPointWP.php:1259 msgid "Edit %s" msgstr "Editar %s" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1207 +#: src/TouchPoint-WP/TouchPointWP.php:1261 msgid "Update %s" msgstr "Actualizar %s" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1209 +#: src/TouchPoint-WP/TouchPointWP.php:1263 msgid "Add New %s" msgstr "Agregar Nuevo %s" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1211 +#: src/TouchPoint-WP/TouchPointWP.php:1265 msgid "New %s" msgstr "Nuevo %s" -#: src/TouchPoint-WP/Report.php:167 +#: src/TouchPoint-WP/Report.php:169 msgid "TouchPoint Reports" msgstr "Informes de TouchPoint" -#: src/TouchPoint-WP/Report.php:168 +#: src/TouchPoint-WP/Report.php:170 msgid "TouchPoint Report" msgstr "Informe de TouchPoint" #. translators: Last updated date/time for a report. %1$s is the date. %2$s is the time. -#: src/TouchPoint-WP/Report.php:295 +#: src/TouchPoint-WP/Report.php:298 msgid "Updated on %1$s at %2$s" msgstr "Actualizada %1$s %2$s" @@ -1447,3 +1447,43 @@ msgstr "Cada 15 minutos" #: src/TouchPoint-WP/Involvement.php:1395 msgid "Language" msgstr "Idioma" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:771 +msgid "Meeting Calendars" +msgstr "Calendarios de Reuniones" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:772 +msgid "Import Meetings from TouchPoint to a calendar on your website." +msgstr "Importe reuniones desde TouchPoint a un calendario en su sitio web." + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:776 +msgid "Meetings Slug" +msgstr "SLug de Reuniones" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:777 +msgid "The root path for Meetings" +msgstr "El camino raíz para los Reuniones" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:789 +msgid "Months of History" +msgstr "Meses de Historia" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:790 +msgid "Meetings will be kept for the public calendar until the event is this many months in the past. Note that due to limitations in TouchPoint's approach to events, Meetings cannot be fully updated once they occur." +msgstr "Las reuniones se mantendrán para el calendario público hasta que el evento sea hace tantos meses. Tenga en cuenta que debido a las limitaciones en el enfoque de los eventos de TouchPoint, las reuniones no se pueden actualizar por completo una vez que ocurren." + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:799 +msgid "Months of Future" +msgstr "Meses de Futuro" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:800 +msgid "Meetings more than this many months in the future will not be imported." +msgstr "Las reuniones de más de esta cantidad de meses en el futuro no se importarán." + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:809 +msgid "Meeting Deletion Handling" +msgstr "Eliminación de Reuniones" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:810 +msgid "When a Meeting is deleted in TouchPoint that has already been imported to WordPress, how should that be handled?" +msgstr "Cuando se elimina una reunión en TouchPoint que ya se ha importado a WordPress, ¿cómo se debe manejar?" diff --git a/i18n/TouchPoint-WP.pot b/i18n/TouchPoint-WP.pot index 743bc964..e0082f43 100644 --- a/i18n/TouchPoint-WP.pot +++ b/i18n/TouchPoint-WP.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-08-14T19:18:55+00:00\n" +"POT-Creation-Date: 2023-08-15T02:25:51+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: TouchPoint-WP\n" @@ -53,7 +53,7 @@ msgid "Slug" msgstr "" #: src/templates/admin/invKoForm.php:47 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:763 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:865 msgid "Divisions to Import" msgstr "" @@ -141,13 +141,13 @@ msgstr "" #: src/templates/admin/invKoForm.php:169 #: src/TouchPoint-WP/Involvement.php:1419 -#: src/TouchPoint-WP/TouchPointWP.php:1422 +#: src/TouchPoint-WP/TouchPointWP.php:1372 msgid "Weekday" msgstr "" #: src/templates/admin/invKoForm.php:173 #: src/TouchPoint-WP/Involvement.php:1445 -#: src/TouchPoint-WP/TouchPointWP.php:1504 +#: src/TouchPoint-WP/TouchPointWP.php:1419 msgid "Time of Day" msgstr "" @@ -156,7 +156,7 @@ msgid "Prevailing Marital Status" msgstr "" #: src/templates/admin/invKoForm.php:181 -#: src/TouchPoint-WP/TouchPointWP.php:1558 +#: src/TouchPoint-WP/TouchPointWP.php:1448 msgid "Age Group" msgstr "" @@ -239,19 +239,19 @@ msgid "%2.1fmi" msgstr "" #. translators: %s is "what you call TouchPoint at your church", which is a setting -#: src/TouchPoint-WP/Auth.php:137 +#: src/TouchPoint-WP/Auth.php:138 msgid "Sign in with your %s account" msgstr "" -#: src/TouchPoint-WP/Auth.php:392 +#: src/TouchPoint-WP/Auth.php:391 msgid "Your login token expired." msgstr "" -#: src/TouchPoint-WP/Auth.php:407 +#: src/TouchPoint-WP/Auth.php:406 msgid "Your login token is invalid." msgstr "" -#: src/TouchPoint-WP/Auth.php:419 +#: src/TouchPoint-WP/Auth.php:418 msgid "Session could not be validated." msgstr "" @@ -329,7 +329,7 @@ msgid "Language" msgstr "" #: src/TouchPoint-WP/Involvement.php:1467 -#: src/TouchPoint-WP/TouchPointWP.php:1597 +#: src/TouchPoint-WP/TouchPointWP.php:1473 msgid "Marital Status" msgstr "" @@ -433,7 +433,7 @@ msgid "Invalid Post Type." msgstr "" #: src/TouchPoint-WP/Meeting.php:86 -#: src/TouchPoint-WP/TouchPointWP.php:907 +#: src/TouchPoint-WP/TouchPointWP.php:961 msgid "Only GET requests are allowed." msgstr "" @@ -474,16 +474,16 @@ msgstr "" msgid "and" msgstr "" -#: src/TouchPoint-WP/Report.php:167 +#: src/TouchPoint-WP/Report.php:169 msgid "TouchPoint Reports" msgstr "" -#: src/TouchPoint-WP/Report.php:168 +#: src/TouchPoint-WP/Report.php:170 msgid "TouchPoint Report" msgstr "" #. translators: Last updated date/time for a report. %1$s is the date. %2$s is the time. -#: src/TouchPoint-WP/Report.php:295 +#: src/TouchPoint-WP/Report.php:298 msgid "Updated on %1$s at %2$s" msgstr "" @@ -496,640 +496,680 @@ msgid "Every 15 minutes" msgstr "" #. translators: %s: taxonomy name, plural -#: src/TouchPoint-WP/TouchPointWP.php:1201 +#: src/TouchPoint-WP/TouchPointWP.php:1255 msgid "Search %s" msgstr "" #. translators: %s: taxonomy name, plural -#: src/TouchPoint-WP/TouchPointWP.php:1203 +#: src/TouchPoint-WP/TouchPointWP.php:1257 msgid "All %s" msgstr "" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1205 +#: src/TouchPoint-WP/TouchPointWP.php:1259 msgid "Edit %s" msgstr "" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1207 +#: src/TouchPoint-WP/TouchPointWP.php:1261 msgid "Update %s" msgstr "" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1209 +#: src/TouchPoint-WP/TouchPointWP.php:1263 msgid "Add New %s" msgstr "" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1211 +#: src/TouchPoint-WP/TouchPointWP.php:1265 msgid "New %s" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1228 +#: src/TouchPoint-WP/TouchPointWP.php:1282 msgid "Classify posts by their general locations." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1281 +#: src/TouchPoint-WP/TouchPointWP.php:1314 msgid "Classify posts by their church campus." msgstr "" #. translators: %s: taxonomy name, singular -#: src/TouchPoint-WP/TouchPointWP.php:1333 +#: src/TouchPoint-WP/TouchPointWP.php:1345 msgid "Classify things by %s." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1421 +#: src/TouchPoint-WP/TouchPointWP.php:1371 msgid "Classify involvements by the day on which they meet." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1422 +#: src/TouchPoint-WP/TouchPointWP.php:1372 msgid "Weekdays" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1459 +#: src/TouchPoint-WP/TouchPointWP.php:1394 msgid "Classify involvements by tense (present, future, past)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1460 +#: src/TouchPoint-WP/TouchPointWP.php:1395 msgid "Tense" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1460 +#: src/TouchPoint-WP/TouchPointWP.php:1395 msgid "Tenses" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1503 +#: src/TouchPoint-WP/TouchPointWP.php:1418 msgid "Classify involvements by the portion of the day in which they meet." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1504 +#: src/TouchPoint-WP/TouchPointWP.php:1419 msgid "Times of Day" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1557 +#: src/TouchPoint-WP/TouchPointWP.php:1447 msgid "Classify involvements and users by their age groups." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1558 +#: src/TouchPoint-WP/TouchPointWP.php:1448 msgid "Age Groups" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1596 +#: src/TouchPoint-WP/TouchPointWP.php:1472 msgid "Classify involvements by whether participants are mostly single or married." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1597 +#: src/TouchPoint-WP/TouchPointWP.php:1473 msgid "Marital Statuses" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:1641 +#: src/TouchPoint-WP/TouchPointWP.php:1503 msgid "Classify Partners by category chosen in settings." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2404 +#: src/TouchPoint-WP/TouchPointWP.php:2484 msgid "Unknown Type" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2458 +#: src/TouchPoint-WP/TouchPointWP.php:2538 msgid "Your Searches" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2461 +#: src/TouchPoint-WP/TouchPointWP.php:2541 msgid "Public Searches" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2464 +#: src/TouchPoint-WP/TouchPointWP.php:2544 msgid "Status Flags" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2469 -#: src/TouchPoint-WP/TouchPointWP.php:2470 +#: src/TouchPoint-WP/TouchPointWP.php:2549 +#: src/TouchPoint-WP/TouchPointWP.php:2550 msgid "Current Value" msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2597 -#: src/TouchPoint-WP/TouchPointWP.php:2635 +#: src/TouchPoint-WP/TouchPointWP.php:2677 +#: src/TouchPoint-WP/TouchPointWP.php:2715 msgid "Invalid or incomplete API Settings." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2605 -#: src/TouchPoint-WP/TouchPointWP.php:2642 +#: src/TouchPoint-WP/TouchPointWP.php:2685 +#: src/TouchPoint-WP/TouchPointWP.php:2722 msgid "Host appears to be missing from TouchPoint-WP configuration." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2703 +#: src/TouchPoint-WP/TouchPointWP.php:2783 msgid "The scripts on TouchPoint that interact with this plugin are out-of-date, and an automatic update failed." msgstr "" -#: src/TouchPoint-WP/TouchPointWP.php:2762 +#: src/TouchPoint-WP/TouchPointWP.php:2842 msgid "People Query Failed" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:204 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:235 msgid "Basic Settings" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:205 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:236 msgid "Connect to TouchPoint and choose which features you wish to use." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:209 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:240 msgid "Enable Authentication" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:210 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:241 msgid "Allow TouchPoint users to sign into this website with TouchPoint." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:220 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:252 msgid "Enable RSVP Tool" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:221 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:253 msgid "Add a crazy-simple RSVP button to WordPress event pages." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:227 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:260 msgid "Enable Involvements" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:228 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:261 msgid "Load Involvements from TouchPoint for involvement listings and entries native in your website." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:237 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:271 msgid "Enable Public People Lists" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:238 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:272 msgid "Import public people listings from TouchPoint (e.g. staff or elders)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:247 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:282 msgid "Enable Global Partner Listings" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:248 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:283 msgid "Import ministry partners from TouchPoint to list publicly." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:257 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:293 msgid "Enable Campuses" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:258 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:294 msgid "Import campuses as a taxonomy. (You probably want to do this if you're multi-campus.)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:267 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:304 msgid "Display Name" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:268 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:305 msgid "What your church calls your TouchPoint database." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:278 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:315 msgid "TouchPoint Host Name" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:279 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:316 msgid "The domain for your TouchPoint database, without the https or any slashes." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:290 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:328 msgid "Custom Mobile App Deeplink Host Name" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:291 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:329 msgid "" "The domain for your mobile app deeplinks, without the https or any slashes. If you aren't \r\n" " using the custom mobile app, leave this blank." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:303 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:341 msgid "TouchPoint API Username" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:304 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:342 msgid "The username of a user account in TouchPoint with API permissions." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:314 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:353 msgid "TouchPoint API User Password" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:315 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:354 msgid "The password of a user account in TouchPoint with API permissions." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:326 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:366 msgid "TouchPoint API Script Name" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:327 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:367 msgid "The name of the Python script loaded into TouchPoint. Don't change this unless you know what you're doing." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:337 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:378 msgid "Google Maps Javascript API Key" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:338 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:379 msgid "Required for embedding maps." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:348 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:390 msgid "Google Maps Geocoding API Key" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:349 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:391 msgid "Optional. Allows for reverse geocoding of user locations." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:366 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:372 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:409 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:415 msgid "Generate Scripts" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:369 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:412 msgid "" "Once your settings on this page are set and saved, use this tool to generate\r\n" "the scripts needed for TouchPoint in a convenient installation package. " msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:371 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:414 msgid "Upload the package to {tpName} here" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:386 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:429 msgid "People" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:387 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:430 msgid "Manage how people are synchronized between TouchPoint and WordPress." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:391 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:434 msgid "Contact Keywords" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:392 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:435 msgid "These keywords will be used when someone clicks the \"Contact\" button on a Person's listing or profile." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:403 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:446 msgid "Extra Value for WordPress User ID" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:404 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:447 msgid "The name of the extra value to use for the WordPress User ID. If you are using multiple WordPress instances with one TouchPoint database, you will need these values to be unique between WordPress instances. In most cases, the default is fine." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:414 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:457 msgid "Extra Value: Biography" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:415 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:458 msgid "Import a Bio from a Person Extra Value field. Can be an HTML or Text Extra Value. This will overwrite any values set by WordPress. Leave blank to not import." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:425 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:660 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:468 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:705 msgid "Extra Values to Import" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:426 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:469 msgid "Import People Extra Value fields as User Meta data." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:442 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:485 msgid "Authentication" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:443 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:486 msgid "Allow users to log into WordPress using TouchPoint." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:447 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:490 msgid "Make TouchPoint the default authentication method." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:448 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:491 msgid "By checking this box, the TouchPoint login page will become the default. To prevent the redirect and reach the standard TouchPoint login page, add '" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:457 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:500 msgid "Enable Auto-Provisioning" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:458 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:501 msgid "Automatically create WordPress users, if needed, to match authenticated TouchPoint users." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:467 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:510 msgid "Change 'Edit Profile' links" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:468 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:511 msgid "\"Edit Profile\" links will take the user to their TouchPoint profile, instead of their WordPress profile." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:477 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:520 msgid "Enable full logout" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:478 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:521 msgid "Logout of TouchPoint when logging out of WordPress." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:484 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:527 msgid "Prevent Subscriber Admin Bar" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:485 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:528 msgid "By enabling this option, users who can't edit anything won't see the Admin bar." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:499 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:542 msgid "Involvements" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:500 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:543 msgid "Import Involvements from TouchPoint to list them on your website, for Small Groups, Classes, and more. Select the division(s) that immediately correspond to the type of Involvement you want to list. For example, if you want a Small Group list and have a Small Group Division, only select the Small Group Division. If you want Involvements to be filterable by additional Divisions, select those Divisions on the Divisions tab, not here." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:505 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:548 msgid "Involvement Post Types" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:533 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:577 msgid "Global Partners" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:534 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:578 msgid "Manage how global partners are imported from TouchPoint for listing on WordPress. Partners are grouped by family, and content is provided through Family Extra Values. This works for both People and Business records." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:538 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:582 msgid "Global Partner Name (Plural)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:539 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:583 msgid "What you call Global Partners at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:549 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:593 msgid "Global Partner Name (Singular)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:550 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:594 msgid "What you call a Global Partner at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:560 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:604 msgid "Global Partner Name for Secure Places (Plural)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:561 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:605 msgid "What you call Secure Global Partners at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:571 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:615 msgid "Global Partner Name for Secure Places (Singular)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:572 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:616 msgid "What you call a Secure Global Partner at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:582 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:626 msgid "Global Partner Slug" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:583 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:627 msgid "The root path for Global Partner posts" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:594 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:639 msgid "Saved Search" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:595 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:640 msgid "Anyone who is included in this saved search will be included in the listing." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:605 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:650 msgid "Extra Value: Description" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:606 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:651 msgid "Import a description from a Family Extra Value field. Can be an HTML or Text Extra Value. This becomes the body of the Global Partner post." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:616 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:661 msgid "Extra Value: Summary" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:617 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:662 msgid "Optional. Import a short description from a Family Extra Value field. Can be an HTML or Text Extra Value. If not provided, the full bio will be truncated." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:627 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:672 msgid "Latitude Override" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:628 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:673 msgid "Designate a text Family Extra Value that will contain a latitude that overrides any locations on the partner's profile for the partner map. Both latitude and longitude must be provided for an override to take place." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:638 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:683 msgid "Longitude Override" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:639 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:684 msgid "Designate a text Family Extra Value that will contain a longitude that overrides any locations on the partner's profile for the partner map. Both latitude and longitude must be provided for an override to take place." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:649 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:694 msgid "Public Location" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:650 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:695 msgid "Designate a text Family Extra Value that will contain the partner's location, as you want listed publicly. For partners who have DecoupleLocation enabled, this field will be associated with the map point, not the list entry." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:661 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:706 msgid "Import Family Extra Value fields as Meta data on the partner's post" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:672 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:717 msgid "Primary Taxonomy" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:673 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:718 msgid "Import a Family Extra Value as the primary means by which partners are organized." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:688 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:734 msgid "Events Calendar" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:689 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:735 msgid "Integrate with The Events Calendar from ModernTribe." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:693 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:739 msgid "Events for Custom Mobile App" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:696 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:742 msgid "To use your Events Calendar events in the Custom mobile app, set the Provider to Wordpress Plugin - Modern Tribe and use this url:" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:698 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:744 msgid "Preview" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:713 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:759 msgid "Use Standardizing Stylesheet" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:714 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:760 msgid "Inserts some basic CSS into the events feed to clean up display" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:724 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:771 +msgid "Meeting Calendars" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:772 +msgid "Import Meetings from TouchPoint to a calendar on your website." +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:776 +msgid "Meetings Slug" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:777 +msgid "The root path for Meetings" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:789 +msgid "Months of History" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:790 +msgid "Meetings will be kept for the public calendar until the event is this many months in the past. Note that due to limitations in TouchPoint's approach to events, Meetings cannot be fully updated once they occur." +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:799 +msgid "Months of Future" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:800 +msgid "Meetings more than this many months in the future will not be imported." +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:809 +msgid "Meeting Deletion Handling" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:810 +msgid "When a Meeting is deleted in TouchPoint that has already been imported to WordPress, how should that be handled?" +msgstr "" + +#: src/TouchPoint-WP/TouchPointWP_Settings.php:823 msgid "Divisions" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:725 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:824 msgid "Import Divisions from TouchPoint to your website as a taxonomy. These are used to classify users and involvements." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:729 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:828 msgid "Division Name (Plural)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:730 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:829 msgid "What you call Divisions at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:740 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:840 msgid "Division Name (Singular)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:741 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:841 msgid "What you call a Division at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:751 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:852 msgid "Division Slug" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:752 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:853 msgid "The root path for the Division Taxonomy" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:764 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:866 msgid "These Divisions will be imported for the taxonomy" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:777 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:783 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:879 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:885 msgid "Locations" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:778 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:880 msgid "Locations are physical places, probably campuses. None are required, but they can help present geographic information clearly." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:801 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:903 msgid "Campuses" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:802 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:904 msgid "Import Campuses from TouchPoint to your website as a taxonomy. These are used to classify users and involvements." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:809 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:911 msgid "Campus Name (Plural)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:810 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:912 msgid "What you call Campuses at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:820 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:923 msgid "Campus Name (Singular)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:821 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:924 msgid "What you call a Campus at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:831 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:935 msgid "Campus Slug" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:832 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:936 msgid "The root path for the Campus Taxonomy" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:846 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:951 msgid "Resident Codes" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:847 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:952 msgid "Import Resident Codes from TouchPoint to your website as a taxonomy. These are used to classify users and involvements that have locations." msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:851 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:956 msgid "Resident Code Name (Plural)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:852 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:957 msgid "What you call Resident Codes at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:862 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:968 msgid "Resident Code Name (Singular)" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:863 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:969 msgid "What you call a Resident Code at your church" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:873 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:980 msgid "Resident Code Slug" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:874 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:981 msgid "The root path for the Resident Code Taxonomy" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1030 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1138 msgid "password saved" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1086 -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1087 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1194 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1195 msgid "TouchPoint-WP" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1118 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1226 msgid "Settings" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1346 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1449 msgid "Script Update Failed" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1462 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1578 msgid "TouchPoint-WP Settings" msgstr "" -#: src/TouchPoint-WP/TouchPointWP_Settings.php:1513 +#: src/TouchPoint-WP/TouchPointWP_Settings.php:1629 msgid "Save Settings" msgstr "" diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index 1a38ecd4..22dc6ea8 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -66,6 +66,11 @@ * * @property-read string ec_use_standardizing_style Whether to insert the standardizing stylesheet into mobile app requests. * + * @property-read string mc_slug Slug for meetings in the meeting calendar (e.g. "events" for church.org/events) + * @property-read string mc_hist_months Number of months of history to keep. + * @property-read string mc_future_months Number of months into the future to import. + * @property-read string mc_deletion_method Determines how meetings should be handled in WordPress if they're deleted in TouchPoint + * * @property-read string rc_name_plural What resident codes should be called, plural (e.g. "Resident Codes" or "Zones") * @property-read string rc_name_singular What a resident code should be called, singular (e.g. "Resident Code" or "Zone") * @property-read string rc_slug Slug for resident code taxonomy (e.g. "zones" for church.org/zones) @@ -403,7 +408,7 @@ private function settingsFields($includeDetail = false): array 'description' => strtr( '

' . __('Once your settings on this page are set and saved, use this tool to generate the scripts needed for TouchPoint in a convenient installation package. ', 'TouchPoint-WP') . -'' . __('Upload the package to {tpName} here', 'TouchPoint-WP') . '.

+'' . __('Upload the package to {tpName} here', 'TouchPoint-WP') . '.

' . __('Generate Scripts', 'TouchPoint-WP') . '

', [ @@ -756,6 +761,60 @@ private function settingsFields($includeDetail = false): array ]; } + // TODO add some kind of conditional here + $includeThis = $includeDetail === true || $includeDetail === 'events'; + $tribe = TouchPointWP::useTribeCalendar(); + $this->settings['meetCal'] = [ + 'title' => __('Meeting Calendars', 'TouchPoint-WP'), + 'description' => __('Import Meetings from TouchPoint to a calendar on your website.', 'TouchPoint-WP'), + 'fields' => [ + [ + 'id' => 'mc_slug', + 'label' => __('Meetings Slug', 'TouchPoint-WP'), + 'description' => __( + 'The root path for Meetings', + 'TouchPoint-WP' + ), + 'type' => 'text', + 'default' => $tribe ? 'meetings' : 'events', + 'autoload' => true, + 'placeholder' => $tribe ? 'meetings' : 'events', + 'callback' => fn($new) => $this->validation_slug($new, 'mc_slug') + ], + [ + 'id' => 'mc_hist_months', + 'label' => __( 'Months of History', 'TouchPoint-WP' ), + 'description' => __( 'Meetings will be kept for the public calendar until the event is this many months in the past. Note that due to limitations in TouchPoint\'s approach to events, Meetings cannot be fully updated once they occur.', 'TouchPoint-WP' ), + 'type' => 'number', + 'default' => 12, + 'placeholder' => 12, + 'max' => 36, + 'min' => 0 + ], + [ + 'id' => 'mc_future_months', + 'label' => __( 'Months of Future', 'TouchPoint-WP' ), + 'description' => __( 'Meetings more than this many months in the future will not be imported.', 'TouchPoint-WP' ), + 'type' => 'number', + 'default' => 12, + 'placeholder' => 12, + 'max' => 60, + 'min' => 0 + ], + [ + 'id' => 'mc_deletion_method', + 'label' => __( 'Meeting Deletion Handling', 'TouchPoint-WP' ), + 'description' => __( 'When a Meeting is deleted in TouchPoint that has already been imported to WordPress, how should that be handled?', 'TouchPoint-WP' ), + 'type' => 'select', + 'options' => [ + 'delete' => 'Always delete from WordPress.', + 'cancel' => 'Mark the occurrence as cancelled.', + ], + 'default' => 'delete', + ], + ], + ]; + $includeThis = $includeDetail === true || $includeDetail === 'divisions'; $this->settings['divisions'] = [ 'title' => __('Divisions', 'TouchPoint-WP'), @@ -1429,6 +1488,19 @@ public function registerSettings(): void $args['sanitize_callback'] = fn($new) => null; } + if ($field['type'] == 'number' && !isset($args['sanitize_callback'])) { + $args['sanitize_callback'] = function($new) { + $new = intval($new); + if (isset($field['min'])) { + $new = max($new, $field['min']); + } + if (isset($field['max'])) { + $new = min($new, $field['max']); + } + return $new; + }; + } + $option_name = TouchPointWP::SETTINGS_PREFIX . $field['id']; register_setting($this->parent::TOKEN . '_Settings', $option_name, $args); From 470524f4a7f8429b83a7eb8dbdab88bf80c998ad Mon Sep 17 00:00:00 2001 From: "James K." Date: Wed, 30 Aug 2023 12:00:57 -0400 Subject: [PATCH 029/226] revert temp debugging code --- src/TouchPoint-WP/Involvement.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index 535687c3..60a33612 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -346,13 +346,6 @@ public static function updateFromTouchPoint(bool $verbose = false) $verbose &= TouchPointWP::currentUserIsAdmin(); foreach (self::allTypeSettings() as $k => $type) { - - // TODO this is temp debugging code to allow only one post type to be synced during a force-sync. - if ($verbose && isset($_GET['type'])) { - if (intval($k) !== intval($_GET['type'])) - continue; - } - if (count($type->importDivs) < 1) { // Don't update if there aren't any divisions selected yet. if ($verbose) { @@ -2122,19 +2115,11 @@ final protected static function updateInvolvementPostsForType( return false; } - $count = 0; foreach ($invData as $inv) { set_time_limit(15); - $count++; - - if ($verbose) { - var_dump($inv); - } - // TODO this is temp debugging code to allow only one post type to be synced during a force-sync. - if ($verbose && isset($_GET['limit'])) { - if ($count > intval($_GET['limit'])) - continue; + if ($verbose) { + var_dump($inv); } From 249a45d9d281ee4cfc925cb0a93566590a5085b6 Mon Sep 17 00:00:00 2001 From: "James K." Date: Sat, 7 Oct 2023 22:08:56 -0400 Subject: [PATCH 030/226] Spaces to tabs --- src/TouchPoint-WP/Auth.php | 44 +- src/TouchPoint-WP/EventsCalendar.php | 12 +- src/TouchPoint-WP/Involvement.php | 170 ++-- .../Involvement_PostTypeSettings.php | 10 +- src/TouchPoint-WP/Person.php | 30 +- src/TouchPoint-WP/TouchPointWP.php | 750 +++++++++--------- src/TouchPoint-WP/TouchPointWP_AdminAPI.php | 20 +- src/TouchPoint-WP/TouchPointWP_Exception.php | 14 +- src/TouchPoint-WP/TouchPointWP_Settings.php | 356 ++++----- src/TouchPoint-WP/Utilities.php | 34 +- touchpoint-wp.php | 40 +- 11 files changed, 739 insertions(+), 741 deletions(-) diff --git a/src/TouchPoint-WP/Auth.php b/src/TouchPoint-WP/Auth.php index 8d914b6c..2dd31127 100644 --- a/src/TouchPoint-WP/Auth.php +++ b/src/TouchPoint-WP/Auth.php @@ -127,23 +127,23 @@ public static function footer() // echo to print in footer } - /** - * Renders the link used to log in through TouchPoint. - */ - public static function printLoginLink() - { - $html = '

'; - $url = self::getLoginUrl(); - /** @noinspection HtmlUnknownTarget */ - $html .= ""; - $html .= sprintf( - // translators: %s is "what you call TouchPoint at your church", which is a setting - __('Sign in with your %s account', 'TouchPoint-WP'), - htmlentities(TouchPointWP::instance()->settings->system_name) - ); - $html .= '

'; - echo $html; - } + /** + * Renders the link used to log in through TouchPoint. + */ + public static function printLoginLink() + { + $html = '

'; + $url = self::getLoginUrl(); + /** @noinspection HtmlUnknownTarget */ + $html .= ""; + $html .= sprintf( + // translators: %s is "what you call TouchPoint at your church", which is a setting + __('Sign in with your %s account', 'TouchPoint-WP'), + htmlentities(TouchPointWP::instance()->settings->system_name) + ); + $html .= '

'; + echo $html; + } /** * Generates the URL used to initiate a sign-in with TouchPoint. @@ -283,8 +283,8 @@ public static function redirectLoginFormMaybe() public static function removeAdminBarMaybe() { $removeBar = (TouchPointWP::instance()->settings->auth_prevent_admin_bar === 'on') - && ! is_admin() - && ! current_user_can('edit_posts'); + && ! is_admin() + && ! current_user_can('edit_posts'); $removeBar = apply_filters(TouchPointWP::HOOK_PREFIX . 'prevent_admin_bar', $removeBar); @@ -424,9 +424,9 @@ public static function authenticate($user, $username, $password) $s = Session::instance(); if ( ! $lst === $s->auth_sessionToken) { return new WP_Error([ - 177004, - __('Session could not be validated.', 'TouchPoint-WP') - ]); + 177004, + __('Session could not be validated.', 'TouchPoint-WP') + ]); } $p->setLoginTokens(null, null); diff --git a/src/TouchPoint-WP/EventsCalendar.php b/src/TouchPoint-WP/EventsCalendar.php index 037a1302..e975ebe4 100644 --- a/src/TouchPoint-WP/EventsCalendar.php +++ b/src/TouchPoint-WP/EventsCalendar.php @@ -174,8 +174,8 @@ protected static function previewAppList(array $params = []): void foreach ($eventsList as $i => $eo) { echo "

{$eo['title']}

"; $url = get_site_url() . "/" . - TouchPointWP::API_ENDPOINT . "/" . - TouchPointWP::API_ENDPOINT_APP_EVENTS . "/" . $i; + TouchPointWP::API_ENDPOINT . "/" . + TouchPointWP::API_ENDPOINT_APP_EVENTS . "/" . $i; echo ""; } } @@ -197,8 +197,8 @@ public static function api(array $uri): bool // Preview list if (count($uri['path']) === 3 && - strtolower($uri['path'][2]) === 'preview' && - TouchPointWP::currentUserIsAdmin() + strtolower($uri['path'][2]) === 'preview' && + TouchPointWP::currentUserIsAdmin() ) { EventsCalendar::previewAppList($uri['query']); exit; @@ -206,8 +206,8 @@ public static function api(array $uri): bool // Preview items if (count($uri['path']) === 3 && - is_numeric($uri['path'][2]) && - TouchPointWP::currentUserIsAdmin() + is_numeric($uri['path'][2]) && + TouchPointWP::currentUserIsAdmin() ) { EventsCalendar::previewAppListItem($uri['query'], intval($uri['path'][2])); exit; diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index 9323b417..2cf84ca1 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -96,7 +96,7 @@ class Involvement implements api, updatesViaCron, geo, module * Involvement constructor. * * @param $object WP_Post|object an object representing the involvement's post. - * Must have post_id AND inv id attributes. + * Must have post_id AND inv id attributes. * * @throws TouchPointWP_Exception */ @@ -210,8 +210,8 @@ protected function __construct(object $object) // Geo if (self::getSettingsForPostType($this->invType)->useGeo) { if (property_exists($object, 'geo_lat') && - $object->geo_lat !== null && - $object->geo_lat !== '') { + $object->geo_lat !== null && + $object->geo_lat !== '') { // Probably a database query result $this->geo = (object)[ 'lat' => Utilities::toFloatOrNull($object->geo_lat), @@ -472,7 +472,7 @@ public function useRegistrationForm(): bool { if (!isset($this->_useRegistrationForm)) { $this->_useRegistrationForm = (get_post_meta($this->post_id, TouchPointWP::SETTINGS_PREFIX . "hasRegQuestions", true) === '1' || - intval(get_post_meta($this->post_id, TouchPointWP::SETTINGS_PREFIX . "regTypeId", true)) !== 1); + intval(get_post_meta($this->post_id, TouchPointWP::SETTINGS_PREFIX . "regTypeId", true)) !== 1); } return $this->_useRegistrationForm; } @@ -1023,8 +1023,8 @@ public static function doInvolvementList(WP_Query $q, $params = []): void // CSS /** @noinspection SpellCheckingInspection */ $params['includecss'] = ! isset($params['includecss']) || - $params['includecss'] === true || - $params['includecss'] === 'true'; + $params['includecss'] === true || + $params['includecss'] === 'true'; // Only group for single post types. $groupBy = null; @@ -1038,12 +1038,12 @@ public static function doInvolvementList(WP_Query $q, $params = []): void if ($groupBy !== "" && taxonomy_exists($groupBy)) { $terms = get_terms([ - 'taxonomy' => $groupBy, - 'order' => $groupByOrder, - 'orderby' => 'name', - 'hide_empty' => true, - 'fields' => 'id=>name' - ]); + 'taxonomy' => $groupBy, + 'order' => $groupByOrder, + 'orderby' => 'name', + 'hide_empty' => true, + 'fields' => 'id=>name' + ]); } } @@ -1141,12 +1141,12 @@ private static function getWpPostByInvolvementId($postType, $involvementId) $involvementId = (string)$involvementId; $q = new WP_Query([ - 'post_type' => $postType, - 'meta_key' => self::INVOLVEMENT_META_KEY, - 'meta_value' => $involvementId, - 'numberposts' => 2 - // only need one, but if there's two, there should be an error condition. - ]); + 'post_type' => $postType, + 'meta_key' => self::INVOLVEMENT_META_KEY, + 'meta_value' => $involvementId, + 'numberposts' => 2 + // only need one, but if there's two, there should be an error condition. + ]); $posts = $q->get_posts(); $counts = count($posts); if ($counts > 1) { // multiple posts match, which isn't great. @@ -1322,9 +1322,7 @@ protected static final function filterDropdownHtml(array $params, Involvement_Po // Division if (in_array('div', $filters)) { $exclude = $settings->importDivs; - if (count( - $exclude - ) == 1) { // Exclude the imported div if there's only one, as all invs would have that div. + if (count($exclude) == 1) { // Exclude the imported div if there's only one as all would have it. $mq = ['relation' => "AND"]; foreach ($exclude as $e) { $mq[] = [ @@ -1346,11 +1344,11 @@ protected static final function filterDropdownHtml(array $params, Involvement_Po } $dvName = TouchPointWP::instance()->settings->dv_name_singular; $dvList = get_terms([ - 'taxonomy' => TouchPointWP::TAX_DIV, - 'hide_empty' => true, - 'meta_query' => $mq, - TouchPointWP::HOOK_PREFIX . 'post_type' => $postType - ]); + 'taxonomy' => TouchPointWP::TAX_DIV, + 'hide_empty' => true, + 'meta_query' => $mq, + TouchPointWP::HOOK_PREFIX . 'post_type' => $postType + ]); $dvList = TouchPointWP::orderHierarchicalTerms($dvList, true); if (count($dvList) > 1) { $content .= ""; $content .= ""; @@ -1623,40 +1621,40 @@ public static function ajaxNearby(): void if ( ! $settings) { http_response_code(Http::NOT_FOUND); echo json_encode([ - "invList" => [], - "error" => "This involvement type doesn't exist.", - "error_i18n" => __("This involvement type doesn't exist.", 'TouchPoint-WP') - ]); + "invList" => [], + "error" => "This involvement type doesn't exist.", + "error_i18n" => __("This involvement type doesn't exist.", 'TouchPoint-WP') + ]); exit; } if ( ! $settings->useGeo) { http_response_code(Http::EXPECTATION_FAILED); echo json_encode([ - "invList" => [], - "error" => "This involvement type doesn't have geographic locations enabled.", - "error_i18n" => __( - "This involvement type doesn't have geographic locations enabled.", - 'TouchPoint-WP' - ) - ]); + "invList" => [], + "error" => "This involvement type doesn't have geographic locations enabled.", + "error_i18n" => __( + "This involvement type doesn't have geographic locations enabled.", + 'TouchPoint-WP' + ) + ]); exit; } $r = []; if ($lat === "null" || $lng === "null" || - $lat === null || $lng === null) { + $lat === null || $lng === null) { $geoObj = TouchPointWP::instance()->geolocate(); if ($geoObj === false) { http_response_code(Http::PRECONDITION_FAILED); echo json_encode([ - "invList" => [], - "error" => "Could not locate.", - "error_i18n" => __("Could not locate.", 'TouchPoint-WP'), - "geo" => false - ]); + "invList" => [], + "error" => "Could not locate.", + "error_i18n" => __("Could not locate.", 'TouchPoint-WP'), + "geo" => false + ]); exit; } @@ -1677,10 +1675,10 @@ public static function ajaxNearby(): void if ($invs === null) { http_response_code(Http::NOT_FOUND); echo json_encode([ - "invList" => [], - "error" => sprintf("No %s Found.", $settings->namePlural), - "error_i18n" => sprintf(__("No %s Found.", "TouchPoint-WP"), $settings->namePlural) - ]); + "invList" => [], + "error" => sprintf("No %s Found.", $settings->namePlural), + "error_i18n" => sprintf(__("No %s Found.", "TouchPoint-WP"), $settings->namePlural) + ]); exit; } @@ -1714,12 +1712,12 @@ public static function ajaxNearby(): void * @param int $limit Number of results to return. 0-100 inclusive. * * @return object[]|null An array of database query result objects, or null if the location isn't provided or - * valid. + * valid. */ private static function getInvsNear(float $lat, float $lng, string $postType, int $limit = 3): ?array { if ($lat > 90 || $lat < -90 || - $lng > 180 || $lng < -180 + $lng > 180 || $lng < -180 ) { return null; } @@ -1895,8 +1893,8 @@ public static function updateCron(): void public function getDistance(bool $useHiForFalse = false) { if ( ! isset(self::$compareGeo->lat) || ! isset(self::$compareGeo->lng) || - ! isset($this->geo->lat) || ! isset($this->geo->lng) || - $this->geo->lat === null || $this->geo->lng === null) { + ! isset($this->geo->lat) || ! isset($this->geo->lng) || + $this->geo->lat === null || $this->geo->lng === null) { return $useHiForFalse ? 25000 : false; } @@ -2127,9 +2125,9 @@ final protected static function updateInvolvementPostsForType( foreach ($invData as $inv) { set_time_limit(15); - if ($verbose) { - var_dump($inv); - } + if ($verbose) { + var_dump($inv); + } //////////////////////// @@ -2230,7 +2228,7 @@ final protected static function updateInvolvementPostsForType( } if (in_array("registrationEnded", $typeSets->excludeIf) && - $inv->regEnd !== null && $inv->regEnd < $now) { + $inv->regEnd !== null && $inv->regEnd < $now) { if ($verbose) { echo "

Stopping processing because Involvements whose registrations have ended are excluded. Involvement will be deleted from WordPress.

"; } @@ -2447,7 +2445,7 @@ final protected static function updateInvolvementPostsForType( if ($typeSets->useGeo) { // Handle locations if (property_exists($inv, "lat") && $inv->lat !== null && - property_exists($inv, "lng") && $inv->lng !== null) { + property_exists($inv, "lng") && $inv->lng !== null) { update_post_meta($post->ID, TouchPointWP::SETTINGS_PREFIX . "geo_lat", $inv->lat); update_post_meta($post->ID, TouchPointWP::SETTINGS_PREFIX . "geo_lng", $inv->lng); } else { @@ -2546,10 +2544,10 @@ final protected static function updateInvolvementPostsForType( // Delete posts that are no longer current $q = new WP_Query([ - 'post_type' => $typeSets->postType, - 'nopaging' => true, - 'post__not_in' => $postsToKeep - ]); + 'post_type' => $typeSets->postType, + 'nopaging' => true, + 'post__not_in' => $postsToKeep + ]); $removals = 0; foreach ($q->get_posts() as $post) { set_time_limit(10); @@ -2744,7 +2742,7 @@ public function toJsonLD(): ?array * Get notable attributes, such as gender restrictions, as strings. * * @param array $exclude Attributes listed here will be excluded. (e.g. if shown for a parent inv, not needed - * here.) + * here.) * * @return string[] */ @@ -2789,13 +2787,13 @@ public function notableAttributes(array $exclude = []): array $r = array_filter($r, fn($i) => ! in_array($i, $exclude)); if ($this->hasGeo() && - ( - $exclude === [] || - ( - $this->locationName !== null && - ! in_array($this->locationName, $exclude) - ) - ) + ( + $exclude === [] || + ( + $this->locationName !== null && + ! in_array($this->locationName, $exclude) + ) + ) ) { $dist = $this->getDistance(); if ($dist !== false) { @@ -2909,7 +2907,7 @@ public static function getJsInstantiationString(): string $listStr = json_encode($queue); return "\ttpvm.addEventListener('Involvement_class_loaded', function() { - TP_Involvement.fromObjArray($listStr);\n\t});\n"; + TP_Involvement.fromObjArray($listStr);\n\t});\n"; } public function getTouchPointId(): int @@ -2937,9 +2935,9 @@ private static function ajaxInvJoin(): void } else { http_response_code(Http::NOT_FOUND); echo json_encode([ - 'error' => "Invalid Post Type.", - 'error_i18n' => __("Invalid Post Type.", 'TouchPoint-WP') - ]); + 'error' => "Invalid Post Type.", + 'error_i18n' => __("Invalid Post Type.", 'TouchPoint-WP') + ]); exit; } @@ -2991,9 +2989,9 @@ private static function ajaxContact(): void if (!$validate) { http_response_code(Http::BAD_REQUEST); echo json_encode([ - 'error' => $result, - 'error_i18n' => __("Contact Blocked for Spam.", 'TouchPoint-WP') - ]); + 'error' => $result, + 'error_i18n' => __("Contact Blocked for Spam.", 'TouchPoint-WP') + ]); exit; } @@ -3001,9 +2999,9 @@ private static function ajaxContact(): void if (!!$settings) { if (!self::allowContact($inputData->invType)) { echo json_encode([ - 'error' => "Contact Prohibited.", - 'error_i18n' => __("Contact Prohibited.", 'TouchPoint-WP') - ]); + 'error' => "Contact Prohibited.", + 'error_i18n' => __("Contact Prohibited.", 'TouchPoint-WP') + ]); exit; } @@ -3014,9 +3012,9 @@ private static function ajaxContact(): void } else { http_response_code(Http::NOT_FOUND); echo json_encode([ - 'error' => "Invalid Post Type.", - 'error_i18n' => __("Invalid Post Type.", 'TouchPoint-WP') - ]); + 'error' => "Invalid Post Type.", + 'error_i18n' => __("Invalid Post Type.", 'TouchPoint-WP') + ]); exit; } diff --git a/src/TouchPoint-WP/Involvement_PostTypeSettings.php b/src/TouchPoint-WP/Involvement_PostTypeSettings.php index 3dee09d2..57dd8cfc 100644 --- a/src/TouchPoint-WP/Involvement_PostTypeSettings.php +++ b/src/TouchPoint-WP/Involvement_PostTypeSettings.php @@ -167,11 +167,11 @@ public static function getForInvType(string $postType): ?Involvement_PostTypeSet $prefixLength = strlen(self::POST_TYPE_PREFIX); foreach (self::instance() as $type) { if ($type->postType === $postType || - $type->__get('postType') === $postType || - ( - substr($type->postType, 0, $prefixLength) === self::POST_TYPE_PREFIX && - substr($type->postType, $prefixLength) === $postType - ) + $type->__get('postType') === $postType || + ( + substr($type->postType, 0, $prefixLength) === self::POST_TYPE_PREFIX && + substr($type->postType, $prefixLength) === $postType + ) ) { return $type; } diff --git a/src/TouchPoint-WP/Person.php b/src/TouchPoint-WP/Person.php index f63e2c0e..a26189d9 100644 --- a/src/TouchPoint-WP/Person.php +++ b/src/TouchPoint-WP/Person.php @@ -41,7 +41,7 @@ * @property-read ?WP_Term resCode The ResCode taxonomy, if present * @property ?int rescode_term_id The ResCode term ID * @property ?string $loginSessionToken A token that is saved on the Session variable and used to ensure links - * aren't used between sessions. + * aren't used between sessions. * @property ?string $loginToken A token used to validate the user. */ class Person extends WP_User implements api, JsonSerializable, module, updatesViaCron @@ -105,7 +105,7 @@ class Person extends WP_User implements api, JsonSerializable, module, updatesVi 'user_activation_key', 'spam', 'show_admin_bar_front', -// 'role', // Excluding prevents this from being set through __set +// 'role', // Excluding prevents this from being set through __set 'locale' ]; @@ -435,7 +435,7 @@ public static function peopleListShortcode($params = [], string $content = ""): self::$_indexingQueries['inv'][$iid] = [ 'invId' => $iid, 'memTypes' => null, -// 'subGroups' => null, +// 'subGroups' => null, 'with_subGroups' => false // populated below ]; } @@ -723,11 +723,11 @@ protected static function updateFromTouchPoint(bool $verbose = false) self::$_indexingQueries['inv'][$iid] = [ 'invId' => $iid, 'memTypes' => $type->leaderTypeInts(), -// 'subGroups' => null, +// 'subGroups' => null, 'with_subGroups' => false ]; } elseif (is_array(self::$_indexingQueries['inv'][$iid]['memTypes'])) { - $r = array_merge( + $r = array_merge( self::$_indexingQueries['inv'][$iid]['memTypes'], $type->leaderTypeInts() ); @@ -1168,7 +1168,7 @@ protected function resCode(): ?WP_Term * * @param ?string $context A reference to where the action buttons are meant to be used. * @param string $btnClass A string for classes to add to the buttons. Note that buttons can be a or button - * elements. + * elements. * * @return string */ @@ -1537,9 +1537,9 @@ public static function ident($inputData): array if (!$valid) { http_response_code(Http::BAD_REQUEST); echo json_encode([ - 'error' => $comment, - 'error_i18n' => __("Registration Blocked for Spam.", 'TouchPoint-WP') - ]); + 'error' => $comment, + 'error_i18n' => __("Registration Blocked for Spam.", 'TouchPoint-WP') + ]); exit; } unset($valid, $comment); @@ -1605,9 +1605,9 @@ private static function ajaxSrc(): void if ($onBehalfOf === null) { http_response_code(Http::UNAUTHORIZED); echo json_encode([ - "error" => "Not Authorized.", - "error_i18n" => __("You may need to sign in.", 'TouchPoint-WP') - ]); + "error" => "Not Authorized.", + "error_i18n" => __("You may need to sign in.", 'TouchPoint-WP') + ]); exit; } @@ -1733,9 +1733,9 @@ private static function ajaxContact(): void if (!$validate) { http_response_code(Http::BAD_REQUEST); echo json_encode([ - 'error' => $result, - 'error_i18n' => __("Contact Blocked for Spam.", 'TouchPoint-WP') - ]); + 'error' => $result, + 'error_i18n' => __("Contact Blocked for Spam.", 'TouchPoint-WP') + ]); exit; } diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 055552bc..80d53bf8 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -243,9 +243,9 @@ protected function __construct(string $file = '') // add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_styles'], 10, 1 ); // TODO restore? // Load API for generic admin functions. -// if (is_admin()) { -// $this->admin(); // SOMEDAY if we ever need to interact with other post types, this should be uncommented. -// } +// if (is_admin()) { +// $this->admin(); // SOMEDAY if we ever need to interact with other post types, this should be uncommented. +// } add_filter('do_parse_request', [$this, 'parseRequest'], 10, 3); @@ -365,18 +365,18 @@ public static function postHeadersAndFiltering(): string if ($_SERVER['REQUEST_METHOD'] !== 'POST') { echo json_encode([ - 'error' => 'Only POST requests are allowed.', - 'error_i18n' => __("Only POST requests are allowed.", 'TouchPoint-WP') - ]); + 'error' => 'Only POST requests are allowed.', + 'error_i18n' => __("Only POST requests are allowed.", 'TouchPoint-WP') + ]); exit; } $inputData = file_get_contents('php://input'); if ($inputData[0] !== '{') { echo json_encode([ - 'error' => 'Invalid data provided.', - 'error_i18n' => __("Invalid data provided.", 'TouchPoint-WP') - ]); + 'error' => 'Invalid data provided.', + 'error_i18n' => __("Invalid data provided.", 'TouchPoint-WP') + ]); exit; } @@ -427,7 +427,7 @@ public function parseRequest($continue, $wp, $extraVars): bool // App Events Endpoint if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_APP_EVENTS && - TouchPointWP::useTribeCalendar() + TouchPointWP::useTribeCalendar() ) { if ( ! EventsCalendar::api($reqUri)) { return $continue; @@ -436,7 +436,7 @@ public function parseRequest($continue, $wp, $extraVars): bool // Involvement endpoint if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_INVOLVEMENT && - $this->settings->enable_involvements === "on" + $this->settings->enable_involvements === "on" ) { if ( ! Involvement::api($reqUri)) { return $continue; @@ -445,7 +445,7 @@ public function parseRequest($continue, $wp, $extraVars): bool // Global Partner endpoint if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_GLOBAL && - $this->settings->enable_global === "on" + $this->settings->enable_global === "on" ) { if ( ! Partner::api($reqUri)) { return $continue; @@ -475,7 +475,7 @@ public function parseRequest($continue, $wp, $extraVars): bool // Auth endpoints if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_AUTH && - $this->settings->enable_authentication === "on" + $this->settings->enable_authentication === "on" ) { if ( ! Auth::api($reqUri)) { return $continue; @@ -499,7 +499,7 @@ public function parseRequest($continue, $wp, $extraVars): bool // Geolocate via IP if ($reqUri['path'][1] === TouchPointWP::API_ENDPOINT_GEOLOCATE && - count($reqUri['path']) === 2) { + count($reqUri['path']) === 2) { $this->ajaxGeolocate(); } } @@ -652,45 +652,45 @@ public function loadLocalizations() load_plugin_textdomain('TouchPoint-WP', false, $dir . '/i18n/'); } - /** - * Create or update database tables - */ - protected function createTables(): void - { - global $wpdb; - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - - // IP Geo Caching table - $tableName = $wpdb->base_prefix . TouchPointWP::TABLE_IP_GEO; - $sql = "CREATE TABLE $tableName ( - id int(10) unsigned NOT NULL auto_increment, - ip varbinary(16) NOT NULL UNIQUE, - updatedDT datetime DEFAULT NOW(), - data text NOT NULL, - PRIMARY KEY (id) - )"; - dbDelta($sql); - } + /** + * Create or update database tables + */ + protected function createTables(): void + { + global $wpdb; + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - /** + // IP Geo Caching table + $tableName = $wpdb->base_prefix . TouchPointWP::TABLE_IP_GEO; + $sql = "CREATE TABLE $tableName ( + id int(10) unsigned NOT NULL auto_increment, + ip varbinary(16) NOT NULL UNIQUE, + updatedDT datetime DEFAULT NOW(), + data text NOT NULL, + PRIMARY KEY (id) + )"; + dbDelta($sql); + } + + /** * Compare the version numbers to determine if a migration is needed. */ public function migrate($force = false): void { if ($this->settings->version === self::VERSION && !$force) { - return; - } + return; + } - $this->createTables(); + $this->createTables(); - if (self::$_hasBeenInited) { - $this->insertTerms(); - } else { - add_action(self::INIT_ACTION_HOOK, [$this, 'insertTerms']); - } + if (self::$_hasBeenInited) { + $this->insertTerms(); + } else { + add_action(self::INIT_ACTION_HOOK, [$this, 'insertTerms']); + } - $this->settings->migrate(); - } + $this->settings->migrate(); + } /** * Load the settings, connect the references, and check that there aren't pending migrations. @@ -752,7 +752,7 @@ public static function load($file): TouchPointWP // Load Events if enabled (by presence of Events Calendar plugin) if (self::useTribeCalendar() - && ! class_exists("tp\TouchPointWP\EventsCalendar")) { + && ! class_exists("tp\TouchPointWP\EventsCalendar")) { if ( ! TOUCHPOINT_COMPOSER_ENABLED) { require_once 'EventsCalendar.php'; } @@ -770,21 +770,21 @@ public static function load($file): TouchPointWP } /** - * @var bool True of the init process has run. False if not. Prevents things from happening twice, which can cause errors. - */ - private static bool $_hasBeenInited = false; + * @var bool True of the init process has run. False if not. Prevents things from happening twice, which can cause errors. + */ + private static bool $_hasBeenInited = false; - /** - * Initialize the plugin. - * - * @return void - */ - public static function init(): void - { - if (self::$_hasBeenInited) - return; + /** + * Initialize the plugin. + * + * @return void + */ + public static function init(): void + { + if (self::$_hasBeenInited) + return; - self::instance()->loadLocalizations(); + self::instance()->loadLocalizations(); self::instance()->registerTaxonomies(); @@ -796,19 +796,19 @@ public static function init(): void self::$_hasBeenInited = true; - self::requireScript("base"); + self::requireScript("base"); do_action(self::INIT_ACTION_HOOK); } /** - * Prints the inline 'base' script. This is meant to be called in the wp_head and admin_head, and should only be - * called once on a page, but that is not automatically validated. - * - * @return void - */ - public static function renderBaseInlineScript(): void - { + * Prints the inline 'base' script. This is meant to be called in the wp_head and admin_head, and should only be + * called once on a page, but that is not automatically validated. + * + * @return void + */ + public static function renderBaseInlineScript(): void + { include self::instance()->assets_dir . '/js/base-inline.php'; } @@ -823,17 +823,17 @@ public function registerScriptsAndStyles(): void false ); - wp_register_script( - self::SHORTCODE_PREFIX . 'base-defer', - $this->assets_url . 'js/base-defer' . $this->script_ext, - [self::SHORTCODE_PREFIX . 'base', 'wp-i18n'], - self::VERSION, - true - ); - wp_set_script_translations( - self::SHORTCODE_PREFIX . 'base-defer', - 'TouchPoint-WP', $this->getJsLocalizationDir() - ); + wp_register_script( + self::SHORTCODE_PREFIX . 'base-defer', + $this->assets_url . 'js/base-defer' . $this->script_ext, + [self::SHORTCODE_PREFIX . 'base', 'wp-i18n'], + self::VERSION, + true + ); + wp_set_script_translations( + self::SHORTCODE_PREFIX . 'base-defer', + 'TouchPoint-WP', $this->getJsLocalizationDir() + ); wp_register_script( self::SHORTCODE_PREFIX . 'swal2-defer', @@ -893,9 +893,9 @@ public function registerScriptsAndStyles(): void Partner::registerScriptsAndStyles(); } -// if ( ! ! $this->auth) { -// Auth::registerScriptsAndStyles(); -// } +// if ( ! ! $this->auth) { +// Auth::registerScriptsAndStyles(); +// } if ( ! ! $this->rsvp) { Meeting::registerScriptsAndStyles(); @@ -966,11 +966,11 @@ public static function requireStyle(string $name = null): void public function filterByTag(?string $tag, ?string $handle): string { if (strpos($tag, 'async') !== false && - strpos($handle, '-async') > 0) { + strpos($handle, '-async') > 0) { $tag = str_replace(' src=', ' async="async" src=', $tag); } if (strpos($tag, 'defer') !== false && - strpos($handle, '-defer') > 0 + strpos($handle, '-defer') > 0 ) { $tag = str_replace('" - print( - "") + print("") apiCalled = True if ("login" in Data.a or Data.r != '') and model.HttpMethod == "get": # r parameter implies desired redir after login. @@ -1115,6 +1141,7 @@ def get_person_info_for_sync(person_obj): path = "" # add host if missing + # noinspection HttpUrlsUsage if not r[0:8].lower() == "https://" and not r[0:7].lower() == "http://" and not r.split('/', 1)[ 0].__contains__('.'): if r[0] == '/': diff --git a/touchpoint-wp.php b/touchpoint-wp.php index b6057c06..1289e676 100644 --- a/touchpoint-wp.php +++ b/touchpoint-wp.php @@ -14,7 +14,7 @@ Plugin URI: https://github.com/tenthpres/touchpoint-wp Update URI: https://github.com/tenthpres/touchpoint-wp Description: A WordPress Plugin for integrating with TouchPoint Church Management Software. -Version: 0.0.35 +Version: 0.0.36 Author: James K Author URI: https://github.com/jkrrv License: AGPLv3+ From dd82650338d017625afaacb2c89d6e73d44bfcba Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 11:29:52 -0400 Subject: [PATCH 033/226] version bump --- composer.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e8040e13..595caf68 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "A WordPress Plugin for integrating with TouchPoint Church Management Software.", "license": "AGPL-3.0-or-later", "type": "wordpress-plugin", - "version": "0.0.35", + "version": "0.0.36", "keywords": [ "wordpress", "wp", diff --git a/package.json b/package.json index aba6a642..dfe4f2a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "touchpoint-wp", - "version": "0.0.35", + "version": "0.0.36", "description": "A WordPress Plugin for integrating with TouchPoint Church Management Software.", "directories": { "doc": "docs" From 73cd2f434a99f9c251c7c7847afd9d982813026f Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 11:31:40 -0400 Subject: [PATCH 034/226] Resolve an issue when the partner tax isn't defined. --- src/TouchPoint-WP/Partner.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/TouchPoint-WP/Partner.php b/src/TouchPoint-WP/Partner.php index 43680789..911d348a 100644 --- a/src/TouchPoint-WP/Partner.php +++ b/src/TouchPoint-WP/Partner.php @@ -118,12 +118,15 @@ protected function __construct(object $object) throw new TouchPointWP_Exception("Could not construct a Partner with the information provided."); } - $terms = wp_get_post_terms( - $this->post_id, - [ - Taxonomies::TAX_GP_CATEGORY - ] - ); + $terms = []; + if (TouchPointWP::instance()->settings->global_primary_tax !== "") { + $terms = wp_get_post_terms( + $this->post_id, + [ + Taxonomies::TAX_GP_CATEGORY + ] + ); + } if (is_array($terms) && count($terms) > 0) { $hookLength = strlen(TouchPointWP::HOOK_PREFIX); @@ -503,9 +506,15 @@ public static function updateFromTouchPoint(bool $verbose = false) } // Delete terms that are no longer used - $terms = get_terms(['taxonomy' => Taxonomies::TAX_GP_CATEGORY, 'hide_empty' => false, 'exclude' => $termsToKeep]); - foreach ($terms as $term) { - wp_delete_term($term->term_id, Taxonomies::TAX_GP_CATEGORY); + if (TouchPointWP::instance()->settings->global_primary_tax !== "") { + $terms = get_terms( + ['taxonomy' => Taxonomies::TAX_GP_CATEGORY, 'hide_empty' => false, 'exclude' => $termsToKeep] + ); + if (!is_wp_error($terms)) { + foreach ($terms as $term) { + wp_delete_term($term->term_id, Taxonomies::TAX_GP_CATEGORY); + } + } } if ($count !== 0) { From 964e009511dbdf3b99e69d2e2d2f18ce885ac1d7 Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 11:34:43 -0400 Subject: [PATCH 035/226] Resolve an issue with button alignment for actions. --- assets/template/partials-template-style.css | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/template/partials-template-style.css b/assets/template/partials-template-style.css index 220c3d9e..a3294d0f 100644 --- a/assets/template/partials-template-style.css +++ b/assets/template/partials-template-style.css @@ -84,13 +84,20 @@ article.inv-list-item h2 a { text-align: right; } +.partner-actions button, +.partner-actions a.button, +.involvement-actions button, +.involvement-actions a.button { + display: inline-block; +} + .partner-list-item .partner-actions button, .partner-list-item .partner-actions a.button, .inv-list-item .involvement-actions button, .inv-list-item .involvement-actions a.button, .inv-list-item .child-involvements a { - position:relative; - z-index:10; + position: relative; + z-index: 10; } .partner-list-item div.post-meta-single, From 1af9f25e1a08484f687ea568d725ce48beb75f64 Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 11:36:33 -0400 Subject: [PATCH 036/226] Move Templates to override to Module. --- src/TouchPoint-WP/Involvement.php | 2 +- src/TouchPoint-WP/Partner.php | 2 +- src/TouchPoint-WP/module.php | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index ed44fa8d..77fca246 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -402,7 +402,7 @@ public static function templateFilter(string $template): string { if (apply_filters(TouchPointWP::HOOK_PREFIX . 'use_default_templates', true, self::class)) { $postTypesToFilter = Involvement_PostTypeSettings::getPostTypes(); - $templateFilesToOverwrite = TouchPointWP::TEMPLATES_TO_OVERWRITE; + $templateFilesToOverwrite = self::TEMPLATES_TO_OVERWRITE; if (count($postTypesToFilter) == 0) { return $template; diff --git a/src/TouchPoint-WP/Partner.php b/src/TouchPoint-WP/Partner.php index 911d348a..ee799b4d 100644 --- a/src/TouchPoint-WP/Partner.php +++ b/src/TouchPoint-WP/Partner.php @@ -540,7 +540,7 @@ public static function templateFilter(string $template): string { if (apply_filters(TouchPointWP::HOOK_PREFIX . 'use_default_templates', true, self::class)) { $postTypesToFilter = self::POST_TYPE; - $templateFilesToOverwrite = TouchPointWP::TEMPLATES_TO_OVERWRITE; + $templateFilesToOverwrite = self::TEMPLATES_TO_OVERWRITE; if ( ! in_array(ltrim(strrchr($template, '/'), '/'), $templateFilesToOverwrite)) { return $template; diff --git a/src/TouchPoint-WP/module.php b/src/TouchPoint-WP/module.php index d58a09a3..8c34d20c 100644 --- a/src/TouchPoint-WP/module.php +++ b/src/TouchPoint-WP/module.php @@ -16,4 +16,12 @@ interface module * @return bool */ public static function load(): bool; + + public const TEMPLATES_TO_OVERWRITE = [ + 'archive.php', + 'singular.php', + 'single.php', + 'index.php', + 'template-canvas.php' + ]; } \ No newline at end of file From ed9a5c0a64f9f34e569a8ee466f07e7cf7679ac9 Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 19:11:40 -0400 Subject: [PATCH 037/226] Resolve an issue with Locations. Revisit of #113. --- src/TouchPoint-WP/{Utilities => }/Geo.php | 33 +++++++++++--- src/TouchPoint-WP/Involvement.php | 24 +++++----- src/TouchPoint-WP/Location.php | 20 ++++----- src/TouchPoint-WP/Partner.php | 16 +++---- src/TouchPoint-WP/TouchPointWP.php | 55 +++++++++++------------ src/TouchPoint-WP/{geo.php => hasGeo.php} | 4 +- touchpoint-wp.php | 4 +- 7 files changed, 89 insertions(+), 67 deletions(-) rename src/TouchPoint-WP/{Utilities => }/Geo.php (50%) rename src/TouchPoint-WP/{geo.php => hasGeo.php} (88%) diff --git a/src/TouchPoint-WP/Utilities/Geo.php b/src/TouchPoint-WP/Geo.php similarity index 50% rename from src/TouchPoint-WP/Utilities/Geo.php rename to src/TouchPoint-WP/Geo.php index 618b210c..b9c7b32f 100644 --- a/src/TouchPoint-WP/Utilities/Geo.php +++ b/src/TouchPoint-WP/Geo.php @@ -3,14 +3,32 @@ * @package TouchPointWP */ -namespace tp\TouchPointWP\Utilities; +namespace tp\TouchPointWP; + +use stdClass; + +if ( ! defined('ABSPATH')) { + exit(1); +} + /** - * Utility class for geographical attributes and calculations. Not to be confused with the geo interface. - * @see \tp\TouchPointWP\geo + * A standardized set of fields for geographical information. */ -abstract class Geo +class Geo extends stdClass { + public ?float $lat = null; + public ?float $lng = null; + public ?string $human = null; + public ?string $type = null; + + public function __construct(?float $lat = null, ?float $lng = null, ?string $human = null, ?string $type = null) { + $this->lat = $lat; + $this->lng = $lng; + $this->human = $human; + $this->type = $type; + } + /** * Get distance between two geographic points by lat/lng pairs. Returns a number in miles. * @@ -28,8 +46,11 @@ public static function distance(float $latA, float $lngA, float $latB, float $ln $latB_r = deg2rad($latB); $lngB_r = deg2rad($lngB); - return round(3959 * acos( + return round( + 3959 * acos( cos($latA_r) * cos($latB_r) * cos($lngB_r - $lngA_r) + sin($latA_r) * sin($latB_r) - ), 1); + ), + 1 + ); } } \ No newline at end of file diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index 77fca246..c42d3299 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -15,7 +15,6 @@ require_once "jsonLd.php"; require_once "updatesViaCron.php"; require_once "Utilities.php"; - require_once "Utilities/Geo.php"; require_once "Involvement_PostTypeSettings.php"; } @@ -34,7 +33,7 @@ /** * Fundamental object meant to correspond to an Involvement in TouchPoint */ -class Involvement implements api, updatesViaCron, geo, module +class Involvement implements api, updatesViaCron, hasGeo, module { use jsInstantiation; use jsonLd; @@ -1658,6 +1657,10 @@ public static function ajaxNearby(): void exit; } + if ($geoObj->type == "loc") { + $geoObj->type = "ip"; + } + $lat = $geoObj->lat; $lng = $geoObj->lng; @@ -1666,6 +1669,7 @@ public static function ajaxNearby(): void $geoObj = TouchPointWP::instance()->reverseGeocode($lat, $lng); if ($geoObj !== false) { + $geoObj->type = "nav"; $r['geo'] = $geoObj; } } @@ -1897,7 +1901,7 @@ public function getDistance(bool $useHiForFalse = false) return $useHiForFalse ? 25000 : false; } - return Utilities\Geo::distance( + return Geo::distance( $this->geo->lat, $this->geo->lng, self::$compareGeo->lat, @@ -2049,15 +2053,15 @@ public function hasGeo(): bool return $this->geo !== null && $this->geo->lat !== null && $this->geo->lng !== null; } - public function asGeoIFace(string $type = "unknown"): ?object + public function asGeoIFace(string $type = "unknown"): ?Geo { if ($this->hasGeo()) { - return (object)[ - 'lat' => $this->geo->lat, - 'lng' => $this->geo->lng, - 'human' => $this->name, - 'type' => $type - ]; + return new Geo( + $this->geo->lat, + $this->geo->lng, + $this->name, + $type + ); } return null; diff --git a/src/TouchPoint-WP/Location.php b/src/TouchPoint-WP/Location.php index eb548e6a..ffb27c1b 100644 --- a/src/TouchPoint-WP/Location.php +++ b/src/TouchPoint-WP/Location.php @@ -9,14 +9,14 @@ * A Location is generally a physical place, with an internet connection. These likely correspond to campuses, but * don't necessarily need to. */ -class Location implements geo +class Location implements hasGeo { protected static ?array $_locations = null; public string $name; public ?float $lat; public ?float $lng; - public float $radius; + public float $radius; // miles public array $ipAddresses; protected function __construct($data) @@ -79,15 +79,15 @@ public function hasGeo(): bool return $this->lat !== null && $this->lng !== null; } - public function asGeoIFace(string $type = "unknown"): ?object + public function asGeoIFace(string $type = "unknown"): ?Geo { if ($this->hasGeo()) { - return (object)[ - 'lat' => $this->lat, - 'lng' => $this->lng, - 'human' => $this->name, - 'type' => $type - ]; + return new Geo( + $this->lat, + $this->lng, + $this->name, + $type + ); } return null; @@ -97,7 +97,7 @@ public static function getLocationForLatLng(float $lat, float $lng): ?Location { $locs = self::getLocations(); foreach ($locs as $l) { - $d = Utilities\Geo::distance($lat, $lng, $l->lat, $l->lng); + $d = Geo::distance($lat, $lng, $l->lat, $l->lng); if ($d <= $l->radius) { return $l; } diff --git a/src/TouchPoint-WP/Partner.php b/src/TouchPoint-WP/Partner.php index ee799b4d..e3239b59 100644 --- a/src/TouchPoint-WP/Partner.php +++ b/src/TouchPoint-WP/Partner.php @@ -26,7 +26,7 @@ /** * An Outreach partner, corresponding to a family in TouchPoint. */ -class Partner implements api, JsonSerializable, updatesViaCron, geo, module +class Partner implements api, JsonSerializable, updatesViaCron, hasGeo, module { use jsInstantiation { jsInstantiation::enqueueForJsInstantiation as protected enqueueForJsInstantiationTrait; @@ -1385,15 +1385,15 @@ public function hasGeo(): bool return $this->geo !== null; } - public function asGeoIFace(string $type = "unknown"): ?object + public function asGeoIFace(string $type = "unknown"): ?Geo { if ($this->hasGeo()) { - return (object)[ - 'lat' => $this->geo->lat, - 'lng' => $this->geo->lng, - 'human' => $this->name, - 'type' => $type - ]; + return new Geo( + $this->geo->lat, + $this->geo->lng, + $this->name, + $type + ); } return null; diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index d56b3bfa..f0e7aa5e 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -959,7 +959,7 @@ public function ajaxGeolocate(): void /** * @param bool $useApi Set false to only use cached data, and not the IP API. * - * @return stdClass|false An object with 'lat', 'lng', and 'human' attributes, if a location could be identified. + * @return Geo|false An object with 'lat', 'lng', and 'human' attributes, if a location could be identified. * Or, false if not available. */ public function geolocate(bool $useApi = true, bool $includeRaw = false) @@ -974,7 +974,7 @@ public function geolocate(bool $useApi = true, bool $includeRaw = false) $return = Location::getLocationForIP($ip); if ($return !== null && $return->lat !== null && $return->lng !== null) { - return $return->asGeoIFace('ip'); + return $return->asGeoIFace('loc'); } try { @@ -1011,24 +1011,18 @@ public function geolocate(bool $useApi = true, bool $includeRaw = false) $human = $d->city . ", " . $d->country_name; } + $r = new Geo( + $d->latitude, + $d->longitude, + $human, + 'ip' + ); + if ($includeRaw) { - /** @see geo::asGeoIFace() */ - return (object)[ - 'lat' => $d->latitude, - 'lng' => $d->longitude, - 'human' => $human, - 'type' => 'ip', - 'raw' => $d - ]; - } else { - /** @see geo::asGeoIFace() */ - return (object)[ - 'lat' => $d->latitude, - 'lng' => $d->longitude, - 'human' => $human, - 'type' => 'ip' - ]; + $r->raw = $d; } + + return $r; } /** @@ -1036,7 +1030,7 @@ public function geolocate(bool $useApi = true, bool $includeRaw = false) * @param float $lng Longitude * @param bool $includeIpLoc Whether to use IP geolocation as a fallback data source. * - * @return object|false An object with a 'human' attribute, if a location could be identified. Or, false if not + * @return Geo|false An object with a 'human' attribute, if a location could be identified. Or, false if not * available. */ public function reverseGeocode(float $lat, float $lng, bool $includeIpLoc = true) @@ -1050,6 +1044,13 @@ public function reverseGeocode(float $lat, float $lng, bool $includeIpLoc = true return $r->asGeoIFace('loc'); } + if ($includeIpLoc) { + $r = Location::getLocationForIP(); + if ($r !== null) { + return $r->asGeoIFace('ip'); + } + } + if ($this->settings->google_geo_api_key !== "") { $reqData = [ 'key' => $this->settings->google_geo_api_key, @@ -1083,16 +1084,12 @@ public function reverseGeocode(float $lat, float $lng, bool $includeIpLoc = true $human = $out['locality'] . ", " . $out['country_long']; } - $out['human'] = $human; - - return (object)$out; - } - } - - if ($includeIpLoc) { - $r = Location::getLocationForIP(); - if ($r !== null) { - return $r->asGeoIFace('loc'); + return new Geo( + $out['lat'], + $out['lng'], + $human, + 'nav', + ); } } diff --git a/src/TouchPoint-WP/geo.php b/src/TouchPoint-WP/hasGeo.php similarity index 88% rename from src/TouchPoint-WP/geo.php rename to src/TouchPoint-WP/hasGeo.php index 63e137cf..d70f2cc3 100644 --- a/src/TouchPoint-WP/geo.php +++ b/src/TouchPoint-WP/hasGeo.php @@ -13,7 +13,7 @@ /** * For classes that have geographic attributes, or potential geographic attributes */ -interface geo +interface hasGeo { /** @@ -31,5 +31,5 @@ public function hasGeo(): bool; * * @return object|null */ - public function asGeoIFace(string $type = "unknown"): ?object; + public function asGeoIFace(string $type = "unknown"): ?Geo; } \ No newline at end of file diff --git a/touchpoint-wp.php b/touchpoint-wp.php index 1289e676..0a26ed1b 100644 --- a/touchpoint-wp.php +++ b/touchpoint-wp.php @@ -49,11 +49,11 @@ require_once __DIR__ . "/src/TouchPoint-WP/api.php"; require_once __DIR__ . "/src/TouchPoint-WP/module.php"; require_once __DIR__ . "/src/TouchPoint-WP/Utilities/Cleanup.php"; - require_once __DIR__ . "/src/TouchPoint-WP/Utilities/Geo.php"; + require_once __DIR__ . "/src/TouchPoint-WP/Geo.php"; require_once __DIR__ . "/src/TouchPoint-WP/Utilities/PersonArray.php"; require_once __DIR__ . "/src/TouchPoint-WP/Utilities/Http.php"; require_once __DIR__ . "/src/TouchPoint-WP/Taxonomies.php"; - require_once __DIR__ . "/src/TouchPoint-WP/geo.php"; + require_once __DIR__ . "/src/TouchPoint-WP/hasGeo.php"; require_once __DIR__ . "/src/TouchPoint-WP/Person.php"; require_once __DIR__ . "/src/TouchPoint-WP/Involvement.php"; From 439c59feff5ab8a481b6dd58a0c6569c4b85effa Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 19:33:51 -0400 Subject: [PATCH 038/226] Resolve an issue with removing taxonomy terms that are no longer relevant. --- src/TouchPoint-WP/Taxonomies.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/TouchPoint-WP/Taxonomies.php b/src/TouchPoint-WP/Taxonomies.php index ea5097bb..e33befc5 100644 --- a/src/TouchPoint-WP/Taxonomies.php +++ b/src/TouchPoint-WP/Taxonomies.php @@ -104,8 +104,10 @@ public static function insertTermsForArrayBasedTaxonomy(array $list, string $tax // Delete any terms that are no longer current. $terms = get_terms(['taxonomy' => $taxonomy, 'hide_empty' => false, 'exclude' => $existingIds]); - foreach ($terms as $term) { - wp_delete_term($term->term_id, $taxonomy); + if (!is_wp_error($terms)) { + foreach ($terms as $term) { + wp_delete_term($term->term_id, $taxonomy); + } } } @@ -158,8 +160,10 @@ public static function insertTermsForLookupBasedTaxonomy(array $list, string $ta // Delete any terms that are no longer current. $terms = get_terms(['taxonomy' => $taxonomy, 'hide_empty' => false, 'exclude' => $existingIds]); - foreach ($terms as $term) { - wp_delete_term($term->term_id, $taxonomy); + if (!is_wp_error($terms)) { + foreach ($terms as $term) { + wp_delete_term($term->term_id, $taxonomy); + } } } @@ -379,8 +383,10 @@ public static function insertTerms(TouchPointWP $instance) // Delete any terms that are no longer current. $terms = get_terms(['taxonomy' => self::TAX_DIV, 'hide_empty' => false, 'exclude' => $existingIds]); - foreach ($terms as $term) { - wp_delete_term($term->term_id, self::TAX_DIV); + if (!is_wp_error($terms)) { + foreach ($terms as $term) { + wp_delete_term($term->term_id, self::TAX_DIV); + } } } From 848e5436acdf58cf78aa33aea09e206087adfba3 Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 17 Oct 2023 19:34:23 -0400 Subject: [PATCH 039/226] Rm Templates to overwrite, which has moved. --- src/TouchPoint-WP/TouchPointWP.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index f0e7aa5e..7dde6f65 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -55,14 +55,6 @@ class TouchPointWP public const API_ENDPOINT_CLEANUP = "cleanup"; public const API_ENDPOINT_GEOLOCATE = "geolocate"; - public const TEMPLATES_TO_OVERWRITE = [ - 'archive.php', - 'singular.php', - 'single.php', - 'index.php', - 'template-canvas.php' - ]; - /** * Prefix to use for all shortcodes. */ From 55edb206f36bdc9ff3a25ae135eef9570e34abb7 Mon Sep 17 00:00:00 2001 From: "James K." Date: Wed, 18 Oct 2023 18:37:40 -0400 Subject: [PATCH 040/226] Fix an issue with sorting Involvements --- src/TouchPoint-WP/Involvement.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index c42d3299..a164957f 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -1108,7 +1108,10 @@ public static function doInvolvementList(WP_Query $q, $params = []): void usort($posts, [Involvement::class, 'sortPosts']); - foreach ($posts as $post) { + foreach ($posts as $postI) { + global $post; + $post = $postI; + $loadedPart = get_template_part('list-item', 'involvement-list-item'); if ($loadedPart === false) { require TouchPointWP::$dir . "/src/templates/parts/involvement-list-item.php"; From 046c48834d97e7284f61ea9fad5d5377289b9558 Mon Sep 17 00:00:00 2001 From: "James K." Date: Wed, 18 Oct 2023 22:38:54 -0400 Subject: [PATCH 041/226] Rm unneeded loop --- src/TouchPoint-WP/Involvement.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/TouchPoint-WP/Involvement.php b/src/TouchPoint-WP/Involvement.php index a164957f..253afe9e 100644 --- a/src/TouchPoint-WP/Involvement.php +++ b/src/TouchPoint-WP/Involvement.php @@ -571,22 +571,11 @@ public function nextMeeting(): ?DateTimeImmutable // schedules foreach ($this->schedules() as $s) { $mdt = $s->next; - if ($mdt > $now) { - if ($this->_nextMeeting === null || $mdt < $this->_nextMeeting) { - $this->_nextMeeting = $mdt; - } + if ($mdt <= $now) { // If "next meeting" is past, add a week and re-check. + $mdt = $mdt->modify("+1 week"); } - } - } - - // schedules + 1 week (assumes schedules are recurring weekly) - if ($this->_nextMeeting === null) { // really only needed if we don't have a date yet. - foreach ($this->schedules() as $s) { - $mdt = $s->next->modify("+1 week"); - if ($mdt > $now) { - if ($this->_nextMeeting === null || $mdt < $this->_nextMeeting) { - $this->_nextMeeting = $mdt; - } + if ($this->_nextMeeting === null || $mdt < $this->_nextMeeting) { + $this->_nextMeeting = $mdt; } } } From fa3ae469ce24d848bf089e8ad053d4c4c63dadd0 Mon Sep 17 00:00:00 2001 From: "James K." Date: Sun, 22 Oct 2023 22:46:51 -0400 Subject: [PATCH 042/226] Version bump to 1.0.0 --- composer.json | 2 +- i18n/TouchPoint-WP.pot | 4 ++-- package.json | 2 +- src/TouchPoint-WP/EventsCalendar.php | 2 +- src/TouchPoint-WP/TouchPointWP.php | 4 ++-- src/TouchPoint-WP/TouchPointWP_Settings.php | 2 +- src/python/WebApi.py | 2 +- touchpoint-wp.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 595caf68..ebee13e1 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "A WordPress Plugin for integrating with TouchPoint Church Management Software.", "license": "AGPL-3.0-or-later", "type": "wordpress-plugin", - "version": "0.0.36", + "version": "1.0.0", "keywords": [ "wordpress", "wp", diff --git a/i18n/TouchPoint-WP.pot b/i18n/TouchPoint-WP.pot index ca5e1494..a6df4947 100644 --- a/i18n/TouchPoint-WP.pot +++ b/i18n/TouchPoint-WP.pot @@ -2,14 +2,14 @@ # This file is distributed under the AGPLv3+. msgid "" msgstr "" -"Project-Id-Version: TouchPoint WP 0.0.35\n" +"Project-Id-Version: TouchPoint WP 1.0.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/TouchPoint-WP\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-10-07T21:31:31+00:00\n" +"POT-Creation-Date: 2023-10-19T02:39:34+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: TouchPoint-WP\n" diff --git a/package.json b/package.json index dfe4f2a0..0e882e0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "touchpoint-wp", - "version": "0.0.36", + "version": "1.0.0", "description": "A WordPress Plugin for integrating with TouchPoint Church Management Software.", "directories": { "doc": "docs" diff --git a/src/TouchPoint-WP/EventsCalendar.php b/src/TouchPoint-WP/EventsCalendar.php index 5fc66a84..5ee9728d 100644 --- a/src/TouchPoint-WP/EventsCalendar.php +++ b/src/TouchPoint-WP/EventsCalendar.php @@ -19,7 +19,7 @@ * Provides an interface to bridge the gap between The Events Calendar plugin (by ModernTribe) and the TouchPoint * mobile app. * - * @deprecated since 0.0.36 + * @deprecated since 1.0.0 */ abstract class EventsCalendar implements api, module { diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index 7dde6f65..e894b384 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -32,7 +32,7 @@ class TouchPointWP /** * Version number */ - public const VERSION = "0.0.36"; + public const VERSION = "1.0.0"; /** * The Token @@ -1320,7 +1320,7 @@ public static function useTribeCalendarPro(): bool * * @return bool * - * @deprecated since 0.0.36 -- Will not be necessary once mobile 3.0 exists. + * @deprecated since 1.0.0 -- Will not be necessary once mobile 3.0 exists. */ public static function useTribeCalendar(): bool { diff --git a/src/TouchPoint-WP/TouchPointWP_Settings.php b/src/TouchPoint-WP/TouchPointWP_Settings.php index d7d2c8bb..16ccd7be 100644 --- a/src/TouchPoint-WP/TouchPointWP_Settings.php +++ b/src/TouchPoint-WP/TouchPointWP_Settings.php @@ -1483,7 +1483,7 @@ public function migrate(): void } // 0.0.31 - Add lookup IDs to ResCodes - // 0.0.36 - Cleanup possible duplicate terms + // 1.0.0 - Cleanup possible duplicate terms Taxonomies::$forceTermLookupIdUpdate = true; // Update version string diff --git a/src/python/WebApi.py b/src/python/WebApi.py index 27956377..19c88254 100644 --- a/src/python/WebApi.py +++ b/src/python/WebApi.py @@ -5,7 +5,7 @@ import linecache import sys -VERSION = "0.0.36" +VERSION = "1.0.0" sgContactEvName = "Contact" diff --git a/touchpoint-wp.php b/touchpoint-wp.php index 0a26ed1b..fa2456b9 100644 --- a/touchpoint-wp.php +++ b/touchpoint-wp.php @@ -14,7 +14,7 @@ Plugin URI: https://github.com/tenthpres/touchpoint-wp Update URI: https://github.com/tenthpres/touchpoint-wp Description: A WordPress Plugin for integrating with TouchPoint Church Management Software. -Version: 0.0.36 +Version: 1.0.0 Author: James K Author URI: https://github.com/jkrrv License: AGPLv3+ From 0c0f8ec1963ef8c9d73a1213e9c499c859861663 Mon Sep 17 00:00:00 2001 From: "James K." Date: Tue, 24 Oct 2023 14:49:13 -0400 Subject: [PATCH 043/226] i18n for Google Maps --- src/TouchPoint-WP/TouchPointWP.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TouchPoint-WP/TouchPointWP.php b/src/TouchPoint-WP/TouchPointWP.php index e894b384..d9631480 100644 --- a/src/TouchPoint-WP/TouchPointWP.php +++ b/src/TouchPoint-WP/TouchPointWP.php @@ -815,10 +815,11 @@ public function registerScriptsAndStyles(): void true ); + $lang = strtolower(get_locale()); wp_register_script( TouchPointWP::SHORTCODE_PREFIX . "googleMaps", sprintf( - "https://maps.googleapis.com/maps/api/js?key=%s&v=3&libraries=geometry", + "https://maps.googleapis.com/maps/api/js?key=%s&v=3&libraries=geometry&language=$lang", TouchPointWP::instance()->settings->google_maps_api_key ), [TouchPointWP::SHORTCODE_PREFIX . "base-defer"], From 034cb1618b1cddbf0ea3294298127c290f33ed98 Mon Sep 17 00:00:00 2001 From: "James K." Date: Thu, 26 Oct 2023 18:20:37 -0400 Subject: [PATCH 044/226] Resolve issue with parameter not always being defined. --- src/TouchPoint-WP/Taxonomies.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TouchPoint-WP/Taxonomies.php b/src/TouchPoint-WP/Taxonomies.php index e33befc5..f9ff8372 100644 --- a/src/TouchPoint-WP/Taxonomies.php +++ b/src/TouchPoint-WP/Taxonomies.php @@ -258,12 +258,16 @@ public static function getTermsClauses($clauses, $taxonomy, $args): array * Insert the terms for the registered taxonomies. (This is supposed to happen a while after the taxonomies are * loaded.) * - * @param TouchPointWP $instance + * @param ?TouchPointWP $instance * * @return void */ - public static function insertTerms(TouchPointWP $instance) + public static function insertTerms(TouchPointWP $instance = null) { + if ($instance === null) { + $instance = TouchPointWP::instance(); + } + // Resident Codes $types = self::getPostTypesForTaxonomy($instance, self::TAX_RESCODE); if (count($types) > 0) { From 7d5244d780fb0738fefc4b23c2bb434639509c16 Mon Sep 17 00:00:00 2001 From: "James K." Date: Wed, 1 Nov 2023 16:06:32 -0400 Subject: [PATCH 045/226] JS file watchers. --- .idea/watcherTasks.xml | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml index f9519dfe..cc2fc94a 100644 --- a/.idea/watcherTasks.xml +++ b/.idea/watcherTasks.xml @@ -22,22 +22,22 @@ - - @@ -46,9 +46,9 @@