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