| @@ -1,18 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: Datafeedr API |
| 4 | -Version: 1.0.2 | |
| 5 | -Plugin URI: https://v4.datafeedr.com | |
| 4 | +Plugin URI: https://www.datafeedr.com | |
| 6 | 5 | Description: Connect to the Datafeedr API and configure your API settings. |
| 7 | 6 | Author: datafeedr.com |
| 8 | -Author URI: https://v4.datafeedr.com | |
| 7 | +Author URI: https://www.datafeedr.com | |
| 9 | 8 | License: GPL v3 |
| 10 | 9 | Requires at least: 3.8 |
| 11 | -Tested up to: 3.8.1 | |
| 10 | +Tested up to: 5.7-alpha | |
| 11 | +Version: 1.1.2 | |
| 12 | 12 | |
| 13 | 13 | Datafeedr API Plugin |
| 14 | -Copyright (C) 2014, Datafeedr - eric@datafeedr.com | |
| 14 | +Copyright (C) 2021, Datafeedr - help@datafeedr.com | |
| 15 | 15 | |
| 16 | 16 | This program is free software: you can redistribute it and/or modify |
| 17 | 17 | it under the terms of the GNU General Public License as published by |
| 18 | 18 | the Free Software Foundation, either version 3 of the License, or |
| @@ -26,69 +26,24 @@ | ||
| 26 | 26 | You should have received a copy of the GNU General Public License |
| 27 | 27 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
| 30 | +if ( defined( 'DATAFEEDR_DEV' ) && true === DATAFEEDR_DEV ) { | |
| 31 | 31 | |
| 32 | -/** | |
| 33 | - * Define constants. | |
| 34 | - */ | |
| 35 | -define( 'DFRAPI_VERSION', '1.0.2' ); | |
| 36 | -define( 'DFRAPI_URL', plugin_dir_url( __FILE__ ) ); | |
| 37 | -define( 'DFRAPI_PATH', plugin_dir_path( __FILE__ ) ); | |
| 38 | -define( 'DFRAPI_BASENAME', plugin_basename( __FILE__ ) ); | |
| 39 | -define( 'DFRAPI_DOMAIN', 'datafeedr-api' ); | |
| 40 | -define( 'DFRAPI_HOME_URL', 'https://v4.datafeedr.com' ); | |
| 41 | -define( 'DFRAPI_KEYS_URL', 'https://v4.datafeedr.com/keys' ); | |
| 42 | -define( 'DFRAPI_USER_URL', 'https://v4.datafeedr.com/user' ); | |
| 43 | -define( 'DFRAPI_HELP_URL', 'https://v4.datafeedr.com/support' ); | |
| 44 | -define( 'DFRAPI_BUG_REPORTS_URL', 'https://v4.datafeedr.com/bug-reports' ); | |
| 45 | -define( 'DFRAPI_QNA_URL', 'https://v4.datafeedr.com/topics' ); | |
| 46 | -define( 'DFRAPI_DOCS_URL', 'https://v4.datafeedr.com/support' ); | |
| 47 | -define( 'DFRAPI_REPORT_BUG_URL', 'https://v4.datafeedr.com/node/add/bug-report' ); | |
| 48 | -define( 'DFRAPI_ASK_QUESTION_URL', 'https://v4.datafeedr.com/node/add/topic' ); | |
| 49 | -define( 'DFRAPI_EMAIL_US_URL', 'https://v4.datafeedr.com/node/add/ticket' ); | |
| 32 | + add_action( 'admin_notices', 'dfrapi_development_version_notice' ); | |
| 33 | + function dfrapi_development_version_notice() { | |
| 34 | + $class = 'notice notice-error'; | |
| 35 | + $title = 'WARNING!!!'; | |
| 36 | + $message = 'You are now using a development version of the Datafeedr API plugin. Things WILL BREAK. We do NOT recommend using this version of the plugin! You have been warned.'; | |
| 37 | + echo sprintf( | |
| 38 | + '<div class="%1$s"><p><strong>%2$s</strong><br />%3$s</p></div>', | |
| 39 | + esc_attr( $class ), | |
| 40 | + esc_html( $title ), | |
| 41 | + esc_html( $message ) | |
| 42 | + ); | |
| 43 | + } | |
| 50 | 44 | |
| 51 | -/** | |
| 52 | - * Require WP 3.8+ | |
| 53 | - */ | |
| 54 | -add_action( 'admin_init', 'dfrapi_wp_version_check' ); | |
| 55 | -function dfrapi_wp_version_check() { | |
| 56 | - $version = get_bloginfo( 'version' ); | |
| 57 | - if ( version_compare( $version, '3.8', '<' ) ) { | |
| 58 | - deactivate_plugins( DFRAPI_BASENAME ); | |
| 59 | - } | |
| 60 | -} | |
| 45 | + include( 'datafeedr-api-v2.php' ); | |
| 61 | 46 | |
| 62 | -/** | |
| 63 | - * Notify user that this plugin is deactivated. | |
| 64 | - */ | |
| 65 | -add_action( 'admin_notices', 'dfrapi_wp_version_notice' ); | |
| 66 | -function dfrapi_wp_version_notice() { | |
| 67 | - $version = get_bloginfo( 'version' ); | |
| 68 | - if ( version_compare( $version, '3.8', '<' ) ) { | |
| 69 | - echo '<div class="error"><p>' . __( 'The ', DFRAPI_DOMAIN ) . '<strong><em>'; | |
| 70 | - _e( 'Datafeedr API', DFRAPI_DOMAIN ); | |
| 71 | - echo '</em></strong>'; | |
| 72 | - _e( ' plugin could not be activated because it requires WordPress version 3.8 or greater. Please upgrade your installation of WordPress.', DFRAPI_DOMAIN ); | |
| 73 | - echo '</p></div>'; | |
| 74 | - if ( isset( $_GET['activate'] ) ) { | |
| 75 | - unset( $_GET['activate'] ); | |
| 76 | - } | |
| 77 | - } | |
| 47 | +} else { | |
| 48 | + include( 'datafeedr-api-v1.php' ); | |
| 78 | 49 | } |
| 79 | - | |
| 80 | -/** | |
| 81 | - * Load files for all pages. | |
| 82 | - */ | |
| 83 | -require_once( DFRAPI_PATH . 'functions/functions.php' ); // Core functions. | |
| 84 | -require_once( DFRAPI_PATH . 'libraries/datafeedr.php' ); // Load the Datafeedr API Library. | |
| 85 | -require_once( DFRAPI_PATH . 'libraries/zanox_client.php' ); // Load the Zanox Client Library. | |
| 86 | -require_once( DFRAPI_PATH . 'classes/class-dfrapi-searchform.php' ); // Product search form. | |
| 87 | -require_once( DFRAPI_PATH . 'functions/api.php' ); // API specific helper functions. | |
| 88 | - | |
| 89 | -/** | |
| 90 | - * Load files only if we're in the admin section of the site. | |
| 91 | - */ | |
| 92 | -if ( is_admin() ) { | |
| 93 | - require_once ( DFRAPI_PATH . 'classes/class-dfrapi-initialize.php' ); | |
| 94 | -} | |