PageRenderTime 25ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/clearfy/admin/pages/seo.php

https://bitbucket.org/suroj/nepalayatravels
PHP | 221 lines | 155 code | 32 blank | 34 comment | 3 complexity | cc494094329f06d8469e9b7136ed498d MD5 | raw file
Possible License(s): MIT, GPL-3.0, GPL-2.0, BSD-3-Clause, Apache-2.0
  1. <?php
  2. /**
  3. * The page Settings.
  4. *
  5. * @since 1.0.0
  6. */
  7. // Exit if accessed directly
  8. if( !defined('ABSPATH') ) {
  9. exit;
  10. }
  11. class WCL_SeoPage extends WCL_Page {
  12. /**
  13. * The id of the page in the admin menu.
  14. *
  15. * Mainly used to navigate between pages.
  16. * @see FactoryPages401_AdminPage
  17. *
  18. * @since 1.0.0
  19. * @var string
  20. */
  21. public $id = "seo";
  22. public $page_menu_dashicon = 'dashicons-star-filled';
  23. public $page_menu_position = 16;
  24. /**
  25. * @param WCL_Plugin $plugin
  26. */
  27. public function __construct(WCL_Plugin $plugin)
  28. {
  29. $this->menu_title = __('SEO', 'clearfy');
  30. parent::__construct($plugin);
  31. $this->plugin = $plugin;
  32. }
  33. /**
  34. * Conflict notites
  35. */
  36. public function warningNotice()
  37. {
  38. $notices = apply_filters('wbcr_clr_seo_page_warnings', array());
  39. if( !empty($notices) ) {
  40. foreach($notices as $message) {
  41. $this->printWarningNotice($message);
  42. }
  43. }
  44. }
  45. /**
  46. * Permalinks options.
  47. *
  48. * @since 1.0.0
  49. * @return mixed[]
  50. */
  51. public function getOptions()
  52. {
  53. $options = array();
  54. $options[] = array(
  55. 'type' => 'html',
  56. 'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Basic SEO optimization settings</strong>.', 'clearfy') . '<p>' . __('Recommended settings that can complement your SEO plugin.', 'clearfy') . '</p></div>'
  57. );
  58. $options[] = array(
  59. 'type' => 'checkbox',
  60. 'way' => 'buttons',
  61. 'name' => 'content_image_auto_alt',
  62. 'title' => __('Automatically set the alt attribute', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  63. 'layout' => array('hint-type' => 'icon'),
  64. 'hint' => __('The alt attribute is mandatory, so most SEO experts say. If you missed or did not fill it at all, it will be automatically assigned and will be equal to the title of the article.', 'clearfy') . '<br><br><b>Clearfy: </b>' . sprintf(__('Replaces the %s, on attribute with an article name %s', 'clearfy'), '<code>img scr="" alt=""</code>', '<code>img scr="" alt="Hello world"</code>'),
  65. 'default' => false
  66. );
  67. $options[] = array(
  68. 'type' => 'checkbox',
  69. 'way' => 'buttons',
  70. 'name' => 'right_robots_txt',
  71. 'title' => __('Create right robots.txt', 'clearfy'),
  72. 'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
  73. 'hint' => __('After installation, WP does not contain a robots.txt file and create it manually. We re-read about 30 different articles, instructions from Yandex and Google to create the perfect robots.txt', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Automatically creates the perfect robots.txt file', 'clearfy'),
  74. 'default' => false,
  75. 'eventsOn' => array(
  76. 'show' => '.factory-control-robots_txt_text'
  77. ),
  78. 'eventsOff' => array(
  79. 'hide' => '.factory-control-robots_txt_text'
  80. )
  81. );
  82. $options[] = array(
  83. 'type' => 'textarea',
  84. 'name' => 'robots_txt_text',
  85. 'title' => __('You can edit the robots.txt file in the box below:', 'clearfy'),
  86. 'default' => WCL_Helper::getRightRobotTxt(),
  87. 'height' => '300'
  88. );
  89. $options[] = array(
  90. 'type' => 'html',
  91. 'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('Server headers and response', 'clearfy') . '</strong>' . '<p>' . __('WordPress does not know how to give the Last Modified header in the server\'s responses. You can do this using the settings below.', 'clearfy') . '</p>' . '</div>'
  92. );
  93. $options[] = array(
  94. 'type' => 'checkbox',
  95. 'way' => 'buttons',
  96. 'name' => 'set_last_modified_headers',
  97. 'title' => __('Automatically insert the Last Modified header', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  98. 'default' => false,
  99. 'eventsOn' => array(
  100. 'show' => '.factory-control-last_modified_exclude'
  101. ),
  102. 'eventsOff' => array(
  103. 'hide' => '.factory-control-last_modified_exclude'
  104. )
  105. );
  106. $options[] = array(
  107. 'type' => 'textarea',
  108. 'name' => 'last_modified_exclude',
  109. 'height' => '120',
  110. 'title' => __('Exclude pages:', 'clearfy'),
  111. 'layout' => array('hint-type' => 'icon'),
  112. 'hint' => sprintf(__('You can specify a page mask, for example: %s or %s. All pages that contain the string will be excluded. Each exclude must begin with a new line.', 'clearfy'), '/s=', '/manager/'),
  113. );
  114. $options[] = array(
  115. 'type' => 'checkbox',
  116. 'way' => 'buttons',
  117. 'name' => 'if_modified_since_headers',
  118. 'title' => __('Return an If-Modified-Since responce', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  119. 'default' => false
  120. );
  121. if( $this->plugin->isActivateComponent('yoast_seo') ) {
  122. $options[] = array(
  123. 'type' => 'html',
  124. 'html' => '<div class="wbcr-clearfy-group-header">' . '<strong>' . __('For the Yoast SEO plugin', 'clearfy') . '</strong>' . '<p>' . __('These settings will help you eliminate some problems associated with the popular Yoast SEO plugin', 'clearfy') . '</p>' . '</div>'
  125. );
  126. $options[] = array(
  127. 'type' => 'checkbox',
  128. 'way' => 'buttons',
  129. 'name' => 'remove_last_item_breadcrumb_yoast',
  130. 'title' => __('Remove duplicate names in breadcrumbs WP SEO by Yoast', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  131. 'layout' => array('hint-type' => 'icon'),
  132. 'hint' => __('The last element in the breadcrumbs in the Yoast SEO plugin duplicates the title of the article. Some SEO-specialists consider this duplication to be superfluous.', 'clearfy') . '<br><br><b>Clearfy: </b>' . __('Removes duplication of the name in the breadcrumbs of the WP SEO plugin from Yoast.', 'clearfy'),
  133. 'default' => false
  134. );
  135. $options[] = array(
  136. 'type' => 'checkbox',
  137. 'way' => 'buttons',
  138. 'name' => 'yoast_remove_image_from_xml_sitemap',
  139. 'title' => sprintf(__('Remove the tag %s from XML site map', 'clearfy'), 'image:image') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  140. 'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'green'),
  141. 'hint' => __('Yandex.Webmaster swears on a standard XML card from the plugin Yoast, tk. it has a specific tag', 'clearfy') . 'image:image<br><br><b>Clearfy: </b>' . sprintf(__('Remove the tag %s from XML site map of the plugin Yoast SEO.', 'clearfy'), 'image:image') . '<br>--<br><span class="hint-warnign-color">' . __('Attention! After activation, turn off the site map and enable it back to regenerate it.', 'clearfy') . '</span>' . '<br><span class="hint-warnign-color">' . __('In older versions of Yoast SEO may not work - update the plugin Yoast', 'clearfy') . '</span>',
  142. 'default' => false,
  143. 'eventsOn' => array()
  144. );
  145. /*$options[] = array(
  146. 'type' => 'html',
  147. 'id' => 'wbcr-clearfy-image-xml-sitemap-warning',
  148. 'cssClass' => 'factory-hints',
  149. 'html' => array($this, 'sfsdfsdf')
  150. );*/
  151. $options[] = array(
  152. 'type' => 'checkbox',
  153. 'way' => 'buttons',
  154. 'name' => 'yoast_remove_json_ld_search',
  155. 'title' => __('Disable JSON-LD sitelinks searchbox', 'clearfy') . '</span>',
  156. 'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
  157. 'hint' => __('If you’re not familiar with Search Action it’s the mark-up that helps search engines add a shiny Sitelinks Search Box below your search engine results. For the majority of webmasters the extra search box is an absolutely fantastic feature but for many it’s not required or wanted, especially if a site only has a few pages or if the site uses a customised search platform that only searches blog posts and not pages.', 'clearfy') . ' <br><b>Clearfy: </b>' . __('Disable JSON-LD sitelinks searchbox using WordPress in plugin Yoast SEO.', 'clearfy'),
  158. 'default' => false
  159. );
  160. $options[] = array(
  161. 'type' => 'checkbox',
  162. 'way' => 'buttons',
  163. 'name' => 'yoast_remove_json_ld_output',
  164. 'title' => __('Disable Yoast Structured Data', 'clearfy') . ' <span class="wbcr-clearfy-recomended-text"></span>',
  165. 'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
  166. 'hint' => __('Prevents output of the script tag of type application/ld+json containing
  167. schema.org data from the popular Yoast SEO and Yoast SEO Premium plugins.
  168. There is currently no UI to do so.', 'clearfy') . ' <br><b>Clearfy: </b>' . __('Disable Structured Data in plugin Yoast SEO.', 'clearfy'),
  169. 'default' => false
  170. );
  171. $options[] = array(
  172. 'type' => 'checkbox',
  173. 'way' => 'buttons',
  174. 'name' => 'yoast_remove_head_comment',
  175. 'title' => sprintf(__('Remove comment from %s section', 'clearfy'), 'head') . ' <span class="wbcr-clearfy-recomended-text">(' . __('Recommended', 'clearfy') . ')</span>',
  176. 'layout' => array('hint-type' => 'icon'),
  177. 'hint' => sprintf(__('The Yoast SEO plugin displays a comment of the form %s in %s section', 'clearfy'), '!-- This site is optimized with the Yoast SEO plugin v3.1.1 - https://yoast.com/wordpress/plugins/seo/ --', 'head') . '<br><br><b>Clearfy: </b>' . sprintf(__('Removes the Yoast SEO plugin comment of their section %s', 'clearfy'), 'head'),
  178. 'default' => false
  179. );
  180. }
  181. $form_options = array();
  182. $form_options[] = array(
  183. 'type' => 'form-group',
  184. 'items' => $options,
  185. //'cssClass' => 'postbox'
  186. );
  187. return apply_filters('wbcr_clr_seo_form_options', $form_options, $this);
  188. }
  189. }