| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The page Settings. |
| 5 |
* |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
// Exit if accessed directly |
| 10 |
if( !defined('ABSPATH') ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
class WbcrCmp_CommentsPage extends Wbcr_FactoryPages401_ImpressiveThemplate { |
| 15 |
|
| 16 |
/** |
| 17 |
* The id of the page in the admin menu. |
| 18 |
* |
| 19 |
* Mainly used to navigate between pages. |
| 20 |
* @see FactoryPages401_AdminPage |
| 21 |
* |
| 22 |
* @since 1.0.0 |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
public $id = "comments"; |
| 26 |
public $page_menu_dashicon = 'dashicons-testimonial'; |
| 27 |
|
| 28 |
/** |
| 29 |
* @param Wbcr_Factory400_Plugin $plugin |
| 30 |
*/ |
| 31 |
public function __construct(Wbcr_Factory400_Plugin $plugin) |
| 32 |
{ |
| 33 |
$this->menu_title = __('Disable comments', 'comments-plus'); |
| 34 |
|
| 35 |
if( !defined('LOADING_COMMENTS_PLUS_AS_ADDON') ) { |
| 36 |
$this->internal = false; |
| 37 |
$this->menu_target = 'options-general.php'; |
| 38 |
$this->add_link_to_plugin_actions = true; |
| 39 |
} |
| 40 |
|
| 41 |
parent::__construct($plugin); |
| 42 |
} |
| 43 |
|
| 44 |
public function getMenuTitle() |
| 45 |
{ |
| 46 |
return defined('LOADING_COMMENTS_PLUS_AS_ADDON') |
| 47 |
? __('Comments', 'comments-plus') |
| 48 |
: __('General', 'comments-plus'); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
/** |
| 53 |
* Permalinks options. |
| 54 |
* |
| 55 |
* @since 1.0.0 |
| 56 |
* @return mixed[] |
| 57 |
*/ |
| 58 |
public function getOptions() |
| 59 |
{ |
| 60 |
$options = array(); |
| 61 |
|
| 62 |
$options[] = array( |
| 63 |
'type' => 'html', |
| 64 |
'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __('Global disabling of comments', 'comments-plus') . '</strong><p>' . __('What is the difference between these and native WordPress functions? WordPress disables comments only for new posts! Using the functions below, you can disable comments globally, even for old posts, and you can choose which post types comments to disable. The plugin also disables the comment functionality itself, which creates a certain load on the site.', 'comments-plus') . '</p></div>' |
| 65 |
); |
| 66 |
|
| 67 |
$types = get_post_types(array('public' => true), 'objects'); |
| 68 |
$post_types = array(); |
| 69 |
foreach($types as $type_name => $type) { |
| 70 |
$post_types[] = array($type_name, $type->label); |
| 71 |
} |
| 72 |
|
| 73 |
$options[] = array( |
| 74 |
'type' => 'dropdown', |
| 75 |
'name' => 'disable_comments', |
| 76 |
'way' => 'buttons', |
| 77 |
'title' => __('Disable comments', 'comments-plus'), |
| 78 |
'data' => array( |
| 79 |
array('enable_comments', __('Not disable', 'comments-plus')), |
| 80 |
array( |
| 81 |
'disable_comments', |
| 82 |
__('Everywhere', 'comments-plus'), |
| 83 |
sprintf(__('You can delete all comments in the database by clicking on this link (<a href="%s">cleaning comments in database</a>).', 'comments-plus'), admin_url('admin.php?page=delete_comments-' . $this->plugin->getPluginName())) |
| 84 |
), |
| 85 |
array( |
| 86 |
'disable_certain_post_types_comments', |
| 87 |
__('On certain post types', 'comments-plus'), |
| 88 |
sprintf(__('You can delete all comments for the selected post types. Select the post types below and save the settings. After that, click the link (<a href="%s">delete all comments for the selected post types in database</a>).', 'comments-plus'), admin_url('admin.php?page=delete_comments-' . $this->plugin->getPluginName())) |
| 89 |
) |
| 90 |
), |
| 91 |
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'), |
| 92 |
'hint' => __('Everywhere - Warning: This option is global and will affect your entire site. Use it only if you want to disable comments everywhere. A complete description of what this option does is available here', 'comments-plus') . '<br><br>' . __('On certain post types - Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts.', 'comments-plus'), |
| 93 |
'default' => 'enable_comments', |
| 94 |
'events' => array( |
| 95 |
'disable_certain_post_types_comments' => array( |
| 96 |
'show' => '.factory-control-disable_comments_for_post_types, #wbcr-clearfy-comments-base-options' |
| 97 |
), |
| 98 |
'enable_comments' => array( |
| 99 |
'show' => '#wbcr-clearfy-comments-base-options', |
| 100 |
'hide' => '.factory-control-disable_comments_for_post_types' |
| 101 |
), |
| 102 |
'disable_comments' => array( |
| 103 |
'hide' => '.factory-control-disable_comments_for_post_types, #wbcr-clearfy-comments-base-options' |
| 104 |
) |
| 105 |
) |
| 106 |
); |
| 107 |
|
| 108 |
$options[] = array( |
| 109 |
'type' => 'list', |
| 110 |
'way' => 'checklist', |
| 111 |
'name' => 'disable_comments_for_post_types', |
| 112 |
'title' => __('Select post types', 'comments-plus'), |
| 113 |
'data' => $post_types, |
| 114 |
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'), |
| 115 |
'hint' => __('Select the post types for which comments will be disabled', 'comments-plus'), |
| 116 |
'default' => 'post,page,attachment' |
| 117 |
); |
| 118 |
|
| 119 |
$options[] = array( |
| 120 |
'type' => 'div', |
| 121 |
'id' => 'wbcr-clearfy-comments-base-options', |
| 122 |
'items' => array( |
| 123 |
array( |
| 124 |
'type' => 'html', |
| 125 |
'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __('General settings for comments', 'comments-plus') . '</strong><p>' . __('These settings will help you improve SEO and reduce the amount of spam.', 'comments-plus') . '</p></div>' |
| 126 |
), |
| 127 |
array( |
| 128 |
'type' => 'checkbox', |
| 129 |
'way' => 'buttons', |
| 130 |
'name' => 'remove_url_from_comment_form', |
| 131 |
'title' => __('Remove field "site" in comment form', 'comments-plus'), |
| 132 |
'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'), |
| 133 |
'hint' => __('Tired of spam in the comments? Do visitors leave "blank" comments for the sake of a link to their site?', 'comments-plus') . '<br><b>Clearfy: </b>' . __('Removes the "Site" field from the comment form.', 'comments-plus') . '<br>--<br><span class="hint-warnign-color"> *' . __('Works with the standard comment form, if the form is manually written in your theme-it probably will not work!', 'comments-plus') . '</span>', |
| 134 |
'default' => false |
| 135 |
), |
| 136 |
array( |
| 137 |
'type' => 'checkbox', |
| 138 |
'way' => 'buttons', |
| 139 |
'name' => 'comment_text_convert_links_pseudo', |
| 140 |
'title' => __('Replace external links in comments on the JavaScript code', 'comments-plus'), |
| 141 |
'layout' => array('hint-type' => 'icon'), |
| 142 |
'hint' => __('Superfluous external links from comments, which can be typed from a dozen and more for one article, do not bring anything good for promotion.', 'comments-plus') . '<br><br><b>Clearfy: </b>' . sprintf(__('Replaces the links of this kind of %s, on links of this kind %s', 'comments-plus'), '<code>a href="http://yourdomain.com" rel="nofollow"</code>', '<code>span data-uri="http://yourdomain.com"</code>'), |
| 143 |
'default' => false |
| 144 |
), |
| 145 |
array( |
| 146 |
'type' => 'checkbox', |
| 147 |
'way' => 'buttons', |
| 148 |
'name' => 'pseudo_comment_author_link', |
| 149 |
'title' => __('Replace external links from comment authors on the JavaScript code', 'comments-plus'), |
| 150 |
'layout' => array('hint-type' => 'icon'), |
| 151 |
'hint' => __('Up to 90 percent of comments in the blog can be left for the sake of an external link. Even nofollow from page weight loss here does not help.', 'comments-plus') . '<br><br><b>Clearfy: </b>' . __('Replaces the links of the authors of comments on the JavaScript code, it is impossible to distinguish it from usual links.', 'comments-plus') . '<br>--<br><i>' . __('In some Wordpress topics this may not work.', 'comments-plus') . '</i>', |
| 152 |
'default' => false |
| 153 |
), |
| 154 |
array( |
| 155 |
'type' => 'checkbox', |
| 156 |
'way' => 'buttons', |
| 157 |
'name' => 'remove_x_pingback', |
| 158 |
'title' => __('Disable XML-RPC', 'clearfy'), |
| 159 |
'layout' => array('hint-type' => 'icon'), |
| 160 |
'hint' => __('A pingback is basically an automated comment that gets created when another blog links to you. A self-pingback is created when you link to an article within your own blog. Pingbacks are essentially nothing more than spam and simply waste resources.', 'comments-plus') . '<br><b>Clearfy: </b>' . __('Removes the server responses a reference to the xmlrpc file.', 'clearfy'), |
| 161 |
'default' => false |
| 162 |
) |
| 163 |
) |
| 164 |
); |
| 165 |
|
| 166 |
$formOptions = array(); |
| 167 |
|
| 168 |
$formOptions[] = array( |
| 169 |
'type' => 'form-group', |
| 170 |
'items' => $options, |
| 171 |
//'cssClass' => 'postbox' |
| 172 |
); |
| 173 |
|
| 174 |
return apply_filters('wbcr_cmp_comments_form_options', $formOptions); |
| 175 |
} |
| 176 |
} |