Changeset 2486582
- Timestamp:
- 03/04/2021 09:22:41 AM (5 years ago)
- Location:
- convertful/trunk
- Files:
-
- 1 added
- 2 edited
-
convertful.php (modified) (7 diffs)
-
functions/woocommerce.php (added)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
convertful/trunk/convertful.php
r2378652 r2486582 3 3 /** 4 4 * Plugin Name: Convertful - Your Ultimate On-Site Conversion Tool 5 * Version: 2.1 5 * Version: 2.1.1 6 6 * Plugin URI: https://convertful.com/ 7 7 * Description: All the modern on-site conversion solutions, natively integrates with all modern Email Marketing Platforms. 8 8 * Author: Convertful 9 * Author URI: https://convertful.com 9 10 * License: GPLv2 or later 10 11 * License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 36 37 37 38 add_action( 'rest_api_init', function () { 38 39 39 register_rest_route( 'convertful/v2', '/complete_authorization/', [ 40 40 'methods' => 'POST', 41 41 'callback' => 'conv_complete_authorization', 42 'permission_callback' => '__return_true', 42 43 ] ); 43 44 … … 45 46 'methods' => 'POST', 46 47 'callback' => 'conv_get_info', 48 'permission_callback' => '__return_true', 47 49 ] ); 48 50 } ); 49 51 50 /** 51 * Get script id 52 * @return string 53 */ 54 function conv_get_script_id() { 55 global $conv_config; 56 $url = wp_parse_url( $conv_config['host'] ); 57 if ( ! preg_match( '/^(.*?)(convertful|devcf)\.[a-z]{3,5}$/', $url['host'] ) ) { 58 return 'optin-api'; 59 } 60 61 return 'convertful-api'; 62 } 63 64 /** 65 * Get script file name 66 * @return string 67 */ 68 function conv_get_script_filename() { 69 return conv_get_script_id() === 'convertful-api' 70 ? 'Convertful.js' 71 : 'optin.js'; 72 } 73 74 75 function conv_init() { 52 function conv_init() { 53 global $conv_dir; 54 76 55 if ( get_option( 'optinguru_owner_id' ) ) { 77 56 update_option( 'conv_owner_id', get_option( 'optinguru_owner_id' ), TRUE ); … … 92 71 add_filter( 'the_content', 'conv_after_post_content' ); 93 72 } 73 74 if (function_exists( 'woocommerce_get_page_id' )) 75 { 76 require $conv_dir . 'functions/woocommerce.php'; 77 } 78 } 79 /** 80 * Get script id 81 * @return string 82 */ 83 function conv_get_script_id() { 84 global $conv_config; 85 $url = wp_parse_url( $conv_config['host'] ); 86 if ( ! preg_match( '/^(.*?)(convertful|devcf)\.[a-z]{3,5}$/', $url['host'] ) ) { 87 return 'optin-api'; 88 } 89 90 return 'convertful-api'; 91 } 92 93 /** 94 * Get script file name 95 * @return string 96 */ 97 function conv_get_script_filename() { 98 return conv_get_script_id() === 'convertful-api' 99 ? 'Convertful.js' 100 : 'optin.js'; 94 101 } 95 102 … … 121 128 'categories' => $categories, 122 129 'tags' => $tags, 130 'ajax_url' => get_home_url() . '/index.php?rest_route=/convertful/v2/' , 123 131 'userRoles' => ( $user_meta instanceof WP_User and ! empty( $user_meta->roles ) ) ? $user_meta->roles : [ 'guest' ], 124 132 ] ); … … 149 157 } 150 158 151 function conv_complete_authorization( WP_REST_Request$request ) {159 function conv_complete_authorization( $request ) { 152 160 $owner_id = (int) $request->get_param( 'owner_id' ); 153 161 $site_id = (int) $request->get_param( 'site_id' ); … … 205 213 ]; 206 214 215 if (function_exists( 'woocommerce_get_page_id' )){ 216 // Add WooCommerce coupons and products 217 $result['woo_coupons'] = get_woo_coupons(); 218 $result['woo_products'] = get_woo_products(); 219 $result['woo_enabled'] = TRUE; 220 } 221 207 222 wp_send_json_success( $result ); 208 223 } -
convertful/trunk/readme.txt
r2378652 r2486582 3 3 Tags: optin, opt-in, mailchimp, popup, bar, slidein, subscribe, signup, form, email, marketing, lead, campaign 4 4 Requires at least: 4.0 5 Tested up to: 5. 5.15 Tested up to: 5.6.2 6 6 Stable tag: 2.1 7 7 License: GPLv2 or later … … 102 102 == Changelog == 103 103 104 = 2.2 = 105 * Add WooCommerce functionality 106 104 107 = 2.1 = 105 108 * Bug fixes
Note: See TracChangeset
for help on using the changeset viewer.