-
Notifications
You must be signed in to change notification settings - Fork 26
/
feedzy-rss-feed.php
225 lines (203 loc) · 7.58 KB
/
feedzy-rss-feed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link http://themeisle.com
* @since 3.0.0
* @package feedzy-rss-feeds
*
* @wordpress-plugin
* Plugin Name: Feedzy RSS Feeds Lite
* Plugin URI: https://themeisle.com/plugins/feedzy-rss-feeds/
* Description: A small and lightweight RSS aggregator plugin. Fast and very easy to use, it allows you to aggregate multiple RSS feeds into your WordPress site through fully customizable shortcodes & widgets.
* Version: 4.4.16
* Author: Themeisle
* Author URI: http://themeisle.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: feedzy-rss-feeds
* Domain Path: /languages
* WordPress Available: yes
* Pro Slug: feedzy-rss-feeds-pro
* Requires License: no
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* The code that runs during plugin activation.
* This action is documented in includes/feedzy-rss-feeds-activator.php
*/
function activate_feedzy_rss_feeds() {
Feedzy_Rss_Feeds_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/feedzy-rss-feeds-deactivator.php
*
* @since 3.0.0
*/
function deactivate_feedzy_rss_feeds() {
Feedzy_Rss_Feeds_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_feedzy_rss_feeds' );
register_deactivation_hook( __FILE__, 'deactivate_feedzy_rss_feeds' );
/**
* The function thast will handle the queue for autoloader.
*
* @since 3.0.0
*/
function feedzy_rss_feeds_autoload( $class ) {
$namespaces = array( 'Feedzy_Rss_Feeds' );
foreach ( $namespaces as $namespace ) {
if ( substr( $class, 0, strlen( $namespace ) ) === $namespace ) {
$filename = plugin_dir_path( __FILE__ ) . 'includes/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
$filename = plugin_dir_path( __FILE__ ) . 'includes/abstract/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
$filename = plugin_dir_path( __FILE__ ) . 'includes/admin/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
$filename = plugin_dir_path( __FILE__ ) . 'includes/gutenberg/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
$filename = plugin_dir_path( __FILE__ ) . 'includes/util/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
$filename = plugin_dir_path( __FILE__ ) . 'includes/elementor/' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
if ( is_readable( $filename ) ) {
require_once $filename;
return true;
}
}
}
if ( is_readable( plugin_dir_path( __FILE__ ) . 'includes/admin/feedzy-wp-widget.php' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'includes/admin/feedzy-wp-widget.php';
return true;
}
return false;
}
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.s
*
* @since 3.0.0.
*/
function run_feedzy_rss_feeds() {
define( 'FEEDZY_BASEFILE', __FILE__ );
define( 'FEEDZY_ABSURL', plugins_url( '/', __FILE__ ) );
define( 'FEEDZY_BASENAME', plugin_basename( __FILE__ ) );
define( 'FEEDZY_ABSPATH', dirname( __FILE__ ) );
define( 'FEEDZY_DIRNAME', basename( FEEDZY_ABSPATH ) );
define( 'FEEDZY_UPSELL_LINK', 'https://themeisle.com/plugins/feedzy-rss-feeds/upgrade/' );
define( 'FEEDZY_SUBSCRIBE_API', 'https://api.themeisle.com/tracking/subscribe' );
define( 'FEEDZY_NAME', 'Feedzy RSS Feeds' );
define( 'FEEDZY_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' );
define( 'FEEDZY_ALLOW_HTTPS', true );
define( 'FEEDZY_REST_VERSION', '1' );
// to redirect all themeisle_log_event to error log.
define( 'FEEDZY_LOCAL_DEBUG', false );
define( 'FEEDZY_FEED_CUSTOM_TAG_NAMESPACE', 'http://feedzy.themeisle.com' );
// always make this true before testing
// also used in gutenberg.
define( 'FEEDZY_DISABLE_CACHE_FOR_TESTING', false );
$vendor_file = FEEDZY_ABSPATH . '/vendor/autoload.php';
if ( is_readable( $vendor_file ) ) {
require_once $vendor_file;
}
$feedzy = Feedzy_Rss_Feeds::instance();
$feedzy->run();
add_filter( 'themeisle_sdk_products', 'feedzy_register_sdk', 10, 1 );
add_filter( 'pirate_parrot_log', 'feedzy_register_parrot', 10, 1 );
add_filter(
'themeisle_sdk_compatibilities/' . FEEDZY_DIRNAME, function ( $compatibilities ) {
$compatibilities['FeedzyPRO'] = array(
'basefile' => defined( 'FEEDZY_PRO_BASEFILE' ) ? FEEDZY_PRO_BASEFILE : '',
'required' => '1.7',
'tested_up' => '2.4',
);
return $compatibilities;
}
);
add_filter(
'feedzy_rss_feeds_about_us_metadata',
function() {
return array(
'logo' => FEEDZY_ABSURL . 'img/feedzy.svg',
'location' => 'feedzy-admin-menu',
'has_upgrade_menu' => ! feedzy_is_pro(),
'upgrade_text' => esc_html__( 'Upgrade to Pro', 'feedzy-rss-feeds' ),
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ), 'query' ),
);
}
);
define( 'FEEDZY_SURVEY_PRO', 'https://forms.gle/FZXhL3D48KJUhb7q9' );
define( 'FEEDZY_SURVEY_FREE', 'https://forms.gle/yQUGSrKEa7XJTGLx8' );
}
/**
* Registers with the SDK
*
* @since 1.0.0
*/
function feedzy_register_sdk( $products ) {
$products[] = FEEDZY_BASEFILE;
return $products;
}
/**
* Registers with the parrot plugin
*
* @since 1.0.0
*/
function feedzy_register_parrot( $plugins ) {
$plugins[] = FEEDZY_NAME;
return $plugins;
}
spl_autoload_register( 'feedzy_rss_feeds_autoload' );
run_feedzy_rss_feeds();
if ( FEEDZY_LOCAL_DEBUG ) {
add_action( 'themeisle_log_event', 'feedzy_themeisle_log_event', 10, 5 );
/**
* Redirect themeisle_log_event to error log.
*/
function feedzy_themeisle_log_event( $name, $msg, $type, $file, $line ) {
if ( $name === FEEDZY_NAME ) {
error_log( sprintf( '%s (%s:%d): %s', $type, $file, $line, $msg ) );
}
}
}
add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );
add_filter(
'feedzy_rss_feeds_float_widget_metadata', function () {
return array(
'nice_name' => 'Feedzy',
'logo' => FEEDZY_ABSURL . 'img/feedzy.svg',
'primary_color' => '#4268CF',
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support' ),
'has_upgrade_menu' => ! feedzy_is_pro(),
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ), 'query' ),
'documentation_link' => tsdk_translate_link( tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ), 'query' ),
'wizard_link' => ! feedzy_is_pro() && ! empty( get_option( 'feedzy_fresh_install', false ) ) ? admin_url( 'admin.php?page=feedzy-setup-wizard&tab#step-1' ) : '',
);
}
);