class-pages-edit-admin-bar.php
1 month ago
class-pages-edit-redirects.php
6 months ago
class-pages-notices.php
7 months ago
class-pages-settings.php
1 year ago
index.php
3 years ago
class-pages-settings.php
150 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Страница общи� |
| 4 | настроек для этого плагина. |
| 5 | * |
| 6 | * Может быть использована только, если этот плагин используется как отдельный плагин, а не как аддон |
| 7 | * дя плагина Clearfy. Если плагин загружен, как аддон для Clearfy, эта страница не будет подключена. |
| 8 | * |
| 9 | * Поддерживает режим работы с мультисаймами. Вы можете увидеть эту страницу в панели настройки сети. |
| 10 | * |
| 11 | * Github: https://github.com/alexkovalevv |
| 12 | * |
| 13 | * @author Alexander Kovalev <alex.kovalevv@gmail.com> |
| 14 | * @copyright (c) 2018 Webraftic Ltd |
| 15 | * @version 1.0 |
| 16 | */ |
| 17 | |
| 18 | // Exit if accessed directly |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; |
| 21 | } |
| 22 | |
| 23 | class WDN_Settings_Page extends WDN_Page { |
| 24 | |
| 25 | /** |
| 26 | * {@inheritDoc} |
| 27 | * |
| 28 | * @var string |
| 29 | */ |
| 30 | public $id = "wdan_settings"; |
| 31 | |
| 32 | /** |
| 33 | * {@inheritDoc} |
| 34 | * |
| 35 | * @var string |
| 36 | */ |
| 37 | public $page_menu_dashicon = 'dashicons-admin-generic'; |
| 38 | |
| 39 | /** |
| 40 | * {@inheritDoc} |
| 41 | * |
| 42 | * @var bool |
| 43 | */ |
| 44 | public $available_for_multisite = true; |
| 45 | |
| 46 | /** |
| 47 | * {@inheritDoc} |
| 48 | * |
| 49 | * @since 1.1.0 |
| 50 | * @var bool |
| 51 | */ |
| 52 | public $show_right_sidebar_in_options = true; |
| 53 | |
| 54 | /** |
| 55 | * {@inheritDoc} |
| 56 | * |
| 57 | * @since 1.1.3 - Added |
| 58 | * @var bool - true show, false hide |
| 59 | */ |
| 60 | public $show_search_options_form = false; |
| 61 | |
| 62 | /** |
| 63 | * {@inheritDoc} |
| 64 | * @var int |
| 65 | */ |
| 66 | public $page_menu_position = 100; |
| 67 | |
| 68 | |
| 69 | /** |
| 70 | * @param Wbcr_Factory480_Plugin $plugin |
| 71 | */ |
| 72 | public function __construct( Wbcr_Factory480_Plugin $plugin ) { |
| 73 | $this->menu_title = __( 'Hide admin notices', 'disable-admin-notices' ); |
| 74 | $this->page_menu_short_description = __( 'General settings', 'disable-admin-notices' ); |
| 75 | |
| 76 | $this->internal = false; |
| 77 | $this->menu_target = 'options-general.php'; |
| 78 | $this->add_link_to_plugin_actions = true; |
| 79 | |
| 80 | parent::__construct( $plugin ); |
| 81 | |
| 82 | $this->plugin = $plugin; |
| 83 | } |
| 84 | |
| 85 | public function getPageTitle() { |
| 86 | return __( 'Settings', 'disable-admin-notices' ); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Requests assets (js and css) for the page. |
| 91 | * |
| 92 | * @param Wbcr_Factory480_ScriptList $scripts |
| 93 | * @param Wbcr_Factory480_StyleList $styles |
| 94 | * |
| 95 | * @return void |
| 96 | * @see Wbcr_FactoryPages480_AdminPage |
| 97 | * |
| 98 | */ |
| 99 | public function assets( $scripts, $styles ) { |
| 100 | parent::assets( $scripts, $styles ); |
| 101 | |
| 102 | $this->styles->add( WDN_PLUGIN_URL . '/admin/assets/css/settings.css' ); |
| 103 | $this->scripts->add( WDN_PLUGIN_URL . '/admin/assets/js/settings.js' ); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * {@inheritDoc} |
| 108 | * |
| 109 | * @return array |
| 110 | */ |
| 111 | public function actionsNotice( $notices ) { |
| 112 | $notices[] = [ |
| 113 | 'conditions' => [ |
| 114 | 'wbcr_dan_reseted_notices' => 1 |
| 115 | ], |
| 116 | 'type' => 'success', |
| 117 | 'message' => __( 'Hidden notices are successfully reset, now you can see them again!', 'disable-admin-notices' ) |
| 118 | ]; |
| 119 | |
| 120 | /*$notices[] = array( |
| 121 | 'conditions' => array( |
| 122 | 'wbcr_dan_clear_comments_error' => 1, |
| 123 | 'wbcr_dan_code' => 'interal_error' |
| 124 | ), |
| 125 | 'type' => 'danger', |
| 126 | 'message' => __('An error occurred while trying to delete comments. Internal error occured. Please try again later.', 'factory_pages_480') |
| 127 | );*/ |
| 128 | |
| 129 | return $notices; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * {@inheritDoc} |
| 134 | * |
| 135 | * @return array |
| 136 | */ |
| 137 | public function getPageOptions() { |
| 138 | $options = wbcr_dan_get_plugin_options(); |
| 139 | |
| 140 | $formOptions = []; |
| 141 | |
| 142 | $formOptions[] = [ |
| 143 | 'type' => 'form-group', |
| 144 | 'items' => $options, |
| 145 | //'cssClass' => 'postbox' |
| 146 | ]; |
| 147 | |
| 148 | return apply_filters( 'wbcr_dan_notices_form_options', $formOptions, $this ); |
| 149 | } |
| 150 | } |