Changeset 2370598
- Timestamp:
- 08/27/2020 08:21:12 PM (5 years ago)
- Location:
- wp-action-network/trunk
- Files:
-
- 4 edited
-
actionnetwork.php (modified) (14 diffs)
-
includes/actionnetwork-sync.class.php (modified) (2 diffs)
-
includes/actionnetwork-widgets.class.php (modified) (7 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-action-network/trunk/actionnetwork.php
r2100004 r2370598 2 2 /* 3 3 * @package ActionNetwork 4 * @version 1. 1.34 * @version 1.2 5 5 * 6 6 * Plugin Name: Action Network … … 9 9 * Text Domain: actionnetwork 10 10 * Domain Path: /languages 11 * Version: 1. 1.311 * Version: 1.2 12 12 * License: GPLv3 13 13 * Author URI: http://concertedaction.consulting … … 34 34 */ 35 35 global $actionnetwork_version; 36 $actionnetwork_version = '1. 1.3';36 $actionnetwork_version = '1.2'; 37 37 global $actionnetwork_db_version; 38 38 $actionnetwork_db_version = '1.0.7'; … … 50 50 51 51 if ($installed_version != $actionnetwork_version) { 52 53 // test for particular updates here 54 if ($actionnetwork_version == '1.2') { 55 $notices[] = sprintf( 56 /* translators: %s is a link to https://wordpress.org/plugins/wp-action-network/ */ 57 __('The %s has been updated to version 1.2. This major update includes the following updates: - hCaptcha ability added for API based forms. - Bug fixes related too multiple embeds on a single page, and the API sync. - shortcode button for tinymce WYSIWYG. - additional documentation on setting page. Backing up site before upgrading is recommended.', 'actionnetwork'), 58 '<a href="https://wordpress.org/plugins/wp-action-network/">Action Network plugin</a>' 59 ); 60 } 61 52 62 53 63 // test for particular updates here … … 716 726 717 727 switch ($_REQUEST['actionnetwork_admin_action']) { 728 729 case 'update_spam_keys': 730 update_option('actionnetwork_hcaptcha_site_key', $_REQUEST['actionnetwork_hcaptcha_site_key']); 731 update_option('actionnetwork_hcaptcha_secret_key', $_REQUEST['actionnetwork_hcaptcha_secret_key']); 732 break; 718 733 719 734 case 'update_api_key': … … 731 746 $debug .= "get_option did not match actionnetwork_api_key\n"; 732 747 748 echo "---\n"; 733 749 // don't allow API Key to be changed if a sync queue is processing 734 750 if ($queue_status != 'empty') { … … 764 780 765 781 $debug .= $actionnetwork_api_key_is_valid ? "actionnetwork_api_key is valid\n" : "actionnetwork_api_key is not valid\n"; 766 782 //echo "---\n"; 783 767 784 if ($actionnetwork_api_key_is_valid) { 768 785 … … 775 792 // initiate a background process by making a call to the "ajax" URL 776 793 $ajax_url = admin_url( 'admin-ajax.php' ); 777 794 //$ajax_url = get_site_url(). '/wp-admin/admin-ajax.php'; 795 778 796 // since we're making this call from the server, we can't use a nonce 779 797 // because the user id would be different. so create a token … … 783 801 update_option( 'actionnetwork_ajax_token', $token ); 784 802 785 $body = array(803 /*$body = array( 786 804 'action' => 'actionnetwork_process_queue', 787 805 'queue_action' => 'init', 788 806 'token' => $token, 789 807 ); 790 $args = array( 'body' => $body, 'timeout' => 1 ); 791 wp_remote_post( $ajax_url, $args ); 792 808 $args = array( 'body' => $body, 'timeout' => 30 ); 809 //echo "POST RESPONSE:\n"; 810 $response = wp_remote_post( $ajax_url, $args ); 811 //print_r($response);*/ 812 813 $_REQUEST['action'] = 'actionnetwork_process_queue'; 814 $_REQUEST['queue_action'] = 'init'; 815 $_REQUEST['token'] = $token; 816 actionnetwork_process_queue(); 817 793 818 $queue_status = 'processing'; 794 819 $return['queue_status'] = $queue_status; … … 806 831 } 807 832 } 833 //echo $debug. "\n"; 834 808 835 break; 809 836 … … 1250 1277 // get API Key 1251 1278 $actionnetwork_api_key = get_option('actionnetwork_api_key'); 1279 1280 // get hCaptcha keys 1281 $hcaptcha_site_key = get_option('actionnetwork_hcaptcha_site_key'); 1282 $hcaptcha_secret_key = get_option('actionnetwork_hcaptcha_secret_key'); 1252 1283 1253 1284 // get queue status - allow action_returns to override the option because … … 1319 1350 <a href="#actionnetwork-settings" class="nav-tab<?php echo ($tab == 'settings') ? ' nav-tab-active' : ''; ?>"> 1320 1351 <?php _e('Settings', 'actionnetwork'); ?> 1352 </a> 1353 1354 <a href="#actionnetwork-about" class="nav-tab<?php echo ($tab == 'about') ? ' nav-tab-active' : ''; ?>"> 1355 <?php _e('About', 'actionnetwork'); ?> 1321 1356 </a> 1322 1357 </h2> … … 1447 1482 <p class="submit"><input type="submit" id="actionnetwork-options-form-submit" class="button-primary" value="<?php _e('Save Settings', 'actionnetwork'); ?>" /></p> 1448 1483 </form> 1484 <h2><?php _e('Plugin Captcha Settings', 'actionnetwork'); ?></h2> 1485 <p>In order to be able to activate anti-spam challenges you have to fill up the forms bellow. In order to get the keys all you have to do is create 1486 an account on <a href="https://hcaptcha.com" target="_blank">hcaptcha.com</a>.</p> 1487 <form method="post" action=""> 1488 <?php 1489 wp_nonce_field( 'actionnetwork_update_spam_keys', 'actionnetwork_nonce_field' ); 1490 ?> 1491 <input type="hidden" name="actionnetwork_admin_action" value="update_spam_keys" /> 1492 <input type="hidden" name="actionnetwork_tab" value="settings" /> 1493 1494 <table class="form-table"><tbody> 1495 <tr valign="top"> 1496 <th scope="row"><label for="actionnetwork_hcaptcha_site_key"><?php _e('hCaptcha Site Key', 'actionnetwork'); ?></label></th> 1497 <td> 1498 <input id="actionnetwork_hcaptcha_site_key" style="min-width: 400px" name="actionnetwork_hcaptcha_site_key" type="text" value="<?php esc_attr_e($hcaptcha_site_key); ?>" /> 1499 </td> 1500 </tr> 1501 <tr valign="top"> 1502 <th scope="row"><label for="actionnetwork_hcaptcha_secret_key"><?php _e('hCaptcha Secret Key', 'actionnetwork'); ?></label></th> 1503 <td> 1504 <input id="actionnetwork_hcaptcha_secret_key" style="min-width: 400px" name="actionnetwork_hcaptcha_secret_key" type="text" value="<?php esc_attr_e($hcaptcha_secret_key); ?>" /> 1505 </td> 1506 </tr> 1507 </tbody></table> 1508 <p class="submit"><input type="submit" id="actionnetwork-options-form-submit" class="button-primary" value="<?php _e('Save Settings', 'actionnetwork'); ?>" /></p> 1509 </form> 1449 1510 </div> 1450 1511 1512 <?php /* options about */ ?> 1513 <div class="actionnetwork-admin-tab<?php echo ($tab == 'about') ? ' actionnetwork-admin-tab-active' : ''; ?>" id="actionnetwork-about"> 1514 <h2><?php _e('About the Plugin', 'actionnetwork'); ?></h2> 1515 <style type="text/css"> 1516 #can-form-area-wordpress-plugin-users-list h2 {text-align: center; border-bottom: none !important;} 1517 #can-form-area-wordpress-plugin-users-list h4, #can-form-area-wordpress-plugin-users-list #action_info, #can-form-area-wordpress-plugin-users-list #d_sharing {display: none !important;} 1518 </style> 1519 <div style="width: 64%; float: left;"><p>This plugin is maintained by <a href="https://concertedaction.consulting/" target="_blank">Concerted Action</a> a one-stop consulting firm specializing in advocacy, organizing and the digital tools that power grassroots movements.</p> 1520 1521 <p>Learn more about us on our <a href="https://concertedaction.consulting/" target="_blank">website</a>, <a href="https://www.facebook.com/concertedaction" target="_blank">Facebook</a>, <a href="https://twitter.com/ConcertedAct" target="_blank">Twitter</a> or <a href="https://www.linkedin.com/company/concertedaction" target="_blank">LinkedIn</a>.</p> 1522 <p>Sign up using the form to stay informed about future updates to the Action Network WordPress plugin, and have opportunities to provide feedback and make suggestions about the plugin's development roadmap.</p> 1523 1524 </div> 1525 1526 <div style="width: 35%; float: right;"> 1527 1528 <link href='https://actionnetwork.org/css/style-embed-whitelabel-v3.css' rel='stylesheet' type='text/css' /><script src='https://actionnetwork.org/widgets/v3/form/wordpress-plugin-users-list?format=js&source=widget'></script><div id='can-form-area-wordpress-plugin-users-list' style='width: 100%'><!-- this div is the target for our HTML insertion --></div> 1529 </div> 1530 </div> 1451 1531 </div> <!-- /.wrap-inner --> 1452 1532 … … 1592 1672 } 1593 1673 1674 // hooks your functions into the correct filters 1675 function wdm_add_mce_button() { 1676 1677 global $wpdb; 1678 1679 // check user permissions 1680 if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) { 1681 return; 1682 } 1683 1684 global $wpdb; 1685 1686 $results = $wpdb->get_results ( "SELECT * FROM {$wpdb->prefix}actionnetwork WHERE enabled = '1'" ); 1687 $results_array = array(); 1688 $results_count = count( $results ); 1689 $result_itr = 0; 1690 1691 if( $results ){ 1692 foreach( $results as $result ){ 1693 $result_itr++; 1694 $results_array[$result_itr] = array( $result->wp_id, $result->title ) ; 1695 } 1696 1697 } 1698 1699 $script_decode = json_encode( $results_array ); 1700 1701 $script = <<<EOF 1702 <script type = 'text/javascript'> 1703 var actionnetwork_shortcode = $script_decode; 1704 </script> 1705 EOF; 1706 echo $script; 1707 1708 // check if WYSIWYG is enabled 1709 if ( 'true' == get_user_option( 'rich_editing' ) ) { 1710 add_filter( 'mce_external_plugins', 'wdm_add_tinymce_plugin', 22, 1 ); 1711 add_filter( 'mce_buttons', 'wdm_register_mce_button' ); 1712 } 1713 } 1714 add_action('admin_head', 'wdm_add_mce_button'); 1715 1716 // register new button in the editor 1717 function wdm_register_mce_button( $buttons ) { 1718 array_push( $buttons, 'wdm_mce_button' ); 1719 return $buttons; 1720 } 1721 1722 1723 // declare a script for the new button 1724 // the script will insert the shortcode on the click event 1725 function wdm_add_tinymce_plugin( $plugin_array ) { 1726 1727 $plugin_array['wdm_mce_button'] = plugin_dir_url( __FILE__ ). 'admin-wsywyg.js'; 1728 return $plugin_array; 1729 1730 } -
wp-action-network/trunk/includes/actionnetwork-sync.class.php
r2032205 r2370598 95 95 96 96 // check process time 97 $time_elapsed = time() - $this->processStartTime;97 /*$time_elapsed = time() - $this->processStartTime; 98 98 if ( $time_elapsed > 20 ) { $start_new_process = true; } 99 99 … … 124 124 wp_die(); 125 125 return; 126 } 126 }*/ 127 127 128 128 // process the next resource -
wp-action-network/trunk/includes/actionnetwork-widgets.class.php
r1793252 r2370598 616 616 617 617 wp_enqueue_style( 'actionnetwork-signup-css', plugins_url('../signup.css', __FILE__) ); 618 618 619 echo $args['before_widget']; 619 620 if (!empty( $instance['title'])) { … … 635 636 'item_element' => 'li', 636 637 'item_class' => 'actionnetwork-signup-item', 638 'spam_protect' => 0, 637 639 ); 638 640 foreach ($defaults as $key => $value) { … … 640 642 } 641 643 extract($instance); 644 645 if($spam_protect){ 646 wp_enqueue_script( 'actionnetwork-hcaptcha', 'https://www.hCaptcha.com/1/api.js' ); 647 $hcaptcha_site_key = get_option('actionnetwork_hcaptcha_site_key'); 648 $hcaptcha_secret_key = get_option('actionnetwork_hcaptcha_secret_key'); 649 } 642 650 643 651 if (isset($submission['message']) && $submission['message']) { … … 694 702 $form .= isset($errors['zip_code']) ? "<label class=\"error\" for=\"{$args['widget_id']}-zip-code\">".$errors['zip_code']."</label>" : ''; 695 703 $form .= "</$item_element>"; 704 705 // hCaptcha 706 if($spam_protect){ 707 $form .= "<$item_element class=\"h-captcha\" data-sitekey=\"$hcaptcha_site_key\"></$item_element>"; 708 } 696 709 697 710 // submit button … … 725 738 // verify 726 739 $submission['errors'] = array(); 727 740 741 // Check for captcha result 742 if($spam_protect){ 743 if(isset($data['g-recaptcha-response']) && !empty($data['g-recaptcha-response'])) { 744 $data = array('secret' => $hcaptcha_secret_key,'response' => $data['g-recaptcha-response']); 745 746 $verify = curl_init(); 747 curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify"); 748 curl_setopt($verify, CURLOPT_POST, true); 749 curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data)); 750 curl_setopt($verify, CURLOPT_RETURNTRANSFER, true); 751 752 $response = curl_exec($verify); 753 $responseData = json_decode($response); 754 755 if(!$responseData->success) { 756 $submission['errors']['captcha'] = __('We could not confirm the captcha. Please try again.','actionnetwork'); 757 } 758 }else{ 759 $submission['message'] = wpautop( __('Please complete the captcha challenge.', 'actionnetwork') ); 760 return $submission; 761 } 762 } 763 764 // Check for required fields 728 765 if (isset($instance['first_name_require']) && $instance['first_name_require'] && !$submission['first_name']) { 729 766 $submission['errors']['first_name'] = __('This field is required','actionnetwork'); … … 883 920 'description' => __( 'If checked, form will be submitted without loading a new page', 'actionnetwork' ), 884 921 ), 922 'spam_protect' => array( 923 'label' => __('Spam protection', 'actionnetwork'), 924 'type' => 'checkbox', 925 'default' => 0, 926 'advanced' => false, 927 'description' => __( 'If checked, a hCaptcha challenge will be added to the form', 'actionnetwork' ), 928 ), 885 929 'thank_you_message' => array( 886 930 'label' => __('Thank you message', 'actionnetwork'), 887 931 'type' => 'textarea', 932 'default' => 'Thank you for signing up!', 888 933 'advanced' => false, 889 934 'description' => __( 'Text to display after successful signup. If left blank, will default to "Thank you for signing up!" <code>wpautop</code> will be applied (adding line breaks). Accepts HTML.', 'actionnetwork' ), … … 954 999 'item_element', 955 1000 'item_class', 1001 'spam_protect', 956 1002 ); 957 1003 foreach ($sanitize_args as $arg) { -
wp-action-network/trunk/readme.txt
r2100487 r2370598 1 1 === Action Network === 2 Contributors: concertedaction , jonathankissam2 Contributors: concertedaction 3 3 Tags: signup, events, action network, online organizing 4 4 Requires at least: 4.6 5 Tested up to: 5. 2.16 Stable tag: 1. 1.35 Tested up to: 5.5 6 Stable tag: 1.2 7 7 License: GPLv3 or later 8 8 License URI: https://www.gnu.org/licenses/gpl.html … … 12 12 == Description == 13 13 14 A free Wordpress plugin for the [Action Network](https://actionnetwork.org) online organizing tools maintained by [Concerted Action](http://concertedaction.consulting/) originally developed by [Jonathan Kissam](http://jonathankissam.com/).14 A free Wordpress plugin for the [Action Network](https://actionnetwork.org) online organizing tools maintained by [Concerted Action](http://concertedaction.consulting/). 15 15 16 16 Features: … … 24 24 * Create signup widgets which allow visitors to your site to sign up for your email list _without_ using Action Network javascript embeds. This allows you to place a signup form on every page (for example in the sidebar), and still load Action Network embed codes for actions on particular pages (since Action Network's scripts will only load one embed code per page). This feature does require the API key, so you have to be an [Action Network Partner](https://actionnetwork.org/partnerships) to use it. 25 25 26 Detailed specs for shortcode attributes, widget options, etc. are available on the Help menu for the Action Network page on the backend , or in [this blog post](https://jonathankissam.wordpress.com/2017/12/27/new-version-of-my-action-network-plugin/)26 Detailed specs for shortcode attributes, widget options, etc. are available on the Help menu for the Action Network page on the backend. 27 27 28 28 == Installation == … … 44 44 == Changelog == 45 45 46 = 1.2 = 47 48 * This major update includes the following updates: 49 * hCaptcha ability added for API based forms. 50 * Bug fixes related too multiple embeds on a single page, and the API sync. 51 * shortcode button for tinymce WYSIWYG. 52 * additional documentation on setting page. 53 46 54 = 1.1.3 = 47 55 48 Updating developer information.56 * Updating developer information. 49 57 50 58 = 1.1.2 = … … 71 79 72 80 = 1.1.0 = 73 New features, including new widgets, shortcodes, and shortcode options, as well as ajax submission of the signup form. [Read more](https://jonathankissam.wordpress.com)81 New features, including new widgets, shortcodes, and shortcode options, as well as ajax submission of the signup form. 74 82 75 83 = 1.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.