Plugin Directory

Changeset 2686881


Ignore:
Timestamp:
03/01/2022 07:38:24 PM (4 years ago)
Author:
danielmilner
Message:

Update to version 1.4.4 from GitHub

Location:
ccbpress-core
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ccbpress-core/tags/1.4.4/assets/js/admin/admin.js

    r2033621 r2686881  
    1 jQuery(document).ready(function($) {
    2     jQuery('.ccbpress-required-services.button').click(function() {
    3         jQuery('button#contextual-help-link').trigger('click');
    4         return false;
    5     });
    6 
    7     jQuery('.ccbpress-cron-help').click(function() {
    8         jQuery('button#contextual-help-link').trigger('click');
    9         jQuery('#tab-link-ccbpress-cron > a').trigger('click');
    10         return false;
    11     });
    12 
    13     jQuery('#ccbpress-ccb-service-check-button').click(function() {
    14         var button = document.getElementById('ccbpress-ccb-service-check-button');
    15         var button_text = button.textContent || button.innerText;
    16 
    17         jQuery('#ccbpress-ccb-service-check-button')
    18             .text(ccbpress_vars.messages.running)
    19             .attr('disabled', true)
    20             .addClass('updating-message');
    21 
    22         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/check_api_services', {
    23             method: 'POST',
    24             headers: {
    25                 Accept: 'application/json',
    26                 'Content-Type': 'application/json',
    27             },
    28             body: JSON.stringify({
    29                 _wpnonce: ccbpress_vars.api_nonce,
    30             }),
    31         })
    32             .then(response => response.json())
    33             .then(data => {
    34                 if (Array.isArray(data)) {
    35                     let table = document.createElement('table');
    36                     table.className += 'wp-list-table widefat fixed striped';
    37                     table.style.margin = '15px 0 0 0';
    38                     let header = table.createTHead();
    39                     let row = header.insertRow();
    40                     let th = document.createElement('th');
    41                     th.innerText = 'API Service';
    42                     th.style.padding = '8px 10px';
    43                     row.appendChild(th);
    44                     th = document.createElement('th');
    45                     th.innerText = 'Status';
    46                     th.style.padding = '8px 10px';
    47                     row.appendChild(th);
    48                     data.forEach(item => {
    49                         let row = table.insertRow();
    50                         let cell = row.insertCell();
    51                         cell.innerText = item.service;
    52                         cell = row.insertCell();
    53                         if ('Passed' === item.status) {
    54                             cell.innerHTML =
    55                                 '<div class="dashicons dashicons-yes"></div> ' + item.status;
    56                         } else {
    57                             cell.innerHTML =
    58                                 '<div class="dashicons dashicons-no"></div> ' + item.status;
    59                         }
    60                     });
    61                     jQuery('#ccbpress-ccb-service-check-results').html(table);
    62                     jQuery('#ccbpress-ccb-service-check-button')
    63                         .text(ccbpress_vars.messages.done)
    64                         .removeClass('updating-message')
    65                         .addClass('updated-message');
    66                     setTimeout(function() {
    67                         jQuery('#ccbpress-ccb-service-check-button')
    68                             .text(button_text)
    69                             .removeClass('updated-message')
    70                             .attr('disabled', false);
    71                     }, 3000);
    72                 }
    73             });
    74         return false;
    75     });
    76 
    77     jQuery(document).on('widget-updated widget-added', function() {
    78         if (
    79             typeof jQuery('#widgets-right .ccbpress-select select').chosen ===
    80             'function'
    81         ) {
    82             jQuery('#widgets-right .ccbpress-select select').chosen({
    83                 width: '100%',
    84                 disable_search_threshold: 10,
    85             });
    86         }
    87     });
    88 
    89     if (
    90         typeof jQuery('#widgets-right .ccbpress-select select').chosen ===
    91         'function'
    92     ) {
    93         jQuery('#widgets-right .ccbpress-select select').chosen({
    94             width: '100%',
    95             disable_search_threshold: 10,
    96         });
    97     }
    98 
    99     jQuery('#ccbpress-purge-image-cache-button').click(function() {
    100         var button = document.getElementById('ccbpress-purge-image-cache-button');
    101         var button_text = button.textContent || button.innerText;
    102 
    103         jQuery('#ccbpress-purge-image-cache-button')
    104             .text(ccbpress_vars.messages.running)
    105             .attr('disabled', true)
    106             .addClass('updating-message');
    107 
    108         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/purge_image_cache', {
    109             method: 'POST',
    110             headers: {
    111                 Accept: 'application/json',
    112                 'Content-Type': 'application/json',
    113             },
    114             body: JSON.stringify({
    115                 _wpnonce: ccbpress_vars.api_nonce,
    116             }),
    117         })
    118             .then(response => response.json())
    119             .then(data => {
    120                 if (typeof data.result !== 'undefined' && 'success' === data.result) {
    121                     jQuery('#ccbpress-purge-image-cache-button')
    122                         .text(ccbpress_vars.messages.done)
    123                         .removeClass('updating-message')
    124                         .addClass('updated-message');
    125                     setTimeout(function() {
    126                         jQuery('#ccbpress-purge-image-cache-button')
    127                             .text(button_text)
    128                             .removeClass('updated-message')
    129                             .attr('disabled', false);
    130                     }, 3000);
    131                 } else {
    132                     jQuery('#ccbpress-purge-image-cache-button')
    133                         .text(button_text)
    134                         .removeClass('updated-message')
    135                         .attr('disabled', false);
    136                     alert('There was an error purging the image cache.');
    137                 }
    138             })
    139             .catch(err => {
    140                 jQuery('#ccbpress-purge-image-cache-button')
    141                     .text(button_text)
    142                     .removeClass('updated-message')
    143                     .attr('disabled', false);
    144                 alert('There was an error purging the image cache.');
    145             });
    146     });
    147 
    148     jQuery('#ccbpress-purge-transient-cache-button').click(function() {
    149         var button = document.getElementById(
    150             'ccbpress-purge-transient-cache-button',
    151         );
    152         var button_text = button.textContent || button.innerText;
    153 
    154         jQuery('#ccbpress-purge-transient-cache-button')
    155             .text(ccbpress_vars.messages.running)
    156             .attr('disabled', true)
    157             .addClass('updating-message');
    158 
    159         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/purge_transient_cache', {
    160             method: 'POST',
    161             headers: {
    162                 Accept: 'application/json',
    163                 'Content-Type': 'application/json',
    164             },
    165             body: JSON.stringify({
    166                 _wpnonce: ccbpress_vars.api_nonce,
    167             }),
    168         })
    169             .then(response => response.json())
    170             .then(data => {
    171                 if (typeof data.result !== 'undefined' && 'success' === data.result) {
    172                     jQuery('#ccbpress-purge-transient-cache-button')
    173                         .text(ccbpress_vars.messages.done)
    174                         .removeClass('updating-message')
    175                         .addClass('updated-message');
    176                     setTimeout(function() {
    177                         jQuery('#ccbpress-purge-transient-cache-button')
    178                             .text(button_text)
    179                             .removeClass('updated-message')
    180                             .attr('disabled', false);
    181                     }, 3000);
    182                 } else {
    183                     jQuery('#ccbpress-purge-transient-cache-button')
    184                         .text(button_text)
    185                         .removeClass('updated-message')
    186                         .attr('disabled', false);
    187                     alert('There was an error purging the transient cache.');
    188                 }
    189             })
    190             .catch(err => {
    191                 jQuery('#ccbpress-purge-transient-cache-button')
    192                     .text(button_text)
    193                     .removeClass('updated-message')
    194                     .attr('disabled', false);
    195                 alert('There was an error purging the transient cache.');
    196             });
    197     });
    198 });
     1document.addEventListener(
     2  "DOMContentLoaded",
     3  function () {
     4    if (document.querySelector(".ccbpress-required-services.button")) {
     5      document
     6        .querySelector(".ccbpress-required-services.button")
     7        .addEventListener("click", function () {
     8          document.querySelector("button#contextual-help-link").click();
     9          return false;
     10        });
     11    }
     12
     13    if (document.querySelector(".ccbpress-cron-help")) {
     14      document
     15        .querySelector(".ccbpress-cron-help")
     16        .addEventListener("click", function () {
     17          document.querySelector("button#contextual-help-link").click();
     18          document.querySelector("#tab-link-ccbpress-cron > a").click();
     19          return false;
     20        });
     21    }
     22
     23    if (document.querySelector("#ccbpress-ccb-service-check-button")) {
     24      document
     25        .querySelector("#ccbpress-ccb-service-check-button")
     26        .addEventListener("click", function () {
     27          var button = document.getElementById(
     28            "ccbpress-ccb-service-check-button"
     29          );
     30          var button_text = button.textContent || button.innerText;
     31
     32          button.innerText = ccbpress_vars.messages.running;
     33          button.setAttribute("disabled", true);
     34          button.classList.add("updating-message");
     35
     36          fetch(
     37            ccbpress_vars.api_url + "ccbpress/v1/admin/check_api_services",
     38            {
     39              method: "POST",
     40              headers: {
     41                Accept: "application/json",
     42                "Content-Type": "application/json",
     43              },
     44              body: JSON.stringify({
     45                _wpnonce: ccbpress_vars.api_nonce,
     46              }),
     47            }
     48          )
     49            .then((response) => response.json())
     50            .then((data) => {
     51              if (Array.isArray(data)) {
     52                let table = document.createElement("table");
     53                table.className += "wp-list-table widefat fixed striped";
     54                table.style.margin = "15px 0 0 0";
     55                let header = table.createTHead();
     56                let row = header.insertRow();
     57                let th = document.createElement("th");
     58                th.innerText = "API Service";
     59                th.style.padding = "8px 10px";
     60                row.appendChild(th);
     61                th = document.createElement("th");
     62                th.innerText = "Status";
     63                th.style.padding = "8px 10px";
     64                row.appendChild(th);
     65                data.forEach((item) => {
     66                  let row = table.insertRow();
     67                  let cell = row.insertCell();
     68                  cell.innerText = item.service;
     69                  cell = row.insertCell();
     70                  if ("Passed" === item.status) {
     71                    cell.innerHTML =
     72                      '<div class="dashicons dashicons-yes"></div> ' +
     73                      item.status;
     74                  } else {
     75                    cell.innerHTML =
     76                      '<div class="dashicons dashicons-no"></div> ' +
     77                      item.status;
     78                  }
     79                });
     80                document.querySelector(
     81                  "#ccbpress-ccb-service-check-results"
     82                ).innerHTML = "";
     83                document
     84                  .querySelector("#ccbpress-ccb-service-check-results")
     85                  .appendChild(table);
     86                button.innerText = ccbpress_vars.messages.done;
     87                button.classList.remove("updating-message");
     88                button.classList.add("updated-message");
     89
     90                setTimeout(function () {
     91                  button.innerText = button_text;
     92                  button.classList.remove("updated-message");
     93                  button.removeAttribute("disabled");
     94                }, 3000);
     95              }
     96            });
     97          return false;
     98        });
     99    }
     100
     101    document.addEventListener("widget-updated widget-added", function () {
     102      if (
     103        document.querySelector("#widgets-right .ccbpress-select select") &&
     104        document.querySelector("#widgets-right .ccbpress-select select").dataset
     105          .chosen
     106      ) {
     107        document
     108          .querySelector("#widgets-right .ccbpress-select select")
     109          .chosen({
     110            width: "100%",
     111            disable_search_threshold: 10,
     112          });
     113      }
     114    });
     115
     116    if (
     117      document.querySelector("#widgets-right .ccbpress-select select") &&
     118      document.querySelector("#widgets-right .ccbpress-select select").dataset
     119        .chosen
     120    ) {
     121      document.querySelector("#widgets-right .ccbpress-select select").chosen({
     122        width: "100%",
     123        disable_search_threshold: 10,
     124      });
     125    }
     126
     127    if (document.querySelector("#ccbpress-purge-image-cache-button")) {
     128      document
     129        .querySelector("#ccbpress-purge-image-cache-button")
     130        .addEventListener("click", function () {
     131          var button = document.getElementById(
     132            "ccbpress-purge-image-cache-button"
     133          );
     134          var button_text = button.textContent || button.innerText;
     135
     136          button.innerText = ccbpress_vars.messages.running;
     137          button.setAttribute("disabled", true);
     138          button.classList.add("updating-message");
     139
     140          fetch(ccbpress_vars.api_url + "ccbpress/v1/admin/purge_image_cache", {
     141            method: "POST",
     142            headers: {
     143              Accept: "application/json",
     144              "Content-Type": "application/json",
     145            },
     146            body: JSON.stringify({
     147              _wpnonce: ccbpress_vars.api_nonce,
     148            }),
     149          })
     150            .then((response) => response.json())
     151            .then((data) => {
     152              if (
     153                typeof data.result !== "undefined" &&
     154                "success" === data.result
     155              ) {
     156                button.innerText = ccbpress_vars.messages.done;
     157                button.classList.remove("updating-message");
     158                button.classList.add("updated-message");
     159                setTimeout(function () {
     160                  button.innerText = button_text;
     161                  button.classList.remove("updated-message");
     162                  button.removeAttribute("disabled");
     163                }, 3000);
     164              } else {
     165                button.innerText = button_text;
     166                button.classList.remove("updated-message");
     167                button.removeAttribute("disabled");
     168                alert("There was an error purging the image cache.");
     169              }
     170            })
     171            .catch((err) => {
     172              button.innerText = button_text;
     173              button.classList.remove("updated-message");
     174              button.removeAttribute("disabled");
     175              alert("There was an error purging the image cache.");
     176            });
     177        });
     178    }
     179
     180    if (document.querySelector("#ccbpress-purge-transient-cache-button")) {
     181      document
     182        .querySelector("#ccbpress-purge-transient-cache-button")
     183        .addEventListener("click", function () {
     184          var button = document.getElementById(
     185            "ccbpress-purge-transient-cache-button"
     186          );
     187          var button_text = button.textContent || button.innerText;
     188
     189          button.innerText = ccbpress_vars.messages.running;
     190          button.setAttribute("disabled", true);
     191          button.classList.add("updating-message");
     192
     193          fetch(
     194            ccbpress_vars.api_url + "ccbpress/v1/admin/purge_transient_cache",
     195            {
     196              method: "POST",
     197              headers: {
     198                Accept: "application/json",
     199                "Content-Type": "application/json",
     200              },
     201              body: JSON.stringify({
     202                _wpnonce: ccbpress_vars.api_nonce,
     203              }),
     204            }
     205          )
     206            .then((response) => response.json())
     207            .then((data) => {
     208              if (
     209                typeof data.result !== "undefined" &&
     210                "success" === data.result
     211              ) {
     212                button.innerText = ccbpress_vars.messages.done;
     213                button.classList.remove("updating-message");
     214                button.classList.add("updated-message");
     215                setTimeout(function () {
     216                  button.innerText = button_text;
     217                  button.classList.remove("updated-message");
     218                  button.removeAttribute("disabled");
     219                }, 3000);
     220              } else {
     221                button.innerText = button_text;
     222                button.classList.remove("updated-message");
     223                button.removeAttribute("disabled");
     224                alert("There was an error purging the transient cache.");
     225              }
     226            })
     227            .catch((err) => {
     228              button.innerText = button_text;
     229              button.classList.remove("updated-message");
     230              button.removeAttribute("disabled");
     231              alert("There was an error purging the transient cache.");
     232            });
     233        });
     234    }
     235  },
     236  false
     237);
  • ccbpress-core/tags/1.4.4/ccbpress-core.php

    r2566071 r2686881  
    44 * Plugin URI: https://churchdataconnect.com/
    55 * Description: Display information from Church Community Builder on your WordPress site.
    6  * Version: 1.4.3
     6 * Version: 1.4.4
    77 * Author: FireTree Design, LLC <info@firetreedesign.com>
    88 * Author URI: https://firetreedesign.com/
     
    6767         * @since 1.0.0
    6868         */
    69         public $version = '1.4.3';
     69        public $version = '1.4.4';
    7070
    7171        /**
  • ccbpress-core/tags/1.4.4/includes/class-ccbpress-connection.php

    r2327041 r2686881  
    353353            return true;
    354354        }
     355
     356        if ( isset( $ccbpress_rate_limits[ $srv ]['limit'] ) && isset( $ccbpress_rate_limits[ $srv ]['remaining'] ) ) {
     357            $limit = $ccbpress_rate_limits[ $srv ]['limit'];
     358            $remaining = $ccbpress_rate_limits[ $srv ]['remaining'];
     359            if ($remaining >= ($limit / 2)) {
     360                return true;
     361            }
     362        }
    355363       
    356364        if ( isset( $ccbpress_rate_limits[ $srv ]['reset'] ) ) {
  • ccbpress-core/tags/1.4.4/package.json

    r2566071 r2686881  
    11{
    22  "name": "ccbpress-core",
    3   "version": "1.4.3",
     3  "version": "1.4.4",
    44  "private": true,
    55  "scripts": {
  • ccbpress-core/tags/1.4.4/readme.txt

    r2566071 r2686881  
    33Tags: church, ccb, church community builder, chms, gutenberg
    44Requires at least: 4.3
    5 Tested up to: 5.8
     5Tested up to: 5.9
    66Requires PHP: 5.3
    7 Stable tag: 1.4.3
     7Stable tag: 1.4.4
    88License: GPLv2 or later
    99License URI: http://ww.gnu.org/licenses/gpl-2.0.html
     
    4646== Changelog ==
    4747
     48= 1.4.4 =
     49* Changes to the rate limit formula for retrieving data from Church Community Builder.
     50* Removed some deprecated JavaScript code.
     51
    4852= 1.4.3 =
    4953* Added compatibility with WordPress 5.8.
  • ccbpress-core/trunk/assets/js/admin/admin.js

    r2033621 r2686881  
    1 jQuery(document).ready(function($) {
    2     jQuery('.ccbpress-required-services.button').click(function() {
    3         jQuery('button#contextual-help-link').trigger('click');
    4         return false;
    5     });
    6 
    7     jQuery('.ccbpress-cron-help').click(function() {
    8         jQuery('button#contextual-help-link').trigger('click');
    9         jQuery('#tab-link-ccbpress-cron > a').trigger('click');
    10         return false;
    11     });
    12 
    13     jQuery('#ccbpress-ccb-service-check-button').click(function() {
    14         var button = document.getElementById('ccbpress-ccb-service-check-button');
    15         var button_text = button.textContent || button.innerText;
    16 
    17         jQuery('#ccbpress-ccb-service-check-button')
    18             .text(ccbpress_vars.messages.running)
    19             .attr('disabled', true)
    20             .addClass('updating-message');
    21 
    22         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/check_api_services', {
    23             method: 'POST',
    24             headers: {
    25                 Accept: 'application/json',
    26                 'Content-Type': 'application/json',
    27             },
    28             body: JSON.stringify({
    29                 _wpnonce: ccbpress_vars.api_nonce,
    30             }),
    31         })
    32             .then(response => response.json())
    33             .then(data => {
    34                 if (Array.isArray(data)) {
    35                     let table = document.createElement('table');
    36                     table.className += 'wp-list-table widefat fixed striped';
    37                     table.style.margin = '15px 0 0 0';
    38                     let header = table.createTHead();
    39                     let row = header.insertRow();
    40                     let th = document.createElement('th');
    41                     th.innerText = 'API Service';
    42                     th.style.padding = '8px 10px';
    43                     row.appendChild(th);
    44                     th = document.createElement('th');
    45                     th.innerText = 'Status';
    46                     th.style.padding = '8px 10px';
    47                     row.appendChild(th);
    48                     data.forEach(item => {
    49                         let row = table.insertRow();
    50                         let cell = row.insertCell();
    51                         cell.innerText = item.service;
    52                         cell = row.insertCell();
    53                         if ('Passed' === item.status) {
    54                             cell.innerHTML =
    55                                 '<div class="dashicons dashicons-yes"></div> ' + item.status;
    56                         } else {
    57                             cell.innerHTML =
    58                                 '<div class="dashicons dashicons-no"></div> ' + item.status;
    59                         }
    60                     });
    61                     jQuery('#ccbpress-ccb-service-check-results').html(table);
    62                     jQuery('#ccbpress-ccb-service-check-button')
    63                         .text(ccbpress_vars.messages.done)
    64                         .removeClass('updating-message')
    65                         .addClass('updated-message');
    66                     setTimeout(function() {
    67                         jQuery('#ccbpress-ccb-service-check-button')
    68                             .text(button_text)
    69                             .removeClass('updated-message')
    70                             .attr('disabled', false);
    71                     }, 3000);
    72                 }
    73             });
    74         return false;
    75     });
    76 
    77     jQuery(document).on('widget-updated widget-added', function() {
    78         if (
    79             typeof jQuery('#widgets-right .ccbpress-select select').chosen ===
    80             'function'
    81         ) {
    82             jQuery('#widgets-right .ccbpress-select select').chosen({
    83                 width: '100%',
    84                 disable_search_threshold: 10,
    85             });
    86         }
    87     });
    88 
    89     if (
    90         typeof jQuery('#widgets-right .ccbpress-select select').chosen ===
    91         'function'
    92     ) {
    93         jQuery('#widgets-right .ccbpress-select select').chosen({
    94             width: '100%',
    95             disable_search_threshold: 10,
    96         });
    97     }
    98 
    99     jQuery('#ccbpress-purge-image-cache-button').click(function() {
    100         var button = document.getElementById('ccbpress-purge-image-cache-button');
    101         var button_text = button.textContent || button.innerText;
    102 
    103         jQuery('#ccbpress-purge-image-cache-button')
    104             .text(ccbpress_vars.messages.running)
    105             .attr('disabled', true)
    106             .addClass('updating-message');
    107 
    108         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/purge_image_cache', {
    109             method: 'POST',
    110             headers: {
    111                 Accept: 'application/json',
    112                 'Content-Type': 'application/json',
    113             },
    114             body: JSON.stringify({
    115                 _wpnonce: ccbpress_vars.api_nonce,
    116             }),
    117         })
    118             .then(response => response.json())
    119             .then(data => {
    120                 if (typeof data.result !== 'undefined' && 'success' === data.result) {
    121                     jQuery('#ccbpress-purge-image-cache-button')
    122                         .text(ccbpress_vars.messages.done)
    123                         .removeClass('updating-message')
    124                         .addClass('updated-message');
    125                     setTimeout(function() {
    126                         jQuery('#ccbpress-purge-image-cache-button')
    127                             .text(button_text)
    128                             .removeClass('updated-message')
    129                             .attr('disabled', false);
    130                     }, 3000);
    131                 } else {
    132                     jQuery('#ccbpress-purge-image-cache-button')
    133                         .text(button_text)
    134                         .removeClass('updated-message')
    135                         .attr('disabled', false);
    136                     alert('There was an error purging the image cache.');
    137                 }
    138             })
    139             .catch(err => {
    140                 jQuery('#ccbpress-purge-image-cache-button')
    141                     .text(button_text)
    142                     .removeClass('updated-message')
    143                     .attr('disabled', false);
    144                 alert('There was an error purging the image cache.');
    145             });
    146     });
    147 
    148     jQuery('#ccbpress-purge-transient-cache-button').click(function() {
    149         var button = document.getElementById(
    150             'ccbpress-purge-transient-cache-button',
    151         );
    152         var button_text = button.textContent || button.innerText;
    153 
    154         jQuery('#ccbpress-purge-transient-cache-button')
    155             .text(ccbpress_vars.messages.running)
    156             .attr('disabled', true)
    157             .addClass('updating-message');
    158 
    159         fetch(ccbpress_vars.api_url + 'ccbpress/v1/admin/purge_transient_cache', {
    160             method: 'POST',
    161             headers: {
    162                 Accept: 'application/json',
    163                 'Content-Type': 'application/json',
    164             },
    165             body: JSON.stringify({
    166                 _wpnonce: ccbpress_vars.api_nonce,
    167             }),
    168         })
    169             .then(response => response.json())
    170             .then(data => {
    171                 if (typeof data.result !== 'undefined' && 'success' === data.result) {
    172                     jQuery('#ccbpress-purge-transient-cache-button')
    173                         .text(ccbpress_vars.messages.done)
    174                         .removeClass('updating-message')
    175                         .addClass('updated-message');
    176                     setTimeout(function() {
    177                         jQuery('#ccbpress-purge-transient-cache-button')
    178                             .text(button_text)
    179                             .removeClass('updated-message')
    180                             .attr('disabled', false);
    181                     }, 3000);
    182                 } else {
    183                     jQuery('#ccbpress-purge-transient-cache-button')
    184                         .text(button_text)
    185                         .removeClass('updated-message')
    186                         .attr('disabled', false);
    187                     alert('There was an error purging the transient cache.');
    188                 }
    189             })
    190             .catch(err => {
    191                 jQuery('#ccbpress-purge-transient-cache-button')
    192                     .text(button_text)
    193                     .removeClass('updated-message')
    194                     .attr('disabled', false);
    195                 alert('There was an error purging the transient cache.');
    196             });
    197     });
    198 });
     1document.addEventListener(
     2  "DOMContentLoaded",
     3  function () {
     4    if (document.querySelector(".ccbpress-required-services.button")) {
     5      document
     6        .querySelector(".ccbpress-required-services.button")
     7        .addEventListener("click", function () {
     8          document.querySelector("button#contextual-help-link").click();
     9          return false;
     10        });
     11    }
     12
     13    if (document.querySelector(".ccbpress-cron-help")) {
     14      document
     15        .querySelector(".ccbpress-cron-help")
     16        .addEventListener("click", function () {
     17          document.querySelector("button#contextual-help-link").click();
     18          document.querySelector("#tab-link-ccbpress-cron > a").click();
     19          return false;
     20        });
     21    }
     22
     23    if (document.querySelector("#ccbpress-ccb-service-check-button")) {
     24      document
     25        .querySelector("#ccbpress-ccb-service-check-button")
     26        .addEventListener("click", function () {
     27          var button = document.getElementById(
     28            "ccbpress-ccb-service-check-button"
     29          );
     30          var button_text = button.textContent || button.innerText;
     31
     32          button.innerText = ccbpress_vars.messages.running;
     33          button.setAttribute("disabled", true);
     34          button.classList.add("updating-message");
     35
     36          fetch(
     37            ccbpress_vars.api_url + "ccbpress/v1/admin/check_api_services",
     38            {
     39              method: "POST",
     40              headers: {
     41                Accept: "application/json",
     42                "Content-Type": "application/json",
     43              },
     44              body: JSON.stringify({
     45                _wpnonce: ccbpress_vars.api_nonce,
     46              }),
     47            }
     48          )
     49            .then((response) => response.json())
     50            .then((data) => {
     51              if (Array.isArray(data)) {
     52                let table = document.createElement("table");
     53                table.className += "wp-list-table widefat fixed striped";
     54                table.style.margin = "15px 0 0 0";
     55                let header = table.createTHead();
     56                let row = header.insertRow();
     57                let th = document.createElement("th");
     58                th.innerText = "API Service";
     59                th.style.padding = "8px 10px";
     60                row.appendChild(th);
     61                th = document.createElement("th");
     62                th.innerText = "Status";
     63                th.style.padding = "8px 10px";
     64                row.appendChild(th);
     65                data.forEach((item) => {
     66                  let row = table.insertRow();
     67                  let cell = row.insertCell();
     68                  cell.innerText = item.service;
     69                  cell = row.insertCell();
     70                  if ("Passed" === item.status) {
     71                    cell.innerHTML =
     72                      '<div class="dashicons dashicons-yes"></div> ' +
     73                      item.status;
     74                  } else {
     75                    cell.innerHTML =
     76                      '<div class="dashicons dashicons-no"></div> ' +
     77                      item.status;
     78                  }
     79                });
     80                document.querySelector(
     81                  "#ccbpress-ccb-service-check-results"
     82                ).innerHTML = "";
     83                document
     84                  .querySelector("#ccbpress-ccb-service-check-results")
     85                  .appendChild(table);
     86                button.innerText = ccbpress_vars.messages.done;
     87                button.classList.remove("updating-message");
     88                button.classList.add("updated-message");
     89
     90                setTimeout(function () {
     91                  button.innerText = button_text;
     92                  button.classList.remove("updated-message");
     93                  button.removeAttribute("disabled");
     94                }, 3000);
     95              }
     96            });
     97          return false;
     98        });
     99    }
     100
     101    document.addEventListener("widget-updated widget-added", function () {
     102      if (
     103        document.querySelector("#widgets-right .ccbpress-select select") &&
     104        document.querySelector("#widgets-right .ccbpress-select select").dataset
     105          .chosen
     106      ) {
     107        document
     108          .querySelector("#widgets-right .ccbpress-select select")
     109          .chosen({
     110            width: "100%",
     111            disable_search_threshold: 10,
     112          });
     113      }
     114    });
     115
     116    if (
     117      document.querySelector("#widgets-right .ccbpress-select select") &&
     118      document.querySelector("#widgets-right .ccbpress-select select").dataset
     119        .chosen
     120    ) {
     121      document.querySelector("#widgets-right .ccbpress-select select").chosen({
     122        width: "100%",
     123        disable_search_threshold: 10,
     124      });
     125    }
     126
     127    if (document.querySelector("#ccbpress-purge-image-cache-button")) {
     128      document
     129        .querySelector("#ccbpress-purge-image-cache-button")
     130        .addEventListener("click", function () {
     131          var button = document.getElementById(
     132            "ccbpress-purge-image-cache-button"
     133          );
     134          var button_text = button.textContent || button.innerText;
     135
     136          button.innerText = ccbpress_vars.messages.running;
     137          button.setAttribute("disabled", true);
     138          button.classList.add("updating-message");
     139
     140          fetch(ccbpress_vars.api_url + "ccbpress/v1/admin/purge_image_cache", {
     141            method: "POST",
     142            headers: {
     143              Accept: "application/json",
     144              "Content-Type": "application/json",
     145            },
     146            body: JSON.stringify({
     147              _wpnonce: ccbpress_vars.api_nonce,
     148            }),
     149          })
     150            .then((response) => response.json())
     151            .then((data) => {
     152              if (
     153                typeof data.result !== "undefined" &&
     154                "success" === data.result
     155              ) {
     156                button.innerText = ccbpress_vars.messages.done;
     157                button.classList.remove("updating-message");
     158                button.classList.add("updated-message");
     159                setTimeout(function () {
     160                  button.innerText = button_text;
     161                  button.classList.remove("updated-message");
     162                  button.removeAttribute("disabled");
     163                }, 3000);
     164              } else {
     165                button.innerText = button_text;
     166                button.classList.remove("updated-message");
     167                button.removeAttribute("disabled");
     168                alert("There was an error purging the image cache.");
     169              }
     170            })
     171            .catch((err) => {
     172              button.innerText = button_text;
     173              button.classList.remove("updated-message");
     174              button.removeAttribute("disabled");
     175              alert("There was an error purging the image cache.");
     176            });
     177        });
     178    }
     179
     180    if (document.querySelector("#ccbpress-purge-transient-cache-button")) {
     181      document
     182        .querySelector("#ccbpress-purge-transient-cache-button")
     183        .addEventListener("click", function () {
     184          var button = document.getElementById(
     185            "ccbpress-purge-transient-cache-button"
     186          );
     187          var button_text = button.textContent || button.innerText;
     188
     189          button.innerText = ccbpress_vars.messages.running;
     190          button.setAttribute("disabled", true);
     191          button.classList.add("updating-message");
     192
     193          fetch(
     194            ccbpress_vars.api_url + "ccbpress/v1/admin/purge_transient_cache",
     195            {
     196              method: "POST",
     197              headers: {
     198                Accept: "application/json",
     199                "Content-Type": "application/json",
     200              },
     201              body: JSON.stringify({
     202                _wpnonce: ccbpress_vars.api_nonce,
     203              }),
     204            }
     205          )
     206            .then((response) => response.json())
     207            .then((data) => {
     208              if (
     209                typeof data.result !== "undefined" &&
     210                "success" === data.result
     211              ) {
     212                button.innerText = ccbpress_vars.messages.done;
     213                button.classList.remove("updating-message");
     214                button.classList.add("updated-message");
     215                setTimeout(function () {
     216                  button.innerText = button_text;
     217                  button.classList.remove("updated-message");
     218                  button.removeAttribute("disabled");
     219                }, 3000);
     220              } else {
     221                button.innerText = button_text;
     222                button.classList.remove("updated-message");
     223                button.removeAttribute("disabled");
     224                alert("There was an error purging the transient cache.");
     225              }
     226            })
     227            .catch((err) => {
     228              button.innerText = button_text;
     229              button.classList.remove("updated-message");
     230              button.removeAttribute("disabled");
     231              alert("There was an error purging the transient cache.");
     232            });
     233        });
     234    }
     235  },
     236  false
     237);
  • ccbpress-core/trunk/ccbpress-core.php

    r2566071 r2686881  
    44 * Plugin URI: https://churchdataconnect.com/
    55 * Description: Display information from Church Community Builder on your WordPress site.
    6  * Version: 1.4.3
     6 * Version: 1.4.4
    77 * Author: FireTree Design, LLC <info@firetreedesign.com>
    88 * Author URI: https://firetreedesign.com/
     
    6767         * @since 1.0.0
    6868         */
    69         public $version = '1.4.3';
     69        public $version = '1.4.4';
    7070
    7171        /**
  • ccbpress-core/trunk/includes/class-ccbpress-connection.php

    r2327041 r2686881  
    353353            return true;
    354354        }
     355
     356        if ( isset( $ccbpress_rate_limits[ $srv ]['limit'] ) && isset( $ccbpress_rate_limits[ $srv ]['remaining'] ) ) {
     357            $limit = $ccbpress_rate_limits[ $srv ]['limit'];
     358            $remaining = $ccbpress_rate_limits[ $srv ]['remaining'];
     359            if ($remaining >= ($limit / 2)) {
     360                return true;
     361            }
     362        }
    355363       
    356364        if ( isset( $ccbpress_rate_limits[ $srv ]['reset'] ) ) {
  • ccbpress-core/trunk/package.json

    r2566071 r2686881  
    11{
    22  "name": "ccbpress-core",
    3   "version": "1.4.3",
     3  "version": "1.4.4",
    44  "private": true,
    55  "scripts": {
  • ccbpress-core/trunk/readme.txt

    r2566071 r2686881  
    33Tags: church, ccb, church community builder, chms, gutenberg
    44Requires at least: 4.3
    5 Tested up to: 5.8
     5Tested up to: 5.9
    66Requires PHP: 5.3
    7 Stable tag: 1.4.3
     7Stable tag: 1.4.4
    88License: GPLv2 or later
    99License URI: http://ww.gnu.org/licenses/gpl-2.0.html
     
    4646== Changelog ==
    4747
     48= 1.4.4 =
     49* Changes to the rate limit formula for retrieving data from Church Community Builder.
     50* Removed some deprecated JavaScript code.
     51
    4852= 1.4.3 =
    4953* Added compatibility with WordPress 5.8.
Note: See TracChangeset for help on using the changeset viewer.