| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
die; |
| 10 |
} // Cannot access directly. |
| 11 |
|
| 12 |
class Tweaks_Feed extends AdminSettingsModel |
| 13 |
{ |
| 14 |
public function __construct() |
| 15 |
{ |
| 16 |
$this->tweaks_feed_settings(); |
| 17 |
} |
| 18 |
|
| 19 |
public function get_defaults() |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'remove_feed' => false, |
| 23 |
'redirect_feed' => false, |
| 24 |
]; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Tweaks: Feed Fields |
| 30 |
* |
| 31 |
* @param [type] $feed_fields |
| 32 |
* |
| 33 |
* @return void |
| 34 |
*/ |
| 35 |
public function tweaks_feed_fields(&$feed_fields) |
| 36 |
{ |
| 37 |
|
| 38 |
$feed_fields[] = array( |
| 39 |
'type' => 'subheading', |
| 40 |
'content' => Utils::adminfiy_help_urls( |
| 41 |
__('Cleanup your head section from feed links and redirect them to the homepage if needed.', WP_ADMINIFY_TD), |
| 42 |
'https://wpadminify.com/kb/wp-adminify-tweaks/', |
| 43 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 44 |
'https://www.facebook.com/groups/jeweltheme', |
| 45 |
'https://wpadminify.com/support/' |
| 46 |
) |
| 47 |
); |
| 48 |
|
| 49 |
$feed_fields[] = array( |
| 50 |
'id' => 'remove_feed', |
| 51 |
'type' => 'switcher', |
| 52 |
'title' => __('Remove Feed Links', WP_ADMINIFY_TD), |
| 53 |
'subtitle' => __('Remove all feed links from head section', WP_ADMINIFY_TD), |
| 54 |
'label' => __('This option does not disable feed functionality, just cleans head section.', WP_ADMINIFY_TD), |
| 55 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 56 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 57 |
'text_width' => 80, |
| 58 |
'default' => $this->get_default_field('remove_feed'), |
| 59 |
); |
| 60 |
|
| 61 |
$feed_fields[] = array( |
| 62 |
'id' => 'redirect_feed', |
| 63 |
'type' => 'switcher', |
| 64 |
'title' => __('Redirect ALL Feeds', WP_ADMINIFY_TD), |
| 65 |
'subtitle' => __('Disable feeds feature by redirection to the homepage (also removes feed links from head section)', WP_ADMINIFY_TD), |
| 66 |
'label' => __('This option totally disables feed functionality. If you are using feeds on your site (e.g. FeedBurner) do not disable feeds.', WP_ADMINIFY_TD), |
| 67 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 68 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 69 |
'text_width' => 80, |
| 70 |
'default' => $this->get_default_field('redirect_feed'), |
| 71 |
); |
| 72 |
} |
| 73 |
|
| 74 |
public function tweaks_feed_settings() |
| 75 |
{ |
| 76 |
|
| 77 |
if (!class_exists('ADMINIFY')) { |
| 78 |
return; |
| 79 |
} |
| 80 |
|
| 81 |
$feed_fields = []; |
| 82 |
$this->tweaks_feed_fields($feed_fields); |
| 83 |
|
| 84 |
\ADMINIFY::createSection( |
| 85 |
$this->prefix, |
| 86 |
array( |
| 87 |
'title' => __('Feed', WP_ADMINIFY_TD), |
| 88 |
'parent' => 'tweaks_performance', |
| 89 |
'icon' => 'fas fa-rss-square', |
| 90 |
'fields' => $feed_fields |
| 91 |
) |
| 92 |
); |
| 93 |
} |
| 94 |
} |
| 95 |
|