PluginProbe
Datafeedr API / 1.1.2
Datafeedr API v1.1.2
1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 All 181 releases
datafeedr-api / datafeedr-api-v1.php

datafeedr-api-v1.php in Datafeedr API 1.1.2, at datafeedr-api-v1.php

108 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Define constants.
10 */
11 define( 'DFRAPI_VERSION', '1.1.2' );
12 define( 'DFRAPI_URL', plugin_dir_url( __FILE__ ) );
13 define( 'DFRAPI_PATH', plugin_dir_path( __FILE__ ) );
14 define( 'DFRAPI_BASENAME', plugin_basename( __FILE__ ) );
15 define( 'DFRAPI_DOMAIN', 'datafeedr-api' );
16 define( 'DFRAPI_HOME_URL', 'https://www.datafeedr.com' );
17 define( 'DFRAPI_KEYS_URL', 'https://members.datafeedr.com/api' );
18 define( 'DFRAPI_USER_URL', 'https://members.datafeedr.com/' );
19 define( 'DFRAPI_HELP_URL', 'https://datafeedrapi.helpscoutdocs.com/contact' );
20 define( 'DFRAPI_BUG_REPORTS_URL', 'https://datafeedrapi.helpscoutdocs.com/' );
21 define( 'DFRAPI_QNA_URL', 'https://datafeedrapi.helpscoutdocs.com/' );
22 define( 'DFRAPI_DOCS_URL', 'https://datafeedrapi.helpscoutdocs.com/' );
23 define( 'DFRAPI_REPORT_BUG_URL', 'https://datafeedrapi.helpscoutdocs.com/contact' );
24 define( 'DFRAPI_ASK_QUESTION_URL', 'https://datafeedrapi.helpscoutdocs.com/contact' );
25 define( 'DFRAPI_EMAIL_US_URL', 'https://datafeedrapi.helpscoutdocs.com/contact' );
26
27 /**
28 * Require WP 3.8+
29 */
30 add_action( 'admin_init', 'dfrapi_wp_version_check' );
31 function dfrapi_wp_version_check() {
32 $version = get_bloginfo( 'version' );
33 if ( version_compare( $version, '3.8', '<' ) ) {
34 deactivate_plugins( DFRAPI_BASENAME );
35 }
36 }
37
38 /**
39 * Notify user that this plugin is deactivated.
40 */
41 add_action( 'admin_notices', 'dfrapi_wp_version_notice' );
42 function dfrapi_wp_version_notice() {
43 $version = get_bloginfo( 'version' );
44 if ( version_compare( $version, '3.8', '<' ) ) {
45 echo '<div class="error"><p>' . __( 'The ', DFRAPI_DOMAIN ) . '<strong><em>';
46 _e( 'Datafeedr API', DFRAPI_DOMAIN );
47 echo '</em></strong>';
48 _e( ' plugin could not be activated because it requires WordPress version 3.8 or greater. Please upgrade your installation of WordPress.',
49 DFRAPI_DOMAIN );
50 echo '</p></div>';
51 if ( isset( $_GET['activate'] ) ) {
52 unset( $_GET['activate'] );
53 }
54 }
55 }
56
57 /**
58 * Load files for all pages.
59 */
60 require_once( DFRAPI_PATH . 'classes/class-datafeedr-plugin-dependency.php' );
61 require_once( DFRAPI_PATH . 'classes/class-datafeedr-cron.php' );
62 require_once( DFRAPI_PATH . 'classes/class-datafeedr-timer.php' );
63 require_once( DFRAPI_PATH . 'classes/class-datafeedr-currency.php' );
64 require_once( DFRAPI_PATH . 'classes/class-datafeedr-price.php' );
65 require_once( DFRAPI_PATH . 'classes/class-datafeedr-image-importer.php' );
66 require_once( DFRAPI_PATH . 'functions/functions.php' );
67 require_once( DFRAPI_PATH . 'functions/upgrade.php' );
68 require_once( DFRAPI_PATH . 'libraries/datafeedr.php' );
69 require_once( DFRAPI_PATH . 'libraries/zanox_client.php' );
70 require_once( DFRAPI_PATH . 'classes/class-dfrapi-searchform.php' );
71 require_once( DFRAPI_PATH . 'functions/api.php' );
72
73 /**
74 * Display admin notices for each required plugin that needs to be
75 * installed, activated and/or updated.
76 *
77 * @since 1.0.75
78 */
79 function dfrapi_admin_notice_plugin_dependencies() {
80
81 /**
82 * @var Dfrapi_Plugin_Dependency[] $dependencies
83 */
84 $dependencies = array();
85
86 foreach ( $dependencies as $dependency ) {
87
88 $action = $dependency->action_required();
89
90 if ( ! $action ) {
91 continue;
92 }
93
94 echo '<div class="notice notice-error"><p>';
95 echo $dependency->msg( 'Datafeedr API' );
96 echo $dependency->link();
97 echo '</p></div>';
98 }
99 }
100
101 add_action( 'admin_notices', 'dfrapi_admin_notice_plugin_dependencies' );
102
103 /**
104 * Load files only if we're in the admin section of the site.
105 */
106 if ( is_admin() ) {
107 require_once( DFRAPI_PATH . 'classes/class-dfrapi-initialize.php' );
108 }