SmartCrawl SEO - Version 2.2.2.1

Version Description

  • Fix: Allow data import from Yoast 8.x
  • Fix: Updated plugin version constant to latest version for cache busting
Download this release

Release Info

Developer khaxan
Plugin Icon 128x128 SmartCrawl SEO
Version 2.2.2.1
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2.1

Files changed (165) hide show
  1. autoloader.php +10 -0
  2. changelog.txt +513 -444
  3. class-mappings.php +91 -0
  4. config.php +90 -58
  5. includes/admin/admin.php +508 -441
  6. includes/admin/index.php +1 -0
  7. includes/admin/metabox.php +571 -478
  8. includes/admin/settings.php +710 -664
  9. includes/admin/settings/autolinks.php +526 -492
  10. includes/admin/settings/checkup.php +196 -175
  11. includes/admin/settings/dashboard.php +442 -604
  12. includes/admin/settings/index.php +1 -0
  13. includes/admin/settings/onpage.php +798 -660
  14. includes/admin/settings/redirections.php +0 -125
  15. includes/admin/settings/seomoz.php +0 -65
  16. includes/admin/settings/settings.php +569 -492
  17. includes/admin/settings/sitemap.php +506 -472
  18. includes/admin/settings/social.php +227 -203
  19. includes/admin/taxonomy.php +193 -137
  20. includes/admin/templates/_forms/autolinks.php +12 -10
  21. includes/admin/templates/_forms/import-export.php +6 -4
  22. includes/admin/templates/_forms/settings.php +6 -4
  23. includes/admin/templates/advanced-tools/advanced-section-automatic-linking-settings.php +88 -79
  24. includes/admin/templates/advanced-tools/advanced-section-automatic-linking.php +64 -57
  25. includes/admin/templates/advanced-tools/advanced-section-moz.php +69 -62
  26. includes/admin/templates/advanced-tools/advanced-section-redirects.php +109 -106
  27. includes/admin/templates/advanced-tools/advanced-tools-redirect-item.php +71 -69
  28. includes/admin/templates/advanced-tools/advanced-tools-settings.php +157 -149
  29. includes/admin/templates/{underscore-keywords-custom.php → advanced-tools/underscore-keywords-custom.php} +18 -17
  30. includes/admin/templates/{underscore-keywords-form.php → advanced-tools/underscore-keywords-form.php} +32 -31
  31. includes/admin/templates/{underscore-keywords-pairs.php → advanced-tools/underscore-keywords-pairs.php} +21 -21
  32. includes/admin/templates/{underscore-postlist-exclusion-item.php → advanced-tools/underscore-postlist-exclusion-item.php} +10 -9
  33. includes/admin/templates/{underscore-postlist-exclusion.php → advanced-tools/underscore-postlist-exclusion.php} +17 -16
  34. includes/admin/templates/{underscore-postlist-selector-list-item.php → advanced-tools/underscore-postlist-selector-list-item.php} +21 -20
  35. includes/admin/templates/{underscore-postlist-selector-list.php → advanced-tools/underscore-postlist-selector-list.php} +45 -44
  36. includes/admin/templates/{underscore-postlist-selector.php → advanced-tools/underscore-postlist-selector.php} +14 -14
  37. includes/admin/templates/checkup/checkup-checkup-results.php +83 -82
  38. includes/admin/templates/checkup/checkup-checkup-running.php +18 -16
  39. includes/admin/templates/checkup/checkup-checkup.php +13 -13
  40. includes/admin/templates/checkup/checkup-reporting.php +131 -129
  41. includes/admin/templates/checkup/checkup-settings.php +78 -89
  42. includes/admin/templates/checkup/checkup-top.php +98 -96
  43. includes/admin/templates/dashboard-dialog-has_dashboard-service_seo.php +0 -231
  44. includes/admin/templates/dashboard-dialog-has_dashboard-service_uptime.php +0 -30
  45. includes/admin/templates/dashboard-dialog-not_installed-service_seo.php +0 -22
  46. includes/admin/templates/dashboard-dialog-not_installed-service_uptime.php +0 -11
  47. includes/admin/templates/dashboard-dialog-not_logged_in-service_seo.php +0 -28
  48. includes/admin/templates/dashboard-dialog-seo_service-run.php +0 -49
  49. includes/admin/templates/dashboard-report-issue.php +0 -114
  50. includes/admin/templates/dashboard-settings.php +0 -237
  51. includes/admin/templates/dashboard/dashboard-box-title-url-crawl-stats.php +17 -17
  52. includes/admin/templates/dashboard/dashboard-checkup-progress.php +29 -27
  53. includes/admin/templates/dashboard/dashboard-content-analysis-readability-overview.php +88 -89
  54. includes/admin/templates/dashboard/dashboard-content-analysis-seo-overview.php +82 -83
  55. includes/admin/templates/dashboard/dashboard-mini-checkup-report.php +31 -30
  56. includes/admin/templates/dashboard/dashboard-top.php +113 -85
  57. includes/admin/templates/dashboard/dashboard-url-crawl-in-progress.php +11 -11
  58. includes/admin/templates/dashboard/dashboard-url-crawl-no-data-small.php +5 -5
  59. includes/admin/templates/dashboard/dashboard-url-crawl-stats.php +24 -23
  60. includes/admin/templates/dashboard/dashboard-widget-advanced-tools.php +112 -106
  61. includes/admin/templates/dashboard/dashboard-widget-content-analysis.php +85 -79
  62. includes/admin/templates/dashboard/dashboard-widget-onpage.php +60 -54
  63. includes/admin/templates/dashboard/dashboard-widget-seo-checkup.php +78 -72
  64. includes/admin/templates/dashboard/dashboard-widget-sitemap.php +111 -105
  65. includes/admin/templates/dashboard/dashboard-widget-social.php +113 -105
  66. includes/admin/templates/dashboard/dashboard.php +61 -53
  67. includes/admin/templates/dashboard/onboard-progress.php +7 -7
  68. includes/admin/templates/dashboard/onboarding.php +113 -112
  69. includes/admin/templates/disabled-component-inner.php +38 -36
  70. includes/admin/templates/disabled-component.php +23 -23
  71. includes/admin/templates/dismissable-notice.php +21 -20
  72. includes/admin/templates/index.php +1 -0
  73. includes/admin/templates/links-dropdown.php +18 -17
  74. includes/admin/templates/mascot-message.php +25 -25
  75. includes/admin/templates/media-url-field.php +14 -14
  76. includes/admin/templates/metabox.php +0 -294
  77. includes/admin/templates/metabox/analysis-readability.php +124 -115
  78. includes/admin/templates/metabox/analysis-seo-analysis.php +94 -0
  79. includes/admin/templates/metabox/analysis-seo_analysis.php +0 -86
  80. includes/admin/templates/metabox/analysis.php +5 -5
  81. includes/admin/templates/metabox/horizontal-tab-nav.php +16 -16
  82. includes/admin/templates/metabox/horizontal-tab.php +19 -19
  83. includes/admin/templates/metabox/metabox-main.php +99 -88
  84. includes/admin/templates/metabox/metabox-meta-edit-form.php +98 -94
  85. includes/admin/templates/metabox/metabox-preview.php +63 -59
  86. includes/admin/templates/metabox/metabox-seo-analysis-container.php +45 -39
  87. includes/admin/templates/metabox/metabox-social-meta-tags.php +97 -93
  88. includes/admin/templates/metabox/metabox-tab-advanced.php +166 -136
  89. includes/admin/templates/metabox/metabox-tab-readability.php +15 -13
  90. includes/admin/templates/metabox/metabox-tab-seo.php +25 -25
  91. includes/admin/templates/metabox/metabox-tab-social.php +98 -99
  92. includes/admin/templates/native-dismissible-notice-javascript.php +16 -0
  93. includes/admin/templates/notice.php +7 -7
  94. includes/admin/templates/onpage/onpage-marketpress-tabs.php +0 -83
  95. includes/admin/templates/onpage/onpage-meta-robots.php +16 -16
  96. includes/admin/templates/onpage/onpage-og-disabled.php +18 -14
  97. includes/admin/templates/onpage/onpage-og-settings.php +38 -38
  98. includes/admin/templates/onpage/onpage-og-twitter.php +50 -50
  99. includes/admin/templates/onpage/onpage-preview.php +26 -26
  100. includes/admin/templates/onpage/onpage-section-404.php +27 -25
  101. includes/admin/templates/onpage/onpage-section-author-archive.php +43 -40
  102. includes/admin/templates/onpage/onpage-section-buddypress-groups.php +31 -25
  103. includes/admin/templates/onpage/onpage-section-buddypress-profile.php +31 -25
  104. includes/admin/templates/onpage/onpage-section-date-archive.php +43 -40
  105. includes/admin/templates/onpage/onpage-section-homepage.php +99 -91
  106. includes/admin/templates/onpage/onpage-section-post-type-archive.php +57 -0
  107. includes/admin/templates/onpage/onpage-section-post-type.php +50 -41
  108. includes/admin/templates/onpage/onpage-section-search.php +43 -40
  109. includes/admin/templates/onpage/onpage-section-settings.php +35 -35
  110. includes/admin/templates/onpage/onpage-section-taxonomy.php +49 -41
  111. includes/admin/templates/onpage/onpage-settings.php +263 -257
  112. includes/admin/templates/onpage/onpage-social-meta-tags.php +116 -115
  113. includes/admin/templates/onpage/onpage-twitter-disabled.php +18 -14
  114. includes/admin/templates/onpage/onpage-twitter-settings.php +39 -39
  115. includes/admin/templates/{underscore-macros-list.php → onpage/underscore-macros-list.php} +13 -12
  116. includes/admin/templates/post-list/post-seo-analysis-errors.php +18 -0
  117. includes/admin/templates/post-list/post-seo-analysis-good.php +3 -0
  118. includes/admin/templates/progress-bar.php +10 -10
  119. includes/admin/templates/progress-notice.php +28 -26
  120. includes/admin/templates/quick-edit-javascript.php +45 -41
  121. includes/admin/templates/quick-edit-robots.php +39 -38
  122. includes/admin/templates/quick-edit-title.php +14 -12
  123. includes/admin/templates/redirections-settings.php +0 -123
  124. includes/admin/templates/report-vertical-tab.php +84 -81
  125. includes/admin/templates/seomoz-dashboard-widget.php +88 -71
  126. includes/admin/templates/seomoz-settings.php +0 -28
  127. includes/admin/templates/settings-message-top.php +55 -49
  128. includes/admin/templates/settings/settings-custom-meta-tag.php +7 -7
  129. includes/admin/templates/settings/settings-section-general.php +202 -203
  130. includes/admin/templates/settings/settings-section-import-export.php +66 -61
  131. includes/admin/templates/settings/settings-section-user-roles.php +85 -82
  132. includes/admin/templates/settings/settings.php +75 -81
  133. includes/admin/templates/sitemap/sitemap-buddypress-settings.php +53 -53
  134. includes/admin/templates/sitemap/sitemap-crawl-content.php +14 -14
  135. includes/admin/templates/sitemap/sitemap-crawl-issue-generic.php +58 -57
  136. includes/admin/templates/sitemap/sitemap-crawl-issue-ignored.php +26 -24
  137. includes/admin/templates/sitemap/sitemap-crawl-issue-sitemap.php +34 -33
  138. includes/admin/templates/sitemap/sitemap-crawl-issues-3xx.php +18 -18
  139. includes/admin/templates/sitemap/sitemap-crawl-issues-4xx.php +18 -18
  140. includes/admin/templates/sitemap/sitemap-crawl-issues-5xx.php +18 -18
  141. includes/admin/templates/sitemap/sitemap-crawl-issues-generic-controls.php +6 -5
  142. includes/admin/templates/sitemap/sitemap-crawl-issues-group.php +96 -95
  143. includes/admin/templates/sitemap/sitemap-crawl-issues-inaccessible.php +18 -18
  144. includes/admin/templates/sitemap/sitemap-crawl-issues-sitemap-controls.php +10 -8
  145. includes/admin/templates/sitemap/sitemap-crawl-issues-sitemap.php +19 -19
  146. includes/admin/templates/sitemap/sitemap-crawl-results.php +60 -60
  147. includes/admin/templates/sitemap/sitemap-crawl-stats.php +31 -31
  148. includes/admin/templates/sitemap/sitemap-no-crawler-data.php +15 -15
  149. includes/admin/templates/sitemap/sitemap-occurrences-overlay.php +42 -41
  150. includes/admin/templates/sitemap/sitemap-part.php +32 -32
  151. includes/admin/templates/sitemap/sitemap-progress-bar.php +12 -12
  152. includes/admin/templates/sitemap/sitemap-redirect-overlay.php +64 -61
  153. includes/admin/templates/sitemap/sitemap-section-advanced.php +58 -58
  154. includes/admin/templates/sitemap/sitemap-section-reporting.php +103 -100
  155. includes/admin/templates/sitemap/sitemap-section-settings.php +144 -139
  156. includes/admin/templates/sitemap/sitemap-settings.php +203 -195
  157. includes/admin/templates/sitemaps-dashboard-widget.php +71 -59
  158. includes/admin/templates/social/social-section-accounts.php +168 -163
  159. includes/admin/templates/social/social-section-open-graph.php +14 -14
  160. includes/admin/templates/social/social-section-pinterest-verification.php +40 -40
  161. includes/admin/templates/social/social-section-twitter-cards.php +71 -67
  162. includes/admin/templates/social/social-settings.php +89 -81
  163. includes/admin/templates/social/social-twitter-embed.php +27 -23
  164. includes/admin/templates/taxonomy-form-row.php +30 -24
  165. includes/admin/templates/term-additions-form.php +184 -206
autoloader.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function smartcrawl_autoload( $class ) {
4
+ $class_mappings = include 'class-mappings.php';
5
+ if ( isset( $class_mappings[ $class ] ) && file_exists( SMARTCRAWL_PLUGIN_DIR . $class_mappings[ $class ] ) ) {
6
+ include SMARTCRAWL_PLUGIN_DIR . $class_mappings[ $class ];
7
+ }
8
+ }
9
+
10
+ spl_autoload_register( 'smartcrawl_autoload' );
changelog.txt CHANGED
@@ -1,444 +1,513 @@
1
- Plugin Name: SmartCrawl SEO
2
-
3
- Change Log:
4
- ----------------------------------------------------------------------
5
- ----------------------------------------------------------------------
6
-
7
- 2.2.1 - 2018-03-31
8
- ----------------------------------------------------------------------
9
- - Fix: post list pages performance issue.
10
-
11
- 2.2 - 2018-03-28
12
- ----------------------------------------------------------------------
13
- - New: Yoast & All-In-One SEO importers.
14
- - New: 'Refresh' button for content & readability analysis modules.
15
- - New: ability to set twitter cards details on post and type level.
16
-
17
- - Fix: compatibility with New Blog Templates plugin.
18
- - Fix: spelling and grammar issues.
19
- - Fix: duplicate info text in "No Image Alts" section of seo analysis.
20
- - Fix: support for Themify themes.
21
- - Fix: readability analysis summary outputting html tags.
22
- - Fix: saving draft or publishing posts closes the smartcrawl module.
23
- - Fix: problems in "Add All to Sitemap" button.
24
- - Fix: incorrect number of missing url's on main dashboard.
25
-
26
- 2.1.1 - 2017-02-07
27
- ----------------------------------------------------------------------
28
- - New: make Analysis dash widget results numeric and items clickable.
29
- - New: add OpenGraph and Twitter options for taxonomies.
30
- - New: exclude full URLs from sitemap.
31
- - New: grey out deactivated modules in site owner permissions.
32
- - New: enable styled sitemap on fresh setups.
33
-
34
- - Fix: increase recommended description length from 160 to 230 chars.
35
- - Fix: redirection resolution on archive pages.
36
- - Fix: spelling and grammar issues.
37
- - Fix: UI and styling issues.
38
- - Fix: checkup scan tracking auto-update.
39
- - Fix: update option label copies.
40
- - Fix: update info links.
41
- - Fix: admin menu style issues in Firefox.
42
- - Fix: background color style issues.
43
- - Fix: conflict with Divi theme.
44
- - Fix: configuring links destinations when sitewide mode is active.
45
- - Fix: unifiy analysis status results.
46
- - Fix: BBPress compatibility issue with generated URLs.
47
- - Fix: update error strings on import/export issues.
48
- - Fix: sitemap items listed twice in audit report.
49
- - Fix: title tag on custom post type archives issue.
50
- - Fix: conflict with Movedo theme.
51
- - Fix: do not calculate disabled analysis results.
52
- - Fix: empty ignore URLs list clears sitemaps.
53
- - Fix: user name not shown for reporting.
54
-
55
- 2.1.0.1 - 2017-12-18
56
- ----------------------------------------------------------------------
57
- - Fix: Jetpack compatibility issue
58
-
59
- 2.1 - 2017-12-18
60
- ----------------------------------------------------------------------
61
- - Add: complete redesign
62
- - Add: macros separator support
63
- - Add: getting started wizard
64
- - Add: improved OpenGraph controls
65
- - Add: Twitter cards support
66
- - Add: schema support
67
- - Add: Pinterest verification support
68
- - Add: custom meta elements support
69
- - Add: linked social accounts support
70
- - Add: WP Checkup service integration
71
- - Add: scheduled crawl and checkup support
72
- - Add: SEO analysis check per post
73
- - Add: per post readability analysis
74
- - Add: per post autolinks toggle
75
- - Add: improved keywords handling with focus keywords
76
- - Add: ability to import and export settings
77
- - Add: allow sitemode switching in admin area on network setups
78
- - Add: attachment page noindex/redirection
79
-
80
- - Fix: improved previews
81
- - Fix: OpenGraph compatibility issue with Jetpack
82
- - Fix: sitemaps issue with alternate cron
83
- - Fix: additional checks for sitemaps read/write
84
- - Fix: HHVM compatibility
85
- - Fix: improve site owner permissions on network setups
86
-
87
- 2.0.1 - 2017-06-07
88
- ----------------------------------------------------------------------
89
- - Add: ability to ignore issues
90
- - Add: ability to add custom sitemap URLs
91
- - Add: option to skip strict description check
92
- - Fix: homepage keywords saving issue
93
- - Fix: MarketPress coupons conflict
94
- - Fix: typos
95
- - Fix: improve admin toolbar item and allow suppression
96
- - Fix: front-end templating deprecated tags conflict
97
- - Fix: WooCommerce shop page empty SEO details overrides
98
-
99
- 2.0 - 2017-02-23
100
- ----------------------------------------------------------------------
101
- - New: whole new interface
102
- - Add: OpenGraph support
103
- - Add: SEO Audit service support
104
-
105
- - Fix: deprecated constructors usage
106
- - Fix: W3TC object cache conflict issue
107
- - Fix: multiple anonymous post types rendering issue
108
-
109
- 1.7.6 - 2015-08-25
110
- ----------------------------------------------------------------------
111
- - Add advanced robots options info on listing pages.
112
- - Add redirections info on listing pages.
113
- - Project name update.
114
-
115
- 1.7.5 - 2015-08-15
116
- ----------------------------------------------------------------------
117
- - Add 301 redirection box permission level to the defaults list.
118
- - Fix for titles processing in feeds output.
119
- - Fix and cleanup for post type checks conditionals.
120
- - Fix for duplicated static front page in sitemaps.
121
-
122
- 1.7.4 - 2014-12-28
123
- ----------------------------------------------------------------------
124
- - Fix duplicates prevention stopping the post autolink expansion.
125
- - Fix keyword tag detection in autolink expansion replacement.
126
- - Fix extra whitespaces in autolink replacement expansion.
127
- - Fix for `set_time_limits` limitations.
128
-
129
- 1.7.3 - 2014-11-11
130
- ----------------------------------------------------------------------
131
- - Fix for some PHP notices.
132
- - Fix for regex matching points in autolinks detection.
133
- - Fix for link counts in autolinks matching to prevent clearing results.
134
- - Fix for maximum single link replacement in post title matching.
135
-
136
- 1.7.2 - 2014-10-21
137
- ----------------------------------------------------------------------
138
- - Fix for boundary matching in an unicode-safe way.
139
- - Fix for sitemap stylesheet path with SSL enabled.
140
- - Improved per-site settings mode.
141
-
142
- 1.7.1 - 2014-07-08
143
- ----------------------------------------------------------------------
144
- - Fix for attachment metadata handling.
145
- - Fix for showing network management level options.
146
- - Allowing optional partial on-page optimization.
147
-
148
- 1.7 - 2014-05-22
149
- ----------------------------------------------------------------------
150
- - Some typo fixes.
151
- - Fix for posts with invalid modified dates by forcing timestamps.
152
- - Added support for global marketplace pages.
153
-
154
- 1.6.8.1 - 2014-05-10
155
- ----------------------------------------------------------------------
156
- - Improving data validation.
157
- - Fix for BuddyPress pages recognition.
158
-
159
- 1.6.8 - 2014-02-02
160
- ----------------------------------------------------------------------
161
- - Added verification code options.
162
- - Added experimental features flag.
163
- - Fix for the settings binding by pushing it up the queue.
164
-
165
- 1.6.7 - 2013-12-20
166
- ----------------------------------------------------------------------
167
- - Exposed the meta description for filtering.
168
- - Adding in the `nofollow` rel attribute option.
169
- - Exposing the arguments building for filtering from central location.
170
- - Exposing the post/term priority filters.
171
- - Adding separate role settings for 301 redirection box selection.
172
- - Fix for title length replacement.
173
- - Fix for default BuddyPress canonicals.
174
-
175
- 1.6.6 - 2013-08-11
176
- ----------------------------------------------------------------------
177
- - Fix for quickedit boxes.
178
- - Strings update.
179
-
180
- 1.6.5 - 2013-08-02
181
- ----------------------------------------------------------------------
182
- - Converting robots multiple selection box into checbox array.
183
- - Time-limit skipping switch updated.
184
-
185
- 1.6.4 - 2013-07-07
186
- ----------------------------------------------------------------------
187
- - Postponing the capability checks.
188
- - Allowing for timeout prevention override.
189
-
190
- 1.6.3 - 2013-07-06
191
- ----------------------------------------------------------------------
192
- - Exposing title for additional filtering.
193
- - Added blog public sanity check.
194
- - Counters update.
195
-
196
- 1.6.2 - 2013-04-14
197
- ----------------------------------------------------------------------
198
- - Added subsequent pages robots meta rule.
199
- - Added meta robots options to search results page.
200
- - Event delegation update.
201
- - Fix for SeoMOZ calls bit flags.
202
-
203
- 1.6.1 - 2013-03-20
204
- ----------------------------------------------------------------------
205
- - Fix for metabox access privileges.
206
- - Better date archives optimization.
207
-
208
- 1.6 - 2013-02-02
209
- ----------------------------------------------------------------------
210
- - Added global meta robots settings for taxonomies.
211
- - Added conditional unhooking possibility.
212
- - Allowing per-post sitemap inclusion filtering.
213
- - Better post types handling.
214
- - Allowed linking to empty taxonomies.
215
-
216
- 1.5.4 - 2013-01-13
217
- ----------------------------------------------------------------------
218
- - Added custom columns to custom post types list views.
219
- - Allowing quick edit on custom post types lists.
220
- - Fix for WooCommerce main shop on-page settings.
221
-
222
- 1.5.3 - 2013-01-08
223
- ----------------------------------------------------------------------
224
- - Fix for BuddyPress installs outside the main site.
225
- - News keywords support.
226
-
227
- 1.5.2 - 2012-12-30
228
- ----------------------------------------------------------------------
229
- - Fix for autolinks being recognized in shortcodes.
230
- - Updated the project link.
231
-
232
- 1.5.1 - 2012-11-02
233
- ----------------------------------------------------------------------
234
- - Adding link target options for auto-generated links.
235
- - Allowed define override for metabox role settings.
236
- - Propagating autolink fixes by Daniel Speichert (thank you!).
237
- - Fix for BuddyPress groups page titles.
238
- - Fix for link in titles insertion issue and safer regex.
239
-
240
-
241
- 1.5 - 2012-09-08
242
- ----------------------------------------------------------------------
243
- - Exposing more hooks.
244
- - Making admin sitemap auto-update optional.
245
- - URL differentiation for domain mapped sites.
246
- - Disabling dashboard widgets for roles below contributor.
247
-
248
- 1.4.4 - 2012-07-20
249
- ----------------------------------------------------------------------
250
- - Fix for special characters in titles.
251
- - Fix for taxonomies autolinking.
252
- - Fix for post self-linking.
253
- - Added maximum autolinks number limit setting.
254
- - Added quick edit fields.
255
-
256
- 1.4.3 - 2012-07-08
257
- ----------------------------------------------------------------------
258
- - Improved paged output handling.
259
- - More robust post error handling.
260
- - Added boolean debug switches.
261
-
262
- 1.4.2 - 05/26/2012
263
- ----------------------------------------------------------------------
264
- - Fix for sitemaps URL resolution on domain-mapped sites
265
-
266
- 1.4.1 - 05/07/2012
267
- ----------------------------------------------------------------------
268
- - Fix for contextual help trigger.
269
- - Fix for full word auto-linking.
270
- - Added home page keywords settings.
271
-
272
- 1.4 - 03/22/2012 Vladislav Bailovic
273
- ----------------------------------------------------------------------
274
- - Fix for sitemap path finding.
275
- - Fix for BuddyPress Groups paging.
276
- - Improved taxonomies admin output.
277
- - Improved excerpt generation.
278
- - Added title and meta rewriting for BuddyPress Groups.
279
- - Added title and meta rewriting for BuddyPress Profiles.
280
-
281
- 1.3.7 - 01/20/2012 Vladislav Bailovic
282
- ----------------------------------------------------------------------
283
- - Fix for issue with BuddyPress documents plugin.
284
-
285
- 1.3.6 - 12/22/2011 Vladislav Bailovic
286
- ----------------------------------------------------------------------
287
- - Added options for duplicate link prevention.
288
- - Applied better contextual help trigger.
289
-
290
- 1.3.5 - 11/29/2011 Vladislav Bailovic
291
- ----------------------------------------------------------------------
292
- - Fix for robots meta output interaction with privacy settings.
293
- - Additional BuddyPress items check.
294
-
295
- 1.3.4 - 11/24/2011 Vladislav Bailovic
296
- ----------------------------------------------------------------------
297
- - Fix for BuddyPress groups support with no groups set up.
298
- - Added WPML config file.
299
-
300
- 1.3.3 - 11/17/2011 Vladislav Bailovic
301
- ----------------------------------------------------------------------
302
- - Fix for updated SEOMoz links.
303
- - Fix for BuddyPress groups priority calculation.
304
-
305
- 1.3.2 - 11/10/2011 Vladislav Bailovic
306
- ----------------------------------------------------------------------
307
- - Added BuddyPress groups and profiles in sitemaps.
308
- - Fixed site validation META headers.
309
- - Fixed sitemap path finding.
310
-
311
- 1.3.1 - 11/05/2011 Vladislav Bailovic
312
- ----------------------------------------------------------------------
313
- - Fix for sitemap path options.
314
- - Fix for autolinks issue with titles.
315
-
316
- 1.3 - 10/25/2011 Vladislav Bailovic
317
- ----------------------------------------------------------------------
318
- - Sitemap module rewrite, new sitemap options and dashboard widget.
319
- - Changed title limit to soft limit.
320
- - Added priority options for posts.
321
-
322
- 1.2.1 - 07/16/2011 Vladislav Bailovic
323
- ----------------------------------------------------------------------
324
- - Fixed autolink detection for strings that start with an
325
- non-ascii letter.
326
-
327
- 1.2 - 07/15/2011 Vladislav Bailovic
328
- ----------------------------------------------------------------------
329
- - Added "show tab" option to Network Admin while in sitewide, to apply
330
- tab permissions once the plugin goes in per-blog mode
331
- - Added "tags as keywords" checkbox.
332
- - Keywords as tags working.
333
- - Fixed issue with SEOmoz dashboard widget not getting the required info.
334
- - Fixed SEOmoz results caching in transients.
335
- - Changed sitemap path box to actual input box.
336
-
337
- 1.1.2 - 06/15/2011 Vladislav Bailovic
338
- ----------------------------------------------------------------------
339
- - Fix for issue with apostrophe (and other html special chars)
340
- in SEO metabox.
341
-
342
- 1.1.1 - 06/14/2011 Vladislav Bailovic
343
- ----------------------------------------------------------------------
344
- - Add htmlemtities and wordpress texturizer alternations for custom
345
- keywords in Autolinks.
346
-
347
- 1.1 - 06/13/2011 Vladislav Bailovic
348
- ----------------------------------------------------------------------
349
- - Added SEOmoz dashboard widget.
350
- - Added character couter and limits for SEO metabox.
351
- - Added meta keywords field to SEO metabox.
352
- - Fix for WPMU DEV SEO metabox using fixed width.
353
- - Fix for WDS_SITEWIDE define to toggle per-blog settings availability.
354
-
355
- 1.0.9.7 - 06/02/2011 Vladislav Bailovic
356
- ----------------------------------------------------------------------
357
- - Re-wrote some of the code.
358
-
359
- 1.0.9.6 - 05/21/2011 Vladislav Bailovic
360
- ----------------------------------------------------------------------
361
- - Fixed the the SimplePress incompatibility issue.
362
-
363
- 1.0.9.5 - 05/15/2011 Vladislav Bailovic
364
- ----------------------------------------------------------------------
365
- - Fixed the robots settings display on Page/Post list page.
366
-
367
- 1.0.9.4 - 05/10/2011 Vladislav Bailovic
368
- ----------------------------------------------------------------------
369
- - Normalizing newlines for title rewriting in head buffer.
370
- - Allowed matching title tags with arguments.
371
- - Re-introduced `wp_title` filter.
372
-
373
- 1.0.9.3 - 05/02/2011 Vladislav Bailovic
374
- ----------------------------------------------------------------------
375
- - Fixed header detection regular expression.
376
- - Removed HTML comments.
377
-
378
- 1.0.9.2 - 05/01/2011 Vladislav Bailovic
379
- ----------------------------------------------------------------------
380
- - Added Contributors to both metabox allowed lists.
381
-
382
- 1.0.9.1 - 04/28/2011 Vladislav Bailovic
383
- ----------------------------------------------------------------------
384
- - Fixed title rewriting in feeds
385
-
386
- 1.0.9 - 04/23/2011 Vladislav Bailovic
387
- ----------------------------------------------------------------------
388
- - Forced collapsed state on WDS metaboxes.
389
- - Deprecated default metabox hiding.
390
- - Fixed default permission level for showing metaboxes on singular installs.
391
- - Added WPMU DEV SEO metabox title l10n for Network installs. Singular installs will still see the branding.
392
-
393
-
394
- 1.0.8 - 04/22/2011 Vladislav Bailovic
395
- ----------------------------------------------------------------------
396
- - Fix for relative stylesheet URLs in sitemaps.
397
- - Fix for generating AND outputing sitemaps, without rebuilding on refresh.
398
- - Fix for auto-populating settings without admin having to visit the dashboard.
399
- - Added SEO and SEOmoz metabox toggling options and user displaying permission.
400
-
401
- 1.0.7 - 04/20/2011 Vladislav Bailovic
402
- ----------------------------------------------------------------------
403
- - Fix for title rewriting issues.
404
-
405
- 1.0.6 - 04/16/2011 Vladislav Bailovic
406
- ----------------------------------------------------------------------
407
- - Fix for SEOMoz API data fetching bug (transient data being stuck).
408
- - Fix for "Error: options page not found" message on multiple options step saves.
409
- - Updated Title SEO tweak to work with BuddyPress as well.
410
- - Fix for Sitemaps: using a regex match to determine if the sitemap was requested. Using a relative path to link the XSL stylesheet to it.
411
- - Added some error checking with is_wp_error
412
- - Some naming convention consistency fixes for option names.
413
- - Some PHP fixes.
414
-
415
- 1.0.5 - 03/25/2011 Aaron Edwards
416
- ----------------------------------------------------------------------
417
- - Fixes for PHP 4 incompatibilities
418
- - Limited posts in sitemap to 1000 most recent to prevent memory errors.
419
- - Added WDS_SITEMAP_POST_LIMIT define to be able to adjust limit in wp-config
420
- - Bug fix: Was killing admin help content
421
-
422
- 1.0.4 - 03/24/2011 Aaron Edwards
423
- ----------------------------------------------------------------------
424
- - Fixes to various php errors
425
- - Increase the time-limit for sitemap creation to work with big blogs
426
-
427
- 1.0.3 - 03/07/2011
428
- ----------------------------------------------------------------------
429
- - Enhancement: store sitemap in wp-content/uploads for main site on
430
- multisite
431
-
432
- 1.0.2 - 03/05/2011
433
- ----------------------------------------------------------------------
434
- - Bug fix: remove fields added to quick edit which where triggering a
435
- fatal error
436
-
437
- 1.0.1 - 03/02/2011
438
- ----------------------------------------------------------------------
439
- - Bug fix: sitemap not created on Multisite when blog upload dir doesn't
440
- exist yet
441
-
442
- 1.0 - 01/08/2010
443
- ----------------------------------------------------------------------
444
- - Initial Release.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Plugin Name: SmartCrawl SEO
2
+
3
+ Change Log:
4
+ ----------------------------------------------------------------------
5
+ ----------------------------------------------------------------------
6
+
7
+ 2.2.2.1 - 2018-08-20
8
+ ----------------------------------------------------------------------
9
+ - Fix: Allow data import from Yoast 8.x
10
+ - Fix: Updated plugin version constant to latest version for cache busting
11
+
12
+ 2.2.2 - 2018-07-13
13
+ ----------------------------------------------------------------------
14
+ - New: support for custom post type archives
15
+ - New: noindex/nofollow for post types
16
+ - New: new OpenGraph tags og:url, og:type, og:image:width and og:image:height
17
+ - New: code optimization
18
+ - New: integration test suite for quality assurance
19
+ - New: link each page to the relevant documentation section on the plugin website
20
+ - New: import social profile links from AIOSEOP
21
+ - New: dynamically adjust the toggles under "Site Owner Permissions"
22
+ - New: update Google result preview when content is changed
23
+ - New: prompt requesting reviews on WP.org
24
+
25
+ - Fix: hide settings for disabled modules from plugin dashboard
26
+ - Fix: BuddyPress group titles missing
27
+ - Fix: links to enable OpenGraph and Twitter settings pointing to inaccessible pages
28
+ - Fix: duplicate text in SEO Checkup section of metabox
29
+ - Fix: plugin css conflicting with some WP admin components
30
+ - Fix: analysis indicators not displaying correct colors in WP post list
31
+ - Fix: settings need to be saved before reports for SEO Checkup are sent
32
+ - Fix: on WP dashboard, 'update sitemap' link in the sitemap widget not working
33
+ - Fix: typo in opengraph settings
34
+ - Fix: when new URL scan is run, the URL Crawler section not loaded automatically
35
+ - Fix: google/bing verification codes from yoast not imported correctly
36
+ - Fix: columns in the post tables take more space then they should
37
+ - Fix: google verification meta can't be removed once added
38
+ - Fix: meta description not working on WooCommerce shop page
39
+ - Fix: redundant save settings button under URL Crawler report
40
+ - Fix: typo in the upgrade popup
41
+ - Fix: when import from yoast notice dismissed, it comes back on page load
42
+ - Fix: seo column in post list shows wrong color indicator when focus keyword missing
43
+ - Fix: google/bing verification tags disappear when sitemap settings saved
44
+ - Fix: XML sitemap opened in the current tab
45
+ - Fix: when "Upgrade to Pro" clicked, pro version details opened in the current tab
46
+ - Fix: values under "Site Owner Permissions" not saved when everything turned off
47
+ - Fix: last checked time on SEO Checkup inconsistent
48
+ - Fix: if modules disabled by network admin, site admin can still see them in settings
49
+ - Fix: autolinks page has "TBC" as the description of a setting
50
+ - Fix: author archive meta description not saved
51
+ - Fix: dashboard sections display number of issues even if the corresponding module is disabled
52
+ - Fix: on network sub-sites, disabled modules not behaving properly
53
+ - Fix: previews are not refreshing on title and meta admin page
54
+ - Fix: url crawler not always listing the URLs resulting in errors
55
+ - Fix: hide SEO Checkup on network sub-sites
56
+ - Fix: remove code for old google site verification settings
57
+ - Fix: date archive settings not respected
58
+ - Fix: admin bar menu should always match the admin menu
59
+ - Fix: in url crawler, no message is shown when all missing urls added to sitemap
60
+ - Fix: MOZ metabox not styled
61
+ - Fix: Redirect Attachments options in Advanced Tools not saved when in off state
62
+ - Fix: automatic linking toggle in post metabox displays wrong state
63
+ - Fix: redundant MarketPress options
64
+ - Fix: autolinks "Exclusions" don't work when "Case Sensitive Matching" is off
65
+ - Fix: autolinks "Min Lengths" setting not working consistently
66
+ - Fix: twitter settings for date archives not working consistently
67
+ - Fix: meta description settings for search and 404 pages not working consistently
68
+ - Fix: google verification meta settings not working consistently
69
+ - Fix: quick edit fields not loading values
70
+ - Fix: unwanted space before date archive title
71
+ - Fix: minor inconsistencies in SEO analysis
72
+ - Fix: no error message displayed when default user removed in reporting section under SEO Checkup
73
+ - Fix: statistics on dashboard not refreshed when checkup completes in SEO Checkup section
74
+ - Fix: MOZ data displayed even when wrong credentials added
75
+
76
+ 2.2.1 - 2018-03-31
77
+ ----------------------------------------------------------------------
78
+ - Fix: post list pages performance issue.
79
+
80
+ 2.2 - 2018-03-28
81
+ ----------------------------------------------------------------------
82
+ - New: Yoast & All-In-One SEO importers.
83
+ - New: 'Refresh' button for content & readability analysis modules.
84
+ - New: ability to set twitter cards details on post and type level.
85
+
86
+ - Fix: compatibility with New Blog Templates plugin.
87
+ - Fix: spelling and grammar issues.
88
+ - Fix: duplicate info text in "No Image Alts" section of seo analysis.
89
+ - Fix: support for Themify themes.
90
+ - Fix: readability analysis summary outputting html tags.
91
+ - Fix: saving draft or publishing posts closes the smartcrawl module.
92
+ - Fix: problems in "Add All to Sitemap" button.
93
+ - Fix: incorrect number of missing url's on main dashboard.
94
+
95
+ 2.1.1 - 2017-02-07
96
+ ----------------------------------------------------------------------
97
+ - New: make Analysis dash widget results numeric and items clickable.
98
+ - New: add OpenGraph and Twitter options for taxonomies.
99
+ - New: exclude full URLs from sitemap.
100
+ - New: grey out deactivated modules in site owner permissions.
101
+ - New: enable styled sitemap on fresh setups.
102
+
103
+ - Fix: increase recommended description length from 160 to 230 chars.
104
+ - Fix: redirection resolution on archive pages.
105
+ - Fix: spelling and grammar issues.
106
+ - Fix: UI and styling issues.
107
+ - Fix: checkup scan tracking auto-update.
108
+ - Fix: update option label copies.
109
+ - Fix: update info links.
110
+ - Fix: admin menu style issues in Firefox.
111
+ - Fix: background color style issues.
112
+ - Fix: conflict with Divi theme.
113
+ - Fix: configuring links destinations when sitewide mode is active.
114
+ - Fix: unifiy analysis status results.
115
+ - Fix: BBPress compatibility issue with generated URLs.
116
+ - Fix: update error strings on import/export issues.
117
+ - Fix: sitemap items listed twice in audit report.
118
+ - Fix: title tag on custom post type archives issue.
119
+ - Fix: conflict with Movedo theme.
120
+ - Fix: do not calculate disabled analysis results.
121
+ - Fix: empty ignore URLs list clears sitemaps.
122
+ - Fix: user name not shown for reporting.
123
+
124
+ 2.1.0.1 - 2017-12-18
125
+ ----------------------------------------------------------------------
126
+ - Fix: Jetpack compatibility issue
127
+
128
+ 2.1 - 2017-12-18
129
+ ----------------------------------------------------------------------
130
+ - Add: complete redesign
131
+ - Add: macros separator support
132
+ - Add: getting started wizard
133
+ - Add: improved OpenGraph controls
134
+ - Add: Twitter cards support
135
+ - Add: schema support
136
+ - Add: Pinterest verification support
137
+ - Add: custom meta elements support
138
+ - Add: linked social accounts support
139
+ - Add: WP Checkup service integration
140
+ - Add: scheduled crawl and checkup support
141
+ - Add: SEO analysis check per post
142
+ - Add: per post readability analysis
143
+ - Add: per post autolinks toggle
144
+ - Add: improved keywords handling with focus keywords
145
+ - Add: ability to import and export settings
146
+ - Add: allow sitemode switching in admin area on network setups
147
+ - Add: attachment page noindex/redirection
148
+
149
+ - Fix: improved previews
150
+ - Fix: OpenGraph compatibility issue with Jetpack
151
+ - Fix: sitemaps issue with alternate cron
152
+ - Fix: additional checks for sitemaps read/write
153
+ - Fix: HHVM compatibility
154
+ - Fix: improve site owner permissions on network setups
155
+
156
+ 2.0.1 - 2017-06-07
157
+ ----------------------------------------------------------------------
158
+ - Add: ability to ignore issues
159
+ - Add: ability to add custom sitemap URLs
160
+ - Add: option to skip strict description check
161
+ - Fix: homepage keywords saving issue
162
+ - Fix: MarketPress coupons conflict
163
+ - Fix: typos
164
+ - Fix: improve admin toolbar item and allow suppression
165
+ - Fix: front-end templating deprecated tags conflict
166
+ - Fix: WooCommerce shop page empty SEO details overrides
167
+
168
+ 2.0 - 2017-02-23
169
+ ----------------------------------------------------------------------
170
+ - New: whole new interface
171
+ - Add: OpenGraph support
172
+ - Add: SEO Audit service support
173
+
174
+ - Fix: deprecated constructors usage
175
+ - Fix: W3TC object cache conflict issue
176
+ - Fix: multiple anonymous post types rendering issue
177
+
178
+ 1.7.6 - 2015-08-25
179
+ ----------------------------------------------------------------------
180
+ - Add advanced robots options info on listing pages.
181
+ - Add redirections info on listing pages.
182
+ - Project name update.
183
+
184
+ 1.7.5 - 2015-08-15
185
+ ----------------------------------------------------------------------
186
+ - Add 301 redirection box permission level to the defaults list.
187
+ - Fix for titles processing in feeds output.
188
+ - Fix and cleanup for post type checks conditionals.
189
+ - Fix for duplicated static front page in sitemaps.
190
+
191
+ 1.7.4 - 2014-12-28
192
+ ----------------------------------------------------------------------
193
+ - Fix duplicates prevention stopping the post autolink expansion.
194
+ - Fix keyword tag detection in autolink expansion replacement.
195
+ - Fix extra whitespaces in autolink replacement expansion.
196
+ - Fix for `set_time_limits` limitations.
197
+
198
+ 1.7.3 - 2014-11-11
199
+ ----------------------------------------------------------------------
200
+ - Fix for some PHP notices.
201
+ - Fix for regex matching points in autolinks detection.
202
+ - Fix for link counts in autolinks matching to prevent clearing results.
203
+ - Fix for maximum single link replacement in post title matching.
204
+
205
+ 1.7.2 - 2014-10-21
206
+ ----------------------------------------------------------------------
207
+ - Fix for boundary matching in an unicode-safe way.
208
+ - Fix for sitemap stylesheet path with SSL enabled.
209
+ - Improved per-site settings mode.
210
+
211
+ 1.7.1 - 2014-07-08
212
+ ----------------------------------------------------------------------
213
+ - Fix for attachment metadata handling.
214
+ - Fix for showing network management level options.
215
+ - Allowing optional partial on-page optimization.
216
+
217
+ 1.7 - 2014-05-22
218
+ ----------------------------------------------------------------------
219
+ - Some typo fixes.
220
+ - Fix for posts with invalid modified dates by forcing timestamps.
221
+ - Added support for global marketplace pages.
222
+
223
+ 1.6.8.1 - 2014-05-10
224
+ ----------------------------------------------------------------------
225
+ - Improving data validation.
226
+ - Fix for BuddyPress pages recognition.
227
+
228
+ 1.6.8 - 2014-02-02
229
+ ----------------------------------------------------------------------
230
+ - Added verification code options.
231
+ - Added experimental features flag.
232
+ - Fix for the settings binding by pushing it up the queue.
233
+
234
+ 1.6.7 - 2013-12-20
235
+ ----------------------------------------------------------------------
236
+ - Exposed the meta description for filtering.
237
+ - Adding in the `nofollow` rel attribute option.
238
+ - Exposing the arguments building for filtering from central location.
239
+ - Exposing the post/term priority filters.
240
+ - Adding separate role settings for 301 redirection box selection.
241
+ - Fix for title length replacement.
242
+ - Fix for default BuddyPress canonicals.
243
+
244
+ 1.6.6 - 2013-08-11
245
+ ----------------------------------------------------------------------
246
+ - Fix for quickedit boxes.
247
+ - Strings update.
248
+
249
+ 1.6.5 - 2013-08-02
250
+ ----------------------------------------------------------------------
251
+ - Converting robots multiple selection box into checbox array.
252
+ - Time-limit skipping switch updated.
253
+
254
+ 1.6.4 - 2013-07-07
255
+ ----------------------------------------------------------------------
256
+ - Postponing the capability checks.
257
+ - Allowing for timeout prevention override.
258
+
259
+ 1.6.3 - 2013-07-06
260
+ ----------------------------------------------------------------------
261
+ - Exposing title for additional filtering.
262
+ - Added blog public sanity check.
263
+ - Counters update.
264
+
265
+ 1.6.2 - 2013-04-14
266
+ ----------------------------------------------------------------------
267
+ - Added subsequent pages robots meta rule.
268
+ - Added meta robots options to search results page.
269
+ - Event delegation update.
270
+ - Fix for SeoMOZ calls bit flags.
271
+
272
+ 1.6.1 - 2013-03-20
273
+ ----------------------------------------------------------------------
274
+ - Fix for metabox access privileges.
275
+ - Better date archives optimization.
276
+
277
+ 1.6 - 2013-02-02
278
+ ----------------------------------------------------------------------
279
+ - Added global meta robots settings for taxonomies.
280
+ - Added conditional unhooking possibility.
281
+ - Allowing per-post sitemap inclusion filtering.
282
+ - Better post types handling.
283
+ - Allowed linking to empty taxonomies.
284
+
285
+ 1.5.4 - 2013-01-13
286
+ ----------------------------------------------------------------------
287
+ - Added custom columns to custom post types list views.
288
+ - Allowing quick edit on custom post types lists.
289
+ - Fix for WooCommerce main shop on-page settings.
290
+
291
+ 1.5.3 - 2013-01-08
292
+ ----------------------------------------------------------------------
293
+ - Fix for BuddyPress installs outside the main site.
294
+ - News keywords support.
295
+
296
+ 1.5.2 - 2012-12-30
297
+ ----------------------------------------------------------------------
298
+ - Fix for autolinks being recognized in shortcodes.
299
+ - Updated the project link.
300
+
301
+ 1.5.1 - 2012-11-02
302
+ ----------------------------------------------------------------------
303
+ - Adding link target options for auto-generated links.
304
+ - Allowed define override for metabox role settings.
305
+ - Propagating autolink fixes by Daniel Speichert (thank you!).
306
+ - Fix for BuddyPress groups page titles.
307
+ - Fix for link in titles insertion issue and safer regex.
308
+
309
+
310
+ 1.5 - 2012-09-08
311
+ ----------------------------------------------------------------------
312
+ - Exposing more hooks.
313
+ - Making admin sitemap auto-update optional.
314
+ - URL differentiation for domain mapped sites.
315
+ - Disabling dashboard widgets for roles below contributor.
316
+
317
+ 1.4.4 - 2012-07-20
318
+ ----------------------------------------------------------------------
319
+ - Fix for special characters in titles.
320
+ - Fix for taxonomies autolinking.
321
+ - Fix for post self-linking.
322
+ - Added maximum autolinks number limit setting.
323
+ - Added quick edit fields.
324
+
325
+ 1.4.3 - 2012-07-08
326
+ ----------------------------------------------------------------------
327
+ - Improved paged output handling.
328
+ - More robust post error handling.
329
+ - Added boolean debug switches.
330
+
331
+ 1.4.2 - 05/26/2012
332
+ ----------------------------------------------------------------------
333
+ - Fix for sitemaps URL resolution on domain-mapped sites
334
+
335
+ 1.4.1 - 05/07/2012
336
+ ----------------------------------------------------------------------
337
+ - Fix for contextual help trigger.
338
+ - Fix for full word auto-linking.
339
+ - Added home page keywords settings.
340
+
341
+ 1.4 - 03/22/2012 Vladislav Bailovic
342
+ ----------------------------------------------------------------------
343
+ - Fix for sitemap path finding.
344
+ - Fix for BuddyPress Groups paging.
345
+ - Improved taxonomies admin output.
346
+ - Improved excerpt generation.
347
+ - Added title and meta rewriting for BuddyPress Groups.
348
+ - Added title and meta rewriting for BuddyPress Profiles.
349
+
350
+ 1.3.7 - 01/20/2012 Vladislav Bailovic
351
+ ----------------------------------------------------------------------
352
+ - Fix for issue with BuddyPress documents plugin.
353
+
354
+ 1.3.6 - 12/22/2011 Vladislav Bailovic
355
+ ----------------------------------------------------------------------
356
+ - Added options for duplicate link prevention.
357
+ - Applied better contextual help trigger.
358
+
359
+ 1.3.5 - 11/29/2011 Vladislav Bailovic
360
+ ----------------------------------------------------------------------
361
+ - Fix for robots meta output interaction with privacy settings.
362
+ - Additional BuddyPress items check.
363
+
364
+ 1.3.4 - 11/24/2011 Vladislav Bailovic
365
+ ----------------------------------------------------------------------
366
+ - Fix for BuddyPress groups support with no groups set up.
367
+ - Added WPML config file.
368
+
369
+ 1.3.3 - 11/17/2011 Vladislav Bailovic
370
+ ----------------------------------------------------------------------
371
+ - Fix for updated SEOMoz links.
372
+ - Fix for BuddyPress groups priority calculation.
373
+
374
+ 1.3.2 - 11/10/2011 Vladislav Bailovic
375
+ ----------------------------------------------------------------------
376
+ - Added BuddyPress groups and profiles in sitemaps.
377
+ - Fixed site validation META headers.
378
+ - Fixed sitemap path finding.
379
+
380
+ 1.3.1 - 11/05/2011 Vladislav Bailovic
381
+ ----------------------------------------------------------------------
382
+ - Fix for sitemap path options.
383
+ - Fix for autolinks issue with titles.
384
+
385
+ 1.3 - 10/25/2011 Vladislav Bailovic
386
+ ----------------------------------------------------------------------
387
+ - Sitemap module rewrite, new sitemap options and dashboard widget.
388
+ - Changed title limit to soft limit.
389
+ - Added priority options for posts.
390
+
391
+ 1.2.1 - 07/16/2011 Vladislav Bailovic
392
+ ----------------------------------------------------------------------
393
+ - Fixed autolink detection for strings that start with an
394
+ non-ascii letter.
395
+
396
+ 1.2 - 07/15/2011 Vladislav Bailovic
397
+ ----------------------------------------------------------------------
398
+ - Added "show tab" option to Network Admin while in sitewide, to apply
399
+ tab permissions once the plugin goes in per-blog mode
400
+ - Added "tags as keywords" checkbox.
401
+ - Keywords as tags working.
402
+ - Fixed issue with SEOmoz dashboard widget not getting the required info.
403
+ - Fixed SEOmoz results caching in transients.
404
+ - Changed sitemap path box to actual input box.
405
+
406
+ 1.1.2 - 06/15/2011 Vladislav Bailovic
407
+ ----------------------------------------------------------------------
408
+ - Fix for issue with apostrophe (and other html special chars)
409
+ in SEO metabox.
410
+
411
+ 1.1.1 - 06/14/2011 Vladislav Bailovic
412
+ ----------------------------------------------------------------------
413
+ - Add htmlemtities and wordpress texturizer alternations for custom
414
+ keywords in Autolinks.
415
+
416
+ 1.1 - 06/13/2011 Vladislav Bailovic
417
+ ----------------------------------------------------------------------
418
+ - Added SEOmoz dashboard widget.
419
+ - Added character couter and limits for SEO metabox.
420
+ - Added meta keywords field to SEO metabox.
421
+ - Fix for WPMU DEV SEO metabox using fixed width.
422
+ - Fix for WDS_SITEWIDE define to toggle per-blog settings availability.
423
+
424
+ 1.0.9.7 - 06/02/2011 Vladislav Bailovic
425
+ ----------------------------------------------------------------------
426
+ - Re-wrote some of the code.
427
+
428
+ 1.0.9.6 - 05/21/2011 Vladislav Bailovic
429
+ ----------------------------------------------------------------------
430
+ - Fixed the the SimplePress incompatibility issue.
431
+
432
+ 1.0.9.5 - 05/15/2011 Vladislav Bailovic
433
+ ----------------------------------------------------------------------
434
+ - Fixed the robots settings display on Page/Post list page.
435
+
436
+ 1.0.9.4 - 05/10/2011 Vladislav Bailovic
437
+ ----------------------------------------------------------------------
438
+ - Normalizing newlines for title rewriting in head buffer.
439
+ - Allowed matching title tags with arguments.
440
+ - Re-introduced `wp_title` filter.
441
+
442
+ 1.0.9.3 - 05/02/2011 Vladislav Bailovic
443
+ ----------------------------------------------------------------------
444
+ - Fixed header detection regular expression.
445
+ - Removed HTML comments.
446
+
447
+ 1.0.9.2 - 05/01/2011 Vladislav Bailovic
448
+ ----------------------------------------------------------------------
449
+ - Added Contributors to both metabox allowed lists.
450
+
451
+ 1.0.9.1 - 04/28/2011 Vladislav Bailovic
452
+ ----------------------------------------------------------------------
453
+ - Fixed title rewriting in feeds
454
+
455
+ 1.0.9 - 04/23/2011 Vladislav Bailovic
456
+ ----------------------------------------------------------------------
457
+ - Forced collapsed state on WDS metaboxes.
458
+ - Deprecated default metabox hiding.
459
+ - Fixed default permission level for showing metaboxes on singular installs.
460
+ - Added WPMU DEV SEO metabox title l10n for Network installs. Singular installs will still see the branding.
461
+
462
+
463
+ 1.0.8 - 04/22/2011 Vladislav Bailovic
464
+ ----------------------------------------------------------------------
465
+ - Fix for relative stylesheet URLs in sitemaps.
466
+ - Fix for generating AND outputing sitemaps, without rebuilding on refresh.
467
+ - Fix for auto-populating settings without admin having to visit the dashboard.
468
+ - Added SEO and SEOmoz metabox toggling options and user displaying permission.
469
+
470
+ 1.0.7 - 04/20/2011 Vladislav Bailovic
471
+ ----------------------------------------------------------------------
472
+ - Fix for title rewriting issues.
473
+
474
+ 1.0.6 - 04/16/2011 Vladislav Bailovic
475
+ ----------------------------------------------------------------------
476
+ - Fix for SEOMoz API data fetching bug (transient data being stuck).
477
+ - Fix for "Error: options page not found" message on multiple options step saves.
478
+ - Updated Title SEO tweak to work with BuddyPress as well.
479
+ - Fix for Sitemaps: using a regex match to determine if the sitemap was requested. Using a relative path to link the XSL stylesheet to it.
480
+ - Added some error checking with is_wp_error
481
+ - Some naming convention consistency fixes for option names.
482
+ - Some PHP fixes.
483
+
484
+ 1.0.5 - 03/25/2011 Aaron Edwards
485
+ ----------------------------------------------------------------------
486
+ - Fixes for PHP 4 incompatibilities
487
+ - Limited posts in sitemap to 1000 most recent to prevent memory errors.
488
+ - Added WDS_SITEMAP_POST_LIMIT define to be able to adjust limit in wp-config
489
+ - Bug fix: Was killing admin help content
490
+
491
+ 1.0.4 - 03/24/2011 Aaron Edwards
492
+ ----------------------------------------------------------------------
493
+ - Fixes to various php errors
494
+ - Increase the time-limit for sitemap creation to work with big blogs
495
+
496
+ 1.0.3 - 03/07/2011
497
+ ----------------------------------------------------------------------
498
+ - Enhancement: store sitemap in wp-content/uploads for main site on
499
+ multisite
500
+
501
+ 1.0.2 - 03/05/2011
502
+ ----------------------------------------------------------------------
503
+ - Bug fix: remove fields added to quick edit which where triggering a
504
+ fatal error
505
+
506
+ 1.0.1 - 03/02/2011
507
+ ----------------------------------------------------------------------
508
+ - Bug fix: sitemap not created on Multisite when blog upload dir doesn't
509
+ exist yet
510
+
511
+ 1.0 - 01/08/2010
512
+ ----------------------------------------------------------------------
513
+ - Initial Release.
class-mappings.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ // Classes in includes/core/
5
+ 'Smartcrawl_AIOSEOP_Importer' => '/core/class-wds-aioseop-importer.php',
6
+ 'Smartcrawl_Checks' => '/core/class-wds-checks.php',
7
+ 'Smartcrawl_Controller_Analysis' => '/core/class-wds-controller-analysis.php',
8
+ 'Smartcrawl_Controller_Cron' => '/core/class-wds-controller-cron.php',
9
+ 'Smartcrawl_Controller_Hub' => '/core/class-wds-controller-hub.php',
10
+ 'Smartcrawl_Controller_IO' => '/core/class-wds-controller-io.php',
11
+ 'Smartcrawl_Controller_Onboard' => '/core/class-wds-controller-onboard.php',
12
+ 'Smartcrawl_Controller_Sitemap' => '/core/class-wds-controller-sitemap.php',
13
+ 'Smartcrawl_Core_Request' => '/core/class-wds-core-request.php',
14
+ 'Smartcrawl_Endpoint_Resolver' => '/core/class-wds-endpoint-resolver.php',
15
+ 'Smartcrawl_Export' => '/core/class-wds-export.php',
16
+ 'Smartcrawl_Html' => '/core/class-wds-html.php',
17
+ 'Smartcrawl_Import' => '/core/class-wds-import.php',
18
+ 'Smartcrawl_Importer' => '/core/class-wds-importer.php',
19
+ 'Smartcrawl_Logger' => '/core/class-wds-logger.php',
20
+ 'Smartcrawl_Macro' => '/core/class-wds-macro.php',
21
+ 'Smartcrawl_Model' => '/core/class-wds-model.php',
22
+ 'Smartcrawl_Model_Analysis' => '/core/class-wds-model-analysis.php',
23
+ 'Smartcrawl_Model_Ignores' => '/core/class-wds-model-ignores.php',
24
+ 'Smartcrawl_Model_IO' => '/core/class-wds-model-io.php',
25
+ 'Smartcrawl_Model_Redirection' => '/core/class-wds-model-redirection.php',
26
+ 'Smartcrawl_Model_User' => '/core/class-wds-model-user.php',
27
+ 'Smartcrawl_Renderable' => '/core/class-wds-renderable.php',
28
+ 'Smartcrawl_Reset' => '/core/class-wds-reset.php',
29
+ 'Smartcrawl_Robots_Value_Helper' => '/core/class-wds-robots-value-helper.php',
30
+ 'Smartcrawl_SeoReport' => '/core/class-wds-seo-report.php',
31
+ 'Smartcrawl_Service' => '/core/class-wds-service.php',
32
+ 'Smartcrawl_Settings' => '/core/class-wds-settings.php',
33
+ 'Smartcrawl_String' => '/core/class-wds-string.php',
34
+ 'Smartcrawl_Type_Traverser' => '/core/class-wds-type-traverser.php',
35
+ 'Smartcrawl_WorkUnit' => '/core/class-wds-work-unit.php',
36
+ 'Smartcrawl_Yoast_Importer' => '/core/class-wds-yoast-importer.php',
37
+ // Classes in includes/core/service/
38
+ 'Smartcrawl_Checkup_Ajax_Service' => '/core/service/class-wds-checkup-ajax-service.php',
39
+ 'Smartcrawl_Checkup_Rest_Service' => '/core/service/class-wds-checkup-rest-service.php',
40
+ 'Smartcrawl_Checkup_Service_Implementation' => '/core/service/class-wds-checkup-service-implementation.php',
41
+ 'Smartcrawl_Checkup_Service' => '/core/service/class-wds-checkup-service.php',
42
+ 'Smartcrawl_Seo_Service' => '/core/service/class-wds-seo-service.php',
43
+ 'Smartcrawl_Site_Service' => '/core/service/class-wds-site-service.php',
44
+ 'Smartcrawl_Uptime_Service' => '/core/service/class-wds-uptime-service.php',
45
+ // Classes in includes/core/checks/
46
+ 'Smartcrawl_Check_Post_Abstract' => '/core/checks/class-wds-check-post-abstract.php',
47
+ 'Smartcrawl_Check_Abstract' => '/core/checks/class-wds-check-abstract.php',
48
+ 'Smartcrawl_Check_Content_Length' => '/core/checks/class-wds-check-content-length.php',
49
+ 'Smartcrawl_Check_Focus' => '/core/checks/class-wds-check-focus.php',
50
+ 'Smartcrawl_Check_Focus_Stopwords' => '/core/checks/class-wds-check-focus-stopwords.php',
51
+ 'Smartcrawl_Check_Imgalts_Keywords' => '/core/checks/class-wds-check-imgalts-keywords.php',
52
+ 'Smartcrawl_Check_Keyword_Density' => '/core/checks/class-wds-check-keyword-density.php',
53
+ 'Smartcrawl_Check_Keywords_Used' => '/core/checks/class-wds-check-keywords-used.php',
54
+ 'Smartcrawl_Check_Links_Count' => '/core/checks/class-wds-check-links-count.php',
55
+ 'Smartcrawl_Check_Metadesc_Keywords' => '/core/checks/class-wds-check-metadesc-keywords.php',
56
+ 'Smartcrawl_Check_Metadesc_Length' => '/core/checks/class-wds-check-metadesc-length.php',
57
+ 'Smartcrawl_Check_Para_Keywords' => '/core/checks/class-wds-check-para-keywords.php',
58
+ 'Smartcrawl_Check_Slug_Keywords' => '/core/checks/class-wds-check-slug-keywords.php',
59
+ 'Smartcrawl_Check_Subheadings_Keywords' => '/core/checks/class-wds-check-subheadings-keywords.php',
60
+ 'Smartcrawl_Check_Title_Keywords' => '/core/checks/class-wds-check-title-keywords.php',
61
+ 'Smartcrawl_Check_Title_Length' => '/core/checks/class-wds-check-title-length.php',
62
+ // Classes in includes/admin/
63
+ 'Smartcrawl_Admin' => '/admin/admin.php',
64
+ 'Smartcrawl_Metabox' => '/admin/metabox.php',
65
+ 'Smartcrawl_Settings_Admin' => '/admin/settings.php',
66
+ 'Smartcrawl_Taxonomy' => '/admin/taxonomy.php',
67
+ // Classes in includes/admin/settings/
68
+ 'Smartcrawl_Autolinks_Settings' => '/admin/settings/autolinks.php',
69
+ 'Smartcrawl_Checkup_Settings' => '/admin/settings/checkup.php',
70
+ 'Smartcrawl_Settings_Dashboard' => '/admin/settings/dashboard.php',
71
+ 'Smartcrawl_Onpage_Settings' => '/admin/settings/onpage.php',
72
+ 'Smartcrawl_Settings_Settings' => '/admin/settings/settings.php',
73
+ 'Smartcrawl_Sitemap_Settings' => '/admin/settings/sitemap.php',
74
+ 'Smartcrawl_Social_Settings' => '/admin/settings/social.php',
75
+ // Classes in includes/tools/
76
+ 'Smartcrawl_Autolinks' => '/tools/autolinks.php',
77
+ 'Smartcrawl_OpenGraph_Printer' => '/tools/class-wds-opengraph-printer.php',
78
+ 'Smartcrawl_Pinterest_Printer' => '/tools/class-wds-pinterest-printer.php',
79
+ 'Smartcrawl_Schema_Printer' => '/tools/class-wds-schema-printer.php',
80
+ 'Smartcrawl_Twitter_Printer' => '/tools/class-wds-twitter-printer.php',
81
+ 'Smartcrawl_OnPage' => '/tools/onpage.php',
82
+ 'Smartcrawl_Redirection_Front' => '/tools/redirect.php',
83
+ 'Smartcrawl_Xml_Sitemap' => '/tools/sitemaps.php',
84
+ 'Smartcrawl_Sitemaps_Dashboard_Widget' => '/tools/sitemaps-dashboard-widget.php',
85
+ 'Smartcrawl_Xml_VideoSitemap' => '/tools/video-sitemaps.php',
86
+ // Classes in includes/tools/seomoz/
87
+ 'SEOMozAPI' => '/tools/seomoz/api.php',
88
+ 'Smartcrawl_Seomoz_Dashboard_Widget' => '/tools/seomoz/dashboard-widget.php',
89
+ 'Smartcrawl_Seomoz_Dashboard_Widget_Renderer' => '/tools/seomoz/widget-renderer.php',
90
+ 'Smartcrawl_Seomoz_Results' => '/tools/seomoz/results.php',
91
+ );
config.php CHANGED
@@ -1,58 +1,90 @@
1
- <?php
2
- /**
3
- * Plugin configuration constants
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- // First up, try to inherit define flags named with legacy prefix.
9
- if ( file_exists( dirname( __FILE__ ) . '/config-pro.php' ) ) {
10
- require_once( dirname( __FILE__ ) . '/config-pro.php' );
11
- }
12
-
13
- /*
14
- By this time, any legacy defines are re-defined with new prefix.
15
- We can carry on as if the new defines have been used all along.
16
- */
17
-
18
- // you can override this in wp-config.php to enable blog-by-blog settings in multisite.
19
- if ( ! defined( 'SMARTCRAWL_SITEWIDE' ) ) { define( 'SMARTCRAWL_SITEWIDE', get_site_option( 'wds_sitewide_mode', true ) ); }
20
-
21
- // you can override this in wp-config.php to enable more posts in the sitemap, but you may need alot of memory.
22
- if ( ! defined( 'SMARTCRAWL_SITEMAP_POST_LIMIT' ) ) { define( 'SMARTCRAWL_SITEMAP_POST_LIMIT', 1000 ); }
23
-
24
- // you can override this in wp-config.php to enable more BuddyPress groups in the sitemap, but you may need alot of memory.
25
- if ( ! defined( 'SMARTCRAWL_BP_GROUPS_LIMIT' ) ) { define( 'SMARTCRAWL_BP_GROUPS_LIMIT', 200 ); }
26
-
27
- // you can override this in wp-config.php to enable more BuddyPress profiles in the sitemap, but you may need alot of memory.
28
- if ( ! defined( 'SMARTCRAWL_BP_PROFILES_LIMIT' ) ) { define( 'SMARTCRAWL_BP_PROFILES_LIMIT', 200 ); }
29
-
30
- // You can override this value in wp-config.php to allow more or less time for caching SEOmoz results.
31
- if ( ! defined( 'SMARTCRAWL_EXPIRE_TRANSIENT_TIMEOUT' ) ) { define( 'SMARTCRAWL_EXPIRE_TRANSIENT_TIMEOUT', 3600 ); }
32
-
33
- // You can override this value in wp-config.php to allow for longer or shorter minimum autolink requirement.
34
- if ( ! defined( 'SMARTCRAWL_AUTOLINKS_DEFAULT_CHAR_LIMIT' ) ) { define( 'SMARTCRAWL_AUTOLINKS_DEFAULT_CHAR_LIMIT', 3 ); }
35
-
36
- // Suppress redundant canonicals?
37
- // if ( ! defined( 'SMARTCRAWL_SUPPRESS_REDUNDANT_CANONICAL' ) ) define( 'SMARTCRAWL_SUPPRESS_REDUNDANT_CANONICAL', false );
38
- // Char counting defines.
39
- if ( ! defined( 'SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT' ) ) { define( 'SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT', 70 ); }
40
- if ( ! defined( 'SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT' ) ) { define( 'SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT', 230 ); }
41
-
42
- // Debugging defines.
43
- if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_IMAGES' ) ) { define( 'SMARTCRAWL_SITEMAP_SKIP_IMAGES', false ); }
44
- if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_TAXONOMIES' ) ) { define( 'SMARTCRAWL_SITEMAP_SKIP_TAXONOMIES', false ); }
45
- if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_SE_NOTIFICATION' ) ) { define( 'SMARTCRAWL_SITEMAP_SKIP_SE_NOTIFICATION', false ); }
46
- if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_ADMIN_UPDATE' ) ) { define( 'SMARTCRAWL_SITEMAP_SKIP_ADMIN_UPDATE', false ); }
47
-
48
- if ( ! defined( 'SMARTCRAWL_EXPERIMENTAL_FEATURES_ON' ) ) { define( 'SMARTCRAWL_EXPERIMENTAL_FEATURES_ON', false ); }
49
- if ( ! defined( 'SMARTCRAWL_ENABLE_LOGGING' ) ) { define( 'SMARTCRAWL_ENABLE_LOGGING', false ); }
50
-
51
- if ( ! defined( 'SMARTCRAWL_WHITELABEL_ON' ) ) { define( 'SMARTCRAWL_WHITELABEL_ON', false ); }
52
- if ( ! defined( 'SMARTCRAWL_OMIT_PORT_MATCHES' ) ) { define( 'SMARTCRAWL_OMIT_PORT_MATCHES', false ); }
53
-
54
- /**
55
- * Setup plugin path and url.
56
- */
57
- define( 'SMARTCRAWL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) . 'includes/' );
58
- define( 'SMARTCRAWL_PLUGIN_URL', plugin_dir_url( __FILE__ ) . 'includes/' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin configuration constants
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ // First up, try to inherit define flags named with legacy prefix.
9
+ if ( file_exists( dirname( __FILE__ ) . '/config-pro.php' ) ) {
10
+ require_once dirname( __FILE__ ) . '/config-pro.php';
11
+ }
12
+
13
+ /*
14
+ By this time, any legacy defines are re-defined with new prefix.
15
+ We can carry on as if the new defines have been used all along.
16
+ */
17
+
18
+ // you can override this in wp-config.php to enable blog-by-blog settings in multisite.
19
+ if ( ! defined( 'SMARTCRAWL_SITEWIDE' ) ) {
20
+ define( 'SMARTCRAWL_SITEWIDE', get_site_option( 'wds_sitewide_mode', true ) );
21
+ }
22
+
23
+ // you can override this in wp-config.php to enable more posts in the sitemap, but you may need alot of memory.
24
+ if ( ! defined( 'SMARTCRAWL_SITEMAP_POST_LIMIT' ) ) {
25
+ define( 'SMARTCRAWL_SITEMAP_POST_LIMIT', 1000 );
26
+ }
27
+
28
+ // you can override this in wp-config.php to enable more BuddyPress groups in the sitemap, but you may need alot of memory.
29
+ if ( ! defined( 'SMARTCRAWL_BP_GROUPS_LIMIT' ) ) {
30
+ define( 'SMARTCRAWL_BP_GROUPS_LIMIT', 200 );
31
+ }
32
+
33
+ // you can override this in wp-config.php to enable more BuddyPress profiles in the sitemap, but you may need alot of memory.
34
+ if ( ! defined( 'SMARTCRAWL_BP_PROFILES_LIMIT' ) ) {
35
+ define( 'SMARTCRAWL_BP_PROFILES_LIMIT', 200 );
36
+ }
37
+
38
+ // You can override this value in wp-config.php to allow more or less time for caching SEOmoz results.
39
+ if ( ! defined( 'SMARTCRAWL_EXPIRE_TRANSIENT_TIMEOUT' ) ) {
40
+ define( 'SMARTCRAWL_EXPIRE_TRANSIENT_TIMEOUT', 3600 );
41
+ }
42
+
43
+ // You can override this value in wp-config.php to allow for longer or shorter minimum autolink requirement.
44
+ if ( ! defined( 'SMARTCRAWL_AUTOLINKS_DEFAULT_CHAR_LIMIT' ) ) {
45
+ define( 'SMARTCRAWL_AUTOLINKS_DEFAULT_CHAR_LIMIT', 3 );
46
+ }
47
+
48
+ // Suppress redundant canonicals?
49
+ // if ( ! defined( 'SMARTCRAWL_SUPPRESS_REDUNDANT_CANONICAL' ) ) define( 'SMARTCRAWL_SUPPRESS_REDUNDANT_CANONICAL', false );
50
+ // Char counting defines.
51
+ if ( ! defined( 'SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT' ) ) {
52
+ define( 'SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT', 70 );
53
+ }
54
+ if ( ! defined( 'SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT' ) ) {
55
+ define( 'SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT', 230 );
56
+ }
57
+
58
+ // Debugging defines.
59
+ if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_IMAGES' ) ) {
60
+ define( 'SMARTCRAWL_SITEMAP_SKIP_IMAGES', false );
61
+ }
62
+ if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_TAXONOMIES' ) ) {
63
+ define( 'SMARTCRAWL_SITEMAP_SKIP_TAXONOMIES', false );
64
+ }
65
+ if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_SE_NOTIFICATION' ) ) {
66
+ define( 'SMARTCRAWL_SITEMAP_SKIP_SE_NOTIFICATION', false );
67
+ }
68
+ if ( ! defined( 'SMARTCRAWL_SITEMAP_SKIP_ADMIN_UPDATE' ) ) {
69
+ define( 'SMARTCRAWL_SITEMAP_SKIP_ADMIN_UPDATE', false );
70
+ }
71
+
72
+ if ( ! defined( 'SMARTCRAWL_EXPERIMENTAL_FEATURES_ON' ) ) {
73
+ define( 'SMARTCRAWL_EXPERIMENTAL_FEATURES_ON', false );
74
+ }
75
+ if ( ! defined( 'SMARTCRAWL_ENABLE_LOGGING' ) ) {
76
+ define( 'SMARTCRAWL_ENABLE_LOGGING', false );
77
+ }
78
+
79
+ if ( ! defined( 'SMARTCRAWL_WHITELABEL_ON' ) ) {
80
+ define( 'SMARTCRAWL_WHITELABEL_ON', false );
81
+ }
82
+ if ( ! defined( 'SMARTCRAWL_OMIT_PORT_MATCHES' ) ) {
83
+ define( 'SMARTCRAWL_OMIT_PORT_MATCHES', false );
84
+ }
85
+
86
+ /**
87
+ * Setup plugin path and url.
88
+ */
89
+ define( 'SMARTCRAWL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) . 'includes/' );
90
+ define( 'SMARTCRAWL_PLUGIN_URL', plugin_dir_url( __FILE__ ) . 'includes/' );
includes/admin/admin.php CHANGED
@@ -1,441 +1,508 @@
1
- <?php
2
- /**
3
- * Admin side handling
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- /**
9
- * Admin handling root class
10
- */
11
- class Smartcrawl_Admin extends Smartcrawl_Renderable {
12
-
13
- /**
14
- * Admin page handlers
15
- *
16
- * @var array
17
- */
18
- private $_handlers = array();
19
-
20
- /**
21
- * Constructor
22
- */
23
- public function __construct() {
24
- $this->init();
25
- }
26
-
27
- /**
28
- * Initializing method
29
- */
30
- private function init() {
31
- // Set up dash.
32
- if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'external/dash/wpmudev-dash-notification.php' ) ) {
33
- global $wpmudev_notices;
34
- if ( ! is_array( $wpmudev_notices ) ) { $wpmudev_notices = array(); }
35
- $wpmudev_notices[] = array(
36
- 'id' => 167,
37
- 'name' => 'SmartCrawl',
38
- 'screens' => array(
39
- 'toplevel_page_wds_wizard-network',
40
- 'toplevel_page_wds_wizard',
41
- 'smartcrawl_page_wds_onpage-network',
42
- 'smartcrawl_page_wds_onpage',
43
- 'smartcrawl_page_wds_sitemap-network',
44
- 'smartcrawl_page_wds_sitemap',
45
- 'smartcrawl_page_wds_settings-network',
46
- 'smartcrawl_page_wds_settings',
47
- 'smartcrawl_page_wds_autolinks-network',
48
- 'smartcrawl_page_wds_autolinks',
49
- 'smartcrawl_page_wds_social-network',
50
- 'smartcrawl_page_wds_social',
51
- ),
52
- );
53
- require_once( SMARTCRAWL_PLUGIN_DIR . 'external/dash/wpmudev-dash-notification.php' );
54
- }
55
-
56
- add_action( 'admin_init', array( $this, 'register_setting' ) );
57
- add_action( 'admin_init', array( $this, 'admin_master_reset' ) );
58
- add_filter( 'whitelist_options', array( $this, 'save_options' ), 20 );
59
-
60
- add_action( 'wp_ajax_wds_dismiss_message', array( $this, 'smartcrawl_dismiss_message' ) );
61
- add_action( 'wp_ajax_wds-user-search', array( $this, 'json_user_search' ) );
62
- add_action( 'wp_ajax_wds-user-search-add-user', array( $this, 'json_user_search_add_user' ) );
63
-
64
- if ( Smartcrawl_Settings::get_setting( 'extras-admin_bar' ) ) {
65
- add_action( 'admin_bar_menu', array( $this, 'add_toolbar_items' ), 99 );
66
- }
67
-
68
- add_filter( 'plugin_action_links_' . SMARTCRAWL_PLUGIN_BASENAME, array( $this, 'add_settings_link' ) );
69
-
70
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings.php' );
71
- require_once SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_service.php';
72
-
73
- $smartcrawl_options = Smartcrawl_Settings::get_options();
74
-
75
- // Sanity check first!
76
- if ( ! get_option( 'blog_public' ) ) {
77
- add_action( 'admin_notices', array( $this, 'blog_not_public_notice' ) );
78
- }
79
-
80
- if ( ! empty( $smartcrawl_options['access-id'] ) && ! empty( $smartcrawl_options['secret-key'] ) ) {
81
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/seomoz/api.php' );
82
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/seomoz/results.php' );
83
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/seomoz/dashboard-widget.php' );
84
- }
85
-
86
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/dashboard.php' );
87
- $this->_handlers['dashboard'] = Smartcrawl_Settings_Dashboard::get_instance();
88
-
89
- if ( Smartcrawl_Settings::get_setting( 'checkup' ) ) {
90
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/checkup.php' );
91
- $this->_handlers['checkup'] = Smartcrawl_Checkup_Settings::get_instance();
92
- }
93
-
94
- if ( Smartcrawl_Settings::get_setting( 'onpage' ) ) {
95
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/onpage.php' );
96
- $this->_handlers['onpage'] = Smartcrawl_Onpage_Settings::get_instance();
97
- }
98
-
99
- if ( Smartcrawl_Settings::get_setting( 'social' ) ) {
100
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/social.php' );
101
- $this->_handlers['social'] = Smartcrawl_Social_Settings::get_instance();
102
- }
103
-
104
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/sitemaps.php' );
105
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/sitemap.php' );
106
- $this->_handlers['sitemap'] = Smartcrawl_Sitemap_Settings::get_instance();
107
- if ( Smartcrawl_Settings::get_setting( 'sitemap' ) ) {
108
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/sitemaps-dashboard-widget.php' );
109
- }
110
-
111
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/autolinks.php' );
112
- $this->_handlers['autolinks'] = Smartcrawl_Autolinks_Settings::get_instance();
113
-
114
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/settings/settings.php' );
115
- $this->_handlers['settings'] = Smartcrawl_Settings_Settings::get_instance();
116
-
117
- if (
118
- ! class_exists( 'Smartcrawl_Controller_Onboard' ) &&
119
- file_exists( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_controller_onboard.php' )
120
- ) {
121
- require_once( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_controller_onboard.php' );
122
- Smartcrawl_Controller_Onboard::serve();
123
- }
124
-
125
- if (
126
- ! class_exists( 'Smartcrawl_Controller_Analysis' ) &&
127
- file_exists( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_controller_analysis.php' )
128
- ) {
129
- require_once( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_controller_analysis.php' );
130
- Smartcrawl_Controller_Analysis::serve();
131
- }
132
-
133
- if ( Smartcrawl_Settings::get_setting( 'onpage' ) ) {
134
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/metabox.php' );
135
- require_once( SMARTCRAWL_PLUGIN_DIR . 'admin/taxonomy.php' );
136
- }
137
- }
138
-
139
- /**
140
- * Adds settings plugin action link
141
- *
142
- * @param array $links Action links list.
143
- *
144
- * @return array Augmented action links
145
- */
146
- public function add_settings_link( $links ) {
147
- if ( ! is_array( $links ) ) { return $links; }
148
-
149
- $links[] = sprintf(
150
- '<a href="%s">%s</a>',
151
- esc_url( add_query_arg( 'page', Smartcrawl_Settings::TAB_DASHBOARD, admin_url( 'admin.php' ) ) ),
152
- esc_html( __( 'Settings', 'wds' ) )
153
- );
154
-
155
- return $links;
156
- }
157
-
158
- /**
159
- * Saves the submitted options
160
- *
161
- * @param mixed $whitelist_options Options.
162
- *
163
- * @return array
164
- */
165
- public function save_options( $whitelist_options ) {
166
- global $action;
167
-
168
- $smartcrawl_pages = array(
169
- 'wds_settings_options',
170
- 'wds_autolinks_options',
171
- 'wds_onpage_options',
172
- 'wds_sitemap_options',
173
- 'wds_seomoz_options',
174
- 'wds_social_options',
175
- 'wds_redirections_options',
176
- 'wds_checkup_options',
177
- );
178
- if ( is_multisite() && SMARTCRAWL_SITEWIDE == true && 'update' == $action && isset( $_POST['option_page'] ) && in_array( $_POST['option_page'], $smartcrawl_pages ) ) {
179
- global $option_page;
180
-
181
- check_admin_referer( $option_page . '-options' );
182
-
183
- if ( ! isset( $whitelist_options[ $option_page ] ) ) {
184
- wp_die( __( 'Error: options page not found.' , 'wds' ) );
185
- }
186
-
187
- $options = $whitelist_options[ $option_page ];
188
-
189
- if ( $options && is_array( $options ) ) {
190
- foreach ( $options as $option ) {
191
- $option = trim( $option );
192
- $value = null;
193
- if ( isset( $_POST[ $option ] ) ) {
194
- $value = $_POST[ $option ];
195
- }
196
- if ( ! is_array( $value ) ) {
197
- $value = trim( $value );
198
- }
199
- $value = stripslashes_deep( $value );
200
-
201
- // Sanitized/validated via sanitize_option_<option_page>.
202
- // See each of the admin classes validate method.
203
- update_site_option( $option, $value );
204
- }
205
- }
206
-
207
- $errors = get_settings_errors();
208
- set_transient( 'wds-settings-save-errors' , $errors, 30 );
209
-
210
- $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
211
- wp_safe_redirect( $goback );
212
- die;
213
- }
214
-
215
- return $whitelist_options;
216
- }
217
-
218
- /**
219
- * Admin page handler getter
220
- *
221
- * @param string $hndl Handler to get.
222
- *
223
- * @return object Handler
224
- */
225
- public function get_handler( $hndl ) {
226
- return isset( $this->_handlers[ $hndl ] )
227
- ? $this->_handlers[ $hndl ]
228
- : $this
229
- ;
230
- }
231
-
232
- /**
233
- * Admin reset options switch processing
234
- *
235
- * @return bool|void
236
- */
237
- public function admin_master_reset() {
238
- if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) { return false; }
239
- if ( ! is_multisite() && ! current_user_can( 'manage_options' ) ) { return false; }
240
-
241
- if ( isset( $_GET['wds-reset'] ) ) { // Simple presence switch, no value needed.
242
- require_once( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_reset.php' );
243
- Smartcrawl_Reset::reset();
244
- wp_safe_redirect( add_query_arg( 'wds-reset-reload', 'true', remove_query_arg( 'wds-reset' ) ) );
245
- die;
246
- }
247
-
248
- if ( isset( $_GET['wds-reset-reload'] ) ) { // Simple presence switch, no value needed.
249
- wp_safe_redirect( remove_query_arg( 'wds-reset-reload' ) );
250
- die;
251
- }
252
-
253
- return false;
254
- }
255
-
256
- /**
257
- * Brute-register all the settings.
258
- *
259
- * If we got this far, this is a sane thing to do.
260
- * This overrides the `Smartcrawl_Core_Admin::register_setting()`.
261
- *
262
- * In response to "Unable to save options multiple times" bug.
263
- */
264
- public function register_setting() {
265
- register_setting( 'wds_settings_options', 'wds_settings_options', array( $this->get_handler( 'settings' ), 'validate' ) );
266
- register_setting( 'wds_sitemap_options', 'wds_sitemap_options', array( $this->get_handler( 'sitemap' ), 'validate' ) );
267
- register_setting( 'wds_onpage_options', 'wds_onpage_options', array( $this->get_handler( 'onpage' ), 'validate' ) );
268
- register_setting( 'wds_social_options', 'wds_social_options', array( $this->get_handler( 'social' ), 'validate' ) );
269
- register_setting( 'wds_autolinks_options', 'wds_autolinks_options', array( $this->get_handler( 'autolinks' ), 'validate' ) );
270
- register_setting( 'wds_redirections_options', 'wds_redirections_options', array( $this->get_handler( 'redirections' ), 'validate' ) );
271
- register_setting( 'wds_checkup_options', 'wds_checkup_options', array( $this->get_handler( 'checkup' ), 'validate' ) );
272
- }
273
-
274
- /**
275
- * Adds admin toolbar items
276
- *
277
- * @param object $bar Admin toolbar object.
278
- */
279
- public function add_toolbar_items( $bar ) {
280
- if ( empty( $bar ) || ! function_exists( 'is_admin_bar_showing' ) ) { return false; }
281
- if ( ! is_admin_bar_showing() ) { return false; }
282
-
283
- if ( ! apply_filters( 'wds-admin-ui-show_bar', true ) ) { return false; }
284
-
285
- // Do not show if sitewide and we're not super admin.
286
- if ( defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE && ! is_super_admin() ) { return false; }
287
-
288
- $root = array(
289
- 'id' => 'wds-root',
290
- 'title' => __( 'SmartCrawl', 'wds' ),
291
- );
292
- $bar->add_node( $root );
293
- foreach ( $this->_handlers as $handler ) {
294
- if ( empty( $handler ) || empty( $handler->slug ) ) { continue; }
295
-
296
- if ( ! (defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE) && ! is_super_admin() ) {
297
- if ( ! Smartcrawl_Settings_Admin::is_tab_allowed( $handler->slug ) ) { continue; }
298
- }
299
-
300
- $href = (
301
- defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' )
302
- ) . '?page=' . $handler->slug;
303
- $bar->add_node(array(
304
- 'id' => $root['id'] . '.' . $handler->slug,
305
- 'parent' => $root['id'],
306
- 'title' => $handler->title,
307
- 'href' => $href,
308
- ));
309
- }
310
- }
311
-
312
- /**
313
- * Validate user data for some/all of your input fields
314
- *
315
- * @param mixed $input Raw input.
316
- */
317
- public function validate( $input ) {
318
- return $input; // return validated input.
319
- }
320
-
321
- /**
322
- * Shows blog not being public notice.
323
- */
324
- public function blog_not_public_notice() {
325
- if ( ! current_user_can( 'manage_options' ) ) { return false; }
326
-
327
- echo '<div class="notice-error notice is-dismissible"><p>' .
328
- sprintf( __( 'This site discourages search engines from indexing the pages, which will affect your SEO efforts. <a href="%s">You can fix this here</a>', 'wds' ), admin_url( '/options-reading.php' ) ) .
329
- '</p></div>';
330
-
331
- }
332
-
333
- /**
334
- * Process message dismissal request
335
- */
336
- public function smartcrawl_dismiss_message() {
337
- $message = sanitize_key( smartcrawl_get_array_value( $_POST, 'message' ) );
338
- if ( null === $message ) {
339
- wp_send_json_error();
340
- return;
341
- }
342
-
343
- $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
344
- $dismissed_messages = '' === $dismissed_messages ? array() : $dismissed_messages;
345
- $dismissed_messages[ $message ] = true;
346
- update_user_meta( get_current_user_id(), 'wds_dismissed_messages', $dismissed_messages );
347
- }
348
-
349
- /**
350
- * Process user search requests
351
- */
352
- public function json_user_search() {
353
- $result = array( 'success' => false );
354
- if ( ! current_user_can( 'edit_users' ) ) {
355
- wp_send_json( $result );
356
- die;
357
- }
358
-
359
- $params = stripslashes_deep( $_GET );
360
- $query = sanitize_text_field( smartcrawl_get_array_value( $params, 'query' ) );
361
-
362
- if ( ! $query ) {
363
- wp_send_json( $result );
364
- die();
365
- }
366
-
367
- $users = get_users(array(
368
- 'search' => '*' . $params['query'] . '*',
369
- 'fields' => 'all_with_meta',
370
- ));
371
-
372
- $return_users = array();
373
- foreach ( $users as $user ) {
374
- $return_users[] = array(
375
- 'id' => $user->get( 'ID' ),
376
- 'text' => $user->get( 'display_name' ),
377
- );
378
- }
379
- $result['items'] = $return_users;
380
-
381
- wp_send_json( $result );
382
- }
383
-
384
- /**
385
- * Handles user search requests
386
- */
387
- public function json_user_search_add_user() {
388
- $result = array( 'success' => false );
389
- if ( ! current_user_can( 'edit_users' ) ) {
390
- wp_send_json( $result );
391
- die;
392
- }
393
-
394
- $params = stripslashes_deep( $_POST );
395
-
396
- $option_name = sanitize_key( smartcrawl_get_array_value( $params, 'option_name' ) );
397
- $users_key = sanitize_key( smartcrawl_get_array_value( $params, 'users_key' ) );
398
- $new_user_key = sanitize_key( smartcrawl_get_array_value( $params, 'new_user_key' ) );
399
-
400
- $user_search_options = smartcrawl_get_array_value( $params, $option_name );
401
- $email_recipients = smartcrawl_get_array_value( $user_search_options, $users_key );
402
- $new_user = sanitize_text_field( smartcrawl_get_array_value( $user_search_options, $new_user_key ) );
403
-
404
- if ( null === $new_user ) {
405
- wp_send_json( $result );
406
- return;
407
- }
408
-
409
- if ( ! is_array( $email_recipients ) ) {
410
- $email_recipients = array();
411
- } else {
412
- $email_recipients = array_filter( array_map( 'sanitize_text_field', $email_recipients ) );
413
- }
414
-
415
- if ( ! in_array( $new_user, $email_recipients ) ) {
416
- $email_recipients[] = $new_user;
417
- }
418
-
419
- $new_markup = $this->_load('user-search', array(
420
- 'users' => $email_recipients,
421
- 'option_name' => $option_name,
422
- 'users_key' => $users_key,
423
- 'new_user_key' => $new_user_key,
424
- ));
425
-
426
- $result['user_search'] = $new_markup;
427
- $result['success'] = true;
428
-
429
- wp_send_json( $result );
430
- }
431
-
432
- /**
433
- * Gets inherited view defaults
434
- */
435
- protected function _get_view_defaults() {
436
- return array();
437
- }
438
- }
439
-
440
- $Smartcrawl_Admin = new Smartcrawl_Admin();
441
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin side handling
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Admin handling root class
10
+ */
11
+ class Smartcrawl_Admin extends Smartcrawl_Renderable {
12
+
13
+ /**
14
+ * Admin page handlers
15
+ *
16
+ * @var array
17
+ */
18
+ private $_handlers = array();
19
+
20
+ /**
21
+ * Constructor
22
+ */
23
+ public function __construct() {
24
+ $this->init();
25
+ }
26
+
27
+ /**
28
+ * Initializing method
29
+ */
30
+ private function init() {
31
+ // Set up dash.
32
+ if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'external/dash/wpmudev-dash-notification.php' ) ) {
33
+ global $wpmudev_notices;
34
+ if ( ! is_array( $wpmudev_notices ) ) {
35
+ $wpmudev_notices = array();
36
+ }
37
+ $wpmudev_notices[] = array(
38
+ 'id' => 167,
39
+ 'name' => 'SmartCrawl',
40
+ 'screens' => array(
41
+ 'smartcrawl_page_wds_onpage-network',
42
+ 'smartcrawl_page_wds_onpage',
43
+ 'smartcrawl_page_wds_sitemap-network',
44
+ 'smartcrawl_page_wds_sitemap',
45
+ 'smartcrawl_page_wds_settings-network',
46
+ 'smartcrawl_page_wds_settings',
47
+ 'smartcrawl_page_wds_autolinks-network',
48
+ 'smartcrawl_page_wds_autolinks',
49
+ 'smartcrawl_page_wds_social-network',
50
+ 'smartcrawl_page_wds_social',
51
+ ),
52
+ );
53
+ require_once SMARTCRAWL_PLUGIN_DIR . 'external/dash/wpmudev-dash-notification.php';
54
+ }
55
+
56
+ add_action( 'admin_init', array( $this, 'register_setting' ) );
57
+ add_action( 'admin_init', array( $this, 'admin_master_reset' ) );
58
+ add_filter( 'whitelist_options', array( $this, 'save_options' ), 20 );
59
+ add_filter( 'load-index.php', array( $this, 'enqueue_dashboard_resources' ), 20 );
60
+
61
+ add_action( 'wp_ajax_wds_dismiss_message', array( $this, 'smartcrawl_dismiss_message' ) );
62
+ add_action( 'wp_ajax_wds-user-search', array( $this, 'json_user_search' ) );
63
+ add_action( 'wp_ajax_wds-user-search-add-user', array( $this, 'json_user_search_add_user' ) );
64
+
65
+ if ( Smartcrawl_Settings::get_setting( 'extras-admin_bar' ) ) {
66
+ add_action( 'admin_bar_menu', array( $this, 'add_toolbar_items' ), 99 );
67
+ }
68
+
69
+ add_filter( 'plugin_action_links_' . SMARTCRAWL_PLUGIN_BASENAME, array( $this, 'add_settings_link' ) );
70
+
71
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
72
+
73
+ // Sanity check first!
74
+ if ( ! get_option( 'blog_public' ) ) {
75
+ add_action( 'admin_notices', array( $this, 'blog_not_public_notice' ) );
76
+ }
77
+
78
+ if ( ! empty( $smartcrawl_options['access-id'] ) && ! empty( $smartcrawl_options['secret-key'] ) ) {
79
+ Smartcrawl_Seomoz_Results::run();
80
+ Smartcrawl_Seomoz_Dashboard_Widget::run();
81
+ }
82
+
83
+ $this->_handlers['dashboard'] = Smartcrawl_Settings_Dashboard::get_instance();
84
+
85
+ if ( Smartcrawl_Settings::get_setting( 'checkup' ) ) {
86
+ $this->_handlers['checkup'] = Smartcrawl_Checkup_Settings::get_instance();
87
+ }
88
+
89
+ if ( Smartcrawl_Settings::get_setting( 'onpage' ) ) {
90
+ $this->_handlers['onpage'] = Smartcrawl_Onpage_Settings::get_instance();
91
+ }
92
+
93
+ if ( Smartcrawl_Settings::get_setting( 'social' ) ) {
94
+ $this->_handlers['social'] = Smartcrawl_Social_Settings::get_instance();
95
+ }
96
+
97
+ $this->_handlers['sitemap'] = Smartcrawl_Sitemap_Settings::get_instance();
98
+ if ( Smartcrawl_Settings::get_setting( 'sitemap' ) ) {
99
+ Smartcrawl_Xml_Sitemap::run();
100
+ Smartcrawl_Sitemaps_Dashboard_Widget::run();
101
+ }
102
+
103
+ $this->_handlers['autolinks'] = Smartcrawl_Autolinks_Settings::get_instance();
104
+
105
+ $this->_handlers['settings'] = Smartcrawl_Settings_Settings::get_instance();
106
+
107
+ Smartcrawl_Controller_Onboard::serve();
108
+ Smartcrawl_Controller_Analysis::serve();
109
+
110
+ if ( Smartcrawl_Settings::get_setting( 'onpage' ) ) {
111
+ Smartcrawl_Metabox::run();
112
+ Smartcrawl_Taxonomy::run();
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Adds settings plugin action link
118
+ *
119
+ * @param array $links Action links list.
120
+ *
121
+ * @return array Augmented action links
122
+ */
123
+ public function add_settings_link( $links ) {
124
+ if ( ! is_array( $links ) ) {
125
+ return $links;
126
+ }
127
+
128
+ $links[] = sprintf(
129
+ '<a href="%s">%s</a>',
130
+ esc_url( add_query_arg( 'page', Smartcrawl_Settings::TAB_DASHBOARD, admin_url( 'admin.php' ) ) ),
131
+ esc_html( __( 'Settings', 'wds' ) )
132
+ );
133
+
134
+ return $links;
135
+ }
136
+
137
+ /**
138
+ * Saves the submitted options
139
+ *
140
+ * @param mixed $whitelist_options Options.
141
+ *
142
+ * @return array
143
+ */
144
+ public function save_options( $whitelist_options ) {
145
+ global $action;
146
+
147
+ $smartcrawl_pages = array(
148
+ 'wds_settings_options',
149
+ 'wds_autolinks_options',
150
+ 'wds_onpage_options',
151
+ 'wds_sitemap_options',
152
+ 'wds_social_options',
153
+ 'wds_redirections_options',
154
+ 'wds_checkup_options',
155
+ );
156
+ $data = isset( $_POST['_wpnonce'], $_POST['option_page'] ) && wp_verify_nonce( $_POST['_wpnonce'], $_POST['option_page'] . '-options' )
157
+ ? stripslashes_deep( $_POST )
158
+ : array();
159
+
160
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE && 'update' === $action && in_array( $data['option_page'], $smartcrawl_pages, true ) ) {
161
+ global $option_page;
162
+
163
+ check_admin_referer( $option_page . '-options' );
164
+
165
+ if ( ! isset( $whitelist_options[ $option_page ] ) ) {
166
+ wp_die( esc_html__( 'Error: options page not found.', 'wds' ) );
167
+ }
168
+
169
+ $options = $whitelist_options[ $option_page ];
170
+
171
+ if ( $options && is_array( $options ) ) {
172
+ foreach ( $options as $option ) {
173
+ $option = trim( $option );
174
+ $value = null;
175
+ if ( isset( $data[ $option ] ) ) {
176
+ $value = $data[ $option ];
177
+ }
178
+ if ( ! is_array( $value ) ) {
179
+ $value = trim( $value );
180
+ }
181
+ $value = stripslashes_deep( $value );
182
+
183
+ // Sanitized/validated via sanitize_option_<option_page>.
184
+ // See each of the admin classes validate method.
185
+ update_site_option( $option, $value );
186
+ }
187
+ }
188
+
189
+ $errors = get_settings_errors();
190
+ set_transient( 'wds-settings-save-errors', $errors, 30 );
191
+
192
+ $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
193
+ wp_safe_redirect( $goback );
194
+ die;
195
+ }
196
+
197
+ return $whitelist_options;
198
+ }
199
+
200
+ /**
201
+ * Admin reset options switch processing
202
+ *
203
+ * @return bool|void
204
+ */
205
+ public function admin_master_reset() {
206
+ if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
207
+ return false;
208
+ }
209
+ if ( ! is_multisite() && ! current_user_can( 'manage_options' ) ) {
210
+ return false;
211
+ }
212
+
213
+ // phpcs:ignore
214
+ if ( isset( $_GET['wds-reset'] ) ) { // Simple presence switch, no value needed.
215
+ Smartcrawl_Reset::reset();
216
+ wp_safe_redirect( add_query_arg( 'wds-reset-reload', 'true', remove_query_arg( 'wds-reset' ) ) );
217
+ die;
218
+ }
219
+
220
+ // phpcs:ignore
221
+ if ( isset( $_GET['wds-reset-reload'] ) ) { // Simple presence switch, no value needed.
222
+ wp_safe_redirect( remove_query_arg( 'wds-reset-reload' ) );
223
+ die;
224
+ }
225
+
226
+ return false;
227
+ }
228
+
229
+ /**
230
+ * Brute-register all the settings.
231
+ *
232
+ * If we got this far, this is a sane thing to do.
233
+ * This overrides the `Smartcrawl_Core_Admin::register_setting()`.
234
+ *
235
+ * In response to "Unable to save options multiple times" bug.
236
+ */
237
+ public function register_setting() {
238
+ register_setting( 'wds_settings_options', 'wds_settings_options', array(
239
+ $this->get_handler( 'settings' ),
240
+ 'validate',
241
+ ) );
242
+ register_setting( 'wds_sitemap_options', 'wds_sitemap_options', array(
243
+ $this->get_handler( 'sitemap' ),
244
+ 'validate',
245
+ ) );
246
+ register_setting( 'wds_onpage_options', 'wds_onpage_options', array(
247
+ $this->get_handler( 'onpage' ),
248
+ 'validate',
249
+ ) );
250
+ register_setting( 'wds_social_options', 'wds_social_options', array(
251
+ $this->get_handler( 'social' ),
252
+ 'validate',
253
+ ) );
254
+ register_setting( 'wds_autolinks_options', 'wds_autolinks_options', array(
255
+ $this->get_handler( 'autolinks' ),
256
+ 'validate',
257
+ ) );
258
+ register_setting( 'wds_redirections_options', 'wds_redirections_options', array(
259
+ $this->get_handler( 'redirections' ),
260
+ 'validate',
261
+ ) );
262
+ register_setting( 'wds_checkup_options', 'wds_checkup_options', array(
263
+ $this->get_handler( 'checkup' ),
264
+ 'validate',
265
+ ) );
266
+ }
267
+
268
+ /**
269
+ * Admin page handler getter
270
+ *
271
+ * @param string $hndl Handler to get.
272
+ *
273
+ * @return object Handler
274
+ */
275
+ public function get_handler( $hndl ) {
276
+ return isset( $this->_handlers[ $hndl ] )
277
+ ? $this->_handlers[ $hndl ]
278
+ : $this;
279
+ }
280
+
281
+ /**
282
+ * Adds admin toolbar items
283
+ *
284
+ * @param object $admin_bar Admin toolbar object.
285
+ *
286
+ * @return bool
287
+ */
288
+ public function add_toolbar_items( $admin_bar ) {
289
+ if ( empty( $admin_bar ) || ! function_exists( 'is_admin_bar_showing' ) ) {
290
+ return false;
291
+ }
292
+ if ( ! is_admin_bar_showing() ) {
293
+ return false;
294
+ }
295
+ if ( ! apply_filters( 'wds-admin-ui-show_bar', true ) ) {
296
+ return false;
297
+ }
298
+ // Do not show if sitewide and we're not super admin.
299
+ if ( smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) && ! is_super_admin() ) {
300
+ return false;
301
+ }
302
+
303
+ $optional_nodes = array();
304
+ foreach ( $this->_handlers as $handler ) {
305
+ if ( empty( $handler ) || empty( $handler->slug ) ) {
306
+ continue;
307
+ }
308
+
309
+ if ( ! $this->is_admin_bar_node_allowed( $handler->slug ) ) {
310
+ continue;
311
+ }
312
+
313
+ $optional_nodes[] = $this->create_admin_bar_node( $handler->slug, $handler->title );
314
+ }
315
+
316
+ if ( ! empty( $optional_nodes ) ) {
317
+ $admin_bar->add_node( $this->create_admin_bar_node( Smartcrawl_Settings::TAB_DASHBOARD, __( 'SmartCrawl', 'wds' ) ) );
318
+ $admin_bar->add_node( $this->create_admin_bar_node( Smartcrawl_Settings::TAB_DASHBOARD . '_dashboard', __( 'Dashboard', 'wds' ), Smartcrawl_Settings::TAB_DASHBOARD ) );
319
+ foreach ( $optional_nodes as $optional_node ) {
320
+ $admin_bar->add_node( $optional_node );
321
+ }
322
+ }
323
+
324
+ return true;
325
+ }
326
+
327
+ private function is_admin_bar_node_allowed( $slug ) {
328
+ // If sitewide is off
329
+ if ( ! smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) && is_multisite() ) {
330
+ if (
331
+ // and this is network admin then pages other than the settings page are not allowed
332
+ ( is_network_admin() && Smartcrawl_Settings::TAB_SETTINGS !== $slug )
333
+ // if this is a sub-site then the page is not allowed if it is disabled in the settings
334
+ || ( ! is_network_admin() && ! Smartcrawl_Settings_Admin::is_tab_allowed( $slug ) )
335
+ ) {
336
+ return false;
337
+ }
338
+ }
339
+
340
+ return true;
341
+ }
342
+
343
+ private function create_admin_bar_node( $id, $title, $slug = '' ) {
344
+ $node = array(
345
+ 'id' => $id,
346
+ 'title' => $title,
347
+ 'href' => sprintf(
348
+ '%s?page=%s',
349
+ smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ),
350
+ empty( $slug ) ? $id : $slug
351
+ ),
352
+ );
353
+
354
+ if ( Smartcrawl_Settings::TAB_DASHBOARD !== $id ) {
355
+ $node['parent'] = Smartcrawl_Settings::TAB_DASHBOARD;
356
+ }
357
+
358
+ return $node;
359
+ }
360
+
361
+ /**
362
+ * Validate user data for some/all of your input fields
363
+ *
364
+ * @param mixed $input Raw input.
365
+ */
366
+ public function validate( $input ) {
367
+ return $input; // return validated input.
368
+ }
369
+
370
+ /**
371
+ * Shows blog not being public notice.
372
+ */
373
+ public function blog_not_public_notice() {
374
+ if ( ! current_user_can( 'manage_options' ) ) {
375
+ return false;
376
+ }
377
+
378
+ $message = sprintf(
379
+ '%1$s <a href="%3$s">%2$s</a>',
380
+ esc_html__( 'This site discourages search engines from indexing the pages, which will affect your SEO efforts.', 'wds' ),
381
+ esc_html__( 'You can fix this here', 'wds' ),
382
+ admin_url( '/options-reading.php' )
383
+ );
384
+
385
+ echo '<div class="notice-error notice is-dismissible"><p>' . wp_kses_post( $message ) . '</p></div>';
386
+ }
387
+
388
+ /**
389
+ * Process message dismissal request
390
+ */
391
+ public function smartcrawl_dismiss_message() {
392
+ $data = $this->get_request_data();
393
+ $message = sanitize_key( smartcrawl_get_array_value( $data, 'message' ) );
394
+ if ( null === $message ) {
395
+ wp_send_json_error();
396
+
397
+ return;
398
+ }
399
+
400
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
401
+ $dismissed_messages = '' === $dismissed_messages ? array() : $dismissed_messages;
402
+ $dismissed_messages[ $message ] = true;
403
+ update_user_meta( get_current_user_id(), 'wds_dismissed_messages', $dismissed_messages );
404
+ wp_send_json_success();
405
+ }
406
+
407
+ /**
408
+ * Process user search requests
409
+ */
410
+ public function json_user_search() {
411
+ $result = array( 'success' => false );
412
+ if ( ! current_user_can( 'edit_users' ) ) {
413
+ wp_send_json( $result );
414
+ die;
415
+ }
416
+
417
+ $params = $this->get_request_data();
418
+ $query = sanitize_text_field( smartcrawl_get_array_value( $params, 'query' ) );
419
+
420
+ if ( ! $query ) {
421
+ wp_send_json( $result );
422
+ die();
423
+ }
424
+
425
+ $users = get_users( array(
426
+ 'search' => '*' . $params['query'] . '*',
427
+ 'fields' => 'all_with_meta',
428
+ ) );
429
+
430
+ $return_users = array();
431
+ foreach ( $users as $user ) {
432
+ $return_users[] = array(
433
+ 'id' => $user->get( 'ID' ),
434
+ 'text' => $user->get( 'display_name' ),
435
+ );
436
+ }
437
+ $result['items'] = $return_users;
438
+
439
+ wp_send_json( $result );
440
+ }
441
+
442
+ /**
443
+ * Handles user search requests
444
+ */
445
+ public function json_user_search_add_user() {
446
+ $result = array( 'success' => false );
447
+ if ( ! current_user_can( 'edit_users' ) ) {
448
+ wp_send_json( $result );
449
+ die;
450
+ }
451
+
452
+ $params = $this->get_request_data();
453
+
454
+ $option_name = sanitize_key( smartcrawl_get_array_value( $params, 'option_name' ) );
455
+ $users_key = sanitize_key( smartcrawl_get_array_value( $params, 'users_key' ) );
456
+ $new_user_key = sanitize_key( smartcrawl_get_array_value( $params, 'new_user_key' ) );
457
+
458
+ $user_search_options = smartcrawl_get_array_value( $params, $option_name );
459
+ $email_recipients = smartcrawl_get_array_value( $user_search_options, $users_key );
460
+ $new_user = sanitize_text_field( smartcrawl_get_array_value( $user_search_options, $new_user_key ) );
461
+
462
+ if ( null === $new_user ) {
463
+ wp_send_json( $result );
464
+
465
+ return;
466
+ }
467
+
468
+ if ( ! is_array( $email_recipients ) ) {
469
+ $email_recipients = array();
470
+ } else {
471
+ $email_recipients = array_filter( array_map( 'sanitize_text_field', $email_recipients ) );
472
+ }
473
+
474
+ if ( ! in_array( $new_user, $email_recipients, true ) ) {
475
+ $email_recipients[] = $new_user;
476
+ }
477
+
478
+ $new_markup = $this->_load( 'user-search', array(
479
+ 'users' => $email_recipients,
480
+ 'option_name' => $option_name,
481
+ 'users_key' => $users_key,
482
+ 'new_user_key' => $new_user_key,
483
+ ) );
484
+
485
+ $result['user_search'] = $new_markup;
486
+ $result['success'] = true;
487
+
488
+ wp_send_json( $result );
489
+ }
490
+
491
+ public function enqueue_dashboard_resources() {
492
+ wp_enqueue_style( 'wds-wp-dashboard', SMARTCRAWL_PLUGIN_URL . 'css/wp-dashboard.css', array(), Smartcrawl_Loader::get_version() );
493
+ }
494
+
495
+ /**
496
+ * Gets inherited view defaults
497
+ */
498
+ protected function _get_view_defaults() {
499
+ return array();
500
+ }
501
+
502
+ private function get_request_data() {
503
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-admin-nonce' ) ? stripslashes_deep( $_POST ) : array();
504
+ }
505
+ }
506
+
507
+ $smartcrawl_admin = new Smartcrawl_Admin();
508
+
includes/admin/index.php CHANGED
@@ -0,0 +1 @@
 
1
+ <?php // phpcs:ignoreFile
includes/admin/metabox.php CHANGED
@@ -1,478 +1,571 @@
1
- <?php
2
- /**
3
- * Metabox main class
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- if ( ! class_exists( 'Smartcrawl_Renderable' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_renderable.php' ); }
9
-
10
- /**
11
- * Metabox rendering / handling class
12
- */
13
- class Smartcrawl_Metabox extends Smartcrawl_Renderable {
14
-
15
- /**
16
- * Constructor
17
- */
18
- public function __construct() {
19
- // WPSC integration.
20
- add_action( 'wpsc_edit_product', array( $this, 'rebuild_sitemap' ) );
21
- add_action( 'wpsc_rate_product', array( $this, 'rebuild_sitemap' ) );
22
-
23
- add_action( 'admin_menu', array( $this, 'smartcrawl_create_meta_box' ) );
24
-
25
- add_action( 'save_post', array( $this, 'smartcrawl_save_postdata' ) );
26
- add_filter( 'attachment_fields_to_save', array( $this, 'smartcrawl_save_attachment_postdata' ) );
27
-
28
- add_filter( 'manage_pages_columns', array( $this, 'smartcrawl_page_title_column_heading' ), 10, 1 );
29
- add_filter( 'manage_posts_columns', array( $this, 'smartcrawl_page_title_column_heading' ), 10, 1 );
30
-
31
- add_action( 'manage_pages_custom_column', array( $this, 'smartcrawl_page_title_column_content' ), 10, 2 );
32
- add_action( 'manage_posts_custom_column', array( $this, 'smartcrawl_page_title_column_content' ), 10, 2 );
33
-
34
- add_action( 'quick_edit_custom_box', array( $this, 'smartcrawl_quick_edit_dispatch' ), 10, 2 );
35
- add_action( 'admin_footer-edit.php', array( $this, 'smartcrawl_quick_edit_javascript' ) );
36
- add_action( 'wp_ajax_wds_get_meta_fields', array( $this, 'json_wds_postmeta' ) );
37
- add_action( 'wp_ajax_wds_metabox_update', array( $this, 'smartcrawl_metabox_live_update' ) );
38
-
39
- add_action( 'admin_print_scripts-post.php', array( $this, 'js_load_scripts' ) );
40
- add_action( 'admin_print_scripts-post-new.php', array( $this, 'js_load_scripts' ) );
41
- add_action( 'wp_ajax_wds-metabox-preview', array( $this, 'json_create_preview' ) );
42
- }
43
-
44
- /**
45
- * Handles preview asking requests
46
- */
47
- public function json_create_preview() {
48
- $data = stripslashes_deep( $_POST );
49
- $title = sanitize_text_field( smartcrawl_get_array_value( $data, 'title' ) );
50
- $description = sanitize_text_field( smartcrawl_get_array_value( $data, 'description' ) );
51
- $post_id = (int) smartcrawl_get_array_value( $data, 'post_id' );
52
- $result = array( 'success' => false );
53
-
54
- if ( is_null( $title ) || is_null( $description ) || empty( $post_id ) ) {
55
- wp_send_json( $result );
56
- return;
57
- }
58
-
59
- $result['success'] = true;
60
- $result['markup'] = $this->_load('metabox/metabox-preview', array(
61
- 'post' => get_post( $post_id ),
62
- 'title' => $title,
63
- 'description' => $description,
64
- ));
65
-
66
- wp_send_json( $result );
67
- }
68
-
69
- /**
70
- * Enqueues frontend dependencies
71
- */
72
- public function js_load_scripts() {
73
- $options = Smartcrawl_Settings::get_options();
74
- $version = Smartcrawl_Loader::get_version();
75
-
76
- wp_enqueue_script( 'wds_metabox_counter', SMARTCRAWL_PLUGIN_URL . '/js/wds-metabox-counter.js', array(), $version );
77
- wp_localize_script('wds_metabox_counter', 'l10nWdsCounters', array(
78
- 'title_length' => __( '{TOTAL_LEFT} characters left', 'wds' ),
79
- 'title_longer' => __( 'Over {MAX_COUNT} characters ({CURRENT_COUNT})', 'wds' ),
80
- 'main_title_longer' => __( 'Over {MAX_COUNT} characters ({CURRENT_COUNT}) - make sure your SEO title is shorter', 'wds' ),
81
-
82
- 'title_limit' => SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT,
83
- 'metad_limit' => SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT,
84
- 'main_title_warning' => ! (defined( 'SMARTCRAWL_MAIN_TITLE_LENGTH_WARNING_HIDE' ) && SMARTCRAWL_MAIN_TITLE_LENGTH_WARNING_HIDE),
85
- 'lax_enforcement' => (isset( $options['metabox-lax_enforcement'] ) ? ! ! $options['metabox-lax_enforcement'] : false),
86
- ));
87
- Smartcrawl_Settings_Admin::register_global_admin_scripts();
88
- wp_enqueue_script( 'wds_metabox_onpage', SMARTCRAWL_PLUGIN_URL . '/js/wds-metabox.js', array( 'wds-select2' ), $version );
89
- wp_localize_script('wds_metabox_onpage', 'l10nWdsMetabox', array(
90
- 'content_analysis_working' => __('Analyzing content, please wait a few moments', 'wds'),
91
- ));
92
-
93
- Smartcrawl_Settings_Admin::enqueue_shared_ui( false );
94
-
95
- wp_enqueue_script( 'wds-admin-opengraph' );
96
- wp_enqueue_style( 'wds-admin-opengraph' );
97
- wp_enqueue_style( 'wds-select2' );
98
- wp_enqueue_style( 'wds-app' );
99
- }
100
-
101
- /**
102
- * Handles page body class
103
- *
104
- * @param string $string Body classes this far.
105
- *
106
- * @return string
107
- */
108
- public function admin_body_class( $string ) {
109
- return str_replace( 'wpmud', '', $string );
110
- }
111
-
112
- /**
113
- * Handles actual metabox rendering
114
- */
115
- public function smartcrawl_meta_boxes() {
116
- global $post;
117
-
118
- $robots_noindex_value = (int) smartcrawl_get_value( 'meta-robots-noindex' );
119
- $robots_nofollow_value = (int) smartcrawl_get_value( 'meta-robots-nofollow' );
120
- $advanced_value = explode( ',', smartcrawl_get_value( 'meta-robots-adv' ) );
121
- $advanced_options = array(
122
- 'noodp' => __( 'NO ODP (Block Open Directory Project description of the page)', 'wds' ),
123
- 'noydir' => __( 'NO YDIR (Don\'t display the Yahoo! Directory titles and abstracts)', 'wds' ),
124
- 'noarchive' => __( 'No Archive', 'wds' ),
125
- 'nosnippet' => __( 'No Snippet', 'wds' ),
126
- );
127
- $sitemap_priority_options = array(
128
- '' => __( 'Automatic prioritization', 'wds' ),
129
- '1' => __( '1 - Highest priority', 'wds' ),
130
- '0.9' => '0.9',
131
- '0.8' => '0.8 - ' . __( 'High priority (root pages default)', 'wds' ),
132
- '0.7' => '0.7',
133
- '0.6' => '0.6 - ' . __( 'Secondary priority (subpages default)', 'wds' ),
134
- '0.5' => '0.5 - ' . __( 'Medium priority', 'wds' ),
135
- '0.4' => '0.4',
136
- '0.3' => '0.3',
137
- '0.2' => '0.2',
138
- '0.1' => '0.1 - ' . __( 'Lowest priority', 'wds' ),
139
- );
140
-
141
- $this->_render('metabox/metabox-main', array(
142
- 'post' => $post,
143
- 'robots_noindex_value' => $robots_noindex_value,
144
- 'robots_nofollow_value' => $robots_nofollow_value,
145
- 'advanced_value' => $advanced_value,
146
- 'advanced_options' => $advanced_options,
147
- 'sitemap_priority_options' => $sitemap_priority_options,
148
- ));
149
- }
150
-
151
- /**
152
- * Adds the metabox to the queue
153
- */
154
- public function smartcrawl_create_meta_box() {
155
- $show = user_can_see_seo_metabox();
156
- if ( function_exists( 'add_meta_box' ) ) {
157
- $metabox_title = is_multisite() ? __( 'SmartCrawl' , 'wds' ) : 'SmartCrawl'; // Show branding for singular installs.
158
- foreach ( get_post_types() as $posttype ) {
159
- if ( $show ) { add_meta_box( 'wds-wds-meta-box', $metabox_title, array( &$this, 'smartcrawl_meta_boxes' ), $posttype, 'normal', 'high' ); }
160
- }
161
- }
162
- }
163
-
164
- /**
165
- * Handles attachment metadata saving
166
- *
167
- * @param array $data Data to save.
168
- *
169
- * @return array
170
- */
171
- public function smartcrawl_save_attachment_postdata( $data ) {
172
- if ( empty( $_POST ) || empty( $data['post_ID'] ) || ! is_numeric( $data['post_ID'] ) ) { return $data; }
173
- $this->smartcrawl_save_postdata( (int) $data['post_ID'] );
174
- return $data;
175
- }
176
-
177
- /**
178
- * Saves submitted metabox POST data
179
- *
180
- * @param int $post_id Post ID.
181
- *
182
- * @return bool
183
- */
184
- public function smartcrawl_save_postdata( $post_id ) {
185
- if ( null == $post_id || empty( $_POST ) ) { return; }
186
-
187
- global $post;
188
- if ( empty( $post ) ) { $post = get_post( $post_id ); }
189
-
190
- // Determine posted type.
191
- $post_type_rq = ! empty( $_POST['post_type'] ) ? sanitize_key( $_POST['post_type'] ) : false;
192
- if ( 'page' === $post_type_rq && ! current_user_can( 'edit_page', $post_id ) ) {
193
- return $post_id;
194
- } elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
195
- return $post_id;
196
- }
197
-
198
- $ptype = ! empty( $post_type_rq )
199
- ? $post_type_rq
200
- : ( ! empty( $post->post_type ) ? $post->post_type : false)
201
- ;
202
- // Do not process post stuff for non-public post types.
203
- if ( ! in_array( $ptype, get_post_types( array( 'public' => true ) ) ) ) {
204
- return $post_id;
205
- }
206
-
207
- if ( ! empty( $_POST['wds-opengraph'] ) ) {
208
- $input = stripslashes_deep( $_POST['wds-opengraph'] );
209
- $result = array();
210
-
211
- $result['disabled'] = ! empty( $input['disabled'] );
212
- if ( ! empty( $input['title'] ) ) { $result['title'] = sanitize_text_field( $input['title'] ); }
213
- if ( ! empty( $input['description'] ) ) { $result['description'] = sanitize_text_field( $input['description'] ); }
214
- if ( ! empty( $input['images'] ) && is_array( $input['images'] ) ) {
215
- $result['images'] = array();
216
- foreach ( $input['images'] as $img ) {
217
- $img = esc_url_raw( $img );
218
- $result['images'][] = $img;
219
- }
220
- }
221
-
222
- if ( ! empty( $result ) ) {
223
- update_post_meta( $post_id, '_wds_opengraph', $result );
224
- }
225
- }
226
-
227
- if ( ! empty( $_POST['wds-twitter'] ) ) {
228
- $input = stripslashes_deep( $_POST['wds-twitter'] );
229
- $twitter = array();
230
-
231
- $twitter['disabled'] = ! empty( $input['disabled'] );
232
- if ( ! empty( $input['title'] ) ) { $twitter['title'] = sanitize_text_field( $input['title'] ); }
233
- if ( ! empty( $input['description'] ) ) { $twitter['description'] = sanitize_text_field( $input['description'] ); }
234
- if ( ! empty( $input['images'] ) && is_array( $input['images'] ) ) {
235
- $twitter['images'] = array();
236
- foreach ( $input['images'] as $img ) {
237
- $img = esc_url_raw( $img );
238
- $twitter['images'][] = $img;
239
- }
240
- }
241
-
242
- if ( ! empty( $twitter ) ) {
243
- update_post_meta( $post_id, '_wds_twitter', $twitter );
244
- }
245
- }
246
-
247
- if ( isset( $_POST['wds_focus'] ) ) {
248
- $focus = stripslashes_deep( $_POST['wds_focus'] );
249
- update_post_meta( $post_id, '_wds_focus-keywords', sanitize_text_field( $focus ) );
250
- }
251
-
252
- foreach ( $_POST as $key => $value ) {
253
- if ( in_array( $key, array( 'wds-opengraph', 'wds_focus', 'wds-twitter' ) ) ) { continue; } // We already handled those.
254
- if ( ! preg_match( '/^wds_/', $key ) ) { continue; }
255
-
256
- $id = "_{$key}";
257
- $data = $value;
258
- if ( is_array( $value ) ) { $data = join( ',', $value ); }
259
-
260
- if ( $data ) {
261
- $value = in_array( $key, array( 'wds_canonical', 'wds_redirect' ) )
262
- ? esc_url_raw( $data )
263
- : sanitize_text_field( $data );
264
- update_post_meta( $post_id, $id, $value );
265
- } else {
266
- delete_post_meta( $post_id, $id );
267
- }
268
- }
269
-
270
- /**
271
- * If the user un-checks a checkbox and saves the post, the value for that checkbox will not be included inside $_POST array
272
- * so we may have to delete the corresponding meta value manually.
273
- */
274
- $checkbox_meta_items = array(
275
- 'wds_tags_to_keywords',
276
- 'wds_meta-robots-noindex',
277
- 'wds_meta-robots-nofollow',
278
- 'wds_meta-robots-adv',
279
- 'wds_autolinks-exclude',
280
- );
281
- foreach ( $checkbox_meta_items as $item ) {
282
- if ( ! isset( $_POST[ $item ] ) ) {
283
- delete_post_meta( $post_id, "_{$item}" );
284
- }
285
- }
286
-
287
- do_action( 'wds_saved_postdata' );
288
- }
289
-
290
- /**
291
- * Handles sitemap rebuilding
292
- */
293
- public function rebuild_sitemap() {
294
- require_once SMARTCRAWL_PLUGIN_DIR . '/tools/sitemaps.php';
295
-
296
- }
297
-
298
- /**
299
- * Adds title and robots columns to post listing page
300
- *
301
- * @param array $columns Post list columns.
302
- *
303
- * @return array
304
- */
305
- public function smartcrawl_page_title_column_heading( $columns ) {
306
- return array_merge(
307
- array_slice( $columns, 0, 2 ),
308
- array( 'page-title' => __( 'Title Tag' , 'wds' ) ),
309
- array_slice( $columns, 2, 6 ),
310
- array( 'page-meta-robots' => __( 'Robots Meta' , 'wds' ) )
311
- );
312
- }
313
-
314
- /**
315
- * Puts out actual column bodies
316
- *
317
- * @param string $column_name Column ID.
318
- * @param int $id Post ID.
319
- *
320
- * @return void
321
- */
322
- public function smartcrawl_page_title_column_content( $column_name, $id ) {
323
- if ( 'page-title' == $column_name ) {
324
- echo esc_html( $this->smartcrawl_page_title( $id ) );
325
-
326
- // Show any 301 redirects.
327
- $redirect = smartcrawl_get_value( 'redirect', $id );
328
- if ( ! empty( $redirect ) ) {
329
- $href = esc_url( $redirect );
330
- $link = "<a href='{$href}' target='_blank'>{$href}</a>";
331
- echo '<br /><em>' . sprintf( esc_html( __( 'Redirects to %s', 'wds' ) ), $href ) . '</em>';
332
- }
333
- }
334
-
335
- if ( 'page-meta-robots' == $column_name ) {
336
- $meta_robots_arr = array(
337
- (smartcrawl_get_value( 'meta-robots-noindex', $id ) ? 'noindex' : 'index'),
338
- (smartcrawl_get_value( 'meta-robots-nofollow', $id ) ? 'nofollow' : 'follow'),
339
- );
340
- $meta_robots = join( ',', $meta_robots_arr );
341
- if ( empty( $meta_robots ) ) {
342
- $meta_robots = 'index,follow'; }
343
- echo esc_html( ucwords( str_replace( ',', ', ', $meta_robots ) ) );
344
-
345
- // Show additional robots data.
346
- $advanced = array_filter( array_map( 'trim', explode( ',', smartcrawl_get_value( 'meta-robots-adv', $id ) ) ) );
347
- if ( ! empty( $advanced ) && 'none' !== $advanced ) {
348
- $adv_map = array(
349
- 'noodp' => __( 'No ODP', 'wds' ),
350
- 'noydir' => __( 'No YDIR', 'wds' ),
351
- 'noarchive' => __( 'No Archive', 'wds' ),
352
- 'nosnippet' => __( 'No Snippet', 'wds' ),
353
- );
354
- $additional = array();
355
- foreach ( $advanced as $key ) {
356
- if ( ! empty( $adv_map[ $key ] ) ) { $additional[] = $adv_map[ $key ]; }
357
- }
358
- if ( ! empty( $additional ) ) { echo '<br /><small>' . esc_html( join( ', ', $additional ) ) . '</small>'; }
359
- }
360
- }
361
- }
362
-
363
- /**
364
- * Gets SEO title (with expanded macro replacements)
365
- *
366
- * @param int $postid Post ID.
367
- *
368
- * @return string
369
- */
370
- public function smartcrawl_page_title( $postid ) {
371
- $post = get_post( $postid );
372
- $fixed_title = smartcrawl_get_value( 'title', $post->ID );
373
- if ( $fixed_title ) {
374
- return smartcrawl_replace_vars( $fixed_title, (array) $post );
375
- } else {
376
- $smartcrawl_options = Smartcrawl_Settings::get_options();
377
- if ( ! empty( $smartcrawl_options[ 'title-' . $post->post_type ] ) ) {
378
- return smartcrawl_replace_vars( $smartcrawl_options[ 'title-' . $post->post_type ], (array) $post );
379
- } else {
380
- return '';
381
- }
382
- }
383
- }
384
-
385
- /**
386
- * Dispatch quick edit areas
387
- *
388
- * @param string $column Column ID.
389
- * @param string $type Passthrough.
390
- */
391
- public function smartcrawl_quick_edit_dispatch( $column, $type ) {
392
- switch ( $column ) {
393
- case 'page-title': return $this->_title_qe_box( $type );
394
- case 'page-meta-robots': return $this->_robots_qe_box();
395
- }
396
- }
397
-
398
- /**
399
- * Inject the quick editing javascript
400
- */
401
- public function smartcrawl_quick_edit_javascript() {
402
- $this->_render( 'quick-edit-javascript' );
403
- }
404
-
405
- /**
406
- * Handle postmeta getting requests
407
- */
408
- public function json_wds_postmeta() {
409
- $id = (int) $_POST['id'];
410
- $post = get_post( $id );
411
- die(json_encode(array(
412
- 'title' => smartcrawl_replace_vars( smartcrawl_get_value( 'title', $id ), (array) $post ),
413
- 'description' => smartcrawl_replace_vars( smartcrawl_get_value( 'metadesc', $id ), (array) $post ),
414
- 'focus' => smartcrawl_get_value( 'focus-keywords', $id ),
415
- 'keywords' => smartcrawl_get_value( 'keywords', $id ),
416
- )));
417
- }
418
-
419
- /**
420
- * Handle metabox live update requests
421
- */
422
- public function smartcrawl_metabox_live_update() {
423
- $id = (int) $_POST['id'];
424
- $post = get_post( $id );
425
-
426
- $post_data = sanitize_post( $_POST['post'] );
427
-
428
- $description = $title = '';
429
-
430
- /* Merge live post data with currently saved post data */
431
- $post->post_author = $post_data['post_author'];
432
- $post->post_title = $post_data['post_title'];
433
- $post->post_excerpt = $post_data['excerpt'];
434
- $post->post_content = $post_data['content'];
435
- $post->post_type = $post_data['post_type'];
436
-
437
- $title = smartcrawl_get_seo_title( $post );
438
- $description = smartcrawl_get_seo_desc( $post );
439
-
440
- wp_send_json(array(
441
- 'title' => $title,
442
- 'description' => $description,
443
- 'focus' => smartcrawl_get_value( 'focus-keywords', $id ),
444
- 'keywords' => smartcrawl_get_value( 'keywords', $id ),
445
- ));
446
-
447
- die();
448
- }
449
-
450
- /**
451
- * Renders title quick edit box
452
- */
453
- private function _title_qe_box() {
454
- global $post;
455
- $this->_render('quick-edit-title', array(
456
- 'post' => $post,
457
- ));
458
- }
459
-
460
- /**
461
- * Renders robots quick edit box
462
- */
463
- private function _robots_qe_box() {
464
- global $post;
465
- $this->_render('quick-edit-robots', array(
466
- 'post' => $post,
467
- ));
468
- }
469
-
470
- /**
471
- * Sattisfy interface
472
- */
473
- protected function _get_view_defaults() {
474
- return array();
475
- }
476
- }
477
-
478
- $smartcrawl_metabox = new Smartcrawl_Metabox();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Metabox main class
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Metabox rendering / handling class
10
+ */
11
+ class Smartcrawl_Metabox extends Smartcrawl_Renderable {
12
+
13
+ /**
14
+ * Static instance
15
+ *
16
+ * @var Smartcrawl_Metabox
17
+ */
18
+ private static $_instance;
19
+
20
+ /**
21
+ * State flag
22
+ *
23
+ * @var bool
24
+ */
25
+ private $_is_running = false;
26
+
27
+ /**
28
+ * Constructor
29
+ */
30
+ public function __construct() {
31
+ }
32
+
33
+ /**
34
+ * Boot the hooking part
35
+ */
36
+ public static function run() {
37
+ self::get()->_add_hooks();
38
+ }
39
+
40
+ public function _add_hooks() {
41
+ if ( $this->_is_running ) {
42
+ return false;
43
+ }
44
+
45
+ // WPSC integration.
46
+ add_action( 'wpsc_edit_product', array( $this, 'rebuild_sitemap' ) );
47
+ add_action( 'wpsc_rate_product', array( $this, 'rebuild_sitemap' ) );
48
+
49
+ add_action( 'admin_menu', array( $this, 'smartcrawl_create_meta_box' ) );
50
+
51
+ add_action( 'save_post', array( $this, 'smartcrawl_save_postdata' ) );
52
+ add_filter( 'attachment_fields_to_save', array( $this, 'smartcrawl_save_attachment_postdata' ) );
53
+
54
+ add_filter( 'manage_pages_columns', array( $this, 'smartcrawl_page_title_column_heading' ), 10, 1 );
55
+ add_filter( 'manage_posts_columns', array( $this, 'smartcrawl_page_title_column_heading' ), 10, 1 );
56
+
57
+ add_action( 'manage_pages_custom_column', array( $this, 'smartcrawl_page_title_column_content' ), 10, 2 );
58
+ add_action( 'manage_posts_custom_column', array( $this, 'smartcrawl_page_title_column_content' ), 10, 2 );
59
+
60
+ add_action( 'quick_edit_custom_box', array( $this, 'smartcrawl_quick_edit_dispatch' ), 10, 2 );
61
+ add_action( 'admin_footer-edit.php', array( $this, 'smartcrawl_quick_edit_javascript' ) );
62
+ add_action( 'wp_ajax_wds_get_meta_fields', array( $this, 'json_wds_postmeta' ) );
63
+ add_action( 'wp_ajax_wds_metabox_update', array( $this, 'smartcrawl_metabox_live_update' ) );
64
+
65
+ add_action( 'admin_print_scripts-post.php', array( $this, 'js_load_scripts' ) );
66
+ add_action( 'admin_print_scripts-post-new.php', array( $this, 'js_load_scripts' ) );
67
+ add_action( 'wp_ajax_wds-metabox-preview', array( $this, 'json_create_preview' ) );
68
+
69
+ $this->_is_running = true;
70
+ }
71
+
72
+ /**
73
+ * Static instance getter
74
+ */
75
+ public static function get() {
76
+ if ( empty( self::$_instance ) ) {
77
+ self::$_instance = new self();
78
+ }
79
+
80
+ return self::$_instance;
81
+ }
82
+
83
+ /**
84
+ * Handles preview asking requests
85
+ */
86
+ public function json_create_preview() {
87
+ $data = $this->get_request_data();
88
+ $title = sanitize_text_field( smartcrawl_get_array_value( $data, 'title' ) );
89
+ $description = sanitize_text_field( smartcrawl_get_array_value( $data, 'description' ) );
90
+ $post_id = (int) smartcrawl_get_array_value( $data, 'post_id' );
91
+ $result = array( 'success' => false );
92
+
93
+ if ( is_null( $title ) || is_null( $description ) || empty( $post_id ) ) {
94
+ wp_send_json( $result );
95
+
96
+ return;
97
+ }
98
+
99
+ $latest_post_version = smartcrawl_get_latest_post_version( $post_id );
100
+ $result['success'] = true;
101
+ $result['markup'] = $this->_load( 'metabox/metabox-preview', array(
102
+ 'post' => $latest_post_version,
103
+ 'title' => $title,
104
+ 'description' => $description,
105
+ ) );
106
+
107
+ wp_send_json( $result );
108
+ }
109
+
110
+ /**
111
+ * Enqueues frontend dependencies
112
+ */
113
+ public function js_load_scripts() {
114
+ $options = Smartcrawl_Settings::get_options();
115
+ $version = Smartcrawl_Loader::get_version();
116
+
117
+ wp_enqueue_script( 'wds_metabox_counter', SMARTCRAWL_PLUGIN_URL . '/js/wds-metabox-counter.js', array(), $version );
118
+ wp_localize_script( 'wds_metabox_counter', 'l10nWdsCounters', array(
119
+ 'title_length' => __( '{TOTAL_LEFT} characters left', 'wds' ),
120
+ 'title_longer' => __( 'Over {MAX_COUNT} characters ({CURRENT_COUNT})', 'wds' ),
121
+ 'main_title_longer' => __( 'Over {MAX_COUNT} characters ({CURRENT_COUNT}) - make sure your SEO title is shorter', 'wds' ),
122
+
123
+ 'title_limit' => SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT,
124
+ 'metad_limit' => SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT,
125
+ 'main_title_warning' => ! ( defined( 'SMARTCRAWL_MAIN_TITLE_LENGTH_WARNING_HIDE' ) && SMARTCRAWL_MAIN_TITLE_LENGTH_WARNING_HIDE ),
126
+ 'lax_enforcement' => ( isset( $options['metabox-lax_enforcement'] ) ? ! ! $options['metabox-lax_enforcement'] : false ),
127
+ ) );
128
+ Smartcrawl_Settings_Admin::register_global_admin_scripts();
129
+ wp_enqueue_script( 'wds_metabox_onpage', SMARTCRAWL_PLUGIN_URL . '/js/wds-metabox.js', array( 'wds-select2' ), $version );
130
+ wp_localize_script( 'wds_metabox_onpage', '_wds_metabox', array(
131
+ 'nonce' => wp_create_nonce( 'wds-metabox-nonce' ),
132
+ ) );
133
+ wp_localize_script( 'wds_metabox_onpage', 'l10nWdsMetabox', array(
134
+ 'content_analysis_working' => __( 'Analyzing content, please wait a few moments', 'wds' ),
135
+ ) );
136
+
137
+ Smartcrawl_Settings_Admin::enqueue_shared_ui( false );
138
+
139
+ wp_enqueue_script( 'wds-admin-opengraph' );
140
+ wp_enqueue_style( 'wds-admin-opengraph' );
141
+ wp_enqueue_style( 'wds-select2' );
142
+ wp_enqueue_style( 'wds-app' );
143
+ }
144
+
145
+ /**
146
+ * Handles page body class
147
+ *
148
+ * @param string $string Body classes this far.
149
+ *
150
+ * @return string
151
+ */
152
+ public function admin_body_class( $string ) {
153
+ return str_replace( 'wpmud', '', $string );
154
+ }
155
+
156
+ /**
157
+ * Handles actual metabox rendering
158
+ */
159
+ public function smartcrawl_meta_boxes() {
160
+ global $post;
161
+
162
+ $robots_noindex_value = (int) smartcrawl_get_value( 'meta-robots-noindex' );
163
+ $robots_nofollow_value = (int) smartcrawl_get_value( 'meta-robots-nofollow' );
164
+ $robots_index_value = (int) smartcrawl_get_value( 'meta-robots-index' );
165
+ $robots_follow_value = (int) smartcrawl_get_value( 'meta-robots-follow' );
166
+ $advanced_value = explode( ',', smartcrawl_get_value( 'meta-robots-adv' ) );
167
+ $advanced_options = array(
168
+ 'noodp' => __( 'NO ODP (Block Open Directory Project description of the page)', 'wds' ),
169
+ 'noydir' => __( 'NO YDIR (Don\'t display the Yahoo! Directory titles and abstracts)', 'wds' ),
170
+ 'noarchive' => __( 'No Archive', 'wds' ),
171
+ 'nosnippet' => __( 'No Snippet', 'wds' ),
172
+ );
173
+ $sitemap_priority_options = array(
174
+ '' => __( 'Automatic prioritization', 'wds' ),
175
+ '1' => __( '1 - Highest priority', 'wds' ),
176
+ '0.9' => '0.9',
177
+ '0.8' => '0.8 - ' . __( 'High priority (root pages default)', 'wds' ),
178
+ '0.7' => '0.7',
179
+ '0.6' => '0.6 - ' . __( 'Secondary priority (subpages default)', 'wds' ),
180
+ '0.5' => '0.5 - ' . __( 'Medium priority', 'wds' ),
181
+ '0.4' => '0.4',
182
+ '0.3' => '0.3',
183
+ '0.2' => '0.2',
184
+ '0.1' => '0.1 - ' . __( 'Lowest priority', 'wds' ),
185
+ );
186
+
187
+ $this->_render( 'metabox/metabox-main', array(
188
+ 'post' => $post,
189
+ 'robots_noindex_value' => $robots_noindex_value,
190
+ 'robots_nofollow_value' => $robots_nofollow_value,
191
+ 'robots_index_value' => $robots_index_value,
192
+ 'robots_follow_value' => $robots_follow_value,
193
+ 'advanced_value' => $advanced_value,
194
+ 'advanced_options' => $advanced_options,
195
+ 'sitemap_priority_options' => $sitemap_priority_options,
196
+ ) );
197
+ }
198
+
199
+ /**
200
+ * Adds the metabox to the queue
201
+ */
202
+ public function smartcrawl_create_meta_box() {
203
+ $show = user_can_see_seo_metabox();
204
+ if ( function_exists( 'add_meta_box' ) ) {
205
+ $metabox_title = is_multisite() ? __( 'SmartCrawl', 'wds' ) : 'SmartCrawl'; // Show branding for singular installs.
206
+ foreach ( get_post_types() as $posttype ) {
207
+ if ( $show ) {
208
+ add_meta_box( 'wds-wds-meta-box', $metabox_title, array(
209
+ &$this,
210
+ 'smartcrawl_meta_boxes',
211
+ ), $posttype, 'normal', 'high' );
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Handles attachment metadata saving
219
+ *
220
+ * @param array $data Data to save.
221
+ *
222
+ * @return array
223
+ */
224
+ public function smartcrawl_save_attachment_postdata( $data ) {
225
+ $request_data = $this->get_request_data();
226
+ if ( empty( $request_data ) || empty( $data['post_ID'] ) || ! is_numeric( $data['post_ID'] ) ) {
227
+ return $data;
228
+ }
229
+ $this->smartcrawl_save_postdata( (int) $data['post_ID'] );
230
+
231
+ return $data;
232
+ }
233
+
234
+ private function get_post() {
235
+ global $post;
236
+
237
+ return $post;
238
+ }
239
+
240
+ /**
241
+ * Saves submitted metabox POST data
242
+ *
243
+ * @param int $post_id Post ID.
244
+ *
245
+ * @return bool
246
+ */
247
+ public function smartcrawl_save_postdata( $post_id ) {
248
+ $request_data = $this->get_request_data();
249
+ if ( ! $post_id || empty( $request_data ) ) {
250
+ return;
251
+ }
252
+
253
+ $post = $this->get_post();
254
+ if ( empty( $post ) ) {
255
+ $post = get_post( $post_id );
256
+ }
257
+
258
+ $all_options = Smartcrawl_Settings::get_options();
259
+ $post_type_noindexed = (bool) smartcrawl_get_array_value( $all_options, sprintf( 'meta_robots-noindex-%s', get_post_type( $post ) ) );
260
+ $post_type_nofollowed = (bool) smartcrawl_get_array_value( $all_options, sprintf( 'meta_robots-nofollow-%s', get_post_type( $post ) ) );
261
+
262
+ // Determine posted type.
263
+ $post_type_rq = ! empty( $request_data['post_type'] ) ? sanitize_key( $request_data['post_type'] ) : false;
264
+ if ( 'page' === $post_type_rq && ! current_user_can( 'edit_page', $post_id ) ) {
265
+ return $post_id;
266
+ } elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
267
+ return $post_id;
268
+ }
269
+
270
+ $ptype = ! empty( $post_type_rq )
271
+ ? $post_type_rq
272
+ : ( ! empty( $post->post_type ) ? $post->post_type : false );
273
+ // Do not process post stuff for non-public post types.
274
+ if ( ! in_array( $ptype, get_post_types( array( 'public' => true ) ), true ) ) {
275
+ return $post_id;
276
+ }
277
+
278
+ if ( ! empty( $request_data['wds-opengraph'] ) ) {
279
+ $input = stripslashes_deep( $request_data['wds-opengraph'] );
280
+ $result = array();
281
+
282
+ $result['disabled'] = ! empty( $input['disabled'] );
283
+ if ( ! empty( $input['title'] ) ) {
284
+ $result['title'] = sanitize_text_field( $input['title'] );
285
+ }
286
+ if ( ! empty( $input['description'] ) ) {
287
+ $result['description'] = sanitize_text_field( $input['description'] );
288
+ }
289
+ if ( ! empty( $input['images'] ) && is_array( $input['images'] ) ) {
290
+ $result['images'] = array();
291
+ foreach ( $input['images'] as $img ) {
292
+ $img = esc_url_raw( $img );
293
+ $result['images'][] = $img;
294
+ }
295
+ }
296
+
297
+ if ( ! empty( $result ) ) {
298
+ update_post_meta( $post_id, '_wds_opengraph', $result );
299
+ }
300
+ }
301
+
302
+ if ( ! empty( $request_data['wds-twitter'] ) ) {
303
+ $input = stripslashes_deep( $request_data['wds-twitter'] );
304
+ $twitter = array();
305
+
306
+ $twitter['disabled'] = ! empty( $input['disabled'] );
307
+ if ( ! empty( $input['title'] ) ) {
308
+ $twitter['title'] = sanitize_text_field( $input['title'] );
309
+ }
310
+ if ( ! empty( $input['description'] ) ) {
311
+ $twitter['description'] = sanitize_text_field( $input['description'] );
312
+ }
313
+ if ( ! empty( $input['images'] ) && is_array( $input['images'] ) ) {
314
+ $twitter['images'] = array();
315
+ foreach ( $input['images'] as $img ) {
316
+ $img = esc_url_raw( $img );
317
+ $twitter['images'][] = $img;
318
+ }
319
+ }
320
+
321
+ if ( ! empty( $twitter ) ) {
322
+ update_post_meta( $post_id, '_wds_twitter', $twitter );
323
+ }
324
+ }
325
+
326
+ if ( isset( $request_data['wds_focus'] ) ) {
327
+ $focus = stripslashes_deep( $request_data['wds_focus'] );
328
+ update_post_meta( $post_id, '_wds_focus-keywords', sanitize_text_field( $focus ) );
329
+ }
330
+
331
+ foreach ( $request_data as $key => $value ) {
332
+ if ( in_array( $key, array( 'wds-opengraph', 'wds_focus', 'wds-twitter' ), true ) ) {
333
+ continue;
334
+ } // We already handled those.
335
+ if ( ! preg_match( '/^wds_/', $key ) ) {
336
+ continue;
337
+ }
338
+
339
+ $id = "_{$key}";
340
+ $data = $value;
341
+ if ( is_array( $value ) ) {
342
+ $data = join( ',', $value );
343
+ }
344
+
345
+ if ( $data ) {
346
+ $value = in_array( $key, array( 'wds_canonical', 'wds_redirect' ), true )
347
+ ? esc_url_raw( $data )
348
+ : sanitize_text_field( $data );
349
+ update_post_meta( $post_id, $id, $value );
350
+ } else {
351
+ delete_post_meta( $post_id, $id );
352
+ }
353
+ }
354
+
355
+ /**
356
+ * If the user un-checks a checkbox and saves the post, the value for that checkbox will not be included inside $_POST array
357
+ * so we may have to delete the corresponding meta value manually.
358
+ */
359
+ $checkbox_meta_items = array(
360
+ 'wds_tags_to_keywords',
361
+ 'wds_meta-robots-adv',
362
+ 'wds_autolinks-exclude',
363
+ );
364
+ $checkbox_meta_items[] = $post_type_nofollowed ? 'wds_meta-robots-follow' : 'wds_meta-robots-nofollow';
365
+ $checkbox_meta_items[] = $post_type_noindexed ? 'wds_meta-robots-index' : 'wds_meta-robots-noindex';
366
+ foreach ( $checkbox_meta_items as $item ) {
367
+ if ( ! isset( $request_data[ $item ] ) ) {
368
+ delete_post_meta( $post_id, "_{$item}" );
369
+ }
370
+ }
371
+
372
+ do_action( 'wds_saved_postdata' );
373
+ }
374
+
375
+ /**
376
+ * Handles sitemap rebuilding
377
+ */
378
+ public function rebuild_sitemap() {
379
+ Smartcrawl_Xml_Sitemap::get()->generate_sitemap();
380
+ }
381
+
382
+ /**
383
+ * Adds title and robots columns to post listing page
384
+ *
385
+ * @param array $columns Post list columns.
386
+ *
387
+ * @return array
388
+ */
389
+ public function smartcrawl_page_title_column_heading( $columns ) {
390
+ return array_merge(
391
+ array_slice( $columns, 0, 2 ),
392
+ array( 'page-title' => __( 'Title Tag', 'wds' ) ),
393
+ array_slice( $columns, 2, 6 ),
394
+ array( 'page-meta-robots' => __( 'Robots Meta', 'wds' ) )
395
+ );
396
+ }
397
+
398
+ /**
399
+ * Puts out actual column bodies
400
+ *
401
+ * @param string $column_name Column ID.
402
+ * @param int $id Post ID.
403
+ *
404
+ * @return void
405
+ */
406
+ public function smartcrawl_page_title_column_content( $column_name, $id ) {
407
+ if ( 'page-title' === $column_name ) {
408
+ echo esc_html( $this->smartcrawl_page_title( $id ) );
409
+
410
+ // Show any 301 redirects.
411
+ $redirect = smartcrawl_get_value( 'redirect', $id );
412
+ if ( ! empty( $redirect ) ) {
413
+ $href = $redirect;
414
+ $link = "<a href='{$href}' target='_blank'>{$href}</a>";
415
+ echo '<br /><em>' . sprintf( esc_html( __( 'Redirects to %s', 'wds' ) ), esc_url( $href ) ) . '</em>';
416
+ }
417
+ }
418
+
419
+ if ( 'page-meta-robots' === $column_name ) {
420
+ $meta_robots_arr = array(
421
+ ( smartcrawl_get_value( 'meta-robots-noindex', $id ) ? 'noindex' : 'index' ),
422
+ ( smartcrawl_get_value( 'meta-robots-nofollow', $id ) ? 'nofollow' : 'follow' ),
423
+ );
424
+ $meta_robots = join( ',', $meta_robots_arr );
425
+ if ( empty( $meta_robots ) ) {
426
+ $meta_robots = 'index,follow';
427
+ }
428
+ echo esc_html( ucwords( str_replace( ',', ', ', $meta_robots ) ) );
429
+
430
+ // Show additional robots data.
431
+ $advanced = array_filter( array_map( 'trim', explode( ',', smartcrawl_get_value( 'meta-robots-adv', $id ) ) ) );
432
+ if ( ! empty( $advanced ) && 'none' !== $advanced ) {
433
+ $adv_map = array(
434
+ 'noodp' => __( 'No ODP', 'wds' ),
435
+ 'noydir' => __( 'No YDIR', 'wds' ),
436
+ 'noarchive' => __( 'No Archive', 'wds' ),
437
+ 'nosnippet' => __( 'No Snippet', 'wds' ),
438
+ );
439
+ $additional = array();
440
+ foreach ( $advanced as $key ) {
441
+ if ( ! empty( $adv_map[ $key ] ) ) {
442
+ $additional[] = $adv_map[ $key ];
443
+ }
444
+ }
445
+ if ( ! empty( $additional ) ) {
446
+ echo '<br /><small>' . esc_html( join( ', ', $additional ) ) . '</small>';
447
+ }
448
+ }
449
+ }
450
+ }
451
+
452
+ /**
453
+ * Gets SEO title (with expanded macro replacements)
454
+ *
455
+ * @param int $postid Post ID.
456
+ *
457
+ * @return string
458
+ */
459
+ public function smartcrawl_page_title( $postid ) {
460
+ $post = get_post( $postid );
461
+ $fixed_title = smartcrawl_get_value( 'title', $post->ID );
462
+ if ( $fixed_title ) {
463
+ return smartcrawl_replace_vars( $fixed_title, (array) $post );
464
+ } else {
465
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
466
+ if ( ! empty( $smartcrawl_options[ 'title-' . $post->post_type ] ) ) {
467
+ return smartcrawl_replace_vars( $smartcrawl_options[ 'title-' . $post->post_type ], (array) $post );
468
+ } else {
469
+ return '';
470
+ }
471
+ }
472
+ }
473
+
474
+ /**
475
+ * Dispatch quick edit areas
476
+ *
477
+ * @param string $column Column ID.
478
+ * @param string $type Passthrough.
479
+ */
480
+ public function smartcrawl_quick_edit_dispatch( $column, $type ) {
481
+ switch ( $column ) {
482
+ case 'page-title':
483
+ return $this->_title_qe_box( $type );
484
+ case 'page-meta-robots':
485
+ return $this->_robots_qe_box();
486
+ }
487
+ }
488
+
489
+ /**
490
+ * Renders title quick edit box
491
+ */
492
+ private function _title_qe_box() {
493
+ global $post;
494
+ $this->_render( 'quick-edit-title', array(
495
+ 'post' => $post,
496
+ ) );
497
+ }
498
+
499
+ /**
500
+ * Renders robots quick edit box
501
+ */
502
+ private function _robots_qe_box() {
503
+ global $post;
504
+ $this->_render( 'quick-edit-robots', array(
505
+ 'post' => $post,
506
+ ) );
507
+ }
508
+
509
+ /**
510
+ * Inject the quick editing javascript
511
+ */
512
+ public function smartcrawl_quick_edit_javascript() {
513
+ $this->_render( 'quick-edit-javascript' );
514
+ }
515
+
516
+ /**
517
+ * Handle postmeta getting requests
518
+ */
519
+ public function json_wds_postmeta() {
520
+ $data = $this->get_request_data();
521
+ $id = (int) $data['id'];
522
+ $post = get_post( $id );
523
+ die( wp_json_encode( array(
524
+ 'title' => smartcrawl_replace_vars( smartcrawl_get_value( 'title', $id ), (array) $post ),
525
+ 'description' => smartcrawl_replace_vars( smartcrawl_get_value( 'metadesc', $id ), (array) $post ),
526
+ 'focus' => smartcrawl_get_value( 'focus-keywords', $id ),
527
+ 'keywords' => smartcrawl_get_value( 'keywords', $id ),
528
+ ) ) );
529
+ }
530
+
531
+ /**
532
+ * Handle metabox live update requests
533
+ */
534
+ public function smartcrawl_metabox_live_update() {
535
+ $data = $this->get_request_data();
536
+ $id = (int) $data['id'];
537
+ $post = get_post( $id );
538
+
539
+ $post_data = sanitize_post( $data['post'] );
540
+
541
+ /* Merge live post data with currently saved post data */
542
+ $post->post_author = $post_data['post_author'];
543
+ $post->post_title = $post_data['post_title'];
544
+ $post->post_excerpt = $post_data['excerpt'];
545
+ $post->post_content = $post_data['content'];
546
+ $post->post_type = $post_data['post_type'];
547
+
548
+ $title = smartcrawl_get_seo_title( $post );
549
+ $description = smartcrawl_get_seo_desc( $post );
550
+
551
+ wp_send_json( array(
552
+ 'title' => $title,
553
+ 'description' => $description,
554
+ 'focus' => smartcrawl_get_value( 'focus-keywords', $id ),
555
+ 'keywords' => smartcrawl_get_value( 'keywords', $id ),
556
+ ) );
557
+
558
+ die();
559
+ }
560
+
561
+ /**
562
+ * Sattisfy interface
563
+ */
564
+ protected function _get_view_defaults() {
565
+ return array();
566
+ }
567
+
568
+ private function get_request_data() {
569
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-metabox-nonce' ) ? stripslashes_deep( $_POST ) : array();
570
+ }
571
+ }
includes/admin/settings.php CHANGED
@@ -1,664 +1,710 @@
1
- <?php
2
- /**
3
- * Admin area setup stuff
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- /**
9
- * Admin area instance page abstraction
10
- */
11
- abstract class Smartcrawl_Settings_Admin extends Smartcrawl_Settings {
12
-
13
- /**
14
- * Sections
15
- *
16
- * @var array
17
- */
18
- public $sections = array();
19
-
20
- /**
21
- * Settings corresponding to this page
22
- *
23
- * @var array
24
- */
25
- public $options = array();
26
-
27
- /**
28
- * Capability required for this page
29
- *
30
- * @var string
31
- */
32
- public $capability = 'list_users';
33
-
34
- /**
35
- * Name of the options corresponding to this page
36
- *
37
- * @var string
38
- */
39
- public $option_name = '';
40
-
41
- /**
42
- * Page name
43
- *
44
- * @var string
45
- */
46
- public $name = '';
47
-
48
- /**
49
- * Page slug
50
- *
51
- * @var string
52
- */
53
- public $slug = '';
54
-
55
- /**
56
- * Action URL
57
- *
58
- * @var string
59
- */
60
- public $action_url = '';
61
-
62
- /**
63
- * Action message
64
- *
65
- * @var string
66
- */
67
- public $msg = '';
68
-
69
- /**
70
- * Current page hook
71
- *
72
- * @var string
73
- */
74
- public $smartcrawl_page_hook = '';
75
-
76
- /**
77
- * Blog tabs
78
- *
79
- * @var array
80
- */
81
- public $blog_tabs = array();
82
-
83
- /**
84
- * Validation abstraction
85
- *
86
- * @param array $input Raw input to validate.
87
- *
88
- * @return array
89
- */
90
- abstract public function validate ( $input );
91
-
92
- /**
93
- * Constructor
94
- */
95
- protected function __construct() {
96
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
97
- $this->capability = 'manage_network_options';
98
- }
99
-
100
- $this->init();
101
-
102
- }
103
-
104
- /**
105
- * Initializes the interface and binds hooks
106
- */
107
- public function init() {
108
- $this->options = self::get_specific_options( $this->option_name );
109
- if ( is_multisite() && defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE ) {
110
- $this->capability = 'manage_network_options';
111
- }
112
-
113
- add_action( 'init', array( $this, 'defaults' ), 999 );
114
- add_action( 'admin_body_class', array( $this, 'add_body_class' ), 20 );
115
-
116
- add_action( 'admin_init', array( $this, 'save_last_active_tab' ) );
117
-
118
- if ( is_multisite() ) {
119
- add_action( 'network_admin_menu', array( $this, 'add_page' ) );
120
- }
121
- if ( ! is_multisite() || ! (defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE) ) {
122
- add_action( 'admin_menu', array( $this, 'add_page' ) );
123
- }
124
-
125
- }
126
-
127
- /**
128
- * Renders the whole page view by calling `_render`
129
- *
130
- * As a side-effect, also calls `WDEV_Plugin_Ui::output()`
131
- *
132
- * @param string $view View file to load.
133
- * @param array $args Optional array of arguments to pass to view.
134
- *
135
- * @return bool
136
- */
137
- protected function _render_page( $view, $args = array() ) {
138
- WDEV_Plugin_Ui::output();
139
- $this->_render( $view, $args );
140
- return true;
141
- }
142
-
143
- /**
144
- * Check if a tab (settings page) is allowed for access
145
- *
146
- * It can be not allowed for access to site admins
147
- *
148
- * @param string $tab Tab to check.
149
- *
150
- * @return bool
151
- */
152
- public static function is_tab_allowed( $tab ) {
153
- if ( empty( $tab ) ) { return false; }
154
-
155
- if ( ! is_multisite() ) { return true; } // On single installs, everything is good
156
- if ( is_network_admin() ) { return true; } // Always good in network
157
- if ( smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) ) { return smartcrawl_is_switch_active( 'DOING_AJAX' ) ? true : is_network_admin(); } // If we're sitewide, we're good *in network admin* pages
158
-
159
- // We're network install, not sitewide now.
160
- // Let's see what's up.
161
- $allowed = Smartcrawl_Settings_Settings::get_blog_tabs();
162
- if ( empty( $allowed ) ) { return false; }
163
-
164
- return in_array( $tab, array_keys( $allowed ) ) && ! empty( $allowed[ $tab ] );
165
- }
166
-
167
- /**
168
- * Check if the current tab (settings page) is allowed for access
169
- *
170
- * @return bool
171
- */
172
- protected function _is_current_tab_allowed() {
173
- return ! empty( $this->slug )
174
- ? self::is_tab_allowed( $this->slug )
175
- : false
176
- ;
177
- }
178
-
179
- /**
180
- * Add sub page to the Settings Menu
181
- */
182
- public function add_page() {
183
- $allowed = true;
184
-
185
- if ( ! $this->_is_current_tab_allowed() ) { $allowed = false; }
186
-
187
- // Only allow network settings page on multisite when sitewide mode is off.
188
- if ( is_multisite() && ! smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) && is_network_admin() ) {
189
- $allowed = Smartcrawl_Settings::TAB_SETTINGS === $this->slug;
190
- }
191
-
192
- if ( ! $allowed ) { return false; }
193
-
194
- $this->smartcrawl_page_hook = add_submenu_page(
195
- 'wds_wizard',
196
- $this->page_title,
197
- $this->title,
198
- $this->capability,
199
- $this->slug,
200
- array( $this, 'options_page' )
201
- );
202
-
203
- // For pages that can deal with run requests, let's make sure they actually do that early enough.
204
- if ( is_callable( array( $this, 'process_run_action' ) ) ) {
205
- add_action( 'load-' . $this->smartcrawl_page_hook, array( $this, 'process_run_action' ) );
206
- }
207
-
208
- add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
209
-
210
- add_action( "admin_print_styles-{$this->smartcrawl_page_hook}", array( $this, 'admin_styles' ) );
211
- add_action( "admin_print_scripts-{$this->smartcrawl_page_hook}", array( $this, 'admin_scripts' ) );
212
-
213
- }
214
-
215
- /**
216
- * Unified admin tab URL getter
217
- *
218
- * Also takes into account whether the tab is allowed or not
219
- *
220
- * @param string $tab Tab to check.
221
- *
222
- * @return string Unescaped admin URL, or tab anchor on failure
223
- */
224
- public static function admin_url( $tab ) {
225
- $fallback = '#' . esc_attr( $tab );
226
-
227
- if ( empty( $tab ) ) { return $fallback; }
228
- if ( ! self::is_tab_allowed( $tab ) ) { return $fallback; }
229
-
230
- $use_network_url = false;
231
- if ( is_multisite() && smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) ) {
232
- $use_network_url = is_network_admin() || smartcrawl_is_switch_active( 'DOING_AJAX' );
233
- }
234
-
235
- return ! empty( $use_network_url )
236
- ? add_query_arg( 'page', $tab, network_admin_url( 'admin.php' ) )
237
- : add_query_arg( 'page', $tab, admin_url( 'admin.php' ) );
238
- }
239
-
240
- /**
241
- * Registers the scripts with global admin functionality
242
- */
243
- public static function register_global_admin_scripts() {
244
- $version = Smartcrawl_Loader::get_version();
245
- if ( ! wp_script_is( 'wds-admin', 'registered' ) ) {
246
- wp_register_script( 'wds-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin.js', array( 'jquery' ), $version );
247
- }
248
-
249
- if ( ! wp_script_is( 'wds-admin-opengraph', 'registered' ) ) {
250
- wp_register_script( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-opengraph.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
251
- }
252
-
253
- if ( ! wp_script_is( 'wds-select2', 'registered' ) ) {
254
- wp_register_script( 'wds-select2', SMARTCRAWL_PLUGIN_URL . 'js/external/select2.min.js', array( 'jquery' ), $version );
255
- }
256
-
257
- if ( ! wp_script_is( 'wds-qtip2-script', 'registered' ) ) {
258
- wp_register_script( 'wds-qtip2-script', SMARTCRAWL_PLUGIN_URL . 'js/external/jquery.qtip.min.js', array( 'jquery' ), $version );
259
- }
260
-
261
- wp_register_style( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . '/css/wds-opengraph.css', null, $version );
262
-
263
- wp_register_style( 'wds-qtip2-style', SMARTCRAWL_PLUGIN_URL . '/css/external/jquery.qtip.min.css', null, $version );
264
-
265
- wp_register_style( 'wds-select2', SMARTCRAWL_PLUGIN_URL . 'css/external/select2.min.css', null, $version );
266
-
267
- wp_register_style( 'wds-app', SMARTCRAWL_PLUGIN_URL . 'css/app.css', array( 'wds-qtip2-style' ), $version );
268
- }
269
-
270
- /**
271
- * Registers the known scripts on admin side.
272
- */
273
- public function register_admin_scripts() {
274
- // Do the globals first.
275
- self::register_global_admin_scripts();
276
-
277
- $version = Smartcrawl_Loader::get_version();
278
- if ( class_exists( 'Smartcrawl_Onpage_Settings' ) && ! wp_script_is( 'wds-admin-macros', 'registered' ) ) {
279
- wp_register_script( 'wds-admin-macros', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-macros.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
280
- wp_localize_script('wds-admin-macros', '_wds_macros', array(
281
- 'macros' => Smartcrawl_Onpage_Settings::get_macros(),
282
- 'templates' => array(
283
- 'list' => $this->_load( 'underscore-macros-list' ),
284
- ),
285
- 'strings' => array(
286
- 'Insert dynamic macro' => __( 'Insert dynamic macro', 'wds' ),
287
- ),
288
- ));
289
- }
290
-
291
- if ( ! wp_script_is( 'wds-admin-service', 'registered' ) ) {
292
- wp_register_script( 'wds-admin-service', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-service.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
293
- wp_localize_script('wds-admin-service', '_wds_service', array(
294
- 'strings' => array(
295
- 'Connecting' => __( 'Connecting...', 'wds' ),
296
- 'Parsing results' => __( 'Parsing results...', 'wds' ),
297
- 'Something went wrong' => __( 'It appears something went wrong with communicating with the service', 'wds' ),
298
- 'Checking the site ...' => __( 'Checking the site ...', 'wds' ),
299
- 'Still working ...' => __( 'Still working ...', 'wds' ),
300
- 'Waiting for service response ...' => __( 'Waiting for service response ...', 'wds' ),
301
- 'Request queued, waiting ...' => __( 'Request queued, waiting ...', 'wds' ),
302
- ),
303
- 'templates' => array(
304
- 'run' => $this->_load( 'dashboard-dialog-seo_service-run' ),
305
- ),
306
- ));
307
- }
308
-
309
- if ( ! wp_script_is( 'wds-admin-keywords', 'registered' ) ) {
310
- wp_register_script( 'wds-admin-keywords', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-keywords.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
311
- wp_localize_script('wds-admin-keywords', '_wds_keywords', array(
312
- 'templates' => array(
313
- 'custom' => $this->_load( 'underscore-keywords-custom' ),
314
- 'pairs' => $this->_load( 'underscore-keywords-pairs' ),
315
- 'form' => $this->_load( 'underscore-keywords-form' ),
316
- ),
317
- 'strings' => array(
318
- 'Keyword' => __( 'Keyword', 'wds' ),
319
- 'Auto-Linked URL' => __( 'Auto-Linked URL', 'wds' ),
320
- 'Add New' => __( 'Add New', 'wds' ),
321
- 'Add Custom Keywords' => __( 'Add Custom Keywords', 'wds' ),
322
- 'Update Custom Keywords' => __( 'Update Custom Keywords', 'wds' ),
323
- 'Add' => __( 'Add', 'wds' ),
324
- 'Update' => __( 'Update', 'wds' ),
325
- 'Edit' => __( 'Edit', 'wds' ),
326
- 'Remove' => __( 'Remove', 'wds' ),
327
- 'E.g. Cats, Kittens, Felines' => __( 'E.g. Cats, Kittens, Felines', 'wds' ),
328
- 'E.g. /cats' => __( 'E.g. /cats', 'wds' ),
329
- 'Keyword group' => __( 'Keyword group', 'wds' ),
330
- '- Usually related terms' => __( '- Usually related terms', 'wds' ),
331
- 'Link URL' => __( 'Link URL', 'wds' ),
332
- '- Both internal and external links are supported' => __( '- Both internal and external links are supported', 'wds' ),
333
- 'Choose your keywords, and then specify the URL to auto-link to.' => __( 'Choose your keywords, and then specify the URL to auto-link to.', 'wds' ),
334
- 'Formats include relative (E.g. <b>/cats</b>) or absolute URLs (E.g. <b>www.website.com/cats</b> or <b>https://website.com/cats</b>).' => __( 'Formats include relative (E.g. <b>/cats</b>) or absolute URLs (E.g. <b>www.website.com/cats</b> or <b>https://website.com/cats</b>).', 'wds' ),
335
- 'Cancel' => __( 'Cancel', 'wds' ),
336
- ),
337
- ));
338
- }
339
-
340
- if ( class_exists( 'Smartcrawl_Autolinks_Settings' ) && ! wp_script_is( 'wds-admin-postlist', 'registered' ) ) {
341
- wp_register_script( 'wds-admin-postlist', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-postlist.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
342
- wp_localize_script('wds-admin-postlist', '_wds_postlist', array(
343
- 'templates' => array(
344
- 'exclude' => $this->_load( 'underscore-postlist-exclusion' ),
345
- 'exclude-item' => $this->_load( 'underscore-postlist-exclusion-item' ),
346
- 'selector' => $this->_load( 'underscore-postlist-selector' ),
347
- 'selector-list' => $this->_load( 'underscore-postlist-selector-list' ),
348
- 'selector-list-item' => $this->_load( 'underscore-postlist-selector-list-item' ),
349
- ),
350
- 'post_types' => Smartcrawl_Autolinks_Settings::get_post_types(),
351
- 'strings' => array(
352
- 'Add Posts' => __( 'Add Posts', 'wds' ),
353
- 'Remove' => __( 'Remove', 'wds' ),
354
- 'Post' => __( 'Post', 'wds' ),
355
- 'Post Type' => __( 'Post Type', 'wds' ),
356
- 'Loading post items, please hold on' => __( 'Loading post items, please hold on...', 'wds' ),
357
- 'Jump to page' => __( 'Jump to page:', 'wds' ),
358
- 'Total Pages' => __( 'Total Pages:', 'wds' ),
359
- ),
360
- ));
361
- }
362
-
363
- if ( class_exists( 'Smartcrawl_Autolinks_Settings' ) && ! wp_script_is( 'wds-admin-autolinks', 'registered' ) ) {
364
- wp_register_script('wds-admin-autolinks', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-autolinks.js', array(
365
- 'underscore',
366
- 'jquery',
367
- 'wds-admin',
368
- 'wds-select2',
369
- 'wds-select2-admin',
370
- 'wds-admin-keywords',
371
- 'wds-admin-postlist',
372
- ), $version);
373
- }
374
-
375
- if ( 'Smartcrawl_Autolinks_Settings' == get_class( $this ) && ! wp_script_is( 'wds-admin-redirects', 'registered' ) ) {
376
- wp_register_script('wds-admin-redirects', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-redirects.js', array(
377
- 'underscore',
378
- 'jquery',
379
- 'wds-admin',
380
- 'wds-select2',
381
- 'wds-select2-admin',
382
- ), $version);
383
-
384
- wp_localize_script('wds-admin-redirects', '_wds_redirects', array(
385
- 'templates' => array(
386
- 'redirect-item' => $this->_load( 'advanced-tools/underscore-redirect-item' ),
387
- 'update-form' => $this->_load( 'advanced-tools/underscore-bulk-update-form' ),
388
- ),
389
- 'strings' => array(
390
- 'Permanent (301)' => __( 'Permanent (301)', 'wds' ),
391
- 'Temporary (302)' => __( 'Temporary (302)', 'wds' ),
392
- 'Options' => __( 'Options', 'wds' ),
393
- 'Remove' => __( 'Remove', 'wds' ),
394
- 'Cancel' => __( 'Cancel', 'wds' ),
395
- 'Update' => __( 'Update', 'wds' ),
396
- 'Redirect Type' => __( 'Redirect Type', 'wds' ),
397
- 'New URL' => __( 'New URL', 'wds' ),
398
- 'Bulk Update' => __( 'Bulk Update', 'wds' ),
399
- 'Please select some items to edit them.' => __( 'Please select some items to edit them.', 'wds' ),
400
- ),
401
- ));
402
- }
403
-
404
- if ( class_exists( 'Smartcrawl_Onpage_Settings' ) && ! wp_script_is( 'wds-admin-onpage', 'registered' ) ) {
405
- wp_register_script('wds-admin-onpage', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-onpage.js', array(
406
- 'wds-admin-macros',
407
- 'wds-admin-opengraph',
408
- 'wds-qtip2-script',
409
- 'jquery',
410
- ), $version);
411
- }
412
-
413
- if ( class_exists( 'Smartcrawl_Sitemap_Settings' ) && ! wp_script_is( 'wds-admin-sitemaps', 'registered' ) ) {
414
- wp_register_script('wds-admin-sitemaps', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-sitemaps.js', array(
415
- 'wds-admin',
416
- 'wds-qtip2-script',
417
- 'jquery',
418
- ), $version);
419
- };
420
-
421
- if ( class_exists( 'Smartcrawl_Settings_Dashboard' ) && ! wp_script_is( 'wds-admin-dashboard', 'registered' ) ) {
422
- wp_register_script('wds-admin-dashboard', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-dashboard.js', array(
423
- 'wds-admin',
424
- 'wds-qtip2-script',
425
- 'jquery',
426
- ), $version);
427
- };
428
-
429
- if ( class_exists( 'Smartcrawl_Checkup_Settings' ) && ! wp_script_is( 'wds-admin-checkup', 'registered' ) ) {
430
- wp_register_script('wds-admin-checkup', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-checkup.js', array(
431
- 'wds-admin',
432
- 'wds-qtip2-script',
433
- 'jquery',
434
- ), $version);
435
- };
436
-
437
- if ( class_exists( 'Smartcrawl_Social_Settings' ) && ! wp_script_is( 'wds-admin-social', 'registered' ) ) {
438
- wp_register_script('wds-admin-social', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-social.js', array(
439
- 'wds-admin',
440
- 'wds-qtip2-script',
441
- 'jquery',
442
- ), $version);
443
- };
444
-
445
- if ( class_exists( 'Smartcrawl_Settings_Settings' ) && ! wp_script_is( 'wds-admin-settings', 'registered' ) ) {
446
- wp_register_script('wds-admin-settings', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-settings.js', array(
447
- 'wds-admin',
448
- 'wds-qtip2-script',
449
- 'jquery',
450
- ), $version);
451
-
452
- wp_localize_script('wds-admin-settings', '_wds_setting', array(
453
- 'strings' => array(
454
- 'importing' => esc_html__('Importing', 'wds'),
455
- 'import' => esc_html__('Import', 'wds'),
456
- )
457
- ));
458
- };
459
- }
460
-
461
- /**
462
- * Enqueue styles
463
- */
464
- public function admin_styles() {
465
- $version = Smartcrawl_Loader::get_version();
466
-
467
- $this->enqueue_shared_ui();
468
-
469
- wp_enqueue_style( 'wds-qtip2-style' );
470
- wp_enqueue_style( 'wds-select2' );
471
- wp_enqueue_style( 'wds-app' );
472
-
473
- if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'css/' . $this->name . '.css' ) ) {
474
- wp_enqueue_style( $this->slug, SMARTCRAWL_PLUGIN_URL . 'css/' . $this->name . '.css', array( 'wds' ), $version );
475
- }
476
- }
477
-
478
- /**
479
- * Enqueue scripts
480
- */
481
- public function admin_scripts() {
482
- $version = Smartcrawl_Loader::get_version();
483
-
484
- wp_enqueue_script( 'wds' );
485
-
486
- wp_enqueue_script( 'wds-select2' );
487
- wp_enqueue_script( 'wds-select2-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-select2.js', array( 'wds-select2' ), $version );
488
-
489
- if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'js/' . $this->name . '.js' ) ) {
490
- wp_enqueue_script( $this->slug, SMARTCRAWL_PLUGIN_URL . 'js/' . $this->name . '.js', array( 'wds' ), $version );
491
- }
492
-
493
- }
494
-
495
- /**
496
- * Initiates a checkup run
497
- */
498
- public function run_checkup() {
499
- if ( current_user_can( 'manage_options' ) ) {
500
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
501
- $service->start();
502
- }
503
- wp_safe_redirect( esc_url( remove_query_arg( 'run-checkup' ) ) );
504
- die;
505
- }
506
-
507
- /**
508
- * Display the admin options page
509
- */
510
- public function options_page() {
511
- $this->msg = '';
512
- if ( ! empty( $_GET['updated'] ) || ! empty( $_GET['settings-updated'] ) ) {
513
- $this->msg = __( 'Settings updated' , 'wds' );
514
-
515
- if ( function_exists( 'w3tc_pgcache_flush' ) ) {
516
- w3tc_pgcache_flush();
517
- $this->msg .= __( ' &amp; W3 Total Cache Page Cache flushed' , 'wds' );
518
- } elseif ( function_exists( 'wp_cache_clear_cache' ) ) {
519
- wp_cache_clear_cache();
520
- $this->msg .= __( ' &amp; WP Super Cache flushed' , 'wds' );
521
- }
522
- }
523
-
524
- if (!empty($_GET['imported'])) {
525
- $plugin = smartcrawl_get_array_value($_GET, 'plugin');
526
- $plugin_label = $plugin == 'yoast' ? __('Yoast SEO', 'wds') : __('All In One SEO', 'wds');
527
-
528
- $plugins_link = sprintf(
529
- '<a href="%s">%s</a>',
530
- admin_url('plugins.php'),
531
- sprintf(
532
- __('deactivate %s', 'wds'),
533
- $plugin_label
534
- )
535
- );
536
-
537
- $this->msg = sprintf(
538
- __('Your %s configuration has been successfully imported! We recommend you %s to avoid any potential conflicts.', 'wds'),
539
- $plugin_label,
540
- $plugins_link
541
- );
542
- }
543
- }
544
-
545
- /**
546
- * Sets up contextual help
547
- *
548
- * @param string $contextual_help Help.
549
- *
550
- * @return string
551
- */
552
- public function contextual_help( $contextual_help ) {
553
- if ( ! empty( $_GET['page'] ) && $_GET['page'] === $this->slug && ! empty( $this->contextual_help ) ) {
554
- $contextual_help = $this->contextual_help;
555
- }
556
-
557
- return $contextual_help;
558
- }
559
-
560
- /**
561
- * Adds body class
562
- *
563
- * @TODO: Apparently a no-op?
564
- *
565
- * @param string $class Class that's being processed.
566
- *
567
- * @return string
568
- */
569
- public function add_body_class( $class ) {
570
- global $current_screen;
571
-
572
- if ( str_replace( '-network', '', $current_screen->id ) === $this->smartcrawl_page_hook ) {
573
- return $class;
574
- } else {
575
- return $class;
576
- }
577
- }
578
-
579
- /**
580
- * Populates view defaults with view meta information
581
- *
582
- * @return array Defaults
583
- */
584
- protected function _get_view_defaults() {
585
- $errors = get_transient( 'wds-settings-save-errors' );
586
- $errors = ! empty( $errors ) ? $errors : array();
587
- return array(
588
- '_view' => array(
589
- 'slug' => $this->slug,
590
- 'name' => $this->name,
591
- 'option_name' => $this->option_name,
592
- 'options' => $this->options,
593
- 'action_url' => $this->action_url,
594
- 'msg' => $this->msg,
595
- 'errors' => $errors,
596
- ),
597
- );
598
- }
599
-
600
- /**
601
- * On form submission, this method saves the last active tab in a transient so that it can be opened when the page is refreshed.
602
- */
603
- public function save_last_active_tab() {
604
- if ( isset( $_POST['wds-admin-active-tab'] ) ) {
605
- set_transient( 'wds-admin-active-tab', sanitize_key( $_POST['wds-admin-active-tab'] ), 10 );
606
- }
607
- }
608
-
609
- /**
610
- * Checks if the last active tab is stored in the transient and returns its value. If nothing is available then it returns the default value.
611
- *
612
- * @param string $default Fallback value.
613
- *
614
- * @return string The last active tab.
615
- */
616
- protected function _get_last_active_tab( $default = '' ) {
617
- $active_tab = get_transient( 'wds-admin-active-tab' );
618
- delete_transient( 'wds-admin-active-tab' );
619
-
620
- return $active_tab ? $active_tab : $default;
621
- }
622
-
623
- /**
624
- * Sets up and enqueues shared UI library
625
- *
626
- * @param bool $add_class Whether to add admin body class to the current page.
627
- */
628
- public static function enqueue_shared_ui( $add_class = true ) {
629
- $version = Smartcrawl_Loader::get_version();
630
- if ( $add_class ) {
631
- add_filter(
632
- 'admin_body_class',
633
- array( 'WDEV_Plugin_Ui', 'admin_body_class' )
634
- );
635
- }
636
-
637
- /**
638
- * Enqueue Dashboard UI Shared Lib.
639
- * We are doing it this way instead of calling WDEV_Plugin_Ui::load because we want to clear out the cache
640
- * by changing the version.
641
- */
642
- $shared_ui_url = SMARTCRAWL_PLUGIN_URL . 'admin/shared-ui';
643
- wp_enqueue_style(
644
- 'wdev-plugin-google_fonts',
645
- 'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Roboto:400,500,300,300italic',
646
- false,
647
- $version
648
- );
649
-
650
- wp_enqueue_style(
651
- 'wdev-plugin-ui',
652
- $shared_ui_url . '/wdev-ui.css',
653
- array( 'wdev-plugin-google_fonts' ),
654
- $version
655
- );
656
-
657
- wp_enqueue_script(
658
- 'wdev-plugin-ui',
659
- $shared_ui_url . '/wdev-ui.js',
660
- array( 'jquery' ),
661
- $version
662
- );
663
- }
664
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin area setup stuff
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Admin area instance page abstraction
10
+ */
11
+ abstract class Smartcrawl_Settings_Admin extends Smartcrawl_Settings {
12
+
13
+ /**
14
+ * Sections
15
+ *
16
+ * @var array
17
+ */
18
+ public $sections = array();
19
+
20
+ /**
21
+ * Settings corresponding to this page
22
+ *
23
+ * @var array
24
+ */
25
+ public $options = array();
26
+
27
+ /**
28
+ * Capability required for this page
29
+ *
30
+ * @var string
31
+ */
32
+ public $capability = 'list_users';
33
+
34
+ /**
35
+ * Name of the options corresponding to this page
36
+ *
37
+ * @var string
38
+ */
39
+ public $option_name = '';
40
+
41
+ /**
42
+ * Page name
43
+ *
44
+ * @var string
45
+ */
46
+ public $name = '';
47
+
48
+ /**
49
+ * Page slug
50
+ *
51
+ * @var string
52
+ */
53
+ public $slug = '';
54
+
55
+ /**
56
+ * Action URL
57
+ *
58
+ * @var string
59
+ */
60
+ public $action_url = '';
61
+
62
+ /**
63
+ * Action message
64
+ *
65
+ * @var string
66
+ */
67
+ public $msg = '';
68
+
69
+ /**
70
+ * Current page hook
71
+ *
72
+ * @var string
73
+ */
74
+ public $smartcrawl_page_hook = '';
75
+
76
+ /**
77
+ * Blog tabs
78
+ *
79
+ * @var array
80
+ */
81
+ public $blog_tabs = array();
82
+
83
+ /**
84
+ * Constructor
85
+ */
86
+ protected function __construct() {
87
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
88
+ $this->capability = 'manage_network_options';
89
+ }
90
+
91
+ $this->init();
92
+
93
+ }
94
+
95
+ /**
96
+ * Initializes the interface and binds hooks
97
+ */
98
+ public function init() {
99
+ $this->options = self::get_specific_options( $this->option_name );
100
+ if ( is_multisite() && defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE ) {
101
+ $this->capability = 'manage_network_options';
102
+ }
103
+
104
+ add_action( 'init', array( $this, 'defaults' ), 999 );
105
+ add_action( 'admin_body_class', array( $this, 'add_body_class' ), 20 );
106
+
107
+ add_action( 'admin_init', array( $this, 'save_last_active_tab' ) );
108
+
109
+ if ( is_multisite() ) {
110
+ add_action( 'network_admin_menu', array( $this, 'add_page' ) );
111
+ }
112
+ if ( ! is_multisite() || ! ( defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE ) ) {
113
+ add_action( 'admin_menu', array( $this, 'add_page' ) );
114
+ }
115
+
116
+ }
117
+
118
+ /**
119
+ * Unified admin tab URL getter
120
+ *
121
+ * Also takes into account whether the tab is allowed or not
122
+ *
123
+ * @param string $tab Tab to check.
124
+ *
125
+ * @return string Unescaped admin URL, or tab anchor on failure
126
+ */
127
+ public static function admin_url( $tab ) {
128
+ $fallback = '#' . esc_attr( $tab );
129
+
130
+ if ( empty( $tab ) ) {
131
+ return $fallback;
132
+ }
133
+ if ( ! self::is_tab_allowed( $tab ) ) {
134
+ return $fallback;
135
+ }
136
+
137
+ $use_network_url = false;
138
+ if ( is_multisite() && smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) ) {
139
+ $use_network_url = is_network_admin() || smartcrawl_is_switch_active( 'DOING_AJAX' );
140
+ }
141
+
142
+ return ! empty( $use_network_url )
143
+ ? add_query_arg( 'page', $tab, network_admin_url( 'admin.php' ) )
144
+ : add_query_arg( 'page', $tab, admin_url( 'admin.php' ) );
145
+ }
146
+
147
+ /**
148
+ * Validation abstraction
149
+ *
150
+ * @param array $input Raw input to validate.
151
+ *
152
+ * @return array
153
+ */
154
+ abstract public function validate( $input );
155
+
156
+ /**
157
+ * Add sub page to the Settings Menu
158
+ */
159
+ public function add_page() {
160
+ $allowed = true;
161
+
162
+ if ( ! $this->_is_current_tab_allowed() ) {
163
+ $allowed = false;
164
+ }
165
+
166
+ // Only allow network settings page on multisite when sitewide mode is off.
167
+ if ( is_multisite() && ! smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) && is_network_admin() ) {
168
+ $allowed = Smartcrawl_Settings::TAB_SETTINGS === $this->slug;
169
+ }
170
+
171
+ if ( ! $allowed ) {
172
+ return false;
173
+ }
174
+
175
+ $this->smartcrawl_page_hook = add_submenu_page(
176
+ 'wds_wizard',
177
+ $this->page_title,
178
+ $this->title,
179
+ $this->capability,
180
+ $this->slug,
181
+ array( $this, 'options_page' )
182
+ );
183
+
184
+ // For pages that can deal with run requests, let's make sure they actually do that early enough.
185
+ if ( is_callable( array( $this, 'process_run_action' ) ) ) {
186
+ add_action( 'load-' . $this->smartcrawl_page_hook, array( $this, 'process_run_action' ) );
187
+ }
188
+
189
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
190
+
191
+ add_action( "admin_print_styles-{$this->smartcrawl_page_hook}", array( $this, 'admin_styles' ) );
192
+ add_action( "admin_print_scripts-{$this->smartcrawl_page_hook}", array( $this, 'admin_scripts' ) );
193
+
194
+ }
195
+
196
+ /**
197
+ * Check if the current tab (settings page) is allowed for access
198
+ *
199
+ * @return bool
200
+ */
201
+ protected function _is_current_tab_allowed() {
202
+ return ! empty( $this->slug )
203
+ ? self::is_tab_allowed( $this->slug )
204
+ : false;
205
+ }
206
+
207
+ /**
208
+ * Check if a tab (settings page) is allowed for access
209
+ *
210
+ * It can be not allowed for access to site admins
211
+ *
212
+ * @param string $tab Tab to check.
213
+ *
214
+ * @return bool
215
+ */
216
+ public static function is_tab_allowed( $tab ) {
217
+ if ( empty( $tab ) ) {
218
+ return false;
219
+ }
220
+
221
+ if ( ! is_multisite() ) {
222
+ return true;
223
+ } // On single installs, everything is good
224
+ if ( is_network_admin() ) {
225
+ return true;
226
+ } // Always good in network
227
+ if ( smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) ) {
228
+ return smartcrawl_is_switch_active( 'DOING_AJAX' ) ? true : is_network_admin();
229
+ } // If we're sitewide, we're good *in network admin* pages
230
+
231
+ // We're network install, not sitewide now.
232
+ // Let's see what's up.
233
+ $allowed = Smartcrawl_Settings_Settings::get_blog_tabs();
234
+ if ( empty( $allowed ) ) {
235
+ return false;
236
+ }
237
+
238
+ return in_array( $tab, array_keys( $allowed ), true ) && ! empty( $allowed[ $tab ] );
239
+ }
240
+
241
+ /**
242
+ * Registers the known scripts on admin side.
243
+ */
244
+ public function register_admin_scripts() {
245
+ // Do the globals first.
246
+ self::register_global_admin_scripts();
247
+
248
+ $version = Smartcrawl_Loader::get_version();
249
+ if ( class_exists( 'Smartcrawl_Onpage_Settings' ) && ! wp_script_is( 'wds-admin-macros', 'registered' ) ) {
250
+ wp_register_script( 'wds-admin-macros', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-macros.js', array(
251
+ 'underscore',
252
+ 'jquery',
253
+ 'wds-admin',
254
+ ), $version );
255
+ wp_localize_script( 'wds-admin-macros', '_wds_macros', array(
256
+ 'macros' => Smartcrawl_Onpage_Settings::get_macros(),
257
+ 'templates' => array(
258
+ 'list' => $this->_load( 'onpage/underscore-macros-list' ),
259
+ ),
260
+ 'strings' => array(
261
+ 'Insert dynamic macro' => __( 'Insert dynamic macro', 'wds' ),
262
+ ),
263
+ ) );
264
+ }
265
+
266
+ if ( ! wp_script_is( 'wds-admin-keywords', 'registered' ) ) {
267
+ wp_register_script( 'wds-admin-keywords', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-keywords.js', array(
268
+ 'underscore',
269
+ 'jquery',
270
+ 'wds-admin',
271
+ ), $version );
272
+ wp_localize_script( 'wds-admin-keywords', '_wds_keywords', array(
273
+ 'templates' => array(
274
+ 'custom' => $this->_load( 'advanced-tools/underscore-keywords-custom' ),
275
+ 'pairs' => $this->_load( 'advanced-tools/underscore-keywords-pairs' ),
276
+ 'form' => $this->_load( 'advanced-tools/underscore-keywords-form' ),
277
+ ),
278
+ 'strings' => array(
279
+ 'Keyword' => __( 'Keyword', 'wds' ),
280
+ 'Auto-Linked URL' => __( 'Auto-Linked URL', 'wds' ),
281
+ 'Add New' => __( 'Add New', 'wds' ),
282
+ 'Add Custom Keywords' => __( 'Add Custom Keywords', 'wds' ),
283
+ 'Update Custom Keywords' => __( 'Update Custom Keywords', 'wds' ),
284
+ 'Add' => __( 'Add', 'wds' ),
285
+ 'Update' => __( 'Update', 'wds' ),
286
+ 'Edit' => __( 'Edit', 'wds' ),
287
+ 'Remove' => __( 'Remove', 'wds' ),
288
+ 'E.g. Cats, Kittens, Felines' => __( 'E.g. Cats, Kittens, Felines', 'wds' ),
289
+ 'E.g. /cats' => __( 'E.g. /cats', 'wds' ),
290
+ 'Keyword group' => __( 'Keyword group', 'wds' ),
291
+ '- Usually related terms' => __( '- Usually related terms', 'wds' ),
292
+ 'Link URL' => __( 'Link URL', 'wds' ),
293
+ 'internal-external-links-supported' => __( '- Both internal and external links are supported', 'wds' ),
294
+ 'choose-your-keywords-and-url' => __( 'Choose your keywords, and then specify the URL to auto-link to.', 'wds' ),
295
+ 'url-formats-explanation' => __( 'Formats include relative (E.g. <b>/cats</b>) or absolute URLs (E.g. <b>www.website.com/cats</b> or <b>https://website.com/cats</b>).', 'wds' ),
296
+ 'Cancel' => __( 'Cancel', 'wds' ),
297
+ ),
298
+ ) );
299
+ }
300
+
301
+ if ( class_exists( 'Smartcrawl_Autolinks_Settings' ) && ! wp_script_is( 'wds-admin-postlist', 'registered' ) ) {
302
+ wp_register_script( 'wds-admin-postlist', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-postlist.js', array(
303
+ 'underscore',
304
+ 'jquery',
305
+ 'wds-admin',
306
+ ), $version );
307
+ wp_localize_script( 'wds-admin-postlist', '_wds_postlist', array(
308
+ 'templates' => array(
309
+ 'exclude' => $this->_load( 'advanced-tools/underscore-postlist-exclusion' ),
310
+ 'exclude-item' => $this->_load( 'advanced-tools/underscore-postlist-exclusion-item' ),
311
+ 'selector' => $this->_load( 'advanced-tools/underscore-postlist-selector' ),
312
+ 'selector-list' => $this->_load( 'advanced-tools/underscore-postlist-selector-list' ),
313
+ 'selector-list-item' => $this->_load( 'advanced-tools/underscore-postlist-selector-list-item' ),
314
+ ),
315
+ 'post_types' => Smartcrawl_Autolinks_Settings::get_post_types(),
316
+ 'strings' => array(
317
+ 'Add Posts' => __( 'Add Posts', 'wds' ),
318
+ 'Remove' => __( 'Remove', 'wds' ),
319
+ 'Post' => __( 'Post', 'wds' ),
320
+ 'Post Type' => __( 'Post Type', 'wds' ),
321
+ 'Loading post items, please hold on' => __( 'Loading post items, please hold on...', 'wds' ),
322
+ 'Jump to page' => __( 'Jump to page:', 'wds' ),
323
+ 'Total Pages' => __( 'Total Pages:', 'wds' ),
324
+ ),
325
+ 'nonce' => wp_create_nonce( 'wds-autolinks-nonce' ),
326
+ ) );
327
+ }
328
+
329
+ if ( class_exists( 'Smartcrawl_Autolinks_Settings' ) && ! wp_script_is( 'wds-admin-autolinks', 'registered' ) ) {
330
+ wp_register_script( 'wds-admin-autolinks', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-autolinks.js', array(
331
+ 'underscore',
332
+ 'jquery',
333
+ 'wds-admin',
334
+ 'wds-select2',
335
+ 'wds-select2-admin',
336
+ 'wds-admin-keywords',
337
+ 'wds-admin-postlist',
338
+ ), $version );
339
+ }
340
+
341
+ if ( 'Smartcrawl_Autolinks_Settings' === get_class( $this ) && ! wp_script_is( 'wds-admin-redirects', 'registered' ) ) {
342
+ wp_register_script( 'wds-admin-redirects', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-redirects.js', array(
343
+ 'underscore',
344
+ 'jquery',
345
+ 'wds-admin',
346
+ 'wds-select2',
347
+ 'wds-select2-admin',
348
+ ), $version );
349
+
350
+ wp_localize_script( 'wds-admin-redirects', '_wds_redirects', array(
351
+ 'templates' => array(
352
+ 'redirect-item' => $this->_load( 'advanced-tools/underscore-redirect-item' ),
353
+ 'update-form' => $this->_load( 'advanced-tools/underscore-bulk-update-form' ),
354
+ ),
355
+ 'strings' => array(
356
+ 'Permanent (301)' => __( 'Permanent (301)', 'wds' ),
357
+ 'Temporary (302)' => __( 'Temporary (302)', 'wds' ),
358
+ 'Options' => __( 'Options', 'wds' ),
359
+ 'Remove' => __( 'Remove', 'wds' ),
360
+ 'Cancel' => __( 'Cancel', 'wds' ),
361
+ 'Update' => __( 'Update', 'wds' ),
362
+ 'Redirect Type' => __( 'Redirect Type', 'wds' ),
363
+ 'New URL' => __( 'New URL', 'wds' ),
364
+ 'Bulk Update' => __( 'Bulk Update', 'wds' ),
365
+ 'Please select some items to edit them.' => __( 'Please select some items to edit them.', 'wds' ),
366
+ ),
367
+ ) );
368
+ }
369
+
370
+ if ( class_exists( 'Smartcrawl_Onpage_Settings' ) && ! wp_script_is( 'wds-admin-onpage', 'registered' ) ) {
371
+ wp_register_script( 'wds-admin-onpage', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-onpage.js', array(
372
+ 'wds-admin-macros',
373
+ 'wds-admin-opengraph',
374
+ 'wds-qtip2-script',
375
+ 'jquery',
376
+ ), $version );
377
+
378
+ wp_localize_script( 'wds-admin-onpage', '_wds_onpage', array(
379
+ 'nonce' => wp_create_nonce( 'wds-onpage-nonce' ),
380
+ ) );
381
+ }
382
+
383
+ if ( class_exists( 'Smartcrawl_Sitemap_Settings' ) && ! wp_script_is( 'wds-admin-sitemaps', 'registered' ) ) {
384
+ wp_register_script( 'wds-admin-sitemaps', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-sitemaps.js', array(
385
+ 'wds-admin',
386
+ 'wds-qtip2-script',
387
+ 'jquery',
388
+ ), $version );
389
+
390
+ wp_localize_script( 'wds-admin-sitemaps', '_wds_sitemaps', array(
391
+ 'nonce' => wp_create_nonce( 'wds-nonce' ),
392
+ ) );
393
+ };
394
+
395
+ if ( class_exists( 'Smartcrawl_Settings_Dashboard' ) && ! wp_script_is( 'wds-admin-dashboard', 'registered' ) ) {
396
+ wp_register_script( 'wds-admin-dashboard', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-dashboard.js', array(
397
+ 'wds-admin',
398
+ 'wds-qtip2-script',
399
+ 'jquery',
400
+ ), $version );
401
+
402
+ wp_localize_script( 'wds-admin-dashboard', '_wds_dashboard', array(
403
+ 'nonce' => wp_create_nonce( 'wds-nonce' ),
404
+ ) );
405
+ };
406
+
407
+ if ( class_exists( 'Smartcrawl_Checkup_Settings' ) && ! wp_script_is( 'wds-admin-checkup', 'registered' ) ) {
408
+ wp_register_script( 'wds-admin-checkup', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-checkup.js', array(
409
+ 'wds-admin',
410
+ 'wds-qtip2-script',
411
+ 'jquery',
412
+ ), $version );
413
+ };
414
+
415
+ if ( class_exists( 'Smartcrawl_Social_Settings' ) && ! wp_script_is( 'wds-admin-social', 'registered' ) ) {
416
+ wp_register_script( 'wds-admin-social', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-social.js', array(
417
+ 'wds-admin',
418
+ 'wds-qtip2-script',
419
+ 'jquery',
420
+ ), $version );
421
+ };
422
+
423
+ if ( class_exists( 'Smartcrawl_Settings_Settings' ) && ! wp_script_is( 'wds-admin-settings', 'registered' ) ) {
424
+ wp_register_script( 'wds-admin-settings', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-settings.js', array(
425
+ 'wds-admin',
426
+ 'wds-qtip2-script',
427
+ 'jquery',
428
+ ), $version );
429
+
430
+ wp_localize_script( 'wds-admin-settings', '_wds_setting', array(
431
+ 'strings' => array(
432
+ 'importing' => esc_html__( 'Importing', 'wds' ),
433
+ 'import' => esc_html__( 'Import', 'wds' ),
434
+ ),
435
+ ) );
436
+ };
437
+ }
438
+
439
+ /**
440
+ * Registers the scripts with global admin functionality
441
+ */
442
+ public static function register_global_admin_scripts() {
443
+ $version = Smartcrawl_Loader::get_version();
444
+ if ( ! wp_script_is( 'wds-admin', 'registered' ) ) {
445
+ wp_register_script( 'wds-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin.js', array( 'jquery' ), $version );
446
+
447
+ wp_localize_script( 'wds-admin', '_wds_admin', array(
448
+ 'nonce' => wp_create_nonce( 'wds-admin-nonce' ),
449
+ ) );
450
+ }
451
+
452
+ if ( ! wp_script_is( 'wds-admin-opengraph', 'registered' ) ) {
453
+ wp_register_script( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-opengraph.js', array(
454
+ 'underscore',
455
+ 'jquery',
456
+ 'wds-admin',
457
+ ), $version );
458
+ }
459
+
460
+ if ( ! wp_script_is( 'wds-select2', 'registered' ) ) {
461
+ wp_register_script( 'wds-select2', SMARTCRAWL_PLUGIN_URL . 'js/external/select2.min.js', array( 'jquery' ), $version );
462
+ }
463
+
464
+ if ( ! wp_script_is( 'wds-qtip2-script', 'registered' ) ) {
465
+ wp_register_script( 'wds-qtip2-script', SMARTCRAWL_PLUGIN_URL . 'js/external/jquery.qtip.min.js', array( 'jquery' ), $version );
466
+ }
467
+
468
+ wp_register_style( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . '/css/wds-opengraph.css', null, $version );
469
+
470
+ wp_register_style( 'wds-qtip2-style', SMARTCRAWL_PLUGIN_URL . '/css/external/jquery.qtip.min.css', null, $version );
471
+
472
+ wp_register_style( 'wds-select2', SMARTCRAWL_PLUGIN_URL . 'css/external/select2.min.css', null, $version );
473
+
474
+ wp_register_style( 'wds-app', SMARTCRAWL_PLUGIN_URL . 'css/app.css', array( 'wds-qtip2-style' ), $version );
475
+ }
476
+
477
+ /**
478
+ * Enqueue styles
479
+ */
480
+ public function admin_styles() {
481
+ $version = Smartcrawl_Loader::get_version();
482
+
483
+ $this->enqueue_shared_ui();
484
+
485
+ wp_enqueue_style( 'wds-qtip2-style' );
486
+ wp_enqueue_style( 'wds-select2' );
487
+ wp_enqueue_style( 'wds-app' );
488
+
489
+ if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'css/' . $this->name . '.css' ) ) {
490
+ wp_enqueue_style( $this->slug, SMARTCRAWL_PLUGIN_URL . 'css/' . $this->name . '.css', array( 'wds' ), $version );
491
+ }
492
+ }
493
+
494
+ /**
495
+ * Sets up and enqueues shared UI library
496
+ *
497
+ * @param bool $add_class Whether to add admin body class to the current page.
498
+ */
499
+ public static function enqueue_shared_ui( $add_class = true ) {
500
+ $version = Smartcrawl_Loader::get_version();
501
+ if ( $add_class ) {
502
+ add_filter(
503
+ 'admin_body_class',
504
+ array( 'WDEV_Plugin_Ui', 'admin_body_class' )
505
+ );
506
+ }
507
+
508
+ /**
509
+ * Enqueue Dashboard UI Shared Lib.
510
+ * We are doing it this way instead of calling WDEV_Plugin_Ui::load because we want to clear out the cache
511
+ * by changing the version.
512
+ */
513
+ $shared_ui_url = SMARTCRAWL_PLUGIN_URL . 'admin/shared-ui';
514
+ wp_enqueue_style(
515
+ 'wdev-plugin-google_fonts',
516
+ 'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Roboto:400,500,300,300italic',
517
+ false,
518
+ $version
519
+ );
520
+
521
+ wp_enqueue_style(
522
+ 'wdev-plugin-ui',
523
+ $shared_ui_url . '/wdev-ui.css',
524
+ array( 'wdev-plugin-google_fonts' ),
525
+ $version
526
+ );
527
+
528
+ wp_enqueue_script(
529
+ 'wdev-plugin-ui',
530
+ $shared_ui_url . '/wdev-ui.js',
531
+ array( 'jquery' ),
532
+ $version
533
+ );
534
+ }
535
+
536
+ /**
537
+ * Enqueue scripts
538
+ */
539
+ public function admin_scripts() {
540
+ $version = Smartcrawl_Loader::get_version();
541
+
542
+ wp_enqueue_script( 'wds' );
543
+
544
+ wp_enqueue_script( 'wds-select2' );
545
+ wp_enqueue_script( 'wds-select2-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-select2.js', array( 'wds-select2' ), $version );
546
+
547
+ if ( file_exists( SMARTCRAWL_PLUGIN_DIR . 'js/' . $this->name . '.js' ) ) {
548
+ wp_enqueue_script( $this->slug, SMARTCRAWL_PLUGIN_URL . 'js/' . $this->name . '.js', array( 'wds' ), $version );
549
+ }
550
+
551
+ }
552
+
553
+ /**
554
+ * Initiates a checkup run
555
+ */
556
+ public function run_checkup() {
557
+ if ( current_user_can( 'manage_options' ) ) {
558
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
559
+ $service->start();
560
+ }
561
+ wp_safe_redirect( esc_url( remove_query_arg( array( 'run-checkup', '_wds_nonce' ) ) ) );
562
+ die;
563
+ }
564
+
565
+ /**
566
+ * Display the admin options page
567
+ */
568
+ public function options_page() {
569
+ // phpcs:disable -- $_GET values need to be used without nonces
570
+ $this->msg = '';
571
+ if ( ! empty( $_GET['updated'] ) || ! empty( $_GET['settings-updated'] ) ) {
572
+ $this->msg = __( 'Settings updated', 'wds' );
573
+
574
+ if ( function_exists( 'w3tc_pgcache_flush' ) ) {
575
+ w3tc_pgcache_flush();
576
+ $this->msg .= __( ' &amp; W3 Total Cache Page Cache flushed', 'wds' );
577
+ } elseif ( function_exists( 'wp_cache_clear_cache' ) ) {
578
+ wp_cache_clear_cache();
579
+ $this->msg .= __( ' &amp; WP Super Cache flushed', 'wds' );
580
+ }
581
+ }
582
+
583
+ if ( ! empty( $_GET['imported'] ) ) {
584
+ $plugin = smartcrawl_get_array_value( $_GET, 'plugin' );
585
+ $plugin_label = 'yoast' === $plugin ? __( 'Yoast SEO', 'wds' ) : __( 'All In One SEO', 'wds' );
586
+
587
+ $plugins_link = sprintf(
588
+ '<a href="%s">%s</a>',
589
+ admin_url( 'plugins.php' ),
590
+ sprintf(
591
+ __( 'deactivate %s', 'wds' ),
592
+ $plugin_label
593
+ )
594
+ );
595
+
596
+ $this->msg = sprintf(
597
+ __( 'Your %1$s configuration has been successfully imported! We recommend you %2$s to avoid any potential conflicts.', 'wds' ),
598
+ $plugin_label,
599
+ $plugins_link
600
+ );
601
+ }
602
+
603
+ $errors = get_settings_errors( $this->option_name );
604
+ if ( $errors ) {
605
+ set_transient( 'wds-settings-save-errors', $errors, 3 );
606
+ }
607
+ // phpcs:enable
608
+ }
609
+
610
+ /**
611
+ * Sets up contextual help
612
+ *
613
+ * @param string $contextual_help Help.
614
+ *
615
+ * @return string
616
+ */
617
+ public function contextual_help( $contextual_help ) {
618
+ $page = smartcrawl_get_array_value( $_GET, 'page' ); // phpcs:ignore -- Can't add nonce to the request
619
+ if ( ! empty( $page ) && $page === $this->slug && ! empty( $this->contextual_help ) ) {
620
+ $contextual_help = $this->contextual_help;
621
+ }
622
+
623
+ return $contextual_help;
624
+ }
625
+
626
+ /**
627
+ * Adds body class
628
+ *
629
+ * @TODO: Apparently a no-op?
630
+ *
631
+ * @param string $class Class that's being processed.
632
+ *
633
+ * @return string
634
+ */
635
+ public function add_body_class( $class ) {
636
+ global $current_screen;
637
+
638
+ if ( str_replace( '-network', '', $current_screen->id ) === $this->smartcrawl_page_hook ) {
639
+ return $class;
640
+ } else {
641
+ return $class;
642
+ }
643
+ }
644
+
645
+ /**
646
+ * On form submission, this method saves the last active tab in a transient so that it can be opened when the page is refreshed.
647
+ */
648
+ public function save_last_active_tab() {
649
+ $data = isset( $_POST['_wpnonce'], $_POST['option_page'] ) && wp_verify_nonce( $_POST['_wpnonce'], $_POST['option_page'] . '-options' )
650
+ ? stripslashes_deep( $_POST )
651
+ : array();
652
+
653
+ if ( isset( $data['wds-admin-active-tab'] ) ) {
654
+ set_transient( 'wds-admin-active-tab', sanitize_key( $data['wds-admin-active-tab'] ), 10 );
655
+ }
656
+ }
657
+
658
+ /**
659
+ * Renders the whole page view by calling `_render`
660
+ *
661
+ * As a side-effect, also calls `WDEV_Plugin_Ui::output()`
662
+ *
663
+ * @param string $view View file to load.
664
+ * @param array $args Optional array of arguments to pass to view.
665
+ *
666
+ * @return bool
667
+ */
668
+ protected function _render_page( $view, $args = array() ) {
669
+ WDEV_Plugin_Ui::output();
670
+ $this->_render( $view, $args );
671
+
672
+ return true;
673
+ }
674
+
675
+ /**
676
+ * Populates view defaults with view meta information
677
+ *
678
+ * @return array Defaults
679
+ */
680
+ protected function _get_view_defaults() {
681
+ $errors = get_transient( 'wds-settings-save-errors' );
682
+ $errors = ! empty( $errors ) ? $errors : array();
683
+
684
+ return array(
685
+ '_view' => array(
686
+ 'slug' => $this->slug,
687
+ 'name' => $this->name,
688
+ 'option_name' => $this->option_name,
689
+ 'options' => $this->options,
690
+ 'action_url' => $this->action_url,
691
+ 'msg' => $this->msg,
692
+ 'errors' => $errors,
693
+ ),
694
+ );
695
+ }
696
+
697
+ /**
698
+ * Checks if the last active tab is stored in the transient and returns its value. If nothing is available then it returns the default value.
699
+ *
700
+ * @param string $default Fallback value.
701
+ *
702
+ * @return string The last active tab.
703
+ */
704
+ protected function _get_last_active_tab( $default = '' ) {
705
+ $active_tab = get_transient( 'wds-admin-active-tab' );
706
+ delete_transient( 'wds-admin-active-tab' );
707
+
708
+ return $active_tab ? $active_tab : $default;
709
+ }
710
+ }
includes/admin/settings/autolinks.php CHANGED
@@ -1,492 +1,526 @@
1
- <?php
2
- /**
3
- * Autolinks module settings
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- /**
9
- * Init WDS Autolinks Settings
10
- */
11
- class Smartcrawl_Autolinks_Settings extends Smartcrawl_Settings_Admin {
12
-
13
- /**
14
- * Holds singleton instance
15
- *
16
- * @var Smartcrawl_Autolinks_Settings
17
- */
18
- private static $_instance;
19
-
20
- /**
21
- * Singleton instance getter
22
- *
23
- * @return Smartcrawl_Autolinks_Settings instance
24
- */
25
- public static function get_instance() {
26
- if ( empty( self::$_instance ) ) {
27
- self::$_instance = new self;
28
- }
29
- return self::$_instance;
30
- }
31
-
32
- /**
33
- * Static known public post types getter
34
- *
35
- * @return array A list of known post type *objects* keyed by name
36
- */
37
- public static function get_post_types() {
38
- static $post_types;
39
-
40
- if ( empty( $post_types ) ) {
41
- $exclusions = array(
42
- 'revision',
43
- 'nav_menu_item',
44
- 'attachment',
45
- );
46
- $raw = get_post_types(array(
47
- 'public' => true,
48
- ), 'objects');
49
- foreach ( $raw as $pt => $pto ) {
50
- if ( in_array( $pt, $exclusions ) ) { continue; }
51
- $post_types[ $pt ] = $pto;
52
- }
53
- }
54
-
55
- return is_array( $post_types )
56
- ? $post_types
57
- : array()
58
- ;
59
- }
60
-
61
- /**
62
- * Validate submitted options
63
- *
64
- * @param array $input Raw input.
65
- *
66
- * @return array Validated input
67
- */
68
- public function validate( $input ) {
69
- $save_redirects = isset( $input['save_redirects'] ) && $input['save_redirects'];
70
- if ( $save_redirects ) {
71
- $this->save_redirects( $input );
72
-
73
- $result = self::get_specific_options( $this->option_name );
74
-
75
- if ( isset( $input['redirect-attachments'] ) ) {
76
- $result['redirect-attachments'] = ! empty( $input['redirect-attachments'] );
77
- }
78
- if ( isset( $input['redirect-attachments-images_only'] ) ) {
79
- $result['redirect-attachments-images_only'] = ! empty( $input['redirect-attachments-images_only'] );
80
- }
81
-
82
- if ( isset( $input['redirections-code'] ) ) {
83
- $this->_validate_and_save_extra_options( $input );
84
- }
85
-
86
- return $result;
87
- }
88
-
89
- $service = $this->get_site_service();
90
-
91
- $result = array();
92
-
93
- if ( ! empty( $input['wds_autolinks-setup'] ) ) { $result['wds_autolinks-setup'] = true; }
94
-
95
- if ( $service->is_member() ) {
96
- // Booleans.
97
- $booleans = array(
98
- 'comment',
99
- 'onlysingle',
100
- 'allowfeed',
101
- 'casesens',
102
- 'customkey_preventduplicatelink',
103
- 'target_blank',
104
- 'rel_nofollow',
105
- 'allow_empty_tax',
106
- 'excludeheading',
107
- );
108
-
109
- foreach ( $booleans as $bool ) {
110
- if ( ! empty( $input[ $bool ] ) ) { $result[ $bool ] = true; }
111
- }
112
-
113
- // Boolean Arrays.
114
- $post_type_names = array_keys( self::get_post_types() );
115
- foreach ( array_merge( $post_type_names, array( 'comment' ) ) as $post_type ) {
116
- $result[ $post_type ] = in_array( $post_type, $input );
117
- }
118
- foreach ( $post_type_names as $post_type ) {
119
- $result[ "l{$post_type}" ] = in_array( "l{$post_type}", $input );
120
- }
121
- foreach ( get_taxonomies() as $taxonomy ) {
122
- $tax = get_taxonomy( $taxonomy );
123
- $key = strtolower( $tax->labels->name );
124
- $result[ "l{$key}" ] = in_array( "l{$key}", $input );
125
- }
126
-
127
- // Numerics.
128
- $numeric = array(
129
- 'cpt_char_limit',
130
- 'tax_char_limit',
131
- 'link_limit',
132
- 'single_link_limit',
133
- );
134
- foreach ( $numeric as $num ) {
135
- if ( isset( $input[ $num ] ) ) {
136
- if ( is_numeric( $input[ $num ] ) ) {
137
- $result[ $num ] = (int) $input[ $num ];
138
- } elseif ( ! empty( $input[ $num ] ) ) {
139
- add_settings_error( $num, $num, __( 'Limit values must be numeric' ) );
140
- }
141
- }
142
- }
143
-
144
- // Strings.
145
- $strings = array(
146
- 'ignore',
147
- 'ignorepost',
148
- );
149
- foreach ( $strings as $str ) {
150
- if ( isset( $input[ $str ] ) ) { $result[ $str ] = sanitize_text_field( $input[ $str ] ); }
151
- }
152
-
153
- // Custom keywords, they need newlines.
154
- if ( isset( $input['customkey'] ) ) {
155
- $str = wp_check_invalid_utf8( $input['customkey'] );
156
- $str = wp_pre_kses_less_than( $str );
157
- $str = wp_strip_all_tags( $str );
158
- $result['customkey'] = $str;
159
-
160
- $found = false;
161
- while ( preg_match( '/%[a-f0-9]{2}/i', $str, $match ) ) {
162
- $str = str_replace( $match[0], '', $str );
163
- $found = true;
164
- }
165
- if ( $found ) { $str = trim( preg_replace( '/ +/', ' ', $str ) ); }
166
- }
167
- }
168
-
169
- return $result;
170
- }
171
-
172
- /**
173
- * Process extra options
174
- *
175
- * @param array $input Raw input.
176
- */
177
- private function _validate_and_save_extra_options( $input ) {
178
- $settings = Smartcrawl_Settings::get_specific_options( 'wds_settings_options' );
179
- $settings['redirections-code'] = (int) $input['redirections-code'];
180
- Smartcrawl_Settings::update_specific_options( 'wds_settings_options', $settings );
181
- }
182
-
183
- /**
184
- * Initializes the admin pane
185
- */
186
- public function init() {
187
- $this->option_name = 'wds_autolinks_options';
188
- $this->name = Smartcrawl_Settings::COMP_AUTOLINKS;
189
- $this->slug = Smartcrawl_Settings::TAB_AUTOLINKS;
190
- $this->action_url = admin_url( 'options.php' );
191
- $this->title = __( 'Advanced Tools', 'wds' );
192
- $this->page_title = __( 'SmartCrawl Wizard: Advanced Tools', 'wds' );
193
-
194
- add_action( 'wp_ajax_wds-load_exclusion-post_data', array( $this, 'json_load_post' ) );
195
- add_action( 'wp_ajax_wds-load_exclusion_posts-posts_data-specific', array( $this, 'json_load_posts_specific' ) );
196
- add_action( 'wp_ajax_wds-load_exclusion_posts-posts_data-paged', array( $this, 'json_load_posts_paged' ) );
197
- add_action( 'admin_init', array( $this, 'reset_moz_api_credentials' ) );
198
-
199
- parent::init();
200
- }
201
-
202
- /**
203
- * Resets Moz API creds
204
- */
205
- public function reset_moz_api_credentials() {
206
- if ( isset( $_POST['reset-moz-credentials'] ) ) { // Just a presence flag.
207
- $options = self::get_specific_options( 'wds_settings_options' );
208
- unset( $options['access-id'] );
209
- unset( $options['secret-key'] );
210
- self::update_specific_options( 'wds_settings_options', $options );
211
-
212
- $ref = wp_get_referer();
213
- $ref = ! empty( $ref )
214
- ? $ref
215
- : Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
216
- wp_safe_redirect( esc_url_raw( $ref ) );
217
- die;
218
- }
219
- }
220
-
221
- /**
222
- * Loads Individual post data
223
- *
224
- * Outputs AJAX response
225
- */
226
- public function json_load_post() {
227
- $result = array(
228
- 'id' => 0,
229
- 'title' => '',
230
- 'type' => '',
231
- );
232
- if ( ! current_user_can( 'edit_others_posts' ) ) { wp_send_json( $result ); }
233
-
234
- $post_id = ! empty( $_POST['id'] ) && is_numeric( $_POST['id'] )
235
- ? (int) $_POST['id']
236
- : false
237
- ;
238
- if ( empty( $post_id ) ) { wp_send_json( $result ); }
239
-
240
- $post = get_post( $post_id );
241
- if ( ! $post ) { wp_send_json( $result ); }
242
-
243
- wp_send_json( $this->_post_to_response_data( $post ) );
244
- }
245
-
246
- /**
247
- * Loads posts by specific IDs
248
- *
249
- * Outputs AJAX response
250
- */
251
- public function json_load_posts_specific() {
252
- $result = array(
253
- 'meta' => array(),
254
- 'posts' => array(),
255
- );
256
- if ( ! current_user_can( 'edit_others_posts' ) ) { wp_send_json( $result ); }
257
-
258
- $post_ids = ! empty( $_POST['posts'] ) && is_array( $_POST['posts'] )
259
- ? array_values( array_filter( array_map( 'intval', $_POST['posts'] ) ) )
260
- : array()
261
- ;
262
- if ( empty( $post_ids ) ) { wp_send_json( $result ); }
263
-
264
- $args = array(
265
- 'post_status' => 'publish',
266
- 'posts_per_page' => -1,
267
- 'post__in' => $post_ids,
268
- 'ignore_sticky_posts' => true,
269
- 'post_type' => 'any',
270
- );
271
-
272
- $query = new WP_Query( $args );
273
-
274
- $result['meta'] = array(
275
- 'total' => $query->max_num_pages,
276
- 'page' => 1,
277
- );
278
-
279
- foreach ( $query->posts as $post ) {
280
- $result['posts'][] = $this->_post_to_response_data( $post );
281
- }
282
-
283
- wp_send_json( $result );
284
- }
285
-
286
- /**
287
- * Loads paged posts of certain type
288
- *
289
- * Outputs AJAX response
290
- */
291
- public function json_load_posts_paged() {
292
- $result = array(
293
- 'meta' => array(),
294
- 'posts' => array(),
295
- );
296
- if ( ! current_user_can( 'edit_others_posts' ) ) { wp_send_json( $result ); }
297
- $args = array(
298
- 'post_status' => 'publish',
299
- 'posts_per_page' => 10,
300
- 'ignore_sticky_posts' => true,
301
- );
302
- $page = 1;
303
- if ( ! empty( $_POST['type'] ) && in_array( $_POST['type'], array_keys( self::get_post_types() ) ) ) {
304
- $args['post_type'] = sanitize_key( $_POST['type'] );
305
- }
306
- if ( ! empty( $_POST['page'] ) && is_numeric( $_POST['page'] ) ) {
307
- $args['paged'] = (int) $_POST['page'];
308
- $page = $args['paged'];
309
- }
310
-
311
- $query = new WP_Query( $args );
312
-
313
- $result['meta'] = array(
314
- 'total' => $query->max_num_pages,
315
- 'page' => $page,
316
- );
317
-
318
- foreach ( $query->posts as $post ) {
319
- $result['posts'][] = $this->_post_to_response_data( $post );
320
- }
321
-
322
- wp_send_json( $result );
323
- }
324
-
325
- /**
326
- * Makes the post response format uniform
327
- *
328
- * @param object $post WP_Post instance.
329
- *
330
- * @return array Post response hash
331
- */
332
- private function _post_to_response_data( $post ) {
333
- $result = array(
334
- 'id' => 0,
335
- 'title' => '',
336
- 'type' => '',
337
- 'date' => '',
338
- );
339
- if ( empty( $post ) || empty( $post->ID ) ) { return $result; }
340
- static $date_format;
341
-
342
- if ( empty( $date_format ) ) { $date_format = get_option( 'date_format' ); }
343
-
344
- $post_id = $post->ID;
345
- $result['id'] = $post_id;
346
- $result['title'] = get_the_title( $post_id );
347
- $result['type'] = get_post_type( $post_id );
348
- $result['date'] = get_post_time( $date_format, false, $post_id );
349
-
350
- return $result;
351
- }
352
-
353
- /**
354
- * Add admin settings page
355
- */
356
- public function options_page() {
357
- parent::options_page();
358
-
359
- $smartcrawl_options = Smartcrawl_Settings::get_options();
360
- $arguments = array(
361
- 'insert' => array(),
362
- );
363
-
364
- $post_types = array();
365
- foreach ( self::get_post_types() as $post_type => $pt ) {
366
- $key = strtolower( $pt->name );
367
- $post_types[ "l{$key}" ] = $pt->labels->name;
368
-
369
- $arguments['insert'][ "{$key}" ] = $pt->labels->name;
370
- }
371
-
372
- $taxonomies = array();
373
- foreach ( get_taxonomies() as $taxonomy ) {
374
- if ( ! in_array( $taxonomy, array( 'nav_menu', 'link_category', 'post_format' ) ) ) {
375
- $tax = get_taxonomy( $taxonomy );
376
- $key = strtolower( $tax->labels->name );
377
-
378
- $taxonomies[ "l{$key}" ] = $tax->labels->name;
379
- }
380
- }
381
- $redirection_model = new Smartcrawl_Model_Redirection;
382
- $arguments['redirections'] = $redirection_model->get_all_redirections();
383
- $arguments['redirection_types'] = $redirection_model->get_all_redirection_types();
384
-
385
- $arguments['linkto'] = array_merge( $post_types, $taxonomies );
386
- $arguments['insert']['comment'] = __( 'Comments' , 'wds' );
387
-
388
- $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_automatic_linking' );
389
-
390
- wp_enqueue_script( 'wds-admin-autolinks' );
391
- wp_enqueue_script( 'wds-admin-redirects' );
392
- $this->_render_page( 'advanced-tools/advanced-tools-settings', $arguments );
393
- }
394
-
395
- /**
396
- * Default settings
397
- */
398
- public function defaults() {
399
-
400
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
401
- $this->options = get_site_option( $this->option_name );
402
- } else {
403
- $this->options = get_option( $this->option_name );
404
- }
405
-
406
- if ( empty( $this->options['ignorepost'] ) ) {
407
- $this->options['ignorepost'] = '';
408
- }
409
-
410
- if ( empty( $this->options['ignore'] ) ) {
411
- $this->options['ignore'] = '';
412
- }
413
-
414
- if ( empty( $this->options['customkey'] ) ) {
415
- $this->options['customkey'] = '';
416
- }
417
-
418
- if ( empty( $this->options['cpt_char_limit'] ) ) {
419
- $this->options['cpt_char_limit'] = '';
420
- }
421
-
422
- if ( empty( $this->options['tax_char_limit'] ) ) {
423
- $this->options['tax_char_limit'] = '';
424
- }
425
-
426
- if ( ! isset( $this->options['link_limit'] ) ) {
427
- $this->options['link_limit'] = '';
428
- }
429
-
430
- if ( ! isset( $this->options['single_link_limit'] ) ) {
431
- $this->options['single_link_limit'] = '';
432
- }
433
-
434
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
435
- update_site_option( $this->option_name, $this->options );
436
- } else {
437
- update_option( $this->option_name, $this->options );
438
- }
439
- }
440
-
441
- /**
442
- * Saves redirects part of the input
443
- *
444
- * @param array $input Raw input.
445
- */
446
- public function save_redirects( $input ) {
447
- $urls = ! empty( $input['urls'] ) && is_array( $input['urls'] )
448
- ? $input['urls']
449
- : array();
450
- $redirection_model = new Smartcrawl_Model_Redirection;
451
-
452
- $new_urls = array();
453
- $new_types = array();
454
- foreach ( $urls as $index => $url_details ) {
455
- $source = smartcrawl_get_array_value( $url_details, 'source' );
456
- $source = trim( esc_url( $source ) );
457
-
458
- $destination = smartcrawl_get_array_value( $url_details, 'destination' );
459
- $destination = trim( esc_url( $destination ) );
460
-
461
- if ( ! trim( $source ) || ! trim( $destination ) ) {
462
- continue;
463
- }
464
- if ( ! preg_match( '/^https?:\/\//', $source ) ) { $source = home_url( $source ); }
465
- if ( ! preg_match( '/^https?:\/\//', $destination ) ) { $destination = home_url( $destination ); }
466
-
467
- $new_urls[ $source ] = $destination;
468
-
469
- $type = smartcrawl_get_array_value( $url_details, 'type' );
470
- $status = $redirection_model->get_valid_redirection_status_type( $type );
471
-
472
- $new_types[ $source ] = $status;
473
- }
474
- $redirection_model->set_all_redirections( $new_urls );
475
- $redirection_model->set_all_redirection_types( $new_types );
476
- }
477
-
478
- /**
479
- * Gets site service instance
480
- *
481
- * @return object
482
- */
483
- private function get_site_service() {
484
- if ( ! class_exists( 'Smartcrawl_Service' ) ) {
485
- require_once( SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_service.php' );
486
- }
487
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE );
488
- return $service;
489
- }
490
-
491
- }
492
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Autolinks module settings
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Init WDS Autolinks Settings
10
+ */
11
+ class Smartcrawl_Autolinks_Settings extends Smartcrawl_Settings_Admin {
12
+
13
+ /**
14
+ * Holds singleton instance
15
+ *
16
+ * @var Smartcrawl_Autolinks_Settings
17
+ */
18
+ private static $_instance;
19
+
20
+ /**
21
+ * Singleton instance getter
22
+ *
23
+ * @return Smartcrawl_Autolinks_Settings instance
24
+ */
25
+ public static function get_instance() {
26
+ if ( empty( self::$_instance ) ) {
27
+ self::$_instance = new self();
28
+ }
29
+
30
+ return self::$_instance;
31
+ }
32
+
33
+ /**
34
+ * Validate submitted options
35
+ *
36
+ * @param array $input Raw input.
37
+ *
38
+ * @return array Validated input
39
+ */
40
+ public function validate( $input ) {
41
+ $save_redirects = isset( $input['save_redirects'] ) && $input['save_redirects'];
42
+ if ( $save_redirects ) {
43
+ $this->save_redirects( $input );
44
+
45
+ $result = self::get_specific_options( $this->option_name );
46
+ $result['redirect-attachments'] = ! empty( $input['redirect-attachments'] );
47
+ $result['redirect-attachments-images_only'] = ! empty( $input['redirect-attachments-images_only'] );
48
+
49
+ if ( isset( $input['redirections-code'] ) ) {
50
+ $this->_validate_and_save_extra_options( $input );
51
+ }
52
+
53
+ return $result;
54
+ }
55
+
56
+ $service = $this->get_site_service();
57
+
58
+ $result = array();
59
+
60
+ if ( ! empty( $input['wds_autolinks-setup'] ) ) {
61
+ $result['wds_autolinks-setup'] = true;
62
+ }
63
+
64
+ if ( $service->is_member() ) {
65
+ // Booleans.
66
+ $booleans = array(
67
+ 'comment',
68
+ 'onlysingle',
69
+ 'allowfeed',
70
+ 'casesens',
71
+ 'customkey_preventduplicatelink',
72
+ 'target_blank',
73
+ 'rel_nofollow',
74
+ 'allow_empty_tax',
75
+ 'excludeheading',
76
+ );
77
+
78
+ foreach ( $booleans as $bool ) {
79
+ if ( ! empty( $input[ $bool ] ) ) {
80
+ $result[ $bool ] = true;
81
+ }
82
+ }
83
+
84
+ // Boolean Arrays.
85
+ $post_type_names = array_keys( self::get_post_types() );
86
+ foreach ( array_merge( $post_type_names, array( 'comment' ) ) as $post_type ) {
87
+ $result[ $post_type ] = in_array( $post_type, $input, true );
88
+ }
89
+ foreach ( $post_type_names as $post_type ) {
90
+ $result["l{$post_type}"] = in_array( "l{$post_type}", $input, true );
91
+ }
92
+ foreach ( get_taxonomies() as $taxonomy ) {
93
+ $tax = get_taxonomy( $taxonomy );
94
+ $key = strtolower( $tax->labels->name );
95
+ $result["l{$key}"] = in_array( "l{$key}", $input, true );
96
+ }
97
+
98
+ // Numerics.
99
+ $numeric = array(
100
+ 'cpt_char_limit',
101
+ 'tax_char_limit',
102
+ 'link_limit',
103
+ 'single_link_limit',
104
+ );
105
+ foreach ( $numeric as $num ) {
106
+ if ( isset( $input[ $num ] ) ) {
107
+ if ( is_numeric( $input[ $num ] ) ) {
108
+ $result[ $num ] = (int) $input[ $num ];
109
+ } elseif ( ! empty( $input[ $num ] ) ) {
110
+ add_settings_error( $this->option_name, 'numeric-limits', __( 'Limit values must be numeric' ) );
111
+ }
112
+ }
113
+ }
114
+
115
+ // Strings.
116
+ $strings = array(
117
+ 'ignore',
118
+ 'ignorepost',
119
+ );
120
+ foreach ( $strings as $str ) {
121
+ if ( isset( $input[ $str ] ) ) {
122
+ $result[ $str ] = sanitize_text_field( $input[ $str ] );
123
+ }
124
+ }
125
+
126
+ // Custom keywords, they need newlines.
127
+ if ( isset( $input['customkey'] ) ) {
128
+ $str = wp_check_invalid_utf8( $input['customkey'] );
129
+ $str = wp_pre_kses_less_than( $str );
130
+ $str = wp_strip_all_tags( $str );
131
+ $result['customkey'] = $str;
132
+
133
+ $found = false;
134
+ while ( preg_match( '/%[a-f0-9]{2}/i', $str, $match ) ) {
135
+ $str = str_replace( $match[0], '', $str );
136
+ $found = true;
137
+ }
138
+ if ( $found ) {
139
+ $str = trim( preg_replace( '/ +/', ' ', $str ) );
140
+ }
141
+ }
142
+ }
143
+
144
+ return $result;
145
+ }
146
+
147
+ /**
148
+ * Saves redirects part of the input
149
+ *
150
+ * @param array $input Raw input.
151
+ */
152
+ public function save_redirects( $input ) {
153
+ $urls = ! empty( $input['urls'] ) && is_array( $input['urls'] )
154
+ ? $input['urls']
155
+ : array();
156
+ $redirection_model = new Smartcrawl_Model_Redirection();
157
+
158
+ $new_urls = array();
159
+ $new_types = array();
160
+ foreach ( $urls as $index => $url_details ) {
161
+ $source = smartcrawl_get_array_value( $url_details, 'source' );
162
+ $source = trim( esc_url( $source ) );
163
+
164
+ $destination = smartcrawl_get_array_value( $url_details, 'destination' );
165
+ $destination = trim( esc_url( $destination ) );
166
+
167
+ if ( ! trim( $source ) || ! trim( $destination ) ) {
168
+ continue;
169
+ }
170
+ if ( ! preg_match( '/^https?:\/\//', $source ) ) {
171
+ $source = home_url( $source );
172
+ }
173
+ if ( ! preg_match( '/^https?:\/\//', $destination ) ) {
174
+ $destination = home_url( $destination );
175
+ }
176
+
177
+ $new_urls[ $source ] = $destination;
178
+
179
+ $type = smartcrawl_get_array_value( $url_details, 'type' );
180
+ $status = $redirection_model->get_valid_redirection_status_type( $type );
181
+
182
+ $new_types[ $source ] = $status;
183
+ }
184
+ $redirection_model->set_all_redirections( $new_urls );
185
+ $redirection_model->set_all_redirection_types( $new_types );
186
+ }
187
+
188
+ /**
189
+ * Process extra options
190
+ *
191
+ * @param array $input Raw input.
192
+ */
193
+ private function _validate_and_save_extra_options( $input ) {
194
+ $settings = Smartcrawl_Settings::get_specific_options( 'wds_settings_options' );
195
+ $settings['redirections-code'] = (int) $input['redirections-code'];
196
+ Smartcrawl_Settings::update_specific_options( 'wds_settings_options', $settings );
197
+ }
198
+
199
+ /**
200
+ * Gets site service instance
201
+ *
202
+ * @return object
203
+ */
204
+ private function get_site_service() {
205
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE );
206
+
207
+ return $service;
208
+ }
209
+
210
+ /**
211
+ * Static known public post types getter
212
+ *
213
+ * @return array A list of known post type *objects* keyed by name
214
+ */
215
+ public static function get_post_types() {
216
+ static $post_types;
217
+
218
+ if ( empty( $post_types ) ) {
219
+ $exclusions = array(
220
+ 'revision',
221
+ 'nav_menu_item',
222
+ 'attachment',
223
+ );
224
+ $raw = get_post_types( array(
225
+ 'public' => true,
226
+ ), 'objects' );
227
+ foreach ( $raw as $pt => $pto ) {
228
+ if ( in_array( $pt, $exclusions, true ) ) {
229
+ continue;
230
+ }
231
+ $post_types[ $pt ] = $pto;
232
+ }
233
+ }
234
+
235
+ return is_array( $post_types )
236
+ ? $post_types
237
+ : array();
238
+ }
239
+
240
+ /**
241
+ * Initializes the admin pane
242
+ */
243
+ public function init() {
244
+ $this->option_name = 'wds_autolinks_options';
245
+ $this->name = Smartcrawl_Settings::COMP_AUTOLINKS;
246
+ $this->slug = Smartcrawl_Settings::TAB_AUTOLINKS;
247
+ $this->action_url = admin_url( 'options.php' );
248
+ $this->title = __( 'Advanced Tools', 'wds' );
249
+ $this->page_title = __( 'SmartCrawl Wizard: Advanced Tools', 'wds' );
250
+
251
+ add_action( 'wp_ajax_wds-load_exclusion-post_data', array( $this, 'json_load_post' ) );
252
+ add_action( 'wp_ajax_wds-load_exclusion_posts-posts_data-specific', array(
253
+ $this,
254
+ 'json_load_posts_specific',
255
+ ) );
256
+ add_action( 'wp_ajax_wds-load_exclusion_posts-posts_data-paged', array( $this, 'json_load_posts_paged' ) );
257
+ add_action( 'admin_init', array( $this, 'reset_moz_api_credentials' ) );
258
+
259
+ parent::init();
260
+ }
261
+
262
+ /**
263
+ * Resets Moz API creds
264
+ */
265
+ public function reset_moz_api_credentials() {
266
+ $post_data = $this->get_request_data();
267
+ if ( isset( $post_data['reset-moz-credentials'] ) ) { // Just a presence flag.
268
+ $options = self::get_specific_options( 'wds_settings_options' );
269
+ unset( $options['access-id'] );
270
+ unset( $options['secret-key'] );
271
+ self::update_specific_options( 'wds_settings_options', $options );
272
+
273
+ $ref = wp_get_referer();
274
+ $ref = ! empty( $ref )
275
+ ? $ref
276
+ : Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
277
+ wp_safe_redirect( esc_url_raw( $ref ) );
278
+ die;
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Loads Individual post data
284
+ *
285
+ * Outputs AJAX response
286
+ */
287
+ public function json_load_post() {
288
+ $post_data = $this->get_request_data();
289
+ $result = array(
290
+ 'id' => 0,
291
+ 'title' => '',
292
+ 'type' => '',
293
+ );
294
+ if ( ! current_user_can( 'edit_others_posts' ) || empty( $post_data ) ) {
295
+ wp_send_json( $result );
296
+ }
297
+
298
+ $post_id = ! empty( $post_data['id'] ) && is_numeric( $post_data['id'] )
299
+ ? (int) $post_data['id']
300
+ : false;
301
+ if ( empty( $post_id ) ) {
302
+ wp_send_json( $result );
303
+ }
304
+
305
+ $post = get_post( $post_id );
306
+ if ( ! $post ) {
307
+ wp_send_json( $result );
308
+ }
309
+
310
+ wp_send_json( $this->_post_to_response_data( $post ) );
311
+ }
312
+
313
+ /**
314
+ * Makes the post response format uniform
315
+ *
316
+ * @param object $post WP_Post instance.
317
+ *
318
+ * @return array Post response hash
319
+ */
320
+ private function _post_to_response_data( $post ) {
321
+ $result = array(
322
+ 'id' => 0,
323
+ 'title' => '',
324
+ 'type' => '',
325
+ 'date' => '',
326
+ );
327
+ if ( empty( $post ) || empty( $post->ID ) ) {
328
+ return $result;
329
+ }
330
+ static $date_format;
331
+
332
+ if ( empty( $date_format ) ) {
333
+ $date_format = get_option( 'date_format' );
334
+ }
335
+
336
+ $post_id = $post->ID;
337
+ $result['id'] = $post_id;
338
+ $result['title'] = get_the_title( $post_id );
339
+ $result['type'] = get_post_type( $post_id );
340
+ $result['date'] = get_post_time( $date_format, false, $post_id );
341
+
342
+ return $result;
343
+ }
344
+
345
+ /**
346
+ * Loads posts by specific IDs
347
+ *
348
+ * Outputs AJAX response
349
+ */
350
+ public function json_load_posts_specific() {
351
+ $post_data = $this->get_request_data();
352
+ $result = array(
353
+ 'meta' => array(),
354
+ 'posts' => array(),
355
+ );
356
+ if ( ! current_user_can( 'edit_others_posts' ) || empty( $post_data ) ) {
357
+ wp_send_json( $result );
358
+ }
359
+
360
+ $post_ids = ! empty( $post_data['posts'] ) && is_array( $post_data['posts'] )
361
+ ? array_values( array_filter( array_map( 'intval', $post_data['posts'] ) ) )
362
+ : array();
363
+ if ( empty( $post_ids ) ) {
364
+ wp_send_json( $result );
365
+ }
366
+
367
+ $args = array(
368
+ 'post_status' => 'publish',
369
+ 'posts_per_page' => - 1,
370
+ 'post__in' => $post_ids,
371
+ 'ignore_sticky_posts' => true,
372
+ 'post_type' => 'any',
373
+ );
374
+
375
+ $query = new WP_Query( $args );
376
+
377
+ $result['meta'] = array(
378
+ 'total' => $query->max_num_pages,
379
+ 'page' => 1,
380
+ );
381
+
382
+ foreach ( $query->posts as $post ) {
383
+ $result['posts'][] = $this->_post_to_response_data( $post );
384
+ }
385
+
386
+ wp_send_json( $result );
387
+ }
388
+
389
+ /**
390
+ * Loads paged posts of certain type
391
+ *
392
+ * Outputs AJAX response
393
+ */
394
+ public function json_load_posts_paged() {
395
+ $post_data = $this->get_request_data();
396
+ $result = array(
397
+ 'meta' => array(),
398
+ 'posts' => array(),
399
+ );
400
+ if ( ! current_user_can( 'edit_others_posts' ) || empty( $post_data ) ) {
401
+ wp_send_json( $result );
402
+ }
403
+ $args = array(
404
+ 'post_status' => 'publish',
405
+ 'posts_per_page' => 10,
406
+ 'ignore_sticky_posts' => true,
407
+ );
408
+ $page = 1;
409
+ if ( ! empty( $post_data['type'] ) && in_array( $post_data['type'], array_keys( self::get_post_types() ), true ) ) {
410
+ $args['post_type'] = sanitize_key( $post_data['type'] );
411
+ }
412
+ if ( ! empty( $post_data['page'] ) && is_numeric( $post_data['page'] ) ) {
413
+ $args['paged'] = (int) $post_data['page'];
414
+ $page = $args['paged'];
415
+ }
416
+
417
+ $query = new WP_Query( $args );
418
+
419
+ $result['meta'] = array(
420
+ 'total' => $query->max_num_pages,
421
+ 'page' => $page,
422
+ );
423
+
424
+ foreach ( $query->posts as $post ) {
425
+ $result['posts'][] = $this->_post_to_response_data( $post );
426
+ }
427
+
428
+ wp_send_json( $result );
429
+ }
430
+
431
+ /**
432
+ * Add admin settings page
433
+ */
434
+ public function options_page() {
435
+ parent::options_page();
436
+
437
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
438
+ $arguments = array(
439
+ 'insert' => array(),
440
+ );
441
+
442
+ $post_types = array();
443
+ foreach ( self::get_post_types() as $post_type => $pt ) {
444
+ $key = strtolower( $pt->name );
445
+ $post_types["l{$key}"] = $pt->labels->name;
446
+
447
+ $arguments['insert']["{$key}"] = $pt->labels->name;
448
+ }
449
+
450
+ $taxonomies = array();
451
+ foreach ( get_taxonomies() as $taxonomy ) {
452
+ if ( ! in_array( $taxonomy, array( 'nav_menu', 'link_category', 'post_format' ), true ) ) {
453
+ $tax = get_taxonomy( $taxonomy );
454
+ $key = strtolower( $tax->labels->name );
455
+
456
+ $taxonomies["l{$key}"] = $tax->labels->name;
457
+ }
458
+ }
459
+ $redirection_model = new Smartcrawl_Model_Redirection();
460
+ $arguments['redirections'] = $redirection_model->get_all_redirections();
461
+ $arguments['redirection_types'] = $redirection_model->get_all_redirection_types();
462
+
463
+ $arguments['linkto'] = array_merge( $post_types, $taxonomies );
464
+ $arguments['insert']['comment'] = __( 'Comments', 'wds' );
465
+
466
+ $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_automatic_linking' );
467
+
468
+ wp_enqueue_script( 'wds-admin-autolinks' );
469
+ wp_enqueue_script( 'wds-admin-redirects' );
470
+ $this->_render_page( 'advanced-tools/advanced-tools-settings', $arguments );
471
+ }
472
+
473
+ /**
474
+ * Default settings
475
+ */
476
+ public function defaults() {
477
+
478
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
479
+ $this->options = get_site_option( $this->option_name );
480
+ } else {
481
+ $this->options = get_option( $this->option_name );
482
+ }
483
+
484
+ if ( empty( $this->options['ignorepost'] ) ) {
485
+ $this->options['ignorepost'] = '';
486
+ }
487
+
488
+ if ( empty( $this->options['ignore'] ) ) {
489
+ $this->options['ignore'] = '';
490
+ }
491
+
492
+ if ( empty( $this->options['customkey'] ) ) {
493
+ $this->options['customkey'] = '';
494
+ }
495
+
496
+ if ( empty( $this->options['cpt_char_limit'] ) ) {
497
+ $this->options['cpt_char_limit'] = '';
498
+ }
499
+
500
+ if ( empty( $this->options['tax_char_limit'] ) ) {
501
+ $this->options['tax_char_limit'] = '';
502
+ }
503
+
504
+ if ( ! isset( $this->options['link_limit'] ) ) {
505
+ $this->options['link_limit'] = '';
506
+ }
507
+
508
+ if ( ! isset( $this->options['single_link_limit'] ) ) {
509
+ $this->options['single_link_limit'] = '';
510
+ }
511
+
512
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
513
+ update_site_option( $this->option_name, $this->options );
514
+ } else {
515
+ update_option( $this->option_name, $this->options );
516
+ }
517
+ }
518
+
519
+ /**
520
+ * @return array
521
+ */
522
+ private function get_request_data() {
523
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-autolinks-nonce' ) ? $_POST : array();
524
+ }
525
+ }
526
+
includes/admin/settings/checkup.php CHANGED
@@ -1,175 +1,196 @@
1
- <?php
2
- /**
3
- * Checkup service
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- /**
9
- * Checkup service admin handler class
10
- */
11
- class Smartcrawl_Checkup_Settings extends Smartcrawl_Settings_Admin {
12
-
13
- /**
14
- * Singleton instance
15
- *
16
- * @var Smartcrawl_Checkup_Settings
17
- */
18
- private static $_instance;
19
-
20
- /**
21
- * Singleton instance getter
22
- *
23
- * @return Smartcrawl_Checkup_Settings instance
24
- */
25
- public static function get_instance() {
26
- if ( empty( self::$_instance ) ) {
27
- self::$_instance = new self;
28
- }
29
- return self::$_instance;
30
- }
31
-
32
- /**
33
- * Validate submitted options
34
- *
35
- * @param array $input Raw input.
36
- *
37
- * @return array Validated input
38
- */
39
- public function validate( $input ) {
40
- if ( empty( $input['checkup-cron-enable'] ) ) {
41
- $result['checkup-cron-enable'] = false;
42
- return $result;
43
- } else { $result['checkup-cron-enable'] = true; }
44
-
45
- $frequency = ! empty( $input['checkup-frequency'] )
46
- ? Smartcrawl_Controller_Cron::get()->get_valid_frequency( $input['checkup-frequency'] )
47
- : Smartcrawl_Controller_Cron::get()->get_default_frequency();
48
- $result['checkup-frequency'] = $frequency;
49
-
50
- $dow = isset( $input['checkup-dow'] ) && is_numeric( $input['checkup-dow'] )
51
- ? (int) $input['checkup-dow']
52
- : 0
53
- ;
54
- $result['checkup-dow'] = in_array( $dow, range( 0,6 ) ) ? $dow : 0;
55
-
56
- $tod = isset( $input['checkup-tod'] ) && is_numeric( $input['checkup-tod'] )
57
- ? (int) $input['checkup-tod']
58
- : 0
59
- ;
60
- $result['checkup-tod'] = in_array( $tod, range( 0,23 ) ) ? $tod : 0;
61
-
62
- if ( ! empty( $input['email-recipients'] ) && is_array( $input['email-recipients'] ) ) {
63
- $result['email-recipients'] = array();
64
- foreach ( $input['email-recipients'] as $user ) {
65
- if ( ! is_numeric( $user ) ) {
66
- $user_obj = get_user_by( 'login', $user );
67
- $user = $user_obj->ID;
68
- }
69
-
70
- if ( is_numeric( $user ) ) { $result['email-recipients'][] = (int) $user; }
71
- }
72
- $result['email-recipients'] = array_values( array_filter( array_unique( $result['email-recipients'] ) ) );
73
- }
74
- if ( empty( $result['email-recipients'] ) ) {
75
- $defaults = $this->get_default_options();
76
- $result['email-recipients'] = $defaults['email-recipients'];
77
- }
78
-
79
- return $result;
80
- }
81
-
82
- /**
83
- * Initialize admin pane
84
- */
85
- public function init() {
86
- $this->option_name = 'wds_checkup_options';
87
- $this->name = Smartcrawl_Settings::COMP_CHECKUP;
88
- $this->slug = Smartcrawl_Settings::TAB_CHECKUP;
89
- $this->action_url = admin_url( 'options.php' );
90
- $this->title = __( 'SEO Checkup', 'wds' );
91
- $this->page_title = __( 'SmartCrawl Wizard: SEO Checkup', 'wds' );
92
-
93
- parent::init();
94
-
95
- add_action( 'wp_ajax_wds-checkup-status', array( $this, 'ajax_checkup_status' ) );
96
- }
97
-
98
- /**
99
- * Checks checkup service status and sends back percentage.
100
- */
101
- public function ajax_checkup_status() {
102
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
103
- $percentage = $service->status();
104
- return wp_send_json_success(array(
105
- 'percentage' => $percentage,
106
- ));
107
- }
108
-
109
- /**
110
- * Process run action
111
- */
112
- public function process_run_action() {
113
- if ( ! empty( $_GET['run-checkup'] ) ) { // Simple presence switch, no value.
114
- return $this->run_checkup();
115
- }
116
- }
117
-
118
- /**
119
- * Add admin settings page
120
- */
121
- public function options_page() {
122
- parent::options_page();
123
-
124
- $options = Smartcrawl_Settings::get_component_options( $this->name );
125
- $options = wp_parse_args(
126
- (is_array( $options ) ? $options : array()),
127
- $this->get_default_options()
128
- );
129
-
130
- $arguments = array(
131
- 'options' => $options,
132
- 'active_tab' => $this->_get_last_active_tab( 'tab_checkup' ),
133
- );
134
-
135
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
136
- wp_enqueue_script( 'wds-admin-checkup' );
137
-
138
- $this->_render_page( 'checkup/checkup-settings', $arguments );
139
- }
140
-
141
- /**
142
- * Gets default options set and their initial values
143
- *
144
- * @return array
145
- */
146
- public function get_default_options() {
147
- return array(
148
- 'checkup-cron-enable' => false,
149
- 'checkup-frequency' => 'weekly',
150
- 'checkup-dow' => rand( 0, 6 ),
151
- 'checkup-tod' => rand( 0, 23 ),
152
- 'email-recipients' => array( get_current_user_id() ),
153
- );
154
- }
155
-
156
- /**
157
- * Default settings
158
- */
159
- public function defaults() {
160
- $options = Smartcrawl_Settings::get_component_options( $this->name );
161
- $options = is_array( $options ) ? $options : array();
162
-
163
- foreach ( $this->get_default_options() as $opt => $default ) {
164
- if ( ! isset( $options[ $opt ] ) ) { $options[ $opt ] = $default; }
165
- }
166
-
167
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
168
- update_site_option( $this->option_name, $options );
169
- } else {
170
- update_option( $this->option_name, $options );
171
- }
172
- }
173
-
174
- }
175
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Checkup service
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Checkup service admin handler class
10
+ */
11
+ class Smartcrawl_Checkup_Settings extends Smartcrawl_Settings_Admin {
12
+
13
+ /**
14
+ * Singleton instance
15
+ *
16
+ * @var Smartcrawl_Checkup_Settings
17
+ */
18
+ private static $_instance;
19
+
20
+ /**
21
+ * Singleton instance getter
22
+ *
23
+ * @return Smartcrawl_Checkup_Settings instance
24
+ */
25
+ public static function get_instance() {
26
+ if ( empty( self::$_instance ) ) {
27
+ self::$_instance = new self();
28
+ }
29
+
30
+ return self::$_instance;
31
+ }
32
+
33
+ /**
34
+ * Validate submitted options
35
+ *
36
+ * @param array $input Raw input.
37
+ *
38
+ * @return array Validated input
39
+ */
40
+ public function validate( $input ) {
41
+ if ( ! empty( $input['email-recipients'] ) && is_array( $input['email-recipients'] ) ) {
42
+ $result['email-recipients'] = array();
43
+ foreach ( $input['email-recipients'] as $user ) {
44
+ if ( ! is_numeric( $user ) ) {
45
+ $user_obj = get_user_by( 'login', $user );
46
+ $user = $user_obj->ID;
47
+ }
48
+
49
+ if ( is_numeric( $user ) ) {
50
+ $result['email-recipients'][] = (int) $user;
51
+ }
52
+ }
53
+ $result['email-recipients'] = array_values( array_filter( array_unique( $result['email-recipients'] ) ) );
54
+ }
55
+ if ( empty( $result['email-recipients'] ) ) {
56
+ $defaults = $this->get_default_options();
57
+ $result['email-recipients'] = $defaults['email-recipients'];
58
+
59
+ add_settings_error(
60
+ $this->option_name,
61
+ 'email-recipients-required',
62
+ esc_html__( 'There has to be at least one email recipient. The default recipient has been added back.', 'wds' )
63
+ );
64
+ }
65
+
66
+ if ( empty( $input['checkup-cron-enable'] ) ) {
67
+ $result['checkup-cron-enable'] = false;
68
+
69
+ return $result;
70
+ } else {
71
+ $result['checkup-cron-enable'] = true;
72
+ }
73
+
74
+ $frequency = ! empty( $input['checkup-frequency'] )
75
+ ? Smartcrawl_Controller_Cron::get()->get_valid_frequency( $input['checkup-frequency'] )
76
+ : Smartcrawl_Controller_Cron::get()->get_default_frequency();
77
+ $result['checkup-frequency'] = $frequency;
78
+
79
+ $dow = isset( $input['checkup-dow'] ) && is_numeric( $input['checkup-dow'] )
80
+ ? (int) $input['checkup-dow']
81
+ : 0;
82
+ $result['checkup-dow'] = in_array( $dow, range( 0, 6 ), true ) ? $dow : 0;
83
+
84
+ $tod = isset( $input['checkup-tod'] ) && is_numeric( $input['checkup-tod'] )
85
+ ? (int) $input['checkup-tod']
86
+ : 0;
87
+ $result['checkup-tod'] = in_array( $tod, range( 0, 23 ), true ) ? $tod : 0;
88
+
89
+ return $result;
90
+ }
91
+
92
+ /**
93
+ * Gets default options set and their initial values
94
+ *
95
+ * @return array
96
+ */
97
+ public function get_default_options() {
98
+ return array(
99
+ 'checkup-cron-enable' => false,
100
+ 'checkup-frequency' => 'weekly',
101
+ 'checkup-dow' => rand( 0, 6 ),
102
+ 'checkup-tod' => rand( 0, 23 ),
103
+ 'email-recipients' => array( get_current_user_id() ),
104
+ );
105
+ }
106
+
107
+ /**
108
+ * Initialize admin pane
109
+ */
110
+ public function init() {
111
+ $this->option_name = 'wds_checkup_options';
112
+ $this->name = Smartcrawl_Settings::COMP_CHECKUP;
113
+ $this->slug = Smartcrawl_Settings::TAB_CHECKUP;
114
+ $this->action_url = admin_url( 'options.php' );
115
+ $this->title = __( 'SEO Checkup', 'wds' );
116
+ $this->page_title = __( 'SmartCrawl Wizard: SEO Checkup', 'wds' );
117
+
118
+ parent::init();
119
+
120
+ add_action( 'wp_ajax_wds-checkup-status', array( $this, 'ajax_checkup_status' ) );
121
+ }
122
+
123
+ /**
124
+ * Checks checkup service status and sends back percentage.
125
+ */
126
+ public function ajax_checkup_status() {
127
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
128
+ $percentage = $service->status();
129
+ wp_send_json_success( array(
130
+ 'percentage' => $percentage,
131
+ ) );
132
+ }
133
+
134
+ /**
135
+ * Process run action
136
+ */
137
+ public function process_run_action() {
138
+ if ( isset( $_GET['_wds_nonce'], $_GET['run-checkup'] ) && wp_verify_nonce( $_GET['_wds_nonce'], 'wds-checkup-nonce' ) ) { // Simple presence switch, no value.
139
+ return $this->run_checkup();
140
+ }
141
+ }
142
+
143
+ public static function checkup_url() {
144
+ $checkup_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_CHECKUP );
145
+
146
+ return esc_url_raw( add_query_arg( array(
147
+ 'run-checkup' => 'yes',
148
+ '_wds_nonce' => wp_create_nonce( 'wds-checkup-nonce' ),
149
+ ), $checkup_url ) );
150
+ }
151
+
152
+ /**
153
+ * Add admin settings page
154
+ */
155
+ public function options_page() {
156
+ parent::options_page();
157
+
158
+ $options = Smartcrawl_Settings::get_component_options( $this->name );
159
+ $options = wp_parse_args(
160
+ ( is_array( $options ) ? $options : array() ),
161
+ $this->get_default_options()
162
+ );
163
+
164
+ $arguments = array(
165
+ 'options' => $options,
166
+ 'active_tab' => $this->_get_last_active_tab( 'tab_checkup' ),
167
+ );
168
+
169
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
170
+ wp_enqueue_script( 'wds-admin-checkup' );
171
+
172
+ $this->_render_page( 'checkup/checkup-settings', $arguments );
173
+ }
174
+
175
+ /**
176
+ * Default settings
177
+ */
178
+ public function defaults() {
179
+ $options = Smartcrawl_Settings::get_component_options( $this->name );
180
+ $options = is_array( $options ) ? $options : array();
181
+
182
+ foreach ( $this->get_default_options() as $opt => $default ) {
183
+ if ( ! isset( $options[ $opt ] ) ) {
184
+ $options[ $opt ] = $default;
185
+ }
186
+ }
187
+
188
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
189
+ update_site_option( $this->option_name, $options );
190
+ } else {
191
+ update_option( $this->option_name, $options );
192
+ }
193
+ }
194
+
195
+ }
196
+
includes/admin/settings/dashboard.php CHANGED
@@ -1,604 +1,442 @@
1
- <?php
2
-
3
- class Smartcrawl_Settings_Dashboard extends Smartcrawl_Settings_Admin {
4
-
5
- const CRAWL_TIMEOUT_CODE = 'crawl_timeout';
6
- const BOX_SOCIAL = 'wds-social-dashboard-box';
7
- const BOX_ADVANCED_TOOLS = 'wds-advanced-tools-dashboard-box';
8
- const BOX_ONPAGE = 'wds-title-and-meta-dashboard-box';
9
- const BOX_CONTENT_ANALYSIS = 'wds-content-analysis-box';
10
- const BOX_SITEMAP = 'wds-sitemap-box';
11
- const BOX_SEO_CHECKUP = 'wds-seo-checkup';
12
- const BOX_TOP_STATS = 'wds-dashboard-stats';
13
-
14
- protected $_seo_service;
15
- protected $_uptime_service;
16
-
17
- private static $_instance;
18
-
19
- public static function get_instance() {
20
- if ( empty( self::$_instance ) ) {
21
- self::$_instance = new self;
22
- }
23
- return self::$_instance;
24
- }
25
-
26
- public function validate( $input ) {
27
- return $inpt; }
28
-
29
- public function init() {
30
- $this->slug = Smartcrawl_Settings::TAB_DASHBOARD;
31
- $this->title = __( 'SmartCrawl', 'wds' );
32
- $this->sub_title = __( 'Dashboard', 'wds' );
33
- $this->page_title = __( 'SmartCrawl Wizard: Dashboard', 'wds' );
34
-
35
- add_action( 'wp_ajax_wds-service-start', array( $this, 'json_service_start' ) );
36
- add_action( 'wp_ajax_wds-service-status', array( $this, 'json_service_status' ) );
37
- add_action( 'wp_ajax_wds-service-result', array( $this, 'json_service_result' ) );
38
-
39
- add_action( 'wp_ajax_wds-service-redirect', array( $this, 'json_service_redirect' ) );
40
- add_action( 'wp_ajax_wds-service-ignore', array( $this, 'json_service_ignore' ) );
41
- add_action( 'wp_ajax_wds-service-unignore', array( $this, 'json_service_unignore' ) );
42
- add_action( 'wp_ajax_wds-service-ignores-purge', array( $this, 'json_service_ignores_purge' ) );
43
-
44
- add_action( 'wp_ajax_wds-service-update_sitemap', array( $this, 'json_service_update_sitemap' ) );
45
- add_action( 'wp_ajax_wds-activate-component', array( $this, 'json_activate_component' ) );
46
- add_action( 'wp_ajax_wds-reload-box', array( $this, 'json_reload_component' ) );
47
-
48
- parent::init();
49
- }
50
-
51
- /**
52
- * Handles service ignores addition
53
- */
54
- public function json_service_ignore() {
55
- $result = array( 'status' => 0 );
56
- if ( ! current_user_can( 'manage_options' ) ) { return wp_send_json( $result ); }
57
-
58
- if ( ! class_exists( 'Smartcrawl_Model_Ignores' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_model_ignores.php' ); }
59
- $ignores = new Smartcrawl_Model_Ignores;
60
-
61
- $data = stripslashes_deep( $_POST );
62
- if ( empty( $data['issue_id'] ) ) { return wp_send_json( $result ); }
63
-
64
- $issue_id = $data['issue_id'];
65
- $issue_ids = is_array( $issue_id )
66
- ? array_map( 'sanitize_text_field', $issue_id )
67
- : array( sanitize_text_field( $issue_id ) )
68
- ;
69
-
70
- foreach ( $issue_ids as $issue ) {
71
- $ignores->set_ignore( $issue );
72
- }
73
-
74
- // Send updated list to Hub
75
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
76
- if ( ! $service->sync_ignores() ) {
77
- Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
78
- }
79
-
80
- $result['status'] = 1;
81
- return wp_send_json( $result );
82
- }
83
-
84
- /**
85
- * Handles service un-ignores addition
86
- */
87
- public function json_service_unignore() {
88
- $result = array( 'status' => 0 );
89
- if ( ! current_user_can( 'manage_options' ) ) {
90
- wp_send_json( $result );
91
- return;
92
- }
93
-
94
- if ( ! class_exists( 'Smartcrawl_Model_Ignores' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_model_ignores.php' ); }
95
- $ignores = new Smartcrawl_Model_Ignores;
96
-
97
- $data = stripslashes_deep( $_POST );
98
- if ( empty( $data['issue_id'] ) ) {
99
- wp_send_json( $result );
100
- return;
101
- }
102
-
103
- $issue_id = $data['issue_id'];
104
- $issue_ids = is_array( $issue_id )
105
- ? array_map( 'sanitize_text_field', $issue_id )
106
- : array( sanitize_text_field( $issue_id ) )
107
- ;
108
-
109
- foreach ( $issue_ids as $issue ) {
110
- $ignores->unset_ignore( $issue );
111
- }
112
-
113
- // Send updated list to Hub
114
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
115
- if ( ! $service->sync_ignores() ) {
116
- Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
117
- }
118
-
119
- $result['status'] = 1;
120
- wp_send_json( $result );
121
- }
122
-
123
- /**
124
- * Handles service ignores purging
125
- */
126
- public function json_service_ignores_purge() {
127
- $result = array( 'status' => 0 );
128
- if ( ! current_user_can( 'manage_options' ) ) { return wp_send_json( $result ); }
129
-
130
- if ( ! class_exists( 'Smartcrawl_Model_Ignores' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_model_ignores.php' ); }
131
- $ignores = new Smartcrawl_Model_Ignores;
132
-
133
- if ( $ignores->clear() ) {
134
- // Send updated list to Hub
135
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
136
- if ( ! $service->sync_ignores() ) {
137
- Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
138
- }
139
-
140
- $result['status'] = 1;
141
- }
142
-
143
- return wp_send_json( $result );
144
- }
145
-
146
- /**
147
- * Handles sitemap updating requests
148
- */
149
- public function json_service_update_sitemap() {
150
- $result = array();
151
- $controller = Smartcrawl_Controller_Sitemap::get();
152
-
153
- // First up, find out how much stuff we got in the sitemap
154
- $data = $controller->get_sitemap_stats();
155
- $previous_count = ! empty( $data['items'] ) && is_numeric( $data['items'] )
156
- ? (int) $data['items']
157
- : 0
158
- ;
159
-
160
- // Update sitemap
161
- $controller->update_sitemap();
162
-
163
- // Get fresh count
164
- $data = $controller->get_sitemap_stats();
165
- $current_count = ! empty( $data['items'] ) && is_numeric( $data['items'] )
166
- ? (int) $data['items']
167
- : 0
168
- ;
169
-
170
- $diff = (int) ($current_count - $previous_count);
171
-
172
- // Let's clear up the sitemap service results
173
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
174
- $cres = $service->get_result();
175
- if ( isset( $cres['issues'] ) ) {
176
- $cres['issues']['sitemap'] = ! empty( $cres['issues']['sitemap'] )
177
- ? $cres['issues']['sitemap']
178
- : 0
179
- ;
180
- $cres['issues']['sitemap'] = 0;
181
- if ( isset( $cres['issues']['issues'] ) ) { $cres['issues']['issues']['sitemap'] = 0; // Fix data model deviation
182
- } $cres['issues']['messages'] = ! empty( $cres['issues']['messages'] )
183
- ? $cres['issues']['messages']
184
- : array()
185
- ;
186
- // Start with a generic message
187
- $msg = __( 'Sitemap updated. Please, re-crawl your site', 'wds' );
188
- if ( $diff > 0 ) {
189
- sprintf(
190
- __( 'We just updated your sitemap adding %1$d new items, for a total of %2$d. Please, re-crawl your site', 'wds' ),
191
- $diff,
192
- $current_count
193
- );
194
- } elseif ( $diff < 0 ) {
195
- sprintf(
196
- __( 'No new items were added to your sitemap, but we did detect a change (for %1$d items total). Please, re-crawl your site.', 'wds' ),
197
- $current_count
198
- );
199
- }
200
-
201
- if ( ! in_array( $msg, $cres['issues']['messages'] ) ) { $cres['issues']['messages'][] = $msg; }
202
- $service->set_result( $cres );
203
- }
204
-
205
- $result = array(
206
- 'previous' => $previous_count,
207
- 'current' => $current_count,
208
- 'diff' => $diff,
209
- );
210
-
211
- wp_send_json( $result );
212
- }
213
-
214
- /**
215
- * Handles service redirect requests
216
- */
217
- public function json_service_redirect() {
218
- $data = stripslashes_deep( $_POST );
219
- $result = array();
220
-
221
- if (
222
- empty( $data['source'] ) ||
223
- empty( $data['redirect'] ) ||
224
- empty( $data['wds-redirect'] )
225
- ) { wp_send_json_error( $result ); }
226
-
227
- if ( ! wp_verify_nonce( $_POST['wds-redirect'], 'wds-redirect' ) ) { wp_send_json_error( $result ); }
228
-
229
- $is_sitewide = is_multisite() && defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE;
230
-
231
- $permissions = $is_sitewide ? 'manage_network_options' : 'manage_options';
232
- if ( ! current_user_can( $permissions ) ) { wp_send_json_error( $result ); }
233
-
234
- $source = esc_url( $data['source'] );
235
- $redirect = esc_url( $data['redirect'] );
236
- $rmodel = new Smartcrawl_Model_Redirection;
237
-
238
- $status_code = $rmodel->get_default_redirection_status_type();
239
-
240
- // Set both redirection and default status code
241
- $result['status'] = $rmodel->set_redirection( $source, $redirect ) && $rmodel->set_redirection_type( $source, $status_code );
242
-
243
- wp_send_json( $result );
244
- }
245
-
246
- /**
247
- * Handle service crawl start request
248
- */
249
- public function json_service_start() {
250
- $service = $this->_get_seo_service();
251
- $result = $service->start();
252
-
253
- if ( true === $result ) {
254
- $result = $service->status();
255
- }
256
-
257
- $result = ! empty( $result ) && is_array( $result )
258
- ? $result
259
- : array()
260
- ;
261
-
262
- $error = empty( $result ) || ! empty( $result['code'] );
263
- if ( ! empty( $error ) ) {
264
- if ( empty( $result ) ) {
265
- $msgs = $service->get_errors();
266
- if ( ! empty( $msgs ) ) { $result['message'] = join( ' ', $msgs ); }
267
- }
268
- $service->stop();
269
- $result = array(
270
- 'success' => false,
271
- 'code' => ! empty( $result['code'] ) ? $result['code'] : false,
272
- 'message' => ! empty( $result['message'] ) ? $result['message'] : false,
273
- );
274
- }
275
-
276
- wp_send_json( $result );
277
- }
278
-
279
- /**
280
- * Handle service crawl status request
281
- */
282
- public function json_service_status() {
283
- $service = $this->_get_seo_service();
284
- $result = $service->status();
285
-
286
- $result = ! empty( $result ) && is_array( $result )
287
- ? $result
288
- : array()
289
- ;
290
- $error = empty( $result ) || ! empty( $result['code'] );
291
- if ( ! empty( $error ) ) {
292
- if ( empty( $result ) ) {
293
- $msgs = $service->get_errors();
294
- if ( ! empty( $msgs ) ) { $result['message'] = join( ' ', $msgs ); }
295
- }
296
- $code = ! empty( $result['code'] ) ? $result['code'] : false;
297
- $msg = ! empty( $result['message'] ) ? $result['message'] : false;
298
-
299
- // Crawl timed out, let's force the result now
300
- if ( $code && self::CRAWL_TIMEOUT_CODE === $code ) {
301
- $service->result();
302
- }
303
-
304
- $result = array(
305
- 'success' => false,
306
- 'code' => $code,
307
- 'message' => $msg,
308
- );
309
- }
310
-
311
- wp_send_json( $result );
312
- }
313
-
314
- /**
315
- * Handle service crawl result request
316
- */
317
- public function json_service_result() {
318
- $service = $this->_get_seo_service();
319
- $result = $service->result();
320
-
321
- $result = ! empty( $result ) && is_array( $result )
322
- ? $result
323
- : array()
324
- ;
325
- $error = empty( $result ) || ! empty( $result['code'] );
326
- if ( ! empty( $error ) ) {
327
- if ( empty( $result ) ) {
328
- $msgs = $service->get_errors();
329
- if ( ! empty( $msgs ) ) { $result['message'] = join( ' ', $msgs ); }
330
- }
331
- $result = array(
332
- 'success' => false,
333
- 'code' => ! empty( $result['code'] ) ? $result['code'] : false,
334
- 'message' => ! empty( $result['message'] ) ? $result['message'] : false,
335
- );
336
- }
337
-
338
- wp_send_json( $result );
339
- }
340
-
341
- public function json_activate_component() {
342
- $result = array( 'success' => false );
343
- $data = stripslashes_deep( $_POST );
344
-
345
- $option_id = sanitize_key( smartcrawl_get_array_value( $data, 'option' ) );
346
- $flag = sanitize_key( smartcrawl_get_array_value( $data, 'flag' ) );
347
-
348
- if ( is_null( $option_id ) || is_null( $flag ) ) {
349
- wp_send_json( $result );
350
- return;
351
- }
352
-
353
- $options = self::get_specific_options( $option_id );
354
- $options[ $flag ] = true;
355
- self::update_specific_options( $option_id, $options );
356
-
357
- $result['success'] = true;
358
- wp_send_json( $result );
359
- }
360
-
361
- function json_reload_component() {
362
- $result = array( 'success' => false );
363
- $data = stripslashes_deep( $_POST );
364
-
365
- $box_id = smartcrawl_get_array_value( $data, 'box_id' );
366
-
367
- if ( is_null( $box_id ) ) {
368
- wp_send_json( $result );
369
- return;
370
- }
371
-
372
- if ( ! is_array( $box_id ) ) {
373
- $box_id = array( $box_id );
374
- }
375
- $box_id = array_map( 'sanitize_key', $box_id );
376
-
377
- $box_id = array_unique( $box_id );
378
-
379
- foreach ( $box_id as $id ) {
380
- $result[ $id ] = $this->load_box_markup( $id );
381
- }
382
-
383
- $result['success'] = true;
384
- wp_send_json( $result );
385
- }
386
-
387
- function load_box_markup( $box_id ) {
388
- switch ( $box_id ) {
389
- case self::BOX_SOCIAL:
390
- return $this->_load( 'dashboard/dashboard-widget-social' );
391
-
392
- case self::BOX_ADVANCED_TOOLS:
393
- return $this->_load( 'dashboard/dashboard-widget-advanced-tools' );
394
-
395
- case self::BOX_ONPAGE:
396
- return $this->_load( 'dashboard/dashboard-widget-onpage' );
397
-
398
- case self::BOX_CONTENT_ANALYSIS:
399
- return $this->_load( 'dashboard/dashboard-widget-content-analysis' );
400
-
401
- case self::BOX_SITEMAP:
402
- return $this->_load( 'dashboard/dashboard-widget-sitemap' );
403
-
404
- case self::BOX_SEO_CHECKUP:
405
- return $this->_load( 'dashboard/dashboard-widget-seo-checkup' );
406
-
407
- case self::BOX_TOP_STATS:
408
- return $this->_load( 'dashboard/dashboard-top' );
409
- };
410
-
411
- return null;
412
- }
413
-
414
- /**
415
- * Process run action
416
- *
417
- * @return void
418
- */
419
- public function process_run_action() {
420
- if ( ! empty( $_GET['run-checkup'] ) ) { // Simple presence switch, no value.
421
- return $this->run_checkup();
422
- }
423
- }
424
-
425
- /**
426
- * Add admin settings page
427
- */
428
- public function options_page() {
429
- wp_enqueue_script( 'wds-admin-dashboard' );
430
-
431
- $uptime = $this->_get_uptime_service();
432
-
433
- $this->_render_page('dashboard/dashboard', array(
434
- 'current_admin_url' => menu_page_url( $this->smartcrawl_page_hook ),
435
- 'seo_message_box' => $this->_get_seo_service_message(),
436
- 'uptime_message_box' => $this->_get_uptime_service_message(),
437
- ));
438
- }
439
-
440
- /**
441
- * Gets the SEO service box part
442
- *
443
- * @return string
444
- */
445
- private function _get_seo_service_message() {
446
- $service = $this->_get_seo_service();
447
- $msg = '';
448
-
449
- // First up, can we access this at all?
450
- if ( $service->can_access() ) {
451
-
452
- // Okay, we can
453
- if ( $service->has_dashboard() ) {
454
- $result = $service->get_result();
455
- $status = false;
456
-
457
- // If we don't have perma-cached result,
458
- // we issued a re-crawl. So, let's check where we're at
459
- if ( empty( $result ) ) {
460
- $status = $service->status();
461
- $result = ! empty( $status['end'] )
462
- ? $service->result()
463
- : array()
464
- ;
465
- } else { $status = $result; }
466
-
467
- if ( ! class_exists( 'Smartcrawl_SeoReport' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . 'core/class_wds_seo_report.php' ); }
468
- $report = Smartcrawl_SeoReport::build( $result );
469
-
470
- $rmodel = new Smartcrawl_Model_Redirection;
471
-
472
- // We have Dashboard ready to go, we're connected and all
473
- $msg = $this->_load('dashboard-dialog-has_dashboard-service_seo', array(
474
- 'status' => $status,
475
- 'has_result' => ! empty( $result ),
476
- 'report' => $report,
477
- 'redirections' => $rmodel->get_all_redirections(),
478
- 'errors' => $service->get_errors(),
479
- ));
480
- } elseif ( $service->is_dahsboard_active() ) {
481
- // Dashboard is active, but we're not connected
482
- $msg = $this->_load( 'dashboard-dialog-not_logged_in-service_seo' );
483
- } else {
484
- // Dashboard not installed
485
- // Can we even install?
486
- if ( $service->can_install() ) { $msg = $this->_load( 'dashboard-dialog-not_installed-service_seo' ); }
487
- }
488
- }
489
-
490
- return $msg;
491
- }
492
-
493
- /**
494
- * Gets the Uptime service box part
495
- *
496
- * Temporarily disabled
497
- *
498
- * @return string
499
- */
500
- private function _get_uptime_service_message() {
501
- // As per Asana task, temporarily disable uptime report
502
- // See: https://app.asana.com/0/345574004857/277849197601097/
503
- return false;
504
-
505
- $service = $this->_get_uptime_service();
506
- $msg = '';
507
-
508
- // First up, can we access this at all?
509
- if ( $service->can_access() ) {
510
-
511
- // Okay, we can
512
- if ( $service->is_dahsboard_active() ) {
513
- // We have Dashboard active, good enough
514
- $response = $service->request( 'day' );
515
- $msg = $this->_load('dashboard-dialog-has_dashboard-service_uptime', array(
516
- 'data' => $response,
517
- 'errors' => $service->get_errors(),
518
- ));
519
- } else {
520
- // Dashboard not installed
521
- // Can we even install?
522
- if ( $service->can_install() ) { $msg = $this->_load( 'dashboard-dialog-not_installed-service_uptime' ); }
523
- }
524
- }
525
-
526
- return $msg;
527
- }
528
-
529
- /**
530
- * Add sub page to the Settings Menu
531
- */
532
- public function add_page() {
533
- if ( ! $this->_is_current_tab_allowed() ) { return false; }
534
-
535
- $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="18px" height="18px" xmlns="http://www.w3.org/2000/svg"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Artboard" fill-rule="nonzero" fill="#FFFFFF"><path d="M0.558,12.1008055 L17.445,12.1008055 C16.1402452,15.6456454 12.7704642,18 9.0015,18 C5.23253577,18 1.86275481,15.6456454 0.558,12.1008055 Z M17.442,5.89919449 L0.555,5.89919449 C1.85975481,2.35435463 5.22953577,4.81675263e-16 8.9985,7.11236625e-16 C12.7674642,9.40797988e-16 16.1372452,2.35435463 17.442,5.89919449 Z M0.042,8 L17.958,8 C17.985,8.32740214 18,8.66192171 18,9 C18,9.33807829 17.985,9.66903915 17.958,10 L0.042,10 C0.018,9.66903915 0,9.33807829 0,9 C0,8.66192171 0.018,8.32740214 0.042,8 Z" id="smartcrawl"></path></g></g></svg>';
536
- $icon = 'data:image/svg+xml;base64,' . base64_encode( $svg );
537
-
538
- $this->smartcrawl_page_hook = add_menu_page(
539
- $this->page_title,
540
- $this->title,
541
- $this->capability,
542
- $this->slug,
543
- array( &$this, 'options_page' ),
544
- $icon
545
- );
546
-
547
- $this->smartcrawl_page_hook = add_submenu_page(
548
- $this->slug,
549
- $this->page_title,
550
- $this->sub_title,
551
- $this->capability,
552
- $this->slug,
553
- array( &$this, 'options_page' )
554
- );
555
-
556
- // For pages that can deal with run requests, let's make sure they
557
- // actually do that early enough
558
- if ( is_callable( array( $this, 'process_run_action' ) ) ) {
559
- add_action( 'load-' . $this->smartcrawl_page_hook, array( $this, 'process_run_action' ) );
560
- }
561
-
562
- add_action( "admin_print_styles-{$this->smartcrawl_page_hook}", array( &$this, 'admin_styles' ) );
563
- add_action( "admin_print_scripts-{$this->smartcrawl_page_hook}", array( &$this, 'admin_scripts' ) );
564
- }
565
-
566
- /**
567
- * Default settings
568
- */
569
- public function defaults() {
570
- $this->options = Smartcrawl_Settings::get_options();
571
- }
572
-
573
- /**
574
- * Always allow dashboard tab if there's more than one tab allowed
575
- *
576
- * Overrides Smartcrawl_Settings::_is_current_tab_allowed
577
- *
578
- * @return bool
579
- */
580
- protected function _is_current_tab_allowed() {
581
- if ( parent::_is_current_tab_allowed() ) { return true; }
582
- // Else we always add dashboard if there are other pages
583
- $all_tabs = Smartcrawl_Settings_Settings::get_blog_tabs();
584
-
585
- return ! empty( $all_tabs );
586
- }
587
-
588
- protected function _get_seo_service() {
589
- if ( ! empty( $this->_seo_service ) ) { return $this->_seo_service; }
590
-
591
- $this->_seo_service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
592
-
593
- return $this->_seo_service;
594
- }
595
-
596
- protected function _get_uptime_service() {
597
- if ( ! empty( $this->_uptime_service ) ) { return $this->_uptime_service; }
598
-
599
- $this->_uptime_service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_UPTIME );
600
-
601
- return $this->_uptime_service;
602
- }
603
-
604
- }
1
+ <?php
2
+
3
+ class Smartcrawl_Settings_Dashboard extends Smartcrawl_Settings_Admin {
4
+
5
+ const CRAWL_TIMEOUT_CODE = 'crawl_timeout';
6
+ const BOX_SOCIAL = 'wds-social-dashboard-box';
7
+ const BOX_ADVANCED_TOOLS = 'wds-advanced-tools-dashboard-box';
8
+ const BOX_ONPAGE = 'wds-title-and-meta-dashboard-box';
9
+ const BOX_CONTENT_ANALYSIS = 'wds-content-analysis-box';
10
+ const BOX_SITEMAP = 'wds-sitemap-box';
11
+ const BOX_SEO_CHECKUP = 'wds-seo-checkup';
12
+ const BOX_TOP_STATS = 'wds-dashboard-stats';
13
+ private static $_instance;
14
+ protected $_seo_service;
15
+ protected $_uptime_service;
16
+
17
+ public static function get_instance() {
18
+ if ( empty( self::$_instance ) ) {
19
+ self::$_instance = new self();
20
+ }
21
+
22
+ return self::$_instance;
23
+ }
24
+
25
+ public function validate( $input ) {
26
+ return $input;
27
+ }
28
+
29
+ public function init() {
30
+ $this->slug = Smartcrawl_Settings::TAB_DASHBOARD;
31
+ $this->title = __( 'SmartCrawl', 'wds' );
32
+ $this->sub_title = __( 'Dashboard', 'wds' );
33
+ $this->page_title = __( 'SmartCrawl Wizard: Dashboard', 'wds' );
34
+
35
+ add_action( 'wp_ajax_wds-service-redirect', array( $this, 'json_service_redirect' ) );
36
+ add_action( 'wp_ajax_wds-service-ignore', array( $this, 'json_service_ignore' ) );
37
+ add_action( 'wp_ajax_wds-service-unignore', array( $this, 'json_service_unignore' ) );
38
+ add_action( 'wp_ajax_wds-service-ignores-purge', array( $this, 'json_service_ignores_purge' ) );
39
+
40
+ add_action( 'wp_ajax_wds-service-update_sitemap', array( $this, 'json_service_update_sitemap' ) );
41
+ add_action( 'wp_ajax_wds-activate-component', array( $this, 'json_activate_component' ) );
42
+ add_action( 'wp_ajax_wds-reload-box', array( $this, 'json_reload_component' ) );
43
+
44
+ parent::init();
45
+ }
46
+
47
+ /**
48
+ * Handles service ignores addition
49
+ */
50
+ public function json_service_ignore() {
51
+ $result = array( 'status' => 0 );
52
+ if ( ! current_user_can( 'manage_options' ) ) {
53
+ wp_send_json( $result );
54
+ }
55
+
56
+ $ignores = new Smartcrawl_Model_Ignores();
57
+
58
+ $data = $this->get_request_data();
59
+ if ( empty( $data['issue_id'] ) ) {
60
+ wp_send_json( $result );
61
+ }
62
+
63
+ $issue_id = $data['issue_id'];
64
+ $issue_ids = is_array( $issue_id )
65
+ ? array_map( 'sanitize_text_field', $issue_id )
66
+ : array( sanitize_text_field( $issue_id ) );
67
+
68
+ foreach ( $issue_ids as $issue ) {
69
+ $ignores->set_ignore( $issue );
70
+ }
71
+
72
+ // Send updated list to Hub
73
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
74
+ if ( ! $service->sync_ignores() ) {
75
+ Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
76
+ }
77
+
78
+ $result['status'] = 1;
79
+
80
+ wp_send_json( $result );
81
+ }
82
+
83
+ /**
84
+ * Handles service un-ignores addition
85
+ */
86
+ public function json_service_unignore() {
87
+ $result = array( 'status' => 0 );
88
+ if ( ! current_user_can( 'manage_options' ) ) {
89
+ wp_send_json( $result );
90
+
91
+ return;
92
+ }
93
+
94
+ $ignores = new Smartcrawl_Model_Ignores();
95
+
96
+ $data = $this->get_request_data();
97
+ if ( empty( $data['issue_id'] ) ) {
98
+ wp_send_json( $result );
99
+
100
+ return;
101
+ }
102
+
103
+ $issue_id = $data['issue_id'];
104
+ $issue_ids = is_array( $issue_id )
105
+ ? array_map( 'sanitize_text_field', $issue_id )
106
+ : array( sanitize_text_field( $issue_id ) );
107
+
108
+ foreach ( $issue_ids as $issue ) {
109
+ $ignores->unset_ignore( $issue );
110
+ }
111
+
112
+ // Send updated list to Hub
113
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
114
+ if ( ! $service->sync_ignores() ) {
115
+ Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
116
+ }
117
+
118
+ $result['status'] = 1;
119
+ wp_send_json( $result );
120
+ }
121
+
122
+ /**
123
+ * Handles service ignores purging
124
+ */
125
+ public function json_service_ignores_purge() {
126
+ $result = array( 'status' => 0 );
127
+ if ( ! current_user_can( 'manage_options' ) ) {
128
+ return wp_send_json( $result );
129
+ }
130
+
131
+ $ignores = new Smartcrawl_Model_Ignores();
132
+
133
+ if ( $ignores->clear() ) {
134
+ // Send updated list to Hub
135
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
136
+ if ( ! $service->sync_ignores() ) {
137
+ Smartcrawl_Logger::debug( 'We encountered an error syncing ignores with Hub' );
138
+ }
139
+
140
+ $result['status'] = 1;
141
+ }
142
+
143
+ return wp_send_json( $result );
144
+ }
145
+
146
+ /**
147
+ * Handles sitemap updating requests
148
+ */
149
+ public function json_service_update_sitemap() {
150
+ $result = array();
151
+ $controller = Smartcrawl_Controller_Sitemap::get();
152
+
153
+ // First up, find out how much stuff we got in the sitemap
154
+ $data = $controller->get_sitemap_stats();
155
+ $previous_count = ! empty( $data['items'] ) && is_numeric( $data['items'] )
156
+ ? (int) $data['items']
157
+ : 0;
158
+
159
+ // Update sitemap
160
+ $controller->update_sitemap();
161
+
162
+ // Get fresh count
163
+ $data = $controller->get_sitemap_stats();
164
+ $current_count = ! empty( $data['items'] ) && is_numeric( $data['items'] )
165
+ ? (int) $data['items']
166
+ : 0;
167
+
168
+ $diff = (int) ( $current_count - $previous_count );
169
+
170
+ // Let's clear up the sitemap service results
171
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
172
+ $cres = $service->get_result();
173
+ if ( isset( $cres['issues'] ) ) {
174
+ $cres['issues']['sitemap'] = ! empty( $cres['issues']['sitemap'] )
175
+ ? $cres['issues']['sitemap']
176
+ : 0;
177
+ $cres['issues']['sitemap'] = 0;
178
+ if ( isset( $cres['issues']['issues'] ) ) {
179
+ $cres['issues']['issues']['sitemap'] = 0; // Fix data model deviation
180
+ }
181
+ $cres['issues']['messages'] = ! empty( $cres['issues']['messages'] )
182
+ ? $cres['issues']['messages']
183
+ : array();
184
+ // Start with a generic message
185
+ $msg = __( 'Sitemap updated. Please, re-crawl your site', 'wds' );
186
+ if ( $diff > 0 ) {
187
+ sprintf(
188
+ __( 'We just updated your sitemap adding %1$d new items, for a total of %2$d. Please, re-crawl your site', 'wds' ),
189
+ $diff,
190
+ $current_count
191
+ );
192
+ } elseif ( $diff < 0 ) {
193
+ sprintf(
194
+ __( 'No new items were added to your sitemap, but we did detect a change (for %1$d items total). Please, re-crawl your site.', 'wds' ),
195
+ $current_count
196
+ );
197
+ }
198
+
199
+ if ( ! in_array( $msg, $cres['issues']['messages'], true ) ) {
200
+ $cres['issues']['messages'][] = $msg;
201
+ }
202
+ $service->set_result( $cres );
203
+ }
204
+
205
+ $result = array(
206
+ 'previous' => $previous_count,
207
+ 'current' => $current_count,
208
+ 'diff' => $diff,
209
+ );
210
+
211
+ wp_send_json( $result );
212
+ }
213
+
214
+ /**
215
+ * Handles service redirect requests
216
+ */
217
+ public function json_service_redirect() {
218
+ $data = $this->get_request_data();
219
+ $result = array();
220
+
221
+ if (
222
+ empty( $data['source'] ) ||
223
+ empty( $data['redirect'] ) ||
224
+ empty( $data['wds-redirect'] )
225
+ ) {
226
+ wp_send_json_error( $result );
227
+ }
228
+
229
+ if ( ! wp_verify_nonce( $_POST['wds-redirect'], 'wds-redirect' ) ) {
230
+ wp_send_json_error( $result );
231
+ }
232
+
233
+ $is_sitewide = is_multisite() && defined( 'SMARTCRAWL_SITEWIDE' ) && SMARTCRAWL_SITEWIDE;
234
+
235
+ $permissions = $is_sitewide ? 'manage_network_options' : 'manage_options';
236
+ if ( ! current_user_can( $permissions ) ) {
237
+ wp_send_json_error( $result );
238
+ }
239
+
240
+ $source = esc_url( $data['source'] );
241
+ $redirect = esc_url( $data['redirect'] );
242
+ $rmodel = new Smartcrawl_Model_Redirection();
243
+
244
+ $status_code = $rmodel->get_default_redirection_status_type();
245
+
246
+ // Set both redirection and default status code
247
+ $result['status'] = $rmodel->set_redirection( $source, $redirect ) && $rmodel->set_redirection_type( $source, $status_code );
248
+
249
+ wp_send_json( $result );
250
+ }
251
+
252
+ public function json_activate_component() {
253
+ $result = array( 'success' => false );
254
+ $data = $this->get_request_data();
255
+
256
+ $option_id = sanitize_key( smartcrawl_get_array_value( $data, 'option' ) );
257
+ $flag = sanitize_key( smartcrawl_get_array_value( $data, 'flag' ) );
258
+
259
+ if ( is_null( $option_id ) || is_null( $flag ) ) {
260
+ wp_send_json( $result );
261
+
262
+ return;
263
+ }
264
+
265
+ $options = self::get_specific_options( $option_id );
266
+ $options[ $flag ] = true;
267
+ self::update_specific_options( $option_id, $options );
268
+
269
+ $result['success'] = true;
270
+ wp_send_json( $result );
271
+ }
272
+
273
+ public function json_reload_component() {
274
+ $result = array( 'success' => false );
275
+ $data = $this->get_request_data();
276
+
277
+ $box_id = smartcrawl_get_array_value( $data, 'box_id' );
278
+
279
+ if ( is_null( $box_id ) ) {
280
+ wp_send_json( $result );
281
+
282
+ return;
283
+ }
284
+
285
+ if ( ! is_array( $box_id ) ) {
286
+ $box_id = array( $box_id );
287
+ }
288
+ $box_id = array_map( 'sanitize_key', $box_id );
289
+
290
+ $box_id = array_unique( $box_id );
291
+
292
+ foreach ( $box_id as $id ) {
293
+ $result[ $id ] = $this->load_box_markup( $id );
294
+ }
295
+
296
+ $result['success'] = true;
297
+ wp_send_json( $result );
298
+ }
299
+
300
+ private function load_box_markup( $box_id ) {
301
+ switch ( $box_id ) {
302
+ case self::BOX_SOCIAL:
303
+ return $this->_load( 'dashboard/dashboard-widget-social' );
304
+
305
+ case self::BOX_ADVANCED_TOOLS:
306
+ return $this->_load( 'dashboard/dashboard-widget-advanced-tools' );
307
+
308
+ case self::BOX_ONPAGE:
309
+ return $this->_load( 'dashboard/dashboard-widget-onpage' );
310
+
311
+ case self::BOX_CONTENT_ANALYSIS:
312
+ return $this->_load( 'dashboard/dashboard-widget-content-analysis' );
313
+
314
+ case self::BOX_SITEMAP:
315
+ return $this->_load( 'dashboard/dashboard-widget-sitemap' );
316
+
317
+ case self::BOX_SEO_CHECKUP:
318
+ return $this->_load( 'dashboard/dashboard-widget-seo-checkup' );
319
+
320
+ case self::BOX_TOP_STATS:
321
+ return $this->_load( 'dashboard/dashboard-top' );
322
+ };
323
+
324
+ return null;
325
+ }
326
+
327
+ /**
328
+ * Process run action
329
+ */
330
+ public function process_run_action() {
331
+ if ( isset( $_GET['_wds_nonce'], $_GET['run-checkup'] ) && wp_verify_nonce( $_GET['_wds_nonce'], 'wds-checkup-nonce' ) ) { // Simple presence switch, no value.
332
+ return $this->run_checkup();
333
+ }
334
+ }
335
+
336
+ public static function checkup_url() {
337
+ $checkup_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_DASHBOARD );
338
+
339
+ return esc_url_raw( add_query_arg( array(
340
+ 'run-checkup' => 'yes',
341
+ '_wds_nonce' => wp_create_nonce( 'wds-checkup-nonce' ),
342
+ ), $checkup_url ) );
343
+ }
344
+
345
+ /**
346
+ * Add admin settings page
347
+ */
348
+ public function options_page() {
349
+ wp_enqueue_script( 'wds-admin-dashboard' );
350
+
351
+ $uptime = $this->_get_uptime_service();
352
+
353
+ $this->_render_page( 'dashboard/dashboard', array() );
354
+ }
355
+
356
+ protected function _get_uptime_service() {
357
+ if ( ! empty( $this->_uptime_service ) ) {
358
+ return $this->_uptime_service;
359
+ }
360
+
361
+ $this->_uptime_service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_UPTIME );
362
+
363
+ return $this->_uptime_service;
364
+ }
365
+
366
+ /**
367
+ * Add sub page to the Settings Menu
368
+ */
369
+ public function add_page() {
370
+ if ( ! $this->_is_current_tab_allowed() ) {
371
+ return false;
372
+ }
373
+
374
+ $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="18px" height="18px" xmlns="http://www.w3.org/2000/svg"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Artboard" fill-rule="nonzero" fill="#FFFFFF"><path d="M0.558,12.1008055 L17.445,12.1008055 C16.1402452,15.6456454 12.7704642,18 9.0015,18 C5.23253577,18 1.86275481,15.6456454 0.558,12.1008055 Z M17.442,5.89919449 L0.555,5.89919449 C1.85975481,2.35435463 5.22953577,4.81675263e-16 8.9985,7.11236625e-16 C12.7674642,9.40797988e-16 16.1372452,2.35435463 17.442,5.89919449 Z M0.042,8 L17.958,8 C17.985,8.32740214 18,8.66192171 18,9 C18,9.33807829 17.985,9.66903915 17.958,10 L0.042,10 C0.018,9.66903915 0,9.33807829 0,9 C0,8.66192171 0.018,8.32740214 0.042,8 Z" id="smartcrawl"></path></g></g></svg>';
375
+ $icon = 'data:image/svg+xml;base64,' . base64_encode( $svg ); // phpcs:ignore -- base64_encode is harmless here
376
+
377
+ $this->smartcrawl_page_hook = add_menu_page(
378
+ $this->page_title,
379
+ $this->title,
380
+ $this->capability,
381
+ $this->slug,
382
+ array( &$this, 'options_page' ),
383
+ $icon
384
+ );
385
+
386
+ $this->smartcrawl_page_hook = add_submenu_page(
387
+ $this->slug,
388
+ $this->page_title,
389
+ $this->sub_title,
390
+ $this->capability,
391
+ $this->slug,
392
+ array( &$this, 'options_page' )
393
+ );
394
+
395
+ // For pages that can deal with run requests, let's make sure they
396
+ // actually do that early enough
397
+ if ( is_callable( array( $this, 'process_run_action' ) ) ) {
398
+ add_action( 'load-' . $this->smartcrawl_page_hook, array( $this, 'process_run_action' ) );
399
+ }
400
+
401
+ add_action( "admin_print_styles-{$this->smartcrawl_page_hook}", array( &$this, 'admin_styles' ) );
402
+ add_action( "admin_print_scripts-{$this->smartcrawl_page_hook}", array( &$this, 'admin_scripts' ) );
403
+ }
404
+
405
+ /**
406
+ * Always allow dashboard tab if there's more than one tab allowed
407
+ *
408
+ * Overrides Smartcrawl_Settings::_is_current_tab_allowed
409
+ *
410
+ * @return bool
411
+ */
412
+ protected function _is_current_tab_allowed() {
413
+ if ( parent::_is_current_tab_allowed() ) {
414
+ return true;
415
+ }
416
+ // Else we always add dashboard if there are other pages
417
+ $all_tabs = Smartcrawl_Settings_Settings::get_blog_tabs();
418
+
419
+ return ! empty( $all_tabs );
420
+ }
421
+
422
+ /**
423
+ * Default settings
424
+ */
425
+ public function defaults() {
426
+ $this->options = Smartcrawl_Settings::get_options();
427
+ }
428
+
429
+ protected function _get_seo_service() {
430
+ if ( ! empty( $this->_seo_service ) ) {
431
+ return $this->_seo_service;
432
+ }
433
+
434
+ $this->_seo_service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
435
+
436
+ return $this->_seo_service;
437
+ }
438
+
439
+ private function get_request_data() {
440
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-nonce' ) ? stripslashes_deep( $_POST ) : array();
441
+ }
442
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/settings/index.php CHANGED
@@ -0,0 +1 @@
 
1
+ <?php // phpcs:ignoreFile
includes/admin/settings/onpage.php CHANGED
@@ -1,660 +1,798 @@
1
- <?php
2
-
3
- class Smartcrawl_Onpage_Settings extends Smartcrawl_Settings_Admin {
4
-
5
- private static $_instance;
6
-
7
- public static function get_instance() {
8
- if ( empty( self::$_instance ) ) {
9
- self::$_instance = new self;
10
- }
11
- return self::$_instance;
12
- }
13
-
14
- /**
15
- * Validate submitted options
16
- *
17
- * @param array $input Raw input
18
- *
19
- * @return array Validated input
20
- */
21
- public function validate( $input ) {
22
- $result = array();
23
-
24
- // Setup
25
- if ( ! empty( $input['wds_onpage-setup'] ) ) { $result['wds_onpage-setup'] = true; }
26
-
27
- // Meta robots
28
- if ( ! empty( $input['meta_robots-noindex-main_blog_archive'] ) ) { $result['meta_robots-noindex-main_blog_archive'] = true; }
29
- if ( ! empty( $input['meta_robots-nofollow-main_blog_archive'] ) ) { $result['meta_robots-nofollow-main_blog_archive'] = true; }
30
- if ( ! empty( $input['meta_robots-main_blog_archive-subsequent_pages'] ) ) { $result['meta_robots-main_blog_archive-subsequent_pages'] = true; }
31
-
32
- if ( ! empty( $input['meta_robots-noindex-search'] ) ) { $result['meta_robots-noindex-search'] = true; }
33
- if ( ! empty( $input['meta_robots-nofollow-search'] ) ) { $result['meta_robots-nofollow-search'] = true; }
34
-
35
- $tax_options = $this->_get_tax_options( '' );
36
- foreach ( $tax_options as $option => $_tax ) {
37
- $rbts = $this->get_robots_options_for( $option );
38
- if ( ! empty( $rbts ) && is_array( $rbts ) ) { foreach ( array_keys( $rbts ) as $item ) {
39
- if ( ! empty( $input[ $item ] ) ) { $result[ $item ] = true; }
40
- }
41
- }
42
- }
43
- $other_options = $this->_get_other_types_options( '' );
44
- foreach ( $other_options as $option => $_tax ) {
45
- $rbts = $this->get_robots_options_for( $option );
46
- if ( ! empty( $rbts ) && is_array( $rbts ) ) { foreach ( array_keys( $rbts ) as $item ) {
47
- if ( ! empty( $input[ $item ] ) ) { $result[ $item ] = true; }
48
- }
49
- }
50
- }
51
-
52
- // String values
53
- $strings = array(
54
- 'home',
55
- 'search',
56
- '404',
57
- 'bp_groups',
58
- 'bp_profile',
59
- 'mp_marketplace-base',
60
- 'mp_marketplace-categories',
61
- 'mp_marketplace-tags',
62
- );
63
- foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
64
- $strings[] = $pt;
65
- // Allow post types robots noindex/nofollow
66
- if ( isset( $input[ "meta_robots-noindex-{$pt}" ] ) ) { $result[ "meta_robots-noindex-{$pt}" ] = true; }
67
- if ( isset( $input[ "meta_robots-nofollow-{$pt}" ] ) ) { $result[ "meta_robots-nofollow-{$pt}" ] = true; }
68
- }
69
- $strings = array_merge( $strings, array_values( $tax_options ) );
70
- $strings = array_merge( $strings, array_values( $other_options ) );
71
-
72
- foreach ( $strings as $str ) {
73
- if ( isset( $input[ "title-{$str}" ] ) ) { $result[ "title-{$str}" ] = $this->_sanitize_preserve_macros( $input[ "title-{$str}" ] ); }
74
- if ( isset( $input[ "metadesc-{$str}" ] ) ) { $result[ "metadesc-{$str}" ] = $this->_sanitize_preserve_macros( $input[ "metadesc-{$str}" ] ); }
75
- if ( isset( $input[ "metakeywords-{$str}" ] ) ) { $result[ "metakeywords-{$str}" ] = $this->_sanitize_preserve_macros( $input[ "metakeywords-{$str}" ] ); }
76
-
77
- // OpenGraph
78
- if ( isset( $input[ "og-active-{$str}" ] ) ) {
79
- $result[ "og-active-{$str}" ] = (boolean) $input[ "og-active-{$str}" ];
80
- }
81
- if ( isset( $input[ "og-title-{$str}" ] ) ) {
82
- $result[ "og-title-{$str}" ] = $this->_sanitize_preserve_macros( $input[ "og-title-{$str}" ] );
83
- }
84
- if ( isset( $input[ "og-description-{$str}" ] ) ) {
85
- $result[ "og-description-{$str}" ] = $this->_sanitize_preserve_macros( $input[ "og-description-{$str}" ] );
86
- }
87
-
88
- $result[ "og-images-{$str}" ] = array();
89
- if ( ! empty( $input[ "og-images-{$str}" ] ) && is_array( $input[ "og-images-{$str}" ] ) ) {
90
- foreach ( $input[ "og-images-{$str}" ] as $img ) {
91
- $result[ "og-images-{$str}" ][] = esc_url( $img );
92
- }
93
- }
94
- $result[ "og-images-{$str}" ] = array_values( array_filter( array_unique( $result[ "og-images-{$str}" ] ) ) );
95
-
96
- // Twitter cards
97
- if (isset($input["twitter-active-{$str}"])) {
98
- $result["twitter-active-{$str}"] = (boolean)$input["twitter-active-{$str}"];
99
- }
100
- if (isset($input["twitter-title-{$str}"])) {
101
- $result["twitter-title-{$str}"] = $this->_sanitize_preserve_macros($input["twitter-title-{$str}"]);
102
- }
103
- if (isset($input["twitter-description-{$str}"])) {
104
- $result["twitter-description-{$str}"] = $this->_sanitize_preserve_macros($input["twitter-description-{$str}"]);
105
- }
106
-
107
- $result["twitter-images-{$str}"] = array();
108
- if (!empty($input["twitter-images-{$str}"]) && is_array($input["twitter-images-{$str}"])) {
109
- foreach ($input["twitter-images-{$str}"] as $img) {
110
- $result["twitter-images-{$str}"][] = esc_url($img);
111
- }
112
- }
113
- $result["twitter-images-{$str}"] = array_values(array_filter(array_unique($result["twitter-images-{$str}"])));
114
- }
115
-
116
- // Special case handling for home page keywords
117
- // because the legacy one doesn't follow the naming convention
118
- if ( isset( $input['keywords-home'] ) ) {
119
- $result['keywords-home'] = $this->_sanitize_preserve_macros( $input['keywords-home'] );
120
- }
121
-
122
- $result['enable-author-archive'] = isset( $input['enable-author-archive'] )
123
- ? (boolean) $input['enable-author-archive']
124
- : false
125
- ;
126
- $result['enable-date-archive'] = isset( $input['enable-date-archive'] )
127
- ? (boolean) $input['enable-date-archive']
128
- : false
129
- ;
130
-
131
- if ( isset( $input['preset-separator'] ) ) {
132
- $result['preset-separator'] = sanitize_text_field( $input['preset-separator'] );
133
- }
134
-
135
- if ( isset( $input['separator'] ) ) {
136
- $result['separator'] = sanitize_text_field( $input['separator'] );
137
- }
138
-
139
- return $result;
140
- }
141
-
142
- /**
143
- * Preserve macros in sanitization
144
- *
145
- * @param string $str String to sanitize
146
- *
147
- * @return string Sanitized string
148
- */
149
- private function _sanitize_preserve_macros( $str ) {
150
- if ( empty( $str ) ) { return $str; }
151
-
152
- $rpl = '__SMARTCRAWL_MACRO_QUOTES_REPLACEMENT__';
153
- $str = preg_replace( '/%%/', $rpl, $str );
154
-
155
- $str = sanitize_text_field( $str );
156
-
157
- $str = preg_replace( '/' . preg_quote( $rpl, '/' ) . '/', '%%', $str );
158
-
159
- return $str;
160
- }
161
-
162
- public function init() {
163
- $this->option_name = 'wds_onpage_options';
164
- $this->name = Smartcrawl_Settings::COMP_ONPAGE;
165
- $this->slug = Smartcrawl_Settings::TAB_ONPAGE;
166
- $this->action_url = admin_url( 'options.php' );
167
- $this->title = __( 'Title & Meta', 'wds' );
168
- $this->page_title = __( 'SmartCrawl Wizard: Title & Meta', 'wds' );
169
-
170
- add_action( 'wp_ajax_wds-onpage-preview', array( $this, 'json_create_preview' ) );
171
-
172
- parent::init();
173
-
174
- }
175
-
176
- /**
177
- * Preview building handler
178
- */
179
- public function json_create_preview() {
180
- $data = stripslashes_deep( $_POST );
181
-
182
- $src_type = ! empty( $data['type'] ) ? sanitize_text_field( $data['type'] ) : false;
183
- $src_title = ! empty( $data['title'] ) ? $this->_sanitize_preserve_macros( $data['title'] ) : false;
184
- $src_meta = ! empty( $data['description'] ) ? $this->_sanitize_preserve_macros( $data['description'] ) : false;
185
-
186
- $updated = false;
187
-
188
- $link = home_url();
189
- $title = get_bloginfo( 'name' );
190
- $description = get_bloginfo( 'description' );
191
-
192
- $warnings = array();
193
-
194
- switch ( $src_type ) {
195
- case 'search-page':
196
- set_query_var( 's', 'Example search phrase' );
197
- case 'author-archive':
198
- set_query_var( 'author', get_current_user_id() );
199
- case 'date-archive':
200
- case 'homepage':
201
- case '404-page':
202
- $title = smartcrawl_replace_vars( $src_title );
203
- $description = smartcrawl_replace_vars( $src_meta );
204
- $updated = true;
205
-
206
- if ( strlen( $title ) > SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT ) {
207
- $warnings['title'] = __( 'Your title seems to be a bit on the long side, consider trimming it', 'wds' );
208
- }
209
- if ( strlen( $description ) > SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT ) {
210
- $warnings['description'] = __( 'Your description seems to be a bit on the long side, consider trimming it', 'wds' );
211
- }
212
- break;
213
-
214
- case 'bp-group':
215
- $group = $this->_get_random_bp_group();
216
- if ( ! empty( $group ) ) {
217
- $title = smartcrawl_replace_vars( $src_title, (array) $group );
218
- $description = smartcrawl_replace_vars( $src_meta, (array) $group );
219
- $link = bp_get_group_permalink( $group );
220
- }
221
- $updated = true;
222
- break;
223
-
224
- case 'bp-profile':
225
- $bp_profile_args = array(
226
- 'full_name' => bp_get_loggedin_user_fullname(),
227
- 'username' => bp_get_loggedin_user_username(),
228
- );
229
-
230
- $title = smartcrawl_replace_vars( $src_title, $bp_profile_args );
231
- $description = smartcrawl_replace_vars( $src_meta, $bp_profile_args );
232
- $link = bp_loggedin_user_domain();
233
- $updated = true;
234
- break;
235
- }
236
-
237
- // Custom post type?
238
- if ( ! $updated ) {
239
- foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
240
- if ( $type !== $src_type ) {
241
- continue;
242
- }
243
-
244
- $updated = true;
245
- $post = $this->_get_random_post( $type );
246
- if ( ! empty( $post ) ) {
247
- $title = smartcrawl_replace_vars( $src_title, $post );
248
- $description = smartcrawl_replace_vars( $src_meta, $post );
249
- $link = get_permalink( $post['ID'] );
250
- }
251
- }
252
- }
253
-
254
- // Custom taxonomy?
255
- if ( ! $updated ) {
256
- foreach ( get_taxonomies() as $tax ) {
257
- if ( $tax !== $src_type ) {
258
- continue;
259
- }
260
-
261
- $updated = true;
262
- $term = $this->_get_random_term( $tax );
263
- if ( ! empty( $term ) ) {
264
- $title = smartcrawl_replace_vars( $src_title, $term );
265
- $description = smartcrawl_replace_vars( $src_meta, $term );
266
- $link = get_term_link( $term['term_id'], $tax );
267
- }
268
- }
269
- }
270
-
271
- wp_send_json(array(
272
- 'status' => $updated,
273
- 'markup' => $this->_load('onpage/onpage-preview', array(
274
- 'link' => $link,
275
- 'title' => $title,
276
- 'description' => $description,
277
- )),
278
- 'warnings' => $warnings,
279
- ));
280
- }
281
-
282
- /**
283
- * Randomly spawns a post of certain post type
284
- *
285
- * @param string $type Post type
286
- *
287
- * @return array
288
- */
289
- private function _get_random_post( $type = 'post' ) {
290
- $args = array(
291
- 'posts_per_page' => 1,
292
- 'post_type' => $type,
293
- 'orderby' => 'random',
294
- );
295
- if ( 'attachment' === $type ) {
296
- $args['post_status'] = 'any';
297
- }
298
- $q = new WP_Query( $args );
299
- return ! empty( $q->post )
300
- ? (array) $q->post
301
- : array()
302
- ;
303
- }
304
-
305
- /**
306
- * Spawn a random taxonomy term for a tax type
307
- *
308
- * @param string $type Taxonomy type
309
- *
310
- * @return array
311
- */
312
- private function _get_random_term( $type = 'category' ) {
313
- $terms = get_terms(
314
- array(
315
- 'taxonomy' => $type,
316
- 'hide_empty' => 0,
317
- )
318
- );
319
- if ( empty( $terms ) ) {
320
- return array();
321
- }
322
-
323
- shuffle( $terms );
324
- return (array) $terms[0];
325
- }
326
-
327
- /**
328
- * Returns a set of known macros, as macro => description pairs
329
- *
330
- * @return array List of known macros
331
- */
332
- public static function get_macros() {
333
- $macros = array(
334
- '%%sep%%' => __( 'Separator', 'wds' ),
335
- '%%date%%' => __( 'Date of the post/page', 'wds' ),
336
- '%%title%%' => __( 'Title of the post/page', 'wds' ),
337
- '%%sitename%%' => __( 'Site\'s name', 'wds' ),
338
- '%%sitedesc%%' => __( 'Site\'s tagline / description', 'wds' ),
339
- '%%excerpt%%' => __( 'Post/page excerpt (or auto-generated if it does not exist)', 'wds' ),
340
- '%%excerpt_only%%' => __( 'Post/page excerpt (without auto-generation)', 'wds' ),
341
- '%%tag%%' => __( 'Current tag/tags', 'wds' ),
342
- '%%category%%' => __( 'Post categories (comma separated)', 'wds' ),
343
- '%%category_description%%' => __( 'Category description', 'wds' ),
344
- '%%tag_description%%' => __( 'Tag description', 'wds' ),
345
- '%%term_description%%' => __( 'Term description', 'wds' ),
346
- '%%term_title%%' => __( 'Term name', 'wds' ),
347
- '%%modified%%' => __( 'Post/page modified time', 'wds' ),
348
- '%%id%%' => __( 'Post/page ID', 'wds' ),
349
- '%%name%%' => __( 'Post/page author\'s \'nicename\'', 'wds' ),
350
- '%%userid%%' => __( 'Post/page author\'s userid', 'wds' ),
351
- '%%searchphrase%%' => __( 'Current search phrase', 'wds' ),
352
- '%%currenttime%%' => __( 'Current time', 'wds' ),
353
- '%%currentdate%%' => __( 'Current date', 'wds' ),
354
- '%%currentmonth%%' => __( 'Current month', 'wds' ),
355
- '%%currentyear%%' => __( 'Current year', 'wds' ),
356
- '%%page%%' => __( 'Current page number (i.e. page 2 of 4)', 'wds' ),
357
- '%%pagetotal%%' => __( 'Current page total', 'wds' ),
358
- '%%pagenumber%%' => __( 'Current page number', 'wds' ),
359
- '%%caption%%' => __( 'Attachment caption', 'wds' ),
360
- '%%spell_pagenumber%%' => __( 'Current page number, spelled out as numeral in English', 'wds' ),
361
- '%%spell_pagetotal%%' => __( 'Current page total, spelled out as numeral in English', 'wds' ),
362
- '%%spell_page%%' => __( 'Current page number, spelled out as numeral in English', 'wds' ),
363
- );
364
-
365
- if ( defined( 'BP_VERSION' ) ) {
366
- $macros['%%bp_group_name%%'] = __( 'BuddyPress group name', 'wds' );
367
- $macros['%%bp_group_description%%'] = __( 'BuddyPress group description', 'wds' );
368
- $macros['%%bp_user_username%%'] = __( 'BuddyPress username', 'wds' );
369
- $macros['%%bp_user_full_name%%'] = __( "BuddyPress user's full name", 'wds' );
370
- }
371
-
372
- return $macros;
373
- }
374
-
375
- /**
376
- * Spawns a set of robots options for a given type
377
- *
378
- * @param string $type Archives type to generate the robots options for
379
- * @param bool $include_subsequent_pages_option Whether to include the subsequent pages option.
380
- *
381
- * @return array Generated meta robots option array
382
- */
383
- public static function get_robots_options_for( $type, $include_subsequent_pages_option = true ) {
384
- $options = array(
385
- "meta_robots-noindex-{$type}" => array(
386
- 'label' => __( 'Noindex', 'wds' ),
387
- 'description' => __( 'Disabling indexing means that this content will not be indexed and searchable in search engines.', 'wds' ),
388
- ),
389
- "meta_robots-nofollow-{$type}" => array(
390
- 'label' => __( 'Nofollow', 'wds' ),
391
- 'description' => __( 'Disabling following means search engines will not follow and crawl links it finds in this content.', 'wds' ),
392
- ),
393
- );
394
-
395
- if ( $include_subsequent_pages_option ) {
396
- $options[ "meta_robots-{$type}-subsequent_pages" ] = array(
397
- 'label' => __( 'Apply to all pages except the first', 'wds' ),
398
- 'description' => __( 'If you select this option, the first page will be left alone, but the indexing settings will be applied to subsequent pages.', 'wds' ),
399
- );
400
- }
401
-
402
- return $options;
403
- }
404
-
405
- /**
406
- * Spawn taxonomy options and names, indexed by taxonomy option names
407
- *
408
- * @param string $pfx Prefix options with this
409
- *
410
- * @return array
411
- */
412
- protected function _get_tax_options( $pfx = '' ) {
413
- $pfx = ! empty( $pfx ) ? rtrim( $pfx, '_' ) . '_' : $pfx;
414
- $opts = array();
415
- foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
416
- $name = $pfx . str_replace( '-', '_', $taxonomy->name );
417
- $opts[ $name ] = $taxonomy->name;
418
- }
419
- return $opts;
420
- }
421
-
422
- /**
423
- * Spawn taxonomy options and names, indexed by taxonomy option names
424
- *
425
- * @param string $pfx Prefix options with this
426
- *
427
- * @return array
428
- */
429
- protected function _get_other_types_options( $pfx = '' ) {
430
- $pfx = ! empty( $pfx ) ? rtrim( $pfx, '_' ) . '_' : $pfx;
431
- $opts = array();
432
- $other_types = array(
433
- 'category',
434
- 'post_tag',
435
- 'author',
436
- 'date',
437
- );
438
- foreach ( $other_types as $value ) {
439
- $name = $pfx . $value;
440
- $opts[ $name ] = $value;
441
- }
442
- return $opts;
443
- }
444
-
445
- /**
446
- * Add admin settings page
447
- */
448
- public function options_page() {
449
- parent::options_page();
450
-
451
- $smartcrawl_options = Smartcrawl_Settings::get_options();
452
-
453
- $arguments = array(
454
- 'macros' => self::get_macros(),
455
- 'meta_robots_main_blog_archive' => self::get_robots_options_for( 'main_blog_archive' ),
456
- );
457
-
458
- foreach ( $this->_get_tax_options( 'meta_robots_' ) as $option => $tax ) {
459
- $tax = str_replace( '-', '_', $tax );
460
- if ( empty( $arguments[ $option ] ) ) { $arguments[ $option ] = self::get_robots_options_for( $tax ); }
461
- }
462
-
463
- foreach ( $this->_get_other_types_options( 'meta_robots_' ) as $option => $value ) {
464
- if ( empty( $arguments[ $option ] ) ) { $arguments[ $option ] = self::get_robots_options_for( $value ); }
465
- }
466
-
467
- $arguments['meta_robots_search'] = self::get_robots_options_for( 'search', false );
468
-
469
- // Allow for post type options
470
- $arguments['post_robots'] = array(
471
- 'attachment' => self::get_robots_options_for( 'attachment', false ),
472
- );
473
-
474
- $arguments['radio_options'] = array(
475
- __( 'No', 'wds' ),
476
- __( 'Yes', 'wds' ),
477
- );
478
-
479
- $arguments['engines'] = array(
480
- 'ping-google' => __( 'Google', 'wds' ),
481
- 'ping-bing' => __( 'Bing', 'wds' ),
482
- );
483
-
484
- $arguments['separators'] = smartcrawl_get_separators();
485
-
486
- $arguments['show_homepage_options'] = $this->_show_homepage_options();
487
- $arguments['homepage_title'] = $this->_get_homepage_title( $smartcrawl_options );
488
- $arguments['homepage_description'] = $this->_get_homepage_description( $smartcrawl_options );
489
-
490
- $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_homepage' );
491
-
492
- wp_enqueue_script( 'wds-admin-onpage' );
493
- $this->_render_page( 'onpage/onpage-settings', $arguments );
494
- }
495
-
496
- /**
497
- * Default settings
498
- */
499
- public function defaults() {
500
-
501
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
502
- $this->options = get_site_option( $this->option_name );
503
- } else {
504
- $this->options = get_option( $this->option_name );
505
- }
506
-
507
- if ( empty( $this->options['title-home'] ) ) {
508
- $this->options['title-home'] = '%%sitename%%';
509
- }
510
-
511
- if ( empty( $this->options['metadesc-home'] ) ) {
512
- $this->options['metadesc-home'] = '%%sitedesc%%';
513
- }
514
-
515
- if ( empty( $this->options['keywords-home'] ) ) {
516
- $this->options['keywords-home'] = '';
517
- }
518
-
519
- if ( empty( $this->options['onpage-stylesheet'] ) ) {
520
- $this->options['onpage-stylesheet'] = 0;
521
- }
522
-
523
- if ( empty( $this->options['onpage-dashboard-widget'] ) ) {
524
- $this->options['onpage-dashboard-widget'] = 1;
525
- }
526
-
527
- if ( empty( $this->options['onpage-disable-automatic-regeneration'] ) ) {
528
- $this->options['onpage-disable-automatic-regeneration'] = 0;
529
- }
530
-
531
- foreach ( get_post_types( array( 'public' => true ) ) as $posttype ) {
532
- if ( in_array( $posttype, array( 'revision', 'nav_menu_item' ) ) ) { continue; }
533
- if ( preg_match( '/^upfront_/', $posttype ) ) { continue; }
534
-
535
- $type_obj = get_post_type_object( $posttype );
536
- if ( ! is_object( $type_obj ) ) { continue; }
537
-
538
- if ( empty( $this->options[ 'title-' . $posttype ] ) ) {
539
- $this->options[ 'title-' . $posttype ] = '%%title%% %%sep%% %%sitename%%';
540
- }
541
-
542
- if ( empty( $this->options[ 'metadesc-' . $posttype ] ) ) {
543
- $this->options[ 'metadesc-' . $posttype ] = '%%excerpt%%';
544
- }
545
- }
546
-
547
- foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
548
- if ( empty( $this->options[ 'title-' . $taxonomy->name ] ) ) {
549
- $this->options[ 'title-' . $taxonomy->name ] = '';
550
- }
551
-
552
- if ( empty( $this->options[ 'metadesc-' . $taxonomy->name ] ) ) {
553
- $this->options[ 'metadesc-' . $taxonomy->name ] = '';
554
- }
555
- }
556
-
557
- $other_types = array(
558
- 'category' => array( 'title' => '%%category%% %%sep%% %%sitename%%', 'desc' => '%%category_description%%' ),
559
- 'post_tag' => array( 'title' => '%%tag%% %%sep%% %%sitename%%', 'desc' => '%%tag_description%%' ),
560
- 'author' => array( 'title' => '%%name%% %%sep%% %%sitename%%', 'desc' => '' ),
561
- 'date' => array( 'title' => '%%currentdate%% %%sep%% %%sitename%%', 'desc' => '' ),
562
- 'search' => array( 'title' => '%%searchphrase%% %%sep%% %%sitename%%', 'desc' => '' ),
563
- '404' => array( 'title' => 'Page not found %%sep%% %%sitename%%', 'desc' => '' ),
564
- 'bp_groups' => array( 'title' => '%%bp_group_name%% %%sep%% %%sitename%%', 'desc' => '%%bp_group_description%%' ),
565
- 'bp_profile' => array( 'title' => '%%bp_user_username%% %%sep%% %%sitename%%', 'desc' => '%%bp_user_full_name%%' ),
566
- 'mp_marketplace-base' => array( 'title' => '', 'desc' => '' ),
567
- 'mp_marketplace-categories' => array( 'title' => '', 'desc' => '' ),
568
- 'mp_marketplace-tags' => array( 'title' => '', 'desc' => '' ),
569
- );
570
-
571
- foreach ( $other_types as $key => $value ) {
572
- if ( empty( $this->options[ 'title-' . $key ] ) ) {
573
- $this->options[ 'title-' . $key ] = $value['title'];
574
- }
575
-
576
- if ( empty( $this->options[ 'metadesc-' . $key ] ) ) {
577
- $this->options[ 'metadesc-' . $key ] = $value['desc'];
578
- }
579
- }
580
-
581
- if ( ! isset( $this->options['preset-separator'] ) ) {
582
- $this->options['preset-separator'] = 'pipe';
583
- }
584
-
585
- if ( ! isset( $this->options['separator'] ) ) {
586
- $this->options['separator'] = '';
587
- }
588
-
589
- if ( ! isset( $this->options['enable-author-archive'] ) ) {
590
- $this->options['enable-author-archive'] = true;
591
- }
592
-
593
- if ( ! isset( $this->options['enable-date-archive'] ) ) {
594
- $this->options['enable-date-archive'] = true;
595
- }
596
-
597
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
598
- update_site_option( $this->option_name, $this->options );
599
- } else {
600
- update_option( $this->option_name, $this->options );
601
- }
602
-
603
- }
604
-
605
- private function _show_homepage_options() {
606
- if ( is_multisite() ) {
607
- $show_homepage_options = SMARTCRAWL_SITEWIDE || 'posts' == get_site_option( 'show_on_front' );
608
- } else {
609
- $show_homepage_options = 'posts' == get_option( 'show_on_front' );
610
- }
611
-
612
- return $show_homepage_options;
613
- }
614
-
615
- private function _get_homepage_title( $options ) {
616
- $front_page_id = (int) get_option( 'page_on_front' );
617
-
618
- if ( ! $this->_show_homepage_options() && $front_page_id ) {
619
-
620
- $homepage_title = smartcrawl_get_value( 'title', $front_page_id );
621
- if ( empty( $homepage_title ) ) {
622
- $front_page = get_post( $front_page_id );
623
- $homepage_title = $front_page->post_title;
624
- }
625
-
626
- return $homepage_title;
627
- } else {
628
- return $options['title-home'];
629
- }
630
- }
631
-
632
- private function _get_homepage_description( $options ) {
633
- $front_page_id = (int) get_option( 'page_on_front' );
634
-
635
- if ( ! $this->_show_homepage_options() && $front_page_id ) {
636
- $homepage_description = smartcrawl_get_value( 'metadesc', $front_page_id );
637
- if ( empty( $homepage_description ) ) {
638
- $front_page = get_post( $front_page_id );
639
- $homepage_description = substr( strip_tags( $front_page->post_content ), 0, 130 );
640
- }
641
-
642
- return $homepage_description;
643
- } else {
644
- return $options['metadesc-home'];
645
- }
646
- }
647
-
648
- private function _get_random_bp_group() {
649
- $groups = groups_get_groups(array(
650
- 'orderby' => 'random',
651
- 'per_page' => 1,
652
- ));
653
-
654
- $total = isset( $groups['total'] ) ? $groups['total'] : 0;
655
- $groups = isset( $groups['groups'] ) ? $groups['groups'] : array();
656
-
657
- return $total > 0 ? $groups[0] : null;
658
- }
659
- }
660
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smartcrawl_Onpage_Settings extends Smartcrawl_Settings_Admin {
4
+
5
+ const PT_ARCHIVE_PREFIX = 'pt-archive-';
6
+ private static $_instance;
7
+
8
+ public static function get_instance() {
9
+ if ( empty( self::$_instance ) ) {
10
+ self::$_instance = new self();
11
+ }
12
+
13
+ return self::$_instance;
14
+ }
15
+
16
+ /**
17
+ * Validate submitted options
18
+ *
19
+ * @param array $input Raw input
20
+ *
21
+ * @return array Validated input
22
+ */
23
+ public function validate( $input ) {
24
+ $result = array();
25
+
26
+ // Setup
27
+ if ( ! empty( $input['wds_onpage-setup'] ) ) {
28
+ $result['wds_onpage-setup'] = true;
29
+ }
30
+
31
+ // Meta robots
32
+ if ( ! empty( $input['meta_robots-noindex-main_blog_archive'] ) ) {
33
+ $result['meta_robots-noindex-main_blog_archive'] = true;
34
+ }
35
+ if ( ! empty( $input['meta_robots-nofollow-main_blog_archive'] ) ) {
36
+ $result['meta_robots-nofollow-main_blog_archive'] = true;
37
+ }
38
+ if ( ! empty( $input['meta_robots-main_blog_archive-subsequent_pages'] ) ) {
39
+ $result['meta_robots-main_blog_archive-subsequent_pages'] = true;
40
+ }
41
+
42
+ if ( ! empty( $input['meta_robots-noindex-search'] ) ) {
43
+ $result['meta_robots-noindex-search'] = true;
44
+ }
45
+ if ( ! empty( $input['meta_robots-nofollow-search'] ) ) {
46
+ $result['meta_robots-nofollow-search'] = true;
47
+ }
48
+
49
+ $tax_options = $this->_get_tax_options( '' );
50
+ foreach ( $tax_options as $option => $_tax ) {
51
+ $rbts = $this->get_robots_options_for( $option );
52
+ if ( ! empty( $rbts ) && is_array( $rbts ) ) {
53
+ foreach ( array_keys( $rbts ) as $item ) {
54
+ if ( ! empty( $input[ $item ] ) ) {
55
+ $result[ $item ] = true;
56
+ }
57
+ }
58
+ }
59
+ }
60
+ $other_options = $this->_get_other_types_options( '' );
61
+ foreach ( $other_options as $option => $_tax ) {
62
+ $rbts = $this->get_robots_options_for( $option );
63
+ if ( ! empty( $rbts ) && is_array( $rbts ) ) {
64
+ foreach ( array_keys( $rbts ) as $item ) {
65
+ if ( ! empty( $input[ $item ] ) ) {
66
+ $result[ $item ] = true;
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+ $archive_post_types = smartcrawl_get_archive_post_types();
73
+ foreach ( $archive_post_types as $archive_post_type ) {
74
+ $archive_pt_robot_options = $this->get_robots_options_for( $archive_post_type );
75
+
76
+ foreach ( array_keys( $archive_pt_robot_options ) as $archive_pt_robot_option ) {
77
+ if ( ! empty( $input[ $archive_pt_robot_option ] ) ) {
78
+ $result[ $archive_pt_robot_option ] = true;
79
+ }
80
+ }
81
+ }
82
+
83
+ // String values
84
+ $strings = array(
85
+ 'home',
86
+ 'search',
87
+ '404',
88
+ 'bp_groups',
89
+ 'bp_profile',
90
+ );
91
+ foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
92
+ $strings[] = $pt;
93
+ // Allow post types robots noindex/nofollow
94
+ if ( isset( $input["meta_robots-noindex-{$pt}"] ) ) {
95
+ $result["meta_robots-noindex-{$pt}"] = true;
96
+ }
97
+ if ( isset( $input["meta_robots-nofollow-{$pt}"] ) ) {
98
+ $result["meta_robots-nofollow-{$pt}"] = true;
99
+ }
100
+ }
101
+ $strings = array_merge( $strings, array_values( $tax_options ) );
102
+ $strings = array_merge( $strings, array_values( $other_options ) );
103
+ $strings = array_merge( $strings, $archive_post_types );
104
+
105
+ foreach ( $strings as $str ) {
106
+ if ( isset( $input["title-{$str}"] ) ) {
107
+ $result["title-{$str}"] = $this->_sanitize_preserve_macros( $input["title-{$str}"] );
108
+ }
109
+ if ( isset( $input["metadesc-{$str}"] ) ) {
110
+ $result["metadesc-{$str}"] = $this->_sanitize_preserve_macros( $input["metadesc-{$str}"] );
111
+ }
112
+ if ( isset( $input["metakeywords-{$str}"] ) ) {
113
+ $result["metakeywords-{$str}"] = $this->_sanitize_preserve_macros( $input["metakeywords-{$str}"] );
114
+ }
115
+
116
+ // OpenGraph
117
+ if ( isset( $input["og-active-{$str}"] ) ) {
118
+ $result["og-active-{$str}"] = (boolean) $input["og-active-{$str}"];
119
+ }
120
+ if ( isset( $input["og-title-{$str}"] ) ) {
121
+ $result["og-title-{$str}"] = $this->_sanitize_preserve_macros( $input["og-title-{$str}"] );
122
+ }
123
+ if ( isset( $input["og-description-{$str}"] ) ) {
124
+ $result["og-description-{$str}"] = $this->_sanitize_preserve_macros( $input["og-description-{$str}"] );
125
+ }
126
+
127
+ $result["og-images-{$str}"] = array();
128
+ if ( ! empty( $input["og-images-{$str}"] ) && is_array( $input["og-images-{$str}"] ) ) {
129
+ foreach ( $input["og-images-{$str}"] as $img ) {
130
+ $result["og-images-{$str}"][] = esc_url( $img );
131
+ }
132
+ }
133
+ $result["og-images-{$str}"] = array_values( array_filter( array_unique( $result["og-images-{$str}"] ) ) );
134
+
135
+ // Twitter cards
136
+ if ( isset( $input["twitter-active-{$str}"] ) ) {
137
+ $result["twitter-active-{$str}"] = (boolean) $input["twitter-active-{$str}"];
138
+ }
139
+ if ( isset( $input["twitter-title-{$str}"] ) ) {
140
+ $result["twitter-title-{$str}"] = $this->_sanitize_preserve_macros( $input["twitter-title-{$str}"] );
141
+ }
142
+ if ( isset( $input["twitter-description-{$str}"] ) ) {
143
+ $result["twitter-description-{$str}"] = $this->_sanitize_preserve_macros( $input["twitter-description-{$str}"] );
144
+ }
145
+
146
+ $result["twitter-images-{$str}"] = array();
147
+ if ( ! empty( $input["twitter-images-{$str}"] ) && is_array( $input["twitter-images-{$str}"] ) ) {
148
+ foreach ( $input["twitter-images-{$str}"] as $img ) {
149
+ $result["twitter-images-{$str}"][] = esc_url( $img );
150
+ }
151
+ }
152
+ $result["twitter-images-{$str}"] = array_values( array_filter( array_unique( $result["twitter-images-{$str}"] ) ) );
153
+ }
154
+
155
+ // Special case handling for home page keywords
156
+ // because the legacy one doesn't follow the naming convention
157
+ if ( isset( $input['keywords-home'] ) ) {
158
+ $result['keywords-home'] = $this->_sanitize_preserve_macros( $input['keywords-home'] );
159
+ }
160
+
161
+ $result['enable-author-archive'] = isset( $input['enable-author-archive'] )
162
+ ? (boolean) $input['enable-author-archive']
163
+ : false;
164
+ $result['enable-date-archive'] = isset( $input['enable-date-archive'] )
165
+ ? (boolean) $input['enable-date-archive']
166
+ : false;
167
+
168
+ if ( isset( $input['preset-separator'] ) ) {
169
+ $result['preset-separator'] = sanitize_text_field( $input['preset-separator'] );
170
+ }
171
+
172
+ if ( isset( $input['separator'] ) ) {
173
+ $result['separator'] = sanitize_text_field( $input['separator'] );
174
+ }
175
+
176
+ return $result;
177
+ }
178
+
179
+ /**
180
+ * Spawn taxonomy options and names, indexed by taxonomy option names
181
+ *
182
+ * @param string $pfx Prefix options with this
183
+ *
184
+ * @return array
185
+ */
186
+ protected function _get_tax_options( $pfx = '' ) {
187
+ $pfx = ! empty( $pfx ) ? rtrim( $pfx, '_' ) . '_' : $pfx;
188
+ $opts = array();
189
+ foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
190
+ $name = $pfx . str_replace( '-', '_', $taxonomy->name );
191
+ $opts[ $name ] = $taxonomy->name;
192
+ }
193
+
194
+ return $opts;
195
+ }
196
+
197
+ /**
198
+ * Spawns a set of robots options for a given type
199
+ *
200
+ * @param string $type Archives type to generate the robots options for
201
+ * @param bool $include_subsequent_pages_option Whether to include the subsequent pages option.
202
+ *
203
+ * @return array Generated meta robots option array
204
+ */
205
+ public static function get_robots_options_for( $type, $include_subsequent_pages_option = true ) {
206
+ $options = array(
207
+ "meta_robots-noindex-{$type}" => array(
208
+ 'label' => __( 'Noindex', 'wds' ),
209
+ 'description' => __( 'Disabling indexing means that this content will not be indexed and searchable in search engines.', 'wds' ),
210
+ ),
211
+ "meta_robots-nofollow-{$type}" => array(
212
+ 'label' => __( 'Nofollow', 'wds' ),
213
+ 'description' => __( 'Disabling following means search engines will not follow and crawl links it finds in this content.', 'wds' ),
214
+ ),
215
+ );
216
+
217
+ if ( $include_subsequent_pages_option ) {
218
+ $options["meta_robots-{$type}-subsequent_pages"] = array(
219
+ 'label' => __( 'Apply to all pages except the first', 'wds' ),
220
+ 'description' => __( 'If you select this option, the first page will be left alone, but the indexing settings will be applied to subsequent pages.', 'wds' ),
221
+ );
222
+ }
223
+
224
+ return $options;
225
+ }
226
+
227
+ /**
228
+ * Spawn taxonomy options and names, indexed by taxonomy option names
229
+ *
230
+ * @param string $pfx Prefix options with this
231
+ *
232
+ * @return array
233
+ */
234
+ protected function _get_other_types_options( $pfx = '' ) {
235
+ $pfx = ! empty( $pfx ) ? rtrim( $pfx, '_' ) . '_' : $pfx;
236
+ $opts = array();
237
+ $other_types = array(
238
+ 'category',
239
+ 'post_tag',
240
+ 'author',
241
+ 'date',
242
+ );
243
+ foreach ( $other_types as $value ) {
244
+ $name = $pfx . $value;
245
+ $opts[ $name ] = $value;
246
+ }
247
+
248
+ return $opts;
249
+ }
250
+
251
+ /**
252
+ * Preserve macros in sanitization
253
+ *
254
+ * @param string $str String to sanitize
255
+ *
256
+ * @return string Sanitized string
257
+ */
258
+ private function _sanitize_preserve_macros( $str ) {
259
+ if ( empty( $str ) ) {
260
+ return $str;
261
+ }
262
+
263
+ $rpl = '__SMARTCRAWL_MACRO_QUOTES_REPLACEMENT__';
264
+ $str = preg_replace( '/%%/', $rpl, $str );
265
+
266
+ $str = sanitize_text_field( $str );
267
+
268
+ $str = preg_replace( '/' . preg_quote( $rpl, '/' ) . '/', '%%', $str );
269
+
270
+ return $str;
271
+ }
272
+
273
+ public function init() {
274
+ $this->option_name = 'wds_onpage_options';
275
+ $this->name = Smartcrawl_Settings::COMP_ONPAGE;
276
+ $this->slug = Smartcrawl_Settings::TAB_ONPAGE;
277
+ $this->action_url = admin_url( 'options.php' );
278
+ $this->title = __( 'Title & Meta', 'wds' );
279
+ $this->page_title = __( 'SmartCrawl Wizard: Title & Meta', 'wds' );
280
+
281
+ add_action( 'wp_ajax_wds-onpage-preview', array( $this, 'json_create_preview' ) );
282
+
283
+ parent::init();
284
+
285
+ }
286
+
287
+ /**
288
+ * Preview building handler
289
+ */
290
+ public function json_create_preview() {
291
+ $data = $this->get_request_data();
292
+
293
+ $src_type = ! empty( $data['type'] ) ? sanitize_text_field( $data['type'] ) : false;
294
+ $src_title = ! empty( $data['title'] ) ? $this->_sanitize_preserve_macros( $data['title'] ) : false;
295
+ $src_meta = ! empty( $data['description'] ) ? $this->_sanitize_preserve_macros( $data['description'] ) : false;
296
+
297
+ $updated = false;
298
+
299
+ $link = home_url();
300
+ $title = get_bloginfo( 'name' );
301
+ $description = get_bloginfo( 'description' );
302
+
303
+ $warnings = array();
304
+
305
+ switch ( $src_type ) {
306
+ case 'search-page':
307
+ set_query_var( 's', 'Example search phrase' );
308
+ // Handled the same way as homepage so fall-through intentional
309
+ case 'author-archive':
310
+ set_query_var( 'author', get_current_user_id() );
311
+ // Handled the same way as homepage so fall-through intentional
312
+ case 'date-archive':
313
+ set_query_var( 'monthnum', 3 );
314
+ set_query_var( 'year', 2018 );
315
+ // Handled the same way as homepage so fall-through intentional
316
+
317
+ case 'homepage':
318
+ case '404-page':
319
+ $title = smartcrawl_replace_vars( $src_title );
320
+ $description = smartcrawl_replace_vars( $src_meta );
321
+ $updated = true;
322
+
323
+ if ( strlen( $title ) > SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT ) {
324
+ $warnings['title'] = __( 'Your title seems to be a bit on the long side, consider trimming it', 'wds' );
325
+ }
326
+ if ( strlen( $description ) > SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT ) {
327
+ $warnings['description'] = __( 'Your description seems to be a bit on the long side, consider trimming it', 'wds' );
328
+ }
329
+ break;
330
+
331
+ case 'bp-group':
332
+ $group = $this->_get_random_bp_group();
333
+ if ( ! empty( $group ) ) {
334
+ $title = smartcrawl_replace_vars( $src_title, (array) $group );
335
+ $description = smartcrawl_replace_vars( $src_meta, (array) $group );
336
+ $link = bp_get_group_permalink( $group );
337
+ }
338
+ $updated = true;
339
+ break;
340
+
341
+ case 'bp-profile':
342
+ $bp_profile_args = array(
343
+ 'full_name' => bp_get_loggedin_user_fullname(),
344
+ 'username' => bp_get_loggedin_user_username(),
345
+ );
346
+
347
+ $title = smartcrawl_replace_vars( $src_title, $bp_profile_args );
348
+ $description = smartcrawl_replace_vars( $src_meta, $bp_profile_args );
349
+ $link = bp_loggedin_user_domain();
350
+ $updated = true;
351
+ break;
352
+ }
353
+
354
+ // Custom post type?
355
+ if ( ! $updated ) {
356
+ foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
357
+ if ( $type !== $src_type ) {
358
+ continue;
359
+ }
360
+
361
+ $updated = true;
362
+ $post = $this->_get_random_post( $type );
363
+ if ( ! empty( $post ) ) {
364
+ $title = smartcrawl_replace_vars( $src_title, $post );
365
+ $description = smartcrawl_replace_vars( $src_meta, $post );
366
+ $link = get_permalink( $post['ID'] );
367
+ }
368
+ }
369
+ }
370
+
371
+ if ( ! $updated ) {
372
+ $archive_post_type_prefix = self::PT_ARCHIVE_PREFIX;
373
+ foreach ( smartcrawl_get_archive_post_types() as $archive_post_type ) {
374
+ if ( $archive_post_type !== $src_type ) {
375
+ continue;
376
+ }
377
+
378
+ $updated = true;
379
+ $archive_pt = str_replace( $archive_post_type_prefix, '', $archive_post_type );
380
+
381
+ $title = smartcrawl_replace_vars( $src_title, get_post_type_object( $archive_pt ) );
382
+ $description = smartcrawl_replace_vars( $src_meta, get_post_type_object( $archive_pt ) );
383
+ $link = get_post_type_archive_link( $archive_pt );
384
+ }
385
+ }
386
+
387
+ // Custom taxonomy?
388
+ if ( ! $updated ) {
389
+ foreach ( get_taxonomies() as $tax ) {
390
+ if ( $tax !== $src_type ) {
391
+ continue;
392
+ }
393
+
394
+ $updated = true;
395
+ $term = $this->_get_random_term( $tax );
396
+ if ( ! empty( $term ) ) {
397
+ $title = smartcrawl_replace_vars( $src_title, $term );
398
+ $description = smartcrawl_replace_vars( $src_meta, $term );
399
+ $link = get_term_link( $term['term_id'], $tax );
400
+ }
401
+ }
402
+ }
403
+
404
+ wp_send_json( array(
405
+ 'status' => $updated,
406
+ 'markup' => $this->_load( 'onpage/onpage-preview', array(
407
+ 'link' => $link,
408
+ 'title' => $title,
409
+ 'description' => $description,
410
+ ) ),
411
+ 'warnings' => $warnings,
412
+ ) );
413
+ }
414
+
415
+ private function _get_random_bp_group() {
416
+ $groups = groups_get_groups( array(
417
+ 'orderby' => 'random',
418
+ 'per_page' => 1,
419
+ ) );
420
+
421
+ $total = isset( $groups['total'] ) ? $groups['total'] : 0;
422
+ $groups = isset( $groups['groups'] ) ? $groups['groups'] : array();
423
+
424
+ return $total > 0 ? $groups[0] : null;
425
+ }
426
+
427
+ /**
428
+ * Randomly spawns a post of certain post type
429
+ *
430
+ * @param string $type Post type
431
+ *
432
+ * @return array
433
+ */
434
+ private function _get_random_post( $type = 'post' ) {
435
+ $args = array(
436
+ 'posts_per_page' => 1,
437
+ 'post_type' => $type,
438
+ 'orderby' => 'random',
439
+ );
440
+ if ( 'attachment' === $type ) {
441
+ $args['post_status'] = 'any';
442
+ }
443
+ $q = new WP_Query( $args );
444
+
445
+ return ! empty( $q->post )
446
+ ? (array) $q->post
447
+ : array();
448
+ }
449
+
450
+ /**
451
+ * Spawn a random taxonomy term for a tax type
452
+ *
453
+ * @param string $type Taxonomy type
454
+ *
455
+ * @return array
456
+ */
457
+ private function _get_random_term( $type = 'category' ) {
458
+ $terms = get_terms(
459
+ array(
460
+ 'taxonomy' => $type,
461
+ 'hide_empty' => 0,
462
+ )
463
+ );
464
+ if ( empty( $terms ) ) {
465
+ return array();
466
+ }
467
+
468
+ shuffle( $terms );
469
+
470
+ return (array) $terms[0];
471
+ }
472
+
473
+ /**
474
+ * Add admin settings page
475
+ */
476
+ public function options_page() {
477
+ parent::options_page();
478
+
479
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
480
+
481
+ $arguments = array(
482
+ 'macros' => self::get_macros(),
483
+ 'meta_robots_main_blog_archive' => self::get_robots_options_for( 'main_blog_archive' ),
484
+ );
485
+
486
+ foreach ( $this->_get_tax_options( 'meta_robots_' ) as $option => $tax ) {
487
+ $tax = str_replace( '-', '_', $tax );
488
+ if ( empty( $arguments[ $option ] ) ) {
489
+ $arguments[ $option ] = self::get_robots_options_for( $tax );
490
+ }
491
+ }
492
+
493
+ foreach ( $this->_get_other_types_options( 'meta_robots_' ) as $option => $value ) {
494
+ if ( empty( $arguments[ $option ] ) ) {
495
+ $arguments[ $option ] = self::get_robots_options_for( $value );
496
+ }
497
+ }
498
+
499
+ $archive_post_types = smartcrawl_get_archive_post_type_labels();
500
+ foreach ( $archive_post_types as $archive_post_type => $archive_post_type_label ) {
501
+ $arguments['archive_post_type_robots'][ $archive_post_type ] = self::get_robots_options_for( $archive_post_type );
502
+ }
503
+ $arguments['archive_post_types'] = $archive_post_types;
504
+
505
+ $arguments['meta_robots_search'] = self::get_robots_options_for( 'search', false );
506
+
507
+ // Allow for post type options
508
+ foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
509
+ $arguments['post_robots'][ $post_type ] = self::get_robots_options_for( $post_type, false );
510
+ }
511
+
512
+ $arguments['radio_options'] = array(
513
+ __( 'No', 'wds' ),
514
+ __( 'Yes', 'wds' ),
515
+ );
516
+
517
+ $arguments['engines'] = array(
518
+ 'ping-google' => __( 'Google', 'wds' ),
519
+ 'ping-bing' => __( 'Bing', 'wds' ),
520
+ );
521
+
522
+ $arguments['separators'] = smartcrawl_get_separators();
523
+
524
+ $arguments['show_homepage_options'] = $this->_show_homepage_options();
525
+ $arguments['homepage_title'] = $this->_get_homepage_title( $smartcrawl_options );
526
+ $arguments['homepage_description'] = $this->_get_homepage_description( $smartcrawl_options );
527
+
528
+ $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_homepage' );
529
+
530
+ wp_enqueue_script( 'wds-admin-onpage' );
531
+ $this->_render_page( 'onpage/onpage-settings', $arguments );
532
+ }
533
+
534
+ /**
535
+ * Returns a set of known macros, as macro => description pairs
536
+ *
537
+ * @return array List of known macros
538
+ */
539
+ public static function get_macros() {
540
+ $macros = array(
541
+ '%%sep%%' => __( 'Separator', 'wds' ),
542
+ '%%date%%' => __( 'Date of the post/page', 'wds' ),
543
+ '%%title%%' => __( 'Title of the post/page', 'wds' ),
544
+ '%%sitename%%' => __( 'Site\'s name', 'wds' ),
545
+ '%%sitedesc%%' => __( 'Site\'s tagline / description', 'wds' ),
546
+ '%%excerpt%%' => __( 'Post/page excerpt (or auto-generated if it does not exist)', 'wds' ),
547
+ '%%excerpt_only%%' => __( 'Post/page excerpt (without auto-generation)', 'wds' ),
548
+ '%%tag%%' => __( 'Current tag/tags', 'wds' ),
549
+ '%%category%%' => __( 'Post categories (comma separated)', 'wds' ),
550
+ '%%category_description%%' => __( 'Category description', 'wds' ),
551
+ '%%tag_description%%' => __( 'Tag description', 'wds' ),
552
+ '%%term_description%%' => __( 'Term description', 'wds' ),
553
+ '%%term_title%%' => __( 'Term name', 'wds' ),
554
+ '%%modified%%' => __( 'Post/page modified time', 'wds' ),
555
+ '%%id%%' => __( 'Post/page ID', 'wds' ),
556
+ '%%name%%' => __( 'Post/page author\'s \'nicename\'', 'wds' ),
557
+ '%%userid%%' => __( 'Post/page author\'s userid', 'wds' ),
558
+ '%%searchphrase%%' => __( 'Current search phrase', 'wds' ),
559
+ '%%currenttime%%' => __( 'Current time', 'wds' ),
560
+ '%%currentdate%%' => __( 'Current date', 'wds' ),
561
+ '%%currentmonth%%' => __( 'Current month', 'wds' ),
562
+ '%%currentyear%%' => __( 'Current year', 'wds' ),
563
+ '%%page%%' => __( 'Current page number (i.e. page 2 of 4)', 'wds' ),
564
+ '%%pagetotal%%' => __( 'Current page total', 'wds' ),
565
+ '%%pagenumber%%' => __( 'Current page number', 'wds' ),
566
+ '%%caption%%' => __( 'Attachment caption', 'wds' ),
567
+ '%%spell_pagenumber%%' => __( 'Current page number, spelled out as numeral in English', 'wds' ),
568
+ '%%spell_pagetotal%%' => __( 'Current page total, spelled out as numeral in English', 'wds' ),
569
+ '%%spell_page%%' => __( 'Current page number, spelled out as numeral in English', 'wds' ),
570
+ '%%pt_plural%%' => __( 'Post type label plural' ),
571
+ '%%pt_single%%' => __( 'Post type label singular' ),
572
+ );
573
+
574
+ if ( defined( 'BP_VERSION' ) ) {
575
+ $macros['%%bp_group_name%%'] = __( 'BuddyPress group name', 'wds' );
576
+ $macros['%%bp_group_description%%'] = __( 'BuddyPress group description', 'wds' );
577
+ $macros['%%bp_user_username%%'] = __( 'BuddyPress username', 'wds' );
578
+ $macros['%%bp_user_full_name%%'] = __( "BuddyPress user's full name", 'wds' );
579
+ }
580
+
581
+ return $macros;
582
+ }
583
+
584
+ private function _show_homepage_options() {
585
+ if ( is_multisite() ) {
586
+ $show_homepage_options = SMARTCRAWL_SITEWIDE || 'posts' === get_site_option( 'show_on_front' );
587
+ } else {
588
+ $show_homepage_options = 'posts' === get_option( 'show_on_front' );
589
+ }
590
+
591
+ return $show_homepage_options;
592
+ }
593
+
594
+ private function _get_homepage_title( $options ) {
595
+ $front_page_id = (int) get_option( 'page_on_front' );
596
+
597
+ if ( ! $this->_show_homepage_options() && $front_page_id ) {
598
+
599
+ $homepage_title = smartcrawl_get_value( 'title', $front_page_id );
600
+ if ( empty( $homepage_title ) ) {
601
+ $front_page = get_post( $front_page_id );
602
+ $homepage_title = $front_page->post_title;
603
+ }
604
+
605
+ return $homepage_title;
606
+ } else {
607
+ return $options['title-home'];
608
+ }
609
+ }
610
+
611
+ private function _get_homepage_description( $options ) {
612
+ $front_page_id = (int) get_option( 'page_on_front' );
613
+
614
+ if ( ! $this->_show_homepage_options() && $front_page_id ) {
615
+ $homepage_description = smartcrawl_get_value( 'metadesc', $front_page_id );
616
+ if ( empty( $homepage_description ) ) {
617
+ $front_page = get_post( $front_page_id );
618
+ $homepage_description = substr( strip_tags( $front_page->post_content ), 0, 130 );
619
+ }
620
+
621
+ return $homepage_description;
622
+ } else {
623
+ return $options['metadesc-home'];
624
+ }
625
+ }
626
+
627
+ /**
628
+ * Default settings
629
+ */
630
+ public function defaults() {
631
+
632
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
633
+ $this->options = get_site_option( $this->option_name );
634
+ } else {
635
+ $this->options = get_option( $this->option_name );
636
+ }
637
+
638
+ if ( empty( $this->options['title-home'] ) ) {
639
+ $this->options['title-home'] = '%%sitename%%';
640
+ }
641
+
642
+ if ( empty( $this->options['metadesc-home'] ) ) {
643
+ $this->options['metadesc-home'] = '%%sitedesc%%';
644
+ }
645
+
646
+ if ( empty( $this->options['keywords-home'] ) ) {
647
+ $this->options['keywords-home'] = '';
648
+ }
649
+
650
+ if ( empty( $this->options['onpage-stylesheet'] ) ) {
651
+ $this->options['onpage-stylesheet'] = 0;
652
+ }
653
+
654
+ if ( empty( $this->options['onpage-dashboard-widget'] ) ) {
655
+ $this->options['onpage-dashboard-widget'] = 1;
656
+ }
657
+
658
+ if ( empty( $this->options['onpage-disable-automatic-regeneration'] ) ) {
659
+ $this->options['onpage-disable-automatic-regeneration'] = 0;
660
+ }
661
+
662
+ foreach ( get_post_types( array( 'public' => true ) ) as $posttype ) {
663
+ if ( in_array( $posttype, array( 'revision', 'nav_menu_item' ), true ) ) {
664
+ continue;
665
+ }
666
+ if ( preg_match( '/^upfront_/', $posttype ) ) {
667
+ continue;
668
+ }
669
+
670
+ $type_obj = get_post_type_object( $posttype );
671
+ if ( ! is_object( $type_obj ) ) {
672
+ continue;
673
+ }
674
+
675
+ if ( empty( $this->options[ 'title-' . $posttype ] ) ) {
676
+ $this->options[ 'title-' . $posttype ] = '%%title%% %%sep%% %%sitename%%';
677
+ }
678
+
679
+ if ( empty( $this->options[ 'metadesc-' . $posttype ] ) ) {
680
+ $this->options[ 'metadesc-' . $posttype ] = '%%excerpt%%';
681
+ }
682
+ }
683
+
684
+ foreach ( smartcrawl_get_archive_post_types() as $archive_post_type ) {
685
+ if ( empty( $this->options[ 'title-' . $archive_post_type ] ) ) {
686
+ $this->options[ 'title-' . $archive_post_type ] = '%%pt_plural%% %%sep%% %%sitename%%';
687
+ }
688
+ }
689
+
690
+ foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
691
+ if ( empty( $this->options[ 'title-' . $taxonomy->name ] ) ) {
692
+ $this->options[ 'title-' . $taxonomy->name ] = '';
693
+ }
694
+
695
+ if ( empty( $this->options[ 'metadesc-' . $taxonomy->name ] ) ) {
696
+ $this->options[ 'metadesc-' . $taxonomy->name ] = '';
697
+ }
698
+ }
699
+
700
+ $other_types = array(
701
+ 'category' => array(
702
+ 'title' => '%%category%% %%sep%% %%sitename%%',
703
+ 'desc' => '%%category_description%%',
704
+ ),
705
+ 'post_tag' => array(
706
+ 'title' => '%%tag%% %%sep%% %%sitename%%',
707
+ 'desc' => '%%tag_description%%',
708
+ ),
709
+ 'author' => array(
710
+ 'title' => '%%name%% %%sep%% %%sitename%%',
711
+ 'desc' => '',
712
+ ),
713
+ 'date' => array(
714
+ 'title' => '%%currentdate%% %%sep%% %%sitename%%',
715
+ 'desc' => '',
716
+ ),
717
+ 'search' => array(
718
+ 'title' => '%%searchphrase%% %%sep%% %%sitename%%',
719
+ 'desc' => '',
720
+ ),
721
+ '404' => array(
722
+ 'title' => 'Page not found %%sep%% %%sitename%%',
723
+ 'desc' => '',
724
+ ),
725
+ 'bp_groups' => array(
726
+ 'title' => '%%bp_group_name%% %%sep%% %%sitename%%',
727
+ 'desc' => '%%bp_group_description%%',
728
+ ),
729
+ 'bp_profile' => array(
730
+ 'title' => '%%bp_user_username%% %%sep%% %%sitename%%',
731
+ 'desc' => '%%bp_user_full_name%%',
732
+ ),
733
+ );
734
+
735
+ foreach ( $other_types as $key => $value ) {
736
+ if ( empty( $this->options[ 'title-' . $key ] ) ) {
737
+ $this->options[ 'title-' . $key ] = $value['title'];
738
+ }
739
+
740
+ if ( empty( $this->options[ 'metadesc-' . $key ] ) ) {
741
+ $this->options[ 'metadesc-' . $key ] = $value['desc'];
742
+ }
743
+ }
744
+
745
+ if ( ! isset( $this->options['preset-separator'] ) ) {
746
+ $this->options['preset-separator'] = 'pipe';
747
+ }
748
+
749
+ if ( ! isset( $this->options['separator'] ) ) {
750
+ $this->options['separator'] = '';
751
+ }
752
+
753
+ if ( ! isset( $this->options['enable-author-archive'] ) ) {
754
+ $this->options['enable-author-archive'] = true;
755
+ }
756
+
757
+ if ( ! isset( $this->options['enable-date-archive'] ) ) {
758
+ $this->options['enable-date-archive'] = true;
759
+ }
760
+
761
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
762
+ update_site_option( $this->option_name, $this->options );
763
+ } else {
764
+ update_option( $this->option_name, $this->options );
765
+ }
766
+
767
+ }
768
+
769
+ /**
770
+ * @return array
771
+ */
772
+ private function get_archive_post_types( $prefix = '' ) {
773
+ $archive_post_types = array();
774
+ $post_type_args = array(
775
+ 'public' => true,
776
+ 'has_archive' => true,
777
+ );
778
+
779
+ foreach ( get_post_types( $post_type_args ) as $post_type ) {
780
+ if ( in_array( $post_type, array( 'revision', 'nav_menu_item' ), true ) ) {
781
+ continue;
782
+ }
783
+
784
+ $post_type_object = get_post_type_object( $post_type );
785
+ $archive_post_types[ $prefix . $post_type ] = $post_type_object->labels->name;
786
+ }
787
+
788
+ return $archive_post_types;
789
+ }
790
+
791
+ /**
792
+ * @return array
793
+ */
794
+ private function get_request_data() {
795
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-onpage-nonce' ) ? $_POST : array();
796
+ }
797
+ }
798
+
includes/admin/settings/redirections.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
-
3
- class Smartcrawl_Settings_Redirections extends Smartcrawl_Settings_Admin {
4
-
5
-
6
- private static $_instance;
7
-
8
- public static function get_instance() {
9
- if ( empty( self::$_instance ) ) {
10
- self::$_instance = new self;
11
- }
12
- return self::$_instance;
13
- }
14
-
15
- public function validate( $input ) {
16
- $result = array();
17
- $urls = ! empty( $input['urls'] ) && is_array( $input['urls'] )
18
- ? $input['urls']
19
- : array()
20
- ;
21
- $bulk_action = ! empty( $input['bulk_action'] ) && in_array( $input['bulk_action'], array( 'delete', 'redirect_301', 'redirect_302' ) )
22
- ? $input['bulk_action']
23
- : false
24
- ;
25
- $bulk = array();
26
- if ( ! empty( $bulk_action ) ) {
27
- $bulk = ! empty( $input['bulk'] ) && is_array( $input['bulk'] )
28
- ? $input['bulk']
29
- : array()
30
- ;
31
- }
32
- $types = ! empty( $input['types'] ) && is_array( $input['types'] )
33
- ? $input['types']
34
- : array()
35
- ;
36
- $rmodel = new Smartcrawl_Model_Redirection;
37
-
38
- $raw = $rmodel->get_all_redirections();
39
- $rtypes = $rmodel->get_all_redirection_types();
40
- foreach ( $urls as $source => $redir ) {
41
- $source = esc_url( $source );
42
- $redir = esc_url( $redir );
43
- if ( 'delete' === $bulk_action ) {
44
- if ( in_array( $source, $bulk ) ) {
45
- if ( ! empty( $raw[ $source ] ) ) { unset( $raw[ $source ] ); }
46
- if ( ! empty( $type[ $source ] ) ) { unset( $rtypes[ $source ] ); }
47
- continue;
48
- }
49
- }
50
- if ( ! preg_match( '/^https?:\/\//', $source ) ) { $source = home_url( $source ); }
51
- if ( ! preg_match( '/^https?:\/\//', $redir ) ) { $redir = home_url( $redir ); }
52
- $raw[ $source ] = $redir;
53
- }
54
- $rmodel->set_all_redirections( $raw );
55
- if ( 'delete' === $bulk_action ) { $rmodel->set_all_redirection_types( $rtypes ); }
56
-
57
- if ( in_array( $bulk_action, array( 'redirect_301', 'redirect_302' ) ) ) {
58
- $new_status = 'redirect_301' === $bulk_action
59
- ? Smartcrawl_Model_Redirection::TYPE_301
60
- : Smartcrawl_Model_Redirection::TYPE_302
61
- ;
62
- $default_status = $rmodel->get_default_redirection_status_type();
63
- $raw = $rmodel->get_all_redirection_types();
64
- foreach ( $urls as $source => $redir ) {
65
- $source = esc_url( $source );
66
- $old_status = ! empty( $raw[ $source ] )
67
- ? $raw[ $source ]
68
- : $default_status
69
- ;
70
- $raw[ $source ] = in_array( $source, $bulk )
71
- ? $new_status
72
- : $rmodel->get_valid_redirection_status_type( $old_status );
73
- }
74
-
75
- $rmodel->set_all_redirection_types( $raw );
76
- } else {
77
- $new_types = array();
78
- foreach ( $types as $source => $redir ) {
79
- if ( ! empty( $bulk_action ) && ! empty( $bulk ) && in_array( $source, $bulk ) ) { continue; }
80
- $status = $rmodel->get_valid_redirection_status_type( $redir );
81
- if ( empty( $status ) ) { continue; }
82
- $source = esc_url( $source );
83
- $new_types[ $source ] = $status;
84
- }
85
- $rmodel->set_all_redirection_types( $new_types );
86
- }
87
-
88
- return $result;
89
- }
90
-
91
- public function init() {
92
- $this->option_name = 'wds_redirections_options';
93
- $this->name = 'redirections';
94
- $this->slug = Smartcrawl_Settings::TAB_REDIRECTIONS;
95
- $this->action_url = admin_url( 'options.php' );
96
- $this->title = __( 'Redirections', 'wds' );
97
- $this->page_title = __( 'SmartCrawl Wizard: Redirections', 'wds' );
98
-
99
- parent::init();
100
- }
101
-
102
- public function options_page() {
103
- $rmodel = new Smartcrawl_Model_Redirection;
104
- $arguments = array(
105
- 'redirections' => $rmodel->get_all_redirections(),
106
- 'types' => $rmodel->get_all_redirection_types(),
107
- );
108
- wp_enqueue_script( 'wds-admin-redirections' );
109
- $this->_render_page( 'redirections-settings', $arguments );
110
- }
111
-
112
- public function defaults() {
113
- if ( ! is_array( $this->options ) ) { $this->options = array(); }
114
- if ( empty( $this->options['redirections-code'] ) ) {
115
- $this->options['redirections-code'] = 301;
116
- }
117
-
118
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
119
- update_site_option( $this->option_name, $this->options );
120
- } else {
121
- update_option( $this->option_name, $this->options );
122
- }
123
- }
124
-
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/settings/seomoz.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
-
3
- class Smartcrawl_Seomoz_Settings extends Smartcrawl_Settings_Admin {
4
-
5
-
6
- private static $_instance;
7
-
8
- public static function get_instance() {
9
- if ( empty( self::$_instance ) ) {
10
- self::$_instance = new self;
11
- }
12
- return self::$_instance;
13
- }
14
-
15
- public function validate( $input ) {
16
- return $inpt; }
17
-
18
- public function init() {
19
- require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/seomoz/api.php' );
20
-
21
- $this->option_name = 'wds_seomoz_options';
22
- $this->name = Smartcrawl_Settings::COMP_SEOMOZ;
23
- $this->slug = Smartcrawl_Settings::TAB_SEOMOZ;
24
- $this->action_url = admin_url( 'options.php' );
25
- $this->title = __( 'Moz', 'wds' );
26
- $this->page_title = __( 'SmartCrawl Wizard: Moz', 'wds' );
27
-
28
- parent::init();
29
- }
30
-
31
- /**
32
- * Add admin settings page
33
- */
34
- public function options_page() {
35
- parent::options_page();
36
- $this->_render_page( 'seomoz-settings' );
37
- }
38
-
39
- /**
40
- * Default settings
41
- */
42
- public function defaults() {
43
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
44
- $this->options = get_site_option( $this->option_name );
45
- } else {
46
- $this->options = get_option( $this->option_name );
47
- }
48
-
49
- if ( empty( $this->options['access-id'] ) ) {
50
- $this->options['access-id'] = '';
51
- }
52
-
53
- if ( empty( $this->options['secret-key'] ) ) {
54
- $this->options['secret-key'] = '';
55
- }
56
-
57
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
58
- update_site_option( $this->option_name, $this->options );
59
- } else {
60
- update_option( $this->option_name, $this->options );
61
- }
62
- }
63
-
64
- }
65
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/settings/settings.php CHANGED
@@ -1,492 +1,569 @@
1
- <?php
2
-
3
- class Smartcrawl_Settings_Settings extends Smartcrawl_Settings_Admin {
4
-
5
-
6
- private static $_instance;
7
-
8
- public static function get_instance() {
9
- if ( empty( self::$_instance ) ) {
10
- self::$_instance = new self;
11
- }
12
- return self::$_instance;
13
- }
14
-
15
- /**
16
- * Validate submitted options
17
- *
18
- * @param array $input Raw input
19
- *
20
- * @return array Validated input
21
- */
22
- public function validate( $input ) {
23
- $result = array();
24
- $saving_user_roles = isset( $input['saving_user_roles'] ) && $input['saving_user_roles'];
25
-
26
- // The options page is broken down into two parts. The following operation fills in option values from the missing part.
27
- if ( $saving_user_roles ) {
28
- $input = wp_parse_args(
29
- $input,
30
- self::get_specific_options( $this->option_name )
31
- );
32
- } else {
33
- $input = wp_parse_args(
34
- $input,
35
- $this->get_old_user_role_options()
36
- );
37
- }
38
-
39
- if ( ! empty( $input['wds_settings-setup'] ) ) { $result['wds_settings-setup'] = true; }
40
-
41
- $booleans = array_keys( Smartcrawl_Settings::get_known_components() );
42
- foreach ( $booleans as $bool ) {
43
- if ( ! empty( $input[ $bool ] ) ) { $result[ $bool ] = true; }
44
- }
45
-
46
- // Analysis/readability
47
- $result['analysis-seo'] = ! empty( $input['analysis-seo'] );
48
- $result['analysis-readability'] = ! empty( $input['analysis-readability'] );
49
- $result['extras-admin_bar'] = ! empty( $input['extras-admin_bar'] );
50
-
51
- if ( ! empty( $input['redirections-code'] ) && is_numeric( $input['redirections-code'] ) ) {
52
- $code = (int) $input['redirections-code'];
53
- if ( in_array( $code, array( 301, 302 ) ) ) { $result['redirections-code'] = $code; }
54
- }
55
- if ( ! empty( $input['metabox-lax_enforcement'] ) ) {
56
- $result['metabox-lax_enforcement'] = true;
57
- } else {
58
- $result['metabox-lax_enforcement'] = false;
59
- }
60
- if ( ! empty( $input['general-suppress-generator'] ) ) {
61
- $result['general-suppress-generator'] = true;
62
- } else {
63
- $result['general-suppress-generator'] = false;
64
- }
65
- if ( ! empty( $input['general-suppress-redundant_canonical'] ) ) {
66
- $result['general-suppress-redundant_canonical'] = true;
67
- } else {
68
- $result['general-suppress-redundant_canonical'] = false;
69
- }
70
-
71
- $strings = array(
72
- 'access-id',
73
- 'secret-key',
74
- );
75
- foreach ( $strings as $str ) {
76
- if ( ! empty( $input[ $str ] ) ) { $result[ $str ] = sanitize_text_field( $input[ $str ] ); }
77
- }
78
-
79
- // Roles
80
- foreach ( $this->_get_permission_contexts() as $ctx ) {
81
- if ( empty( $input[ $ctx ] ) ) { continue; }
82
- $roles = array_keys( $this->_get_filtered_roles( "wds-{$ctx}" ) );
83
- $check_context = is_array( $input[ $ctx ] )
84
- ? $input[ $ctx ]
85
- : array( $input[ $ctx ] )
86
- ;
87
- $result[ $ctx ] = array();
88
- foreach ( $check_context as $ctx_item ) {
89
- if ( in_array( $ctx_item, $roles ) ) { $result[ $ctx ][] = $ctx_item; }
90
- }
91
- }
92
-
93
- if ( isset( $input['verification-google-meta'] ) ) {
94
- $this->_validate_and_save_extra_options( $input );
95
- }
96
-
97
- return $result;
98
- }
99
-
100
- /**
101
- * Processes extra options passed on from the main form
102
- *
103
- * This is a side-effect method - the extra options don't update
104
- * the tab option key, but go to an extternal location
105
- *
106
- * @param array $input Raw form input
107
- */
108
- private function _validate_and_save_extra_options( $input ) {
109
- // Blog tabs
110
- if ( is_multisite() && current_user_can( 'manage_network_options' ) ) {
111
- if ( isset( $input['wds_blog_tabs'] ) || isset( $input['wds_sitewide_mode'] ) ) {
112
- $raw = ! empty( $input['wds_blog_tabs'] ) && is_array( $input['wds_blog_tabs'] )
113
- ? $input['wds_blog_tabs']
114
- : array()
115
- ;
116
- $tabs = array();
117
- foreach ( $raw as $key => $tab ) {
118
- if ( ! empty( $tab ) ) { $tabs[ $key ] = true; }
119
- }
120
-
121
- update_site_option( 'wds_blog_tabs', $tabs );
122
-
123
- update_site_option( 'wds_sitewide_mode', (int) ! empty( $input['wds_sitewide_mode'] ) );
124
- }
125
- }
126
-
127
- // Sitemaps validation/save
128
- $sitemaps = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_SITEMAP );
129
- $sitemaps_updated = false;
130
- if ( ! empty( $input['verification-google'] ) ) {
131
- $sitemaps['verification-google'] = sanitize_text_field( $input['verification-google'] );
132
- $sitemaps_updated = true;
133
- }
134
- if ( ! empty( $input['verification-bing'] ) ) {
135
- $sitemaps['verification-bing'] = sanitize_text_field( $input['verification-bing'] );
136
- $sitemaps_updated = true;
137
- }
138
- if ( ! empty( $input['verification-pages'] ) ) {
139
- $pages = $input['verification-pages'];
140
- if ( in_array( $pages, array( '', 'home' ) ) ) { $sitemaps['verification-pages'] = $pages; }
141
- $sitemaps_updated = true;
142
- }
143
-
144
- // Meta tags
145
- if ( ! empty( $input['verification-google-meta'] ) ) {
146
- $sitemaps['verification-google-meta'] = $input['verification-google-meta'];
147
- $sitemaps['verification-google'] = false;
148
- $sitemaps_updated = true;
149
- }
150
- if ( ! empty( $input['verification-bing-meta'] ) ) {
151
- $sitemaps['verification-bing-meta'] = $input['verification-bing-meta'];
152
- $sitemaps['verification-bing'] = false;
153
- $sitemaps_updated = true;
154
- }
155
-
156
- $custom_values_key = 'additional-metas';
157
- if ( ! empty( $input[ $custom_values_key ] ) && is_array( $input[ $custom_values_key ] ) ) {
158
- $custom_values = $input[ $custom_values_key ];
159
- $sanitized_custom_values = array();
160
- foreach ( $custom_values as $index => $custom_value ) {
161
- if ( trim( $custom_value ) ) {
162
- $sanitized = wp_kses($custom_value, array(
163
- 'meta' => array(
164
- 'charset' => array(),
165
- 'content' => array(),
166
- 'http-equiv' => array(),
167
- 'name' => array(),
168
- 'scheme' => array(),
169
- ),
170
- ));
171
- if ( preg_match( '/<meta\b/', trim( $sanitized ) ) ) {
172
- $sanitized_custom_values[] = $sanitized;
173
- }
174
- }
175
- }
176
- $sitemaps[ $custom_values_key ] = $sanitized_custom_values;
177
- $sitemaps_updated = true;
178
- }
179
-
180
- if ( $sitemaps_updated ) {
181
- Smartcrawl_Settings::update_component_options( Smartcrawl_Settings::COMP_SITEMAP, $sitemaps );
182
- }
183
- }
184
-
185
- public function init() {
186
- $this->option_name = 'wds_settings_options';
187
- $this->name = 'settings';
188
- $this->slug = Smartcrawl_Settings::TAB_SETTINGS;
189
- $this->action_url = admin_url( 'options.php' );
190
- $this->title = __( 'Settings', 'wds' );
191
- $this->page_title = __( 'SmartCrawl Wizard: Settings', 'wds' );
192
-
193
- add_action( 'admin_init', array( $this, 'activate_component' ) );
194
- add_action( 'admin_init', array( $this, 'save_moz_api_credentials' ) );
195
- add_action( 'network_admin_notices', array( $this, 'import_notice' ) );
196
-
197
- if ($this->display_single_site_import_notice()) {
198
- add_action('admin_notices', array($this, 'import_notice'));
199
- }
200
-
201
- if ( ! class_exists( 'Smartcrawl_Controller_IO' ) ) {
202
- require_once( SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_controller_io.php' );
203
- }
204
- Smartcrawl_Controller_IO::serve();
205
-
206
- parent::init();
207
- }
208
-
209
- /**
210
- * Updates the options to activate a component.
211
- */
212
- function activate_component() {
213
- if ( isset( $_POST['wds-activate-component'] ) ) {
214
-
215
- $component = sanitize_key( $_POST['wds-activate-component'] );
216
- $options = self::get_specific_options( $this->option_name );
217
- $options[ $component ] = 1;
218
-
219
- self::update_specific_options( $this->option_name, $options );
220
-
221
- wp_redirect( esc_url_raw( add_query_arg( array() ) ) );
222
- }
223
- }
224
-
225
- function save_moz_api_credentials() {
226
- if ( isset( $_POST['wds-moz-access-id'] ) || isset( $_POST['wds-moz-secret-key'] ) ) {
227
- $options = self::get_specific_options( $this->option_name );
228
- $options['access-id'] = sanitize_text_field( $_POST['wds-moz-access-id'] );
229
- $options['secret-key'] = sanitize_text_field( $_POST['wds-moz-secret-key'] );
230
-
231
- self::update_specific_options( $this->option_name, $options );
232
-
233
- wp_redirect( esc_url_raw( add_query_arg( array() ) ) );
234
- }
235
- }
236
-
237
- /**
238
- * Get allowed blog tabs
239
- *
240
- * @return array
241
- */
242
- public static function get_blog_tabs() {
243
- $blog_tabs = get_site_option( 'wds_blog_tabs' );
244
- return is_array( $blog_tabs )
245
- ? $blog_tabs
246
- : array()
247
- ;
248
- }
249
-
250
- /**
251
- * Get (optionally filtered) default roles
252
- *
253
- * @param string $context_filter Optional filter to pass the roles through first
254
- *
255
- * @return array List of roles
256
- */
257
- protected function _get_filtered_roles( $context_filter = false ) {
258
- $default_roles = array(
259
- 'manage_network' => __( 'Super Admin' ),
260
- 'list_users' => sprintf( __( '%s (and up)', 'wds' ), __( 'Site Admin' ) ),
261
- 'moderate_comments' => sprintf( __( '%s (and up)', 'wds' ), __( 'Editor' ) ),
262
- 'edit_published_posts' => sprintf( __( '%s (and up)', 'wds' ), __( 'Author' ) ),
263
- 'edit_posts' => sprintf( __( '%s (and up)', 'wds' ), __( 'Contributor' ) ),
264
- );
265
- if ( ! is_multisite() ) { unset( $default_roles['manage_network'] ); }
266
-
267
- return ! empty( $context_filter )
268
- ? (array) apply_filters( $context_filter, $default_roles )
269
- : $default_roles
270
- ;
271
- }
272
-
273
- /**
274
- * Get a list of permission contexts used for roles filtering
275
- *
276
- * @return array
277
- */
278
- protected function _get_permission_contexts() {
279
- return array(
280
- 'seo_metabox_permission_level',
281
- 'seo_metabox_301_permission_level',
282
- 'urlmetrics_metabox_permission_level',
283
- );
284
- }
285
-
286
- /**
287
- * Add admin settings page
288
- */
289
- public function options_page() {
290
- parent::options_page();
291
-
292
- $arguments['default_roles'] = $this->_get_filtered_roles();
293
-
294
- $arguments['active_components'] = Smartcrawl_Settings::get_known_components();
295
- if ( ! empty( $arguments['active_components'][ Smartcrawl_Settings::COMP_SEOMOZ ] ) ) { unset( $arguments['active_components'][ Smartcrawl_Settings::COMP_SEOMOZ ] ); }
296
-
297
- $arguments['slugs'] = array(
298
- Smartcrawl_Settings::TAB_ONPAGE => __( 'Title & Meta', 'wds' ),
299
- Smartcrawl_Settings::TAB_CHECKUP => __( 'SEO Checkup', 'wds' ),
300
- Smartcrawl_Settings::TAB_SITEMAP => __( 'Sitemaps', 'wds' ),
301
- Smartcrawl_Settings::TAB_AUTOLINKS => __( 'Advanced Tools', 'wds' ),
302
- Smartcrawl_Settings::TAB_SOCIAL => __( 'Social', 'wds' ),
303
- Smartcrawl_Settings::TAB_SETTINGS => __( 'Settings', 'wds' ),
304
- );
305
-
306
- if ( is_multisite() ) {
307
- $arguments['blog_tabs'] = self::get_blog_tabs();
308
- } else {
309
- $arguments['blog_tabs'] = array();
310
- }
311
-
312
- foreach ( $this->_get_permission_contexts() as $ctx ) {
313
- $arguments[ $ctx ] = $this->_get_filtered_roles( "wds-{$ctx}" );
314
- }
315
-
316
- $arguments['wds_sitewide_mode'] = smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) || (bool) get_site_option( 'wds_sitewide_mode' );
317
-
318
- $smartcrawl_options = Smartcrawl_Settings::get_options();
319
- $sitemap_settings = Smartcrawl_Sitemap_Settings::get_instance();
320
- $arguments['sitemap_option_name'] = $sitemap_settings->option_name;
321
-
322
- $arguments['verification_pages'] = array(
323
- '' => __( 'All pages', 'wds' ),
324
- 'home' => __( 'Home page', 'wds' ),
325
- );
326
-
327
- $arguments['google_msg'] = ! empty( $smartcrawl_options['verification-google'] )
328
- ? '<code>' . esc_html( '<meta name="google-site-verification" value="' ) . esc_attr( $smartcrawl_options['verification-google'] ) . esc_html( '" />' ) . '</code>'
329
- : '<small>' . esc_html( __( 'No META tag will be added', 'wds' ) ) . '</small>';
330
-
331
- $arguments['bing_msg'] = ! empty( $smartcrawl_options['verification-bing'] )
332
- ? '<code>' . esc_html( '<meta name="msvalidate.01" content="' ) . esc_attr( $smartcrawl_options['verification-bing'] ) . esc_html( '" />' ) . '</code>'
333
- : '<small>' . esc_html( __( 'No META tag will be added', 'wds' ) ) . '</small>';
334
-
335
- $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_general_settings' );
336
-
337
- wp_enqueue_script( 'wds-admin-settings' );
338
- $this->_render_page( 'settings/settings', $arguments );
339
- }
340
-
341
- /**
342
- * Default settings
343
- */
344
- public function defaults() {
345
- $this->options = self::get_specific_options( $this->option_name );
346
-
347
- if ( empty( $this->options ) ) {
348
- if ( empty( $this->options['onpage'] ) ) {
349
- $this->options['onpage'] = 1;
350
- }
351
-
352
- if ( empty( $this->options['autolinks'] ) ) {
353
- $this->options['autolinks'] = 0;
354
- }
355
-
356
- if ( empty( $this->options['seomoz'] ) ) {
357
- $this->options['seomoz'] = 0;
358
- }
359
-
360
- if ( empty( $this->options['sitemap'] ) ) {
361
- $this->options['sitemap'] = 0;
362
- }
363
-
364
- if ( empty( $this->options['social'] ) ) {
365
- $this->options['social'] = 1;
366
- }
367
-
368
- if ( empty( $this->options['checkup'] ) ) {
369
- $this->options['checkup'] = 0;
370
- }
371
- }
372
-
373
- if ( empty( $this->options['seo_metabox_permission_level'] ) ) {
374
- $this->options['seo_metabox_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
375
- }
376
-
377
- if ( empty( $this->options['urlmetrics_metabox_permission_level'] ) ) {
378
- $this->options['urlmetrics_metabox_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
379
- }
380
-
381
- if ( empty( $this->options['seo_metabox_301_permission_level'] ) ) {
382
- $this->options['seo_metabox_301_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
383
- }
384
-
385
- if ( empty( $this->options['access-id'] ) ) {
386
- $this->options['access-id'] = '';
387
- }
388
-
389
- if ( empty( $this->options['secret-key'] ) ) {
390
- $this->options['secret-key'] = '';
391
- }
392
-
393
- if ( ! isset( $this->options['analysis-seo'] ) ) { $this->options['analysis-seo'] = false; }
394
- if ( ! isset( $this->options['analysis-readability'] ) ) { $this->options['analysis-readability'] = false; }
395
- if ( ! isset( $this->options['extras-admin_bar'] ) ) { $this->options['extras-admin_bar'] = true; }
396
-
397
- apply_filters( 'wds_defaults', $this->options );
398
-
399
- self::update_specific_options( $this->option_name, $this->options );
400
- }
401
-
402
- private function get_old_user_role_options() {
403
- $option_keys = array(
404
- 'seo_metabox_permission_level',
405
- 'seo_metabox_301_permission_level',
406
- 'urlmetrics_metabox_permission_level',
407
- );
408
-
409
- $old_options = self::get_specific_options( $this->option_name );
410
-
411
- $user_role_options = array();
412
- foreach ( $option_keys as $option_key ) {
413
- if ( $option_value = smartcrawl_get_array_value( $old_options, $option_key ) ) {
414
- $user_role_options[ $option_key ] = $option_value;
415
- }
416
- }
417
-
418
- return $user_role_options;
419
- }
420
-
421
- private function get_yoast_importer()
422
- {
423
- if (!class_exists('SmartCrawl_Yoast_Importer')) {
424
- require_once(SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_yoast_importer.php');
425
- }
426
-
427
- return new SmartCrawl_Yoast_Importer();
428
- }
429
-
430
- private function get_aioseop_importer()
431
- {
432
- if (!class_exists('SmartCrawl_AIOSEOP_Importer')) {
433
- require_once(SMARTCRAWL_PLUGIN_DIR . '/core/class_wds_aioseop_importer.php');
434
- }
435
-
436
- return new SmartCrawl_AIOSEOP_Importer();
437
- }
438
-
439
- function import_notice()
440
- {
441
- if (!current_user_can('manage_options')) {
442
- return;
443
- }
444
-
445
- $this->show_import_notice(
446
- $this->get_yoast_importer(),
447
- esc_html__('Yoast SEO', 'wds'),
448
- 'wordpress-seo/wp-seo.php'
449
- );
450
-
451
- $this->show_import_notice(
452
- $this->get_aioseop_importer(),
453
- esc_html__('All In One SEO', 'wds'),
454
- 'all-in-one-seo-pack/all_in_one_seo_pack.php'
455
- );
456
- }
457
-
458
- /**
459
- * @param $importer SmartCrawl_Importer
460
- * @param $plugin_name string
461
- */
462
- function show_import_notice($importer, $plugin_name, $plugin)
463
- {
464
- if (!$importer->data_exists() || !is_plugin_active($plugin)) {
465
- return;
466
- }
467
-
468
- $auto_import_url = sprintf(
469
- '<a href="%s">%s</a>',
470
- Smartcrawl_Settings_Admin::admin_url(Smartcrawl_Settings::TAB_SETTINGS) . '#tab_import_export',
471
- esc_html__('auto-import', 'wds')
472
- );
473
- $message = sprintf(
474
- esc_html__("We've detected you have %s installed. Do you want to %s your configuration into SmartCrawl?"),
475
- $plugin_name,
476
- $auto_import_url
477
- );
478
-
479
- ?>
480
- <div class="notice-warning notice is-dismissible"><p><?php echo $message; ?></p></div>
481
- <?php
482
- }
483
-
484
- private function display_single_site_import_notice()
485
- {
486
- // Always display on non-multisite
487
- return !is_multisite()
488
- // or when site-wide flag is off and the current site is the main network site
489
- || (is_main_site() && !smartcrawl_is_switch_active('SMARTCRAWL_SITEWIDE'));
490
- }
491
- }
492
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smartcrawl_Settings_Settings extends Smartcrawl_Settings_Admin {
4
+
5
+
6
+ private static $_instance;
7
+
8
+ public static function get_instance() {
9
+ if ( empty( self::$_instance ) ) {
10
+ self::$_instance = new self();
11
+ }
12
+
13
+ return self::$_instance;
14
+ }
15
+
16
+ /**
17
+ * Validate submitted options
18
+ *
19
+ * @param array $input Raw input
20
+ *
21
+ * @return array Validated input
22
+ */
23
+ public function validate( $input ) {
24
+ $result = array();
25
+ $saving_user_roles = isset( $input['saving_user_roles'] ) && $input['saving_user_roles'];
26
+
27
+ // The options page is broken down into two parts. The following operation fills in option values from the missing part.
28
+ if ( $saving_user_roles ) {
29
+ $input = wp_parse_args(
30
+ $input,
31
+ self::get_specific_options( $this->option_name )
32
+ );
33
+ } else {
34
+ $input = wp_parse_args(
35
+ $input,
36
+ $this->get_old_user_role_options()
37
+ );
38
+ }
39
+
40
+ if ( ! empty( $input['wds_settings-setup'] ) ) {
41
+ $result['wds_settings-setup'] = true;
42
+ }
43
+
44
+ $booleans = array_keys( Smartcrawl_Settings::get_known_components() );
45
+ foreach ( $booleans as $bool ) {
46
+ $result[ $bool ] = ! empty( $input[ $bool ] );
47
+ }
48
+
49
+ // Analysis/readability
50
+ $result['analysis-seo'] = ! empty( $input['analysis-seo'] );
51
+ $result['analysis-readability'] = ! empty( $input['analysis-readability'] );
52
+ $result['extras-admin_bar'] = ! empty( $input['extras-admin_bar'] );
53
+
54
+ if ( ! empty( $input['redirections-code'] ) && is_numeric( $input['redirections-code'] ) ) {
55
+ $code = (int) $input['redirections-code'];
56
+ if ( in_array( $code, array( 301, 302 ), true ) ) {
57
+ $result['redirections-code'] = $code;
58
+ }
59
+ }
60
+ if ( ! empty( $input['metabox-lax_enforcement'] ) ) {
61
+ $result['metabox-lax_enforcement'] = true;
62
+ } else {
63
+ $result['metabox-lax_enforcement'] = false;
64
+ }
65
+ if ( ! empty( $input['general-suppress-generator'] ) ) {
66
+ $result['general-suppress-generator'] = true;
67
+ } else {
68
+ $result['general-suppress-generator'] = false;
69
+ }
70
+ if ( ! empty( $input['general-suppress-redundant_canonical'] ) ) {
71
+ $result['general-suppress-redundant_canonical'] = true;
72
+ } else {
73
+ $result['general-suppress-redundant_canonical'] = false;
74
+ }
75
+
76
+ $strings = array(
77
+ 'access-id',
78
+ 'secret-key',
79
+ );
80
+ foreach ( $strings as $str ) {
81
+ if ( ! empty( $input[ $str ] ) ) {
82
+ $result[ $str ] = sanitize_text_field( $input[ $str ] );
83
+ }
84
+ }
85
+
86
+ // Roles
87
+ foreach ( $this->_get_permission_contexts() as $ctx ) {
88
+ if ( empty( $input[ $ctx ] ) ) {
89
+ continue;
90
+ }
91
+ $roles = array_keys( $this->_get_filtered_roles( "wds-{$ctx}" ) );
92
+ $check_context = is_array( $input[ $ctx ] )
93
+ ? $input[ $ctx ]
94
+ : array( $input[ $ctx ] );
95
+ $result[ $ctx ] = array();
96
+ foreach ( $check_context as $ctx_item ) {
97
+ if ( in_array( $ctx_item, $roles, true ) ) {
98
+ $result[ $ctx ][] = $ctx_item;
99
+ }
100
+ }
101
+ }
102
+
103
+ if ( isset( $input['verification-google-meta'] ) ) {
104
+ $this->_validate_and_save_extra_options( $input );
105
+ }
106
+
107
+ return $result;
108
+ }
109
+
110
+ private function get_old_user_role_options() {
111
+ $option_keys = array(
112
+ 'seo_metabox_permission_level',
113
+ 'seo_metabox_301_permission_level',
114
+ 'urlmetrics_metabox_permission_level',
115
+ );
116
+
117
+ $old_options = self::get_specific_options( $this->option_name );
118
+
119
+ $user_role_options = array();
120
+ foreach ( $option_keys as $option_key ) {
121
+ $option_value = smartcrawl_get_array_value( $old_options, $option_key );
122
+ if ( $option_value ) {
123
+ $user_role_options[ $option_key ] = $option_value;
124
+ }
125
+ }
126
+
127
+ return $user_role_options;
128
+ }
129
+
130
+ /**
131
+ * Get a list of permission contexts used for roles filtering
132
+ *
133
+ * @return array
134
+ */
135
+ protected function _get_permission_contexts() {
136
+ return array(
137
+ 'seo_metabox_permission_level',
138
+ 'seo_metabox_301_permission_level',
139
+ 'urlmetrics_metabox_permission_level',
140
+ );
141
+ }
142
+
143
+ /**
144
+ * Get (optionally filtered) default roles
145
+ *
146
+ * @param string $context_filter Optional filter to pass the roles through first
147
+ *
148
+ * @return array List of roles
149
+ */
150
+ protected function _get_filtered_roles( $context_filter = false ) {
151
+ $default_roles = array(
152
+ 'manage_network' => __( 'Super Admin' ),
153
+ 'list_users' => sprintf( __( '%s (and up)', 'wds' ), __( 'Site Admin' ) ),
154
+ 'moderate_comments' => sprintf( __( '%s (and up)', 'wds' ), __( 'Editor' ) ),
155
+ 'edit_published_posts' => sprintf( __( '%s (and up)', 'wds' ), __( 'Author' ) ),
156
+ 'edit_posts' => sprintf( __( '%s (and up)', 'wds' ), __( 'Contributor' ) ),
157
+ );
158
+ if ( ! is_multisite() ) {
159
+ unset( $default_roles['manage_network'] );
160
+ }
161
+
162
+ return ! empty( $context_filter )
163
+ ? (array) apply_filters( $context_filter, $default_roles )
164
+ : $default_roles;
165
+ }
166
+
167
+ /**
168
+ * Processes extra options passed on from the main form
169
+ *
170
+ * This is a side-effect method - the extra options don't update
171
+ * the tab option key, but go to an extternal location
172
+ *
173
+ * @param array $input Raw form input
174
+ */
175
+ private function _validate_and_save_extra_options( $input ) {
176
+ // Blog tabs
177
+ if ( is_multisite() && ! empty( $input['save_blog_tabs'] ) && current_user_can( 'manage_network_options' ) ) {
178
+ $raw = ! empty( $input['wds_blog_tabs'] ) && is_array( $input['wds_blog_tabs'] )
179
+ ? $input['wds_blog_tabs']
180
+ : array();
181
+ $tabs = array();
182
+ foreach ( $raw as $key => $tab ) {
183
+ if ( ! empty( $tab ) ) {
184
+ $tabs[ $key ] = true;
185
+ }
186
+ }
187
+
188
+ update_site_option( 'wds_blog_tabs', $tabs );
189
+
190
+ update_site_option( 'wds_sitewide_mode', (int) ! empty( $input['wds_sitewide_mode'] ) );
191
+ }
192
+
193
+ // Sitemaps validation/save
194
+ $sitemaps = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_SITEMAP );
195
+ $sitemaps_updated = false;
196
+ if ( isset( $input['verification-pages'] ) ) {
197
+ $pages = $input['verification-pages'];
198
+ if ( in_array( $pages, array( '', 'home' ), true ) ) {
199
+ $sitemaps['verification-pages'] = $pages;
200
+ }
201
+ $sitemaps_updated = true;
202
+ }
203
+
204
+ // Meta tags
205
+ if ( isset( $input['verification-google-meta'] ) ) {
206
+ $sitemaps['verification-google-meta'] = smartcrawl_is_valid_meta_tag( $input['verification-google-meta'] ) ? $input['verification-google-meta'] : '';
207
+ $sitemaps_updated = true;
208
+ }
209
+ if ( isset( $input['verification-bing-meta'] ) ) {
210
+ $sitemaps['verification-bing-meta'] = smartcrawl_is_valid_meta_tag( $input['verification-bing-meta'] ) ? $input['verification-bing-meta'] : '';
211
+ $sitemaps_updated = true;
212
+ }
213
+
214
+ $custom_values_key = 'additional-metas';
215
+ if ( ! empty( $input[ $custom_values_key ] ) && is_array( $input[ $custom_values_key ] ) ) {
216
+ $custom_values = $input[ $custom_values_key ];
217
+ $sanitized_custom_values = array();
218
+ foreach ( $custom_values as $index => $custom_value ) {
219
+ if ( trim( $custom_value ) ) {
220
+ $sanitized = wp_kses( $custom_value, array(
221
+ 'meta' => array(
222
+ 'charset' => array(),
223
+ 'content' => array(),
224
+ 'http-equiv' => array(),
225
+ 'name' => array(),
226
+ 'scheme' => array(),
227
+ ),
228
+ ) );
229
+ if ( preg_match( '/<meta\b/', trim( $sanitized ) ) ) {
230
+ $sanitized_custom_values[] = $sanitized;
231
+ }
232
+ }
233
+ }
234
+ $sitemaps[ $custom_values_key ] = $sanitized_custom_values;
235
+ $sitemaps_updated = true;
236
+ }
237
+
238
+ if ( $sitemaps_updated ) {
239
+ Smartcrawl_Settings::update_component_options( Smartcrawl_Settings::COMP_SITEMAP, $sitemaps );
240
+ }
241
+ }
242
+
243
+ public function init() {
244
+ $this->option_name = 'wds_settings_options';
245
+ $this->name = 'settings';
246
+ $this->slug = Smartcrawl_Settings::TAB_SETTINGS;
247
+ $this->action_url = admin_url( 'options.php' );
248
+ $this->title = __( 'Settings', 'wds' );
249
+ $this->page_title = __( 'SmartCrawl Wizard: Settings', 'wds' );
250
+
251
+ add_action( 'admin_init', array( $this, 'activate_component' ) );
252
+ add_action( 'admin_init', array( $this, 'save_moz_api_credentials' ) );
253
+ add_action( 'admin_footer', array( $this, 'add_native_dismissible_notice_javascript' ) );
254
+ add_action( 'network_admin_notices', array( $this, 'wp_org_rating_request' ) );
255
+ add_action( 'admin_notices', array( $this, 'wp_org_rating_request' ) );
256
+ add_action( 'network_admin_notices', array( $this, 'import_notice' ) );
257
+
258
+ if ( $this->display_single_site_import_notice() ) {
259
+ add_action( 'admin_notices', array( $this, 'import_notice' ) );
260
+ }
261
+
262
+ Smartcrawl_Controller_IO::serve();
263
+
264
+ parent::init();
265
+ }
266
+
267
+ private function display_single_site_import_notice() {
268
+ // Always display on non-multisite
269
+ return ! is_multisite()
270
+ // or when site-wide flag is off and the current site is the main network site
271
+ || ( is_main_site() && ! smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) );
272
+ }
273
+
274
+ /**
275
+ * Updates the options to activate a component.
276
+ */
277
+ public function activate_component() {
278
+ $data = $this->get_request_data();
279
+ if ( isset( $data['wds-activate-component'] ) ) {
280
+ $component = sanitize_key( $data['wds-activate-component'] );
281
+ $options = self::get_specific_options( $this->option_name );
282
+ $options[ $component ] = 1;
283
+
284
+ self::update_specific_options( $this->option_name, $options );
285
+
286
+ wp_redirect( esc_url_raw( add_query_arg( array() ) ) );
287
+ }
288
+ }
289
+
290
+ public function save_moz_api_credentials() {
291
+ $data = $this->get_request_data();
292
+ if ( isset( $data['wds-moz-access-id'] ) || isset( $data['wds-moz-secret-key'] ) ) {
293
+ $options = self::get_specific_options( $this->option_name );
294
+ $options['access-id'] = sanitize_text_field( $data['wds-moz-access-id'] );
295
+ $options['secret-key'] = sanitize_text_field( $data['wds-moz-secret-key'] );
296
+
297
+ self::update_specific_options( $this->option_name, $options );
298
+
299
+ wp_redirect( esc_url_raw( add_query_arg( array() ) ) );
300
+ }
301
+ }
302
+
303
+ /**
304
+ * Add admin settings page
305
+ */
306
+ public function options_page() {
307
+ parent::options_page();
308
+
309
+ $arguments['default_roles'] = $this->_get_filtered_roles();
310
+
311
+ $arguments['active_components'] = Smartcrawl_Settings::get_known_components();
312
+
313
+ $arguments['slugs'] = array(
314
+ Smartcrawl_Settings::TAB_CHECKUP => __( 'SEO Checkup', 'wds' ),
315
+ Smartcrawl_Settings::TAB_ONPAGE => __( 'Title & Meta', 'wds' ),
316
+ Smartcrawl_Settings::TAB_SOCIAL => __( 'Social', 'wds' ),
317
+ Smartcrawl_Settings::TAB_SITEMAP => __( 'Sitemap', 'wds' ),
318
+ Smartcrawl_Settings::TAB_AUTOLINKS => __( 'Advanced Tools', 'wds' ),
319
+ Smartcrawl_Settings::TAB_SETTINGS => __( 'Settings', 'wds' ),
320
+ );
321
+ $arguments['plugin_modules'] = $this->get_plugin_modules();
322
+
323
+ if ( is_multisite() ) {
324
+ $arguments['blog_tabs'] = self::get_blog_tabs();
325
+ } else {
326
+ $arguments['blog_tabs'] = array();
327
+ }
328
+
329
+ foreach ( $this->_get_permission_contexts() as $ctx ) {
330
+ $arguments[ $ctx ] = $this->_get_filtered_roles( "wds-{$ctx}" );
331
+ }
332
+
333
+ $arguments['wds_sitewide_mode'] = smartcrawl_is_switch_active( 'SMARTCRAWL_SITEWIDE' ) || (bool) get_site_option( 'wds_sitewide_mode' );
334
+
335
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
336
+ $sitemap_settings = Smartcrawl_Sitemap_Settings::get_instance();
337
+ $arguments['sitemap_option_name'] = $sitemap_settings->option_name;
338
+
339
+ $arguments['verification_pages'] = array(
340
+ '' => __( 'All pages', 'wds' ),
341
+ 'home' => __( 'Home page', 'wds' ),
342
+ );
343
+
344
+ $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_general_settings' );
345
+
346
+ wp_enqueue_script( 'wds-admin-settings' );
347
+ $this->_render_page( 'settings/settings', $arguments );
348
+ }
349
+
350
+ private function get_plugin_modules() {
351
+ // All available modules:
352
+ $all_plugin_modules = array(
353
+ 'checkup' => __( 'SEO Checkup', 'wds' ),
354
+ 'onpage' => __( 'Title & Meta', 'wds' ),
355
+ 'social' => __( 'Social', 'wds' ),
356
+ 'sitemap' => __( 'Sitemap', 'wds' ),
357
+ 'autolinks' => __( 'Advanced Tools', 'wds' ),
358
+ );
359
+
360
+ if ( ! is_multisite() || is_network_admin() ) {
361
+ return $all_plugin_modules;
362
+ }
363
+
364
+ // The modules that are to be shown in the sub-site settings:
365
+ $sub_site_modules = array();
366
+ $active_blog_tabs = self::get_blog_tabs();
367
+ foreach ( $all_plugin_modules as $plugin_module => $label ) {
368
+ if (
369
+ array_key_exists( 'wds_' . $plugin_module, $active_blog_tabs )
370
+ // Only display the checkup option on the main site or network admin (handled above)
371
+ && ( 'checkup' !== $plugin_module || is_main_site() )
372
+ ) {
373
+ $sub_site_modules[ $plugin_module ] = $label;
374
+ }
375
+ }
376
+
377
+ return $sub_site_modules;
378
+ }
379
+
380
+ /**
381
+ * Get allowed blog tabs
382
+ *
383
+ * @return array
384
+ */
385
+ public static function get_blog_tabs() {
386
+ $blog_tabs = get_site_option( 'wds_blog_tabs' );
387
+
388
+ return is_array( $blog_tabs )
389
+ ? $blog_tabs
390
+ : array();
391
+ }
392
+
393
+ /**
394
+ * Default settings
395
+ */
396
+ public function defaults() {
397
+ $this->options = self::get_specific_options( $this->option_name );
398
+
399
+ if ( empty( $this->options ) ) {
400
+ if ( empty( $this->options['onpage'] ) ) {
401
+ $this->options['onpage'] = 1;
402
+ }
403
+
404
+ if ( empty( $this->options['autolinks'] ) ) {
405
+ $this->options['autolinks'] = 0;
406
+ }
407
+
408
+ if ( empty( $this->options['seomoz'] ) ) {
409
+ $this->options['seomoz'] = 0;
410
+ }
411
+
412
+ if ( empty( $this->options['sitemap'] ) ) {
413
+ $this->options['sitemap'] = 0;
414
+ }
415
+
416
+ if ( empty( $this->options['social'] ) ) {
417
+ $this->options['social'] = 1;
418
+ }
419
+
420
+ if ( empty( $this->options['checkup'] ) ) {
421
+ $this->options['checkup'] = 0;
422
+ }
423
+ }
424
+
425
+ if ( empty( $this->options['seo_metabox_permission_level'] ) ) {
426
+ $this->options['seo_metabox_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
427
+ }
428
+
429
+ if ( empty( $this->options['urlmetrics_metabox_permission_level'] ) ) {
430
+ $this->options['urlmetrics_metabox_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
431
+ }
432
+
433
+ if ( empty( $this->options['seo_metabox_301_permission_level'] ) ) {
434
+ $this->options['seo_metabox_301_permission_level'] = ( is_multisite() ? 'manage_network' : 'list_users' );
435
+ }
436
+
437
+ if ( empty( $this->options['access-id'] ) ) {
438
+ $this->options['access-id'] = '';
439
+ }
440
+
441
+ if ( empty( $this->options['secret-key'] ) ) {
442
+ $this->options['secret-key'] = '';
443
+ }
444
+
445
+ if ( ! isset( $this->options['analysis-seo'] ) ) {
446
+ $this->options['analysis-seo'] = false;
447
+ }
448
+ if ( ! isset( $this->options['analysis-readability'] ) ) {
449
+ $this->options['analysis-readability'] = false;
450
+ }
451
+ if ( ! isset( $this->options['extras-admin_bar'] ) ) {
452
+ $this->options['extras-admin_bar'] = true;
453
+ }
454
+
455
+ apply_filters( 'wds_defaults', $this->options );
456
+
457
+ self::update_specific_options( $this->option_name, $this->options );
458
+ }
459
+
460
+ public function import_notice() {
461
+ if ( ! current_user_can( 'manage_options' ) ) {
462
+ return;
463
+ }
464
+
465
+ $this->show_import_notice(
466
+ new Smartcrawl_Yoast_Importer(),
467
+ 'yoast-seo',
468
+ esc_html__( 'Yoast SEO', 'wds' ),
469
+ 'wordpress-seo/wp-seo.php'
470
+ );
471
+
472
+ $this->show_import_notice(
473
+ new Smartcrawl_AIOSEOP_Importer(),
474
+ 'all-in-one-seo',
475
+ esc_html__( 'All In One SEO', 'wds' ),
476
+ 'all-in-one-seo-pack/all_in_one_seo_pack.php'
477
+ );
478
+ }
479
+
480
+ /**
481
+ * @param $importer Smartcrawl_Importer
482
+ * @param $plugin_key
483
+ * @param $plugin_name string
484
+ * @param $plugin
485
+ */
486
+ private function show_import_notice( $importer, $plugin_key, $plugin_name, $plugin ) {
487
+ if ( ! $importer->data_exists() || ! is_plugin_active( $plugin ) ) {
488
+ return;
489
+ }
490
+
491
+ $auto_import_url = sprintf(
492
+ '<a href="%s">%s</a>',
493
+ Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SETTINGS ) . '#tab_import_export',
494
+ esc_html__( 'auto-import', 'wds' )
495
+ );
496
+ $message = sprintf(
497
+ esc_html__( "We've detected you have %1\$s, installed. Do you want to %2\$s your configuration into SmartCrawl?" ),
498
+ $plugin_name,
499
+ $auto_import_url
500
+ );
501
+ $message_key = sprintf( '%s-import', $plugin_key );
502
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
503
+ $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $message_key ) === true;
504
+
505
+ if ( $is_message_dismissed ) {
506
+ return;
507
+ }
508
+
509
+ ?>
510
+ <div class="notice-warning notice is-dismissible wds-native-dismissible-notice"
511
+ data-message-key="<?php echo esc_attr( $message_key ); ?>">
512
+ <p><?php echo wp_kses_post($message); ?></p>
513
+ </div>
514
+ <?php
515
+ }
516
+
517
+ public function add_native_dismissible_notice_javascript() {
518
+ $this->_render( 'native-dismissible-notice-javascript' );
519
+ }
520
+
521
+ public function wp_org_rating_request() {
522
+ $service = $this->get_service();
523
+ if ( $service->is_member() ) {
524
+ return;
525
+ }
526
+
527
+ if ( is_multisite() && ! is_network_admin() ) {
528
+ return;
529
+ }
530
+
531
+ $now = current_time( 'timestamp' );
532
+ $free_install_date = get_site_option( 'wds-free-install-date' );
533
+ if ( ( $now - (int) $free_install_date ) < 604800 ) {
534
+ return;
535
+ }
536
+
537
+ $key = 'wp-org-rating-request';
538
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
539
+ $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $key ) === true;
540
+ if ( $is_message_dismissed ) {
541
+ return;
542
+ }
543
+
544
+ ?>
545
+ <div class="notice-info notice is-dismissible wds-native-dismissible-notice"
546
+ data-message-key="<?php echo esc_attr( $key ); ?>">
547
+ <p><?php esc_html_e( 'We have spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating.', 'wds' ); ?></p>
548
+ <a target="_blank" href="https://wordpress.org/plugins/smartcrawl-seo#reviews" class="button button-small">
549
+ <?php esc_html_e( 'Rate SmartCrawl', 'wds' ); ?>
550
+ </a>
551
+ <p></p>
552
+ </div>
553
+ <?php
554
+ }
555
+
556
+ /**
557
+ * @return Smartcrawl_Checkup_Service
558
+ */
559
+ private static function get_service() {
560
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
561
+
562
+ return $service;
563
+ }
564
+
565
+ private function get_request_data() {
566
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-settings-nonce' ) ? $_POST : array();
567
+ }
568
+ }
569
+
includes/admin/settings/sitemap.php CHANGED
@@ -1,472 +1,506 @@
1
- <?php
2
- /**
3
- * Sitemap settings admin page
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- /**
9
- * Sitemap settings admin page class
10
- */
11
- class Smartcrawl_Sitemap_Settings extends Smartcrawl_Settings_Admin {
12
-
13
- /**
14
- * Singleton instance
15
- *
16
- * @var Smartcrawl_Sitemap_Settings
17
- */
18
- private static $_instance;
19
-
20
- /**
21
- * Singleton instance getter
22
- *
23
- * @return Smartcrawl_Sitemap_Settings instance
24
- */
25
- public static function get_instance() {
26
- if ( empty( self::$_instance ) ) {
27
- self::$_instance = new self;
28
- }
29
- return self::$_instance;
30
- }
31
-
32
- /**
33
- * Validate submitted options
34
- *
35
- * @param array $input Raw input.
36
- *
37
- * @return array Validated input
38
- */
39
- public function validate( $input ) {
40
- $result = array();
41
-
42
- if ( ! empty( $input['wds_sitemap-setup'] ) ) { $result['wds_sitemap-setup'] = true; }
43
-
44
- $strings = array(
45
- 'verification-google',
46
- 'verification-bing',
47
- 'verification-pages',
48
- );
49
- foreach ( $strings as $str ) {
50
- if ( isset( $input[ $str ] ) ) { $result[ $str ] = sanitize_text_field( $input[ $str ] ); }
51
- }
52
-
53
- $booleans = array(
54
- 'ping-google',
55
- 'ping-bing',
56
- 'sitemap-images',
57
- 'sitemap-stylesheet',
58
- 'sitemap-dashboard-widget',
59
- 'sitemap-disable-automatic-regeneration',
60
- 'sitemap-buddypress-groups',
61
- 'sitemap-buddypress-profiles',
62
- );
63
- foreach ( $booleans as $bool ) {
64
- if ( ! empty( $input[ $bool ] ) ) { $result[ $bool ] = true; }
65
- }
66
-
67
- // Array Booleans.
68
- $input['exclude_post_types'] = ! empty( $input['exclude_post_types'] ) && is_array( $input['exclude_post_types'] ) ? $input['exclude_post_types'] : array();
69
- foreach ( array_keys( $this->_get_post_types_options() ) as $post_type ) {
70
- $result[ $post_type ] = in_array( $post_type, $input['exclude_post_types'] );
71
- }
72
- $input['exclude_taxonomies'] = ! empty( $input['exclude_taxonomies'] ) && is_array( $input['exclude_taxonomies'] ) ? $input['exclude_taxonomies'] : array();
73
- foreach ( array_keys( $this->_get_taxonomies_options() ) as $tax ) {
74
- $result[ $tax ] = in_array( $tax, $input['exclude_taxonomies'] );
75
- }
76
-
77
- // BuddyPress-specific.
78
- $bpo = $this->_get_buddyress_template_values();
79
- if ( ! empty( $bpo['exclude_groups'] ) && is_array( $bpo['exclude_groups'] ) ) {
80
- $input['exclude_bp_groups'] = ! empty( $input['exclude_bp_groups'] ) && is_array( $input['exclude_bp_groups'] ) ? $input['exclude_bp_groups'] : array();
81
- foreach ( $bpo['exclude_groups'] as $slug => $name ) {
82
- $key = "sitemap-buddypress-{$slug}";
83
- $result[ $key ] = in_array( $key, $input['exclude_bp_groups'] );
84
- }
85
- }
86
-
87
- if ( ! empty( $bpo['exclude_roles'] ) && is_array( $bpo['exclude_roles'] ) ) {
88
- $input['exclude_bp_roles'] = isset( $input['exclude_bp_roles'] ) && is_array( $input['exclude_bp_roles'] ) ? $input['exclude_bp_roles'] : array();
89
- foreach ( $bpo['exclude_roles'] as $slug => $name ) {
90
- $key = "sitemap-buddypress-roles-{$slug}";
91
- $result[ $key ] = in_array( $key, $input['exclude_bp_roles'] );
92
- }
93
- }
94
-
95
- // Meta tags.
96
- if ( ! empty( $input['verification-google-meta'] ) ) {
97
- $result['verification-google-meta'] = $input['verification-google-meta'];
98
- $result['verification-google'] = false;
99
- }
100
- if ( ! empty( $input['verification-bing-meta'] ) ) {
101
- $result['verification-bing-meta'] = $input['verification-bing-meta'];
102
- $result['verification-bing'] = false;
103
- }
104
-
105
- $custom_values_key = 'additional-metas';
106
- if ( ! empty( $input[ $custom_values_key ] ) && is_array( $input[ $custom_values_key ] ) ) {
107
- $result[ $custom_values_key ] = $input[ $custom_values_key ];
108
- }
109
-
110
- $result = $this->_validate_crawler_settings( $input, $result );
111
-
112
- if ( isset( $input['extra_sitemap_urls'] ) ) {
113
- $extra_urls = explode( "\n", $input['extra_sitemap_urls'] );
114
- $sanitized_extra_urls = array();
115
- foreach ( $extra_urls as $extra_url ) {
116
- if ( trim( $extra_url ) ) {
117
- $sanitized_extra_urls[] = esc_url( $extra_url );
118
- }
119
- }
120
- Smartcrawl_Xml_Sitemap::set_extra_urls( $sanitized_extra_urls );
121
-
122
- unset( $input['extra_sitemap_urls'] );
123
- }
124
-
125
- if ( isset( $input['sitemap_ignore_urls'] ) ) {
126
- $ignore_urls = explode( "\n", $input['sitemap_ignore_urls'] );
127
- $sanitized_ignore_urls = array();
128
- foreach ( $ignore_urls as $ignore_url ) {
129
- if ( trim( $ignore_url ) ) {
130
- $sanitized_ignore_urls[] = smartcrawl_sanitize_relative_url( $ignore_url );
131
- }
132
- }
133
- Smartcrawl_Xml_Sitemap::set_ignore_urls( $sanitized_ignore_urls );
134
-
135
- unset( $input['sitemap_ignore_urls'] );
136
- }
137
-
138
- if ( isset( $input['sitemap_ignore_post_ids'] ) ) {
139
- $ignore_post_ids = explode( ',', $input['sitemap_ignore_post_ids'] );
140
- $sanitized_ignore_post_ids = array();
141
- foreach ( $ignore_post_ids as $pid ) {
142
- if ( trim( $pid ) && (int) $pid ) {
143
- $sanitized_ignore_post_ids[] = (int) $pid;
144
- }
145
- }
146
- Smartcrawl_Xml_Sitemap::set_ignore_ids( $sanitized_ignore_post_ids );
147
-
148
- unset( $input['sitemap_ignore_post_ids'] );
149
- }
150
-
151
- return $result;
152
- }
153
-
154
- /**
155
- * Crawler settings validation
156
- *
157
- * @param array $input Raw input.
158
- * @param array $result Result this far.
159
- *
160
- * @return array
161
- */
162
- private function _validate_crawler_settings( $input, $result ) {
163
- if ( empty( $input['crawler-cron-enable'] ) ) {
164
- $result['crawler-cron-enable'] = false;
165
- return $result;
166
- } else { $result['crawler-cron-enable'] = true; }
167
-
168
- $frequency = ! empty( $input['crawler-frequency'] )
169
- ? Smartcrawl_Controller_Cron::get()->get_valid_frequency( $input['crawler-frequency'] )
170
- : Smartcrawl_Controller_Cron::get()->get_default_frequency();
171
- $result['crawler-frequency'] = $frequency;
172
-
173
- $dow = isset( $input['crawler-dow'] ) && is_numeric( $input['crawler-dow'] )
174
- ? (int) $input['crawler-dow']
175
- : 0
176
- ;
177
- $result['crawler-dow'] = in_array( $dow, range( 0,6 ) ) ? $dow : 0;
178
-
179
- $tod = isset( $input['crawler-tod'] ) && is_numeric( $input['crawler-tod'] )
180
- ? (int) $input['crawler-tod']
181
- : 0
182
- ;
183
- $result['crawler-tod'] = in_array( $tod, range( 0,23 ) ) ? $tod : 0;
184
-
185
- return $result;
186
- }
187
-
188
- /**
189
- * Initialize the handler
190
- */
191
- public function init() {
192
- $this->option_name = 'wds_sitemap_options';
193
- $this->name = Smartcrawl_Settings::COMP_SITEMAP;
194
- $this->slug = Smartcrawl_Settings::TAB_SITEMAP;
195
- $this->action_url = admin_url( 'options.php' );
196
- $this->title = __( 'Sitemap', 'wds' );
197
- $this->page_title = __( 'SmartCrawl Wizard: Sitemap', 'wds' );
198
-
199
- add_action( 'wp_ajax_wds-toggle-sitemap-status', array( $this, 'json_toggle_sitemap_status' ) );
200
-
201
- parent::init();
202
- }
203
-
204
- /**
205
- * Get a list of post type based options
206
- *
207
- * @return array
208
- */
209
- protected function _get_post_types_options() {
210
- $options = array();
211
-
212
- foreach ( get_post_types(array(
213
- 'public' => true,
214
- 'show_ui' => true,
215
- )) as $post_type ) {
216
- if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ) ) ) { continue; }
217
- $pt = get_post_type_object( $post_type );
218
- $options[ 'post_types-' . $post_type . '-not_in_sitemap' ] = $pt;
219
- }
220
-
221
- return $options;
222
- }
223
-
224
- /**
225
- * Get a list of taxonomy based options
226
- *
227
- * @return array
228
- */
229
- protected function _get_taxonomies_options() {
230
- $options = array();
231
-
232
- foreach ( get_taxonomies(array(
233
- 'public' => true,
234
- 'show_ui' => true,
235
- )) as $taxonomy ) {
236
- if ( in_array( $taxonomy, array( 'nav_menu', 'link_category', 'post_format' ) ) ) { continue; }
237
- $tax = get_taxonomy( $taxonomy );
238
- $options[ 'taxonomies-' . $taxonomy . '-not_in_sitemap' ] = $tax;
239
- }
240
-
241
- return $options;
242
- }
243
-
244
- /**
245
- * Runs SEO Audit crawl
246
- */
247
- public function run_crawl() {
248
- if ( current_user_can( 'manage_options' ) ) {
249
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
250
- $service->start();
251
- }
252
- wp_safe_redirect( esc_url( remove_query_arg( 'run-crawl' ) ) );
253
- die;
254
- }
255
-
256
- /**
257
- * Process run action
258
- *
259
- * @return bool
260
- */
261
- public function process_run_action() {
262
- if ( ! empty( $_GET['run-crawl'] ) ) { // Simple presence switch, no value needed.
263
- return $this->run_crawl();
264
- }
265
- return false;
266
- }
267
-
268
- /**
269
- * Add admin settings page
270
- */
271
- public function options_page() {
272
- parent::options_page();
273
-
274
- $smartcrawl_options = Smartcrawl_Settings::get_options();
275
- $arguments = array(
276
- 'post_types' => array(),
277
- 'taxonomies' => array(),
278
- 'engines' => array(
279
- 'ping-google' => __( 'Google', 'wds' ),
280
- 'ping-bing' => __( 'Bing', 'wds' ),
281
- ),
282
- 'checkbox_options' => array(
283
- 'yes' => __( 'Yes', 'wds' ),
284
- ),
285
- 'verification_pages' => array(
286
- '' => __( 'All pages', 'wds' ),
287
- 'home' => __( 'Home page', 'wds' ),
288
- ),
289
- );
290
-
291
- foreach ( $this->_get_post_types_options() as $opt => $post_type ) {
292
- $arguments['post_types'][ $opt ] = $post_type;
293
- }
294
- foreach ( $this->_get_taxonomies_options() as $opt => $taxonomy ) {
295
- $arguments['taxonomies'][ $opt ] = $taxonomy;
296
- }
297
-
298
- $arguments['google_msg'] = ! empty( $smartcrawl_options['verification-google'] )
299
- ? '<code>' . esc_html( '<meta name="google-site-verification" value="' ) . esc_attr( $smartcrawl_options['verification-google'] ) . esc_html( '" />' ) . '</code>'
300
- : '<small>' . esc_html( __( 'No META tag will be added', 'wds' ) ) . '</small>'
301
- ;
302
- $arguments['bing_msg'] = ! empty( $smartcrawl_options['verification-bing'] )
303
- ? '<code>' . esc_html( '<meta name="msvalidate.01" content="' ) . esc_attr( $smartcrawl_options['verification-bing'] ) . esc_html( '" />' ) . '</code>'
304
- : '<small>' . esc_html( __( 'No META tag will be added', 'wds' ) ) . '</small>'
305
- ;
306
-
307
- $arguments['wds_buddypress'] = $this->_get_buddyress_template_values();
308
-
309
- $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_sitemap' );
310
-
311
- $extra_urls = Smartcrawl_Xml_Sitemap::get_extra_urls();
312
- if ( is_array( $extra_urls ) ) {
313
- $arguments['extra_urls'] = ! empty( $extra_urls )
314
- ? implode( "\n", $extra_urls )
315
- : ''
316
- ;
317
- }
318
-
319
- $ignore_urls = Smartcrawl_Xml_Sitemap::get_ignore_urls();
320
- if ( is_array( $ignore_urls ) ) {
321
- $arguments['ignore_urls'] = ! empty( $ignore_urls )
322
- ? implode( "\n", $ignore_urls )
323
- : ''
324
- ;
325
- }
326
-
327
- $ignore_post_ids = Smartcrawl_Xml_Sitemap::get_ignore_ids();
328
- if ( is_array( $ignore_post_ids ) ) {
329
- $arguments['ignore_post_ids'] = ! empty( $ignore_post_ids )
330
- ? implode( ',', $ignore_post_ids )
331
- : ''
332
- ;
333
- }
334
-
335
- wp_enqueue_script( 'wds-admin-sitemaps' );
336
- $this->_render_page( 'sitemap/sitemap-settings', $arguments );
337
- }
338
-
339
- /**
340
- * BuddyPress settings fields helper.
341
- *
342
- * @return array BuddyPress values for the template
343
- */
344
- private function _get_buddyress_template_values() {
345
- $arguments = array();
346
- if ( ! defined( 'BP_VERSION' ) ) { return $arguments; }
347
-
348
- $arguments['checkbox_options'] = array(
349
- 'yes' => __( 'Yes', 'wds' ),
350
- );
351
-
352
- if ( function_exists( 'groups_get_groups' ) ) { // We have BuddyPress groups, so let's get some settings.
353
- $groups = groups_get_groups( array( 'per_page' => SMARTCRAWL_BP_GROUPS_LIMIT ) );
354
- $arguments['groups'] = ! empty( $groups['groups'] ) ? $groups['groups'] : array();
355
- $arguments['exclude_groups'] = array();
356
- foreach ( $arguments['groups'] as $group ) {
357
- $arguments['exclude_groups'][ "exclude-buddypress-group-{$group->slug}" ] = $group->name;
358
- }
359
- }
360
-
361
- $wp_roles = new WP_Roles();
362
- $wp_roles = $wp_roles->get_names();
363
- $wp_roles = $wp_roles ? $wp_roles : array();
364
- $arguments['exclude_roles'] = array();
365
- foreach ( $wp_roles as $key => $label ) {
366
- $arguments['exclude_roles'][ "exclude-profile-role-{$key}" ] = $label;
367
- }
368
-
369
- return $arguments;
370
- }
371
-
372
- /**
373
- * Default settings
374
- */
375
- public function defaults() {
376
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
377
- $this->options = get_site_option( $this->option_name );
378
- } else {
379
- $this->options = get_option( $this->option_name );
380
- }
381
-
382
- $dir = wp_upload_dir();
383
- $path = trailingslashit( $dir['basedir'] );
384
-
385
- if ( empty( $this->options['wds_sitemap-setup'] ) ) {
386
- if ( ! isset( $this->options['sitemap-stylesheet'] ) ) {
387
- $this->options['sitemap-stylesheet'] = 1;
388
- }
389
- }
390
-
391
- if ( empty( $this->options['sitemappath'] ) ) {
392
- $this->options['sitemappath'] = $path . 'sitemap.xml';
393
- }
394
-
395
- if ( empty( $this->options['sitemapurl'] ) ) {
396
- $this->options['sitemapurl'] = get_bloginfo( 'url' ) . '/sitemap.xml';
397
- }
398
-
399
- if ( empty( $this->options['sitemap-images'] ) ) {
400
- $this->options['sitemap-images'] = 0;
401
- }
402
-
403
- if ( empty( $this->options['sitemap-stylesheet'] ) ) {
404
- $this->options['sitemap-stylesheet'] = 0;
405
- }
406
-
407
- if ( empty( $this->options['sitemap-dashboard-widget'] ) ) {
408
- $this->options['sitemap-dashboard-widget'] = 0;
409
- }
410
-
411
- if ( empty( $this->options['sitemap-disable-automatic-regeneration'] ) ) {
412
- $this->options['sitemap-disable-automatic-regeneration'] = 0;
413
- }
414
-
415
- if ( empty( $this->options['verification-google'] ) ) {
416
- $this->options['verification-google'] = '';
417
- }
418
-
419
- if ( empty( $this->options['verification-bing'] ) ) {
420
- $this->options['verification-bing'] = '';
421
- }
422
-
423
- if ( empty( $this->options['verification-pages'] ) ) {
424
- $this->options['verification-pages'] = '';
425
- }
426
-
427
- if ( empty( $this->options['sitemap-buddypress-groups'] ) ) {
428
- $this->options['sitemap-buddypress-groups'] = 0;
429
- }
430
-
431
- if ( empty( $this->options['sitemap-buddypress-profiles'] ) ) {
432
- $this->options['sitemap-buddypress-profiles'] = 0;
433
- }
434
-
435
- if ( empty( $this->options['verification-google-meta'] ) ) { $this->options['verification-google-meta'] = ''; }
436
- if ( empty( $this->options['verification-bing-meta'] ) ) { $this->options['verification-bing-meta'] = ''; }
437
- if ( empty( $this->options['additional-metas'] ) ) { $this->options['additiona-metas'] = array(); }
438
-
439
- if ( ! isset( $this->options['crawler-cron-enable'] ) ) { $this->options['crawler-cron-enable'] = false; }
440
- if ( ! isset( $this->options['crawler-frequency'] ) ) { $this->options['crawler-frequency'] = Smartcrawl_Controller_Cron::get()->get_default_frequency(); }
441
- if ( ! isset( $this->options['crawler-dow'] ) ) { $this->options['crawler-dow'] = rand( 0, 6 ); }
442
- if ( ! isset( $this->options['crawler-tod'] ) ) { $this->options['crawler-tod'] = rand( 0, 23 ); }
443
-
444
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
445
- update_site_option( $this->option_name, $this->options );
446
- } else {
447
- update_option( $this->option_name, $this->options );
448
- }
449
- }
450
-
451
- /**
452
- * Handles sitemap active toggle request
453
- */
454
- public function json_toggle_sitemap_status() {
455
- $data = stripslashes_deep( $_POST );
456
- $status = (bool) smartcrawl_get_array_value( $data, 'sitemap_active' );
457
- $return = array( 'success' => false );
458
-
459
- if ( null === $status ) {
460
- wp_send_json( $return );
461
- return;
462
- }
463
-
464
- $options = self::get_specific_options( 'wds_settings_options' );
465
- $options['sitemap'] = $status;
466
- self::update_specific_options( 'wds_settings_options', $options );
467
-
468
- $return['success'] = true;
469
- wp_send_json( $return );
470
- }
471
- }
472
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemap settings admin page
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ /**
9
+ * Sitemap settings admin page class
10
+ */
11
+ class Smartcrawl_Sitemap_Settings extends Smartcrawl_Settings_Admin {
12
+
13
+ /**
14
+ * Singleton instance
15
+ *
16
+ * @var Smartcrawl_Sitemap_Settings
17
+ */
18
+ private static $_instance;
19
+
20
+ /**
21
+ * Singleton instance getter
22
+ *
23
+ * @return Smartcrawl_Sitemap_Settings instance
24
+ */
25
+ public static function get_instance() {
26
+ if ( empty( self::$_instance ) ) {
27
+ self::$_instance = new self();
28
+ }
29
+
30
+ return self::$_instance;
31
+ }
32
+
33
+ /**
34
+ * Validate submitted options
35
+ *
36
+ * @param array $input Raw input.
37
+ *
38
+ * @return array Validated input
39
+ */
40
+ public function validate( $input ) {
41
+ $result = array();
42
+ $previous_values = self::get_specific_options( $this->option_name );
43
+
44
+ if ( ! empty( $input['wds_sitemap-setup'] ) ) {
45
+ $result['wds_sitemap-setup'] = true;
46
+ }
47
+
48
+ $strings = array(
49
+ 'verification-google-meta',
50
+ 'verification-bing-meta',
51
+ 'verification-pages',
52
+ );
53
+ foreach ( $strings as $str ) {
54
+ if ( isset( $input[ $str ] ) ) {
55
+ $result[ $str ] = sanitize_text_field( $input[ $str ] );
56
+ } else {
57
+ $result[ $str ] = smartcrawl_get_array_value( $previous_values, $str );
58
+ }
59
+ }
60
+
61
+ $booleans = array(
62
+ 'ping-google',
63
+ 'ping-bing',
64
+ 'sitemap-images',
65
+ 'sitemap-stylesheet',
66
+ 'sitemap-dashboard-widget',
67
+ 'sitemap-disable-automatic-regeneration',
68
+ 'sitemap-buddypress-groups',
69
+ 'sitemap-buddypress-profiles',
70
+ );
71
+ foreach ( $booleans as $bool ) {
72
+ if ( ! empty( $input[ $bool ] ) ) {
73
+ $result[ $bool ] = true;
74
+ }
75
+ }
76
+
77
+ // Array Booleans.
78
+ $input['exclude_post_types'] = ! empty( $input['exclude_post_types'] ) && is_array( $input['exclude_post_types'] ) ? $input['exclude_post_types'] : array();
79
+ foreach ( array_keys( $this->_get_post_types_options() ) as $post_type ) {
80
+ $result[ $post_type ] = in_array( $post_type, $input['exclude_post_types'], true );
81
+ }
82
+ $input['exclude_taxonomies'] = ! empty( $input['exclude_taxonomies'] ) && is_array( $input['exclude_taxonomies'] ) ? $input['exclude_taxonomies'] : array();
83
+ foreach ( array_keys( $this->_get_taxonomies_options() ) as $tax ) {
84
+ $result[ $tax ] = in_array( $tax, $input['exclude_taxonomies'], true );
85
+ }
86
+
87
+ // BuddyPress-specific.
88
+ $bpo = $this->_get_buddyress_template_values();
89
+ if ( ! empty( $bpo['exclude_groups'] ) && is_array( $bpo['exclude_groups'] ) ) {
90
+ $input['exclude_bp_groups'] = ! empty( $input['exclude_bp_groups'] ) && is_array( $input['exclude_bp_groups'] ) ? $input['exclude_bp_groups'] : array();
91
+ foreach ( $bpo['exclude_groups'] as $slug => $name ) {
92
+ $key = "sitemap-buddypress-{$slug}";
93
+ $result[ $key ] = in_array( $key, $input['exclude_bp_groups'], true );
94
+ }
95
+ }
96
+
97
+ if ( ! empty( $bpo['exclude_roles'] ) && is_array( $bpo['exclude_roles'] ) ) {
98
+ $input['exclude_bp_roles'] = isset( $input['exclude_bp_roles'] ) && is_array( $input['exclude_bp_roles'] ) ? $input['exclude_bp_roles'] : array();
99
+ foreach ( $bpo['exclude_roles'] as $slug => $name ) {
100
+ $key = "sitemap-buddypress-roles-{$slug}";
101
+ $result[ $key ] = in_array( $key, $input['exclude_bp_roles'], true );
102
+ }
103
+ }
104
+
105
+ // Meta tags.
106
+ if ( ! empty( $input['verification-google-meta'] ) ) {
107
+ $result['verification-google-meta'] = smartcrawl_is_valid_meta_tag($input['verification-google-meta']) ? $input['verification-google-meta'] : '';
108
+ }
109
+ if ( ! empty( $input['verification-bing-meta'] ) ) {
110
+ $result['verification-bing-meta'] = smartcrawl_is_valid_meta_tag($input['verification-bing-meta']) ? $input['verification-bing-meta'] : '';
111
+ }
112
+
113
+ $custom_values_key = 'additional-metas';
114
+ if ( ! empty( $input[ $custom_values_key ] ) && is_array( $input[ $custom_values_key ] ) ) {
115
+ $result[ $custom_values_key ] = $input[ $custom_values_key ];
116
+ } else {
117
+ $result[ $custom_values_key ] = smartcrawl_get_array_value( $previous_values, $custom_values_key );
118
+ }
119
+
120
+ $result = $this->_validate_crawler_settings( $input, $result );
121
+
122
+ if ( isset( $input['extra_sitemap_urls'] ) ) {
123
+ $extra_urls = explode( "\n", $input['extra_sitemap_urls'] );
124
+ $sanitized_extra_urls = array();
125
+ foreach ( $extra_urls as $extra_url ) {
126
+ if ( trim( $extra_url ) ) {
127
+ $sanitized_extra_urls[] = esc_url( $extra_url );
128
+ }
129
+ }
130
+ Smartcrawl_Xml_Sitemap::set_extra_urls( $sanitized_extra_urls );
131
+
132
+ unset( $input['extra_sitemap_urls'] );
133
+ }
134
+
135
+ if ( isset( $input['sitemap_ignore_urls'] ) ) {
136
+ $ignore_urls = explode( "\n", $input['sitemap_ignore_urls'] );
137
+ $sanitized_ignore_urls = array();
138
+ foreach ( $ignore_urls as $ignore_url ) {
139
+ if ( trim( $ignore_url ) ) {
140
+ $sanitized_ignore_urls[] = smartcrawl_sanitize_relative_url( $ignore_url );
141
+ }
142
+ }
143
+ Smartcrawl_Xml_Sitemap::set_ignore_urls( $sanitized_ignore_urls );
144
+
145
+ unset( $input['sitemap_ignore_urls'] );
146
+ }
147
+
148
+ if ( isset( $input['sitemap_ignore_post_ids'] ) ) {
149
+ $ignore_post_ids = explode( ',', $input['sitemap_ignore_post_ids'] );
150
+ $sanitized_ignore_post_ids = array();
151
+ foreach ( $ignore_post_ids as $pid ) {
152
+ if ( trim( $pid ) && (int) $pid ) {
153
+ $sanitized_ignore_post_ids[] = (int) $pid;
154
+ }
155
+ }
156
+ Smartcrawl_Xml_Sitemap::set_ignore_ids( $sanitized_ignore_post_ids );
157
+
158
+ unset( $input['sitemap_ignore_post_ids'] );
159
+ }
160
+
161
+ return $result;
162
+ }
163
+
164
+ /**
165
+ * Get a list of post type based options
166
+ *
167
+ * @return array
168
+ */
169
+ protected function _get_post_types_options() {
170
+ $options = array();
171
+
172
+ foreach (
173
+ get_post_types( array(
174
+ 'public' => true,
175
+ 'show_ui' => true,
176
+ ) ) as $post_type
177
+ ) {
178
+ if ( in_array( $post_type, array( 'revision', 'nav_menu_item', 'attachment' ), true ) ) {
179
+ continue;
180
+ }
181
+ $pt = get_post_type_object( $post_type );
182
+ $options[ 'post_types-' . $post_type . '-not_in_sitemap' ] = $pt;
183
+ }
184
+
185
+ return $options;
186
+ }
187
+
188
+ /**
189
+ * Get a list of taxonomy based options
190
+ *
191
+ * @return array
192
+ */
193
+ protected function _get_taxonomies_options() {
194
+ $options = array();
195
+
196
+ foreach (
197
+ get_taxonomies( array(
198
+ 'public' => true,
199
+ 'show_ui' => true,
200
+ ) ) as $taxonomy
201
+ ) {
202
+ if ( in_array( $taxonomy, array( 'nav_menu', 'link_category', 'post_format' ), true ) ) {
203
+ continue;
204
+ }
205
+ $tax = get_taxonomy( $taxonomy );
206
+ $options[ 'taxonomies-' . $taxonomy . '-not_in_sitemap' ] = $tax;
207
+ }
208
+
209
+ return $options;
210
+ }
211
+
212
+ /**
213
+ * BuddyPress settings fields helper.
214
+ *
215
+ * @return array BuddyPress values for the template
216
+ */
217
+ private function _get_buddyress_template_values() {
218
+ $arguments = array();
219
+ if ( ! defined( 'BP_VERSION' ) ) {
220
+ return $arguments;
221
+ }
222
+
223
+ $arguments['checkbox_options'] = array(
224
+ 'yes' => __( 'Yes', 'wds' ),
225
+ );
226
+
227
+ if ( function_exists( 'groups_get_groups' ) ) { // We have BuddyPress groups, so let's get some settings.
228
+ $groups = groups_get_groups( array( 'per_page' => SMARTCRAWL_BP_GROUPS_LIMIT ) );
229
+ $arguments['groups'] = ! empty( $groups['groups'] ) ? $groups['groups'] : array();
230
+ $arguments['exclude_groups'] = array();
231
+ foreach ( $arguments['groups'] as $group ) {
232
+ $arguments['exclude_groups']["exclude-buddypress-group-{$group->slug}"] = $group->name;
233
+ }
234
+ }
235
+
236
+ $wp_roles = new WP_Roles();
237
+ $wp_roles = $wp_roles->get_names();
238
+ $wp_roles = $wp_roles ? $wp_roles : array();
239
+ $arguments['exclude_roles'] = array();
240
+ foreach ( $wp_roles as $key => $label ) {
241
+ $arguments['exclude_roles']["exclude-profile-role-{$key}"] = $label;
242
+ }
243
+
244
+ return $arguments;
245
+ }
246
+
247
+ /**
248
+ * Crawler settings validation
249
+ *
250
+ * @param array $input Raw input.
251
+ * @param array $result Result this far.
252
+ *
253
+ * @return array
254
+ */
255
+ private function _validate_crawler_settings( $input, $result ) {
256
+ if ( empty( $input['crawler-cron-enable'] ) ) {
257
+ $result['crawler-cron-enable'] = false;
258
+
259
+ return $result;
260
+ } else {
261
+ $result['crawler-cron-enable'] = true;
262
+ }
263
+
264
+ $frequency = ! empty( $input['crawler-frequency'] )
265
+ ? Smartcrawl_Controller_Cron::get()->get_valid_frequency( $input['crawler-frequency'] )
266
+ : Smartcrawl_Controller_Cron::get()->get_default_frequency();
267
+ $result['crawler-frequency'] = $frequency;
268
+
269
+ $dow = isset( $input['crawler-dow'] ) && is_numeric( $input['crawler-dow'] )
270
+ ? (int) $input['crawler-dow']
271
+ : 0;
272
+ $result['crawler-dow'] = in_array( $dow, range( 0, 6 ), true ) ? $dow : 0;
273
+
274
+ $tod = isset( $input['crawler-tod'] ) && is_numeric( $input['crawler-tod'] )
275
+ ? (int) $input['crawler-tod']
276
+ : 0;
277
+ $result['crawler-tod'] = in_array( $tod, range( 0, 23 ), true ) ? $tod : 0;
278
+
279
+ return $result;
280
+ }
281
+
282
+ /**
283
+ * Initialize the handler
284
+ */
285
+ public function init() {
286
+ $this->option_name = 'wds_sitemap_options';
287
+ $this->name = Smartcrawl_Settings::COMP_SITEMAP;
288
+ $this->slug = Smartcrawl_Settings::TAB_SITEMAP;
289
+ $this->action_url = admin_url( 'options.php' );
290
+ $this->title = __( 'Sitemap', 'wds' );
291
+ $this->page_title = __( 'SmartCrawl Wizard: Sitemap', 'wds' );
292
+
293
+ add_action( 'wp_ajax_wds-toggle-sitemap-status', array( $this, 'json_toggle_sitemap_status' ) );
294
+
295
+ parent::init();
296
+ }
297
+
298
+ /**
299
+ * Process run action
300
+ *
301
+ * @return bool
302
+ */
303
+ public function process_run_action() {
304
+ if ( isset( $_GET['_wds_nonce'], $_GET['run-crawl'] ) && wp_verify_nonce( $_GET['_wds_nonce'], 'wds-crawl-nonce' ) ) { // Simple presence switch, no value.
305
+ return $this->run_crawl();
306
+ }
307
+
308
+ return false;
309
+ }
310
+
311
+ public static function crawl_url() {
312
+ $crawl_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SITEMAP );
313
+
314
+ return esc_url_raw( add_query_arg( array(
315
+ 'run-crawl' => 'yes',
316
+ '_wds_nonce' => wp_create_nonce( 'wds-crawl-nonce' ),
317
+ ), $crawl_url ) );
318
+ }
319
+
320
+ /**
321
+ * Runs SEO Audit crawl
322
+ */
323
+ public function run_crawl() {
324
+ if ( current_user_can( 'manage_options' ) ) {
325
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
326
+ $service->start();
327
+ }
328
+ $url = remove_query_arg( array( 'run-crawl', '_wds_nonce' ) );
329
+ if ( preg_match( '/page=wds_sitemap/', $url ) && ! preg_match( '/#tab_url_crawler/', $url ) ) {
330
+ $url .= '#tab_url_crawler';
331
+ }
332
+ wp_safe_redirect( esc_url( $url ) );
333
+ die;
334
+ }
335
+
336
+ /**
337
+ * Add admin settings page
338
+ */
339
+ public function options_page() {
340
+ parent::options_page();
341
+
342
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
343
+ $arguments = array(
344
+ 'post_types' => array(),
345
+ 'taxonomies' => array(),
346
+ 'engines' => array(
347
+ 'ping-google' => __( 'Google', 'wds' ),
348
+ 'ping-bing' => __( 'Bing', 'wds' ),
349
+ ),
350
+ 'checkbox_options' => array(
351
+ 'yes' => __( 'Yes', 'wds' ),
352
+ ),
353
+ 'verification_pages' => array(
354
+ '' => __( 'All pages', 'wds' ),
355
+ 'home' => __( 'Home page', 'wds' ),
356
+ ),
357
+ );
358
+
359
+ foreach ( $this->_get_post_types_options() as $opt => $post_type ) {
360
+ $arguments['post_types'][ $opt ] = $post_type;
361
+ }
362
+ foreach ( $this->_get_taxonomies_options() as $opt => $taxonomy ) {
363
+ $arguments['taxonomies'][ $opt ] = $taxonomy;
364
+ }
365
+
366
+ $arguments['wds_buddypress'] = $this->_get_buddyress_template_values();
367
+
368
+ $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_sitemap' );
369
+
370
+ $extra_urls = Smartcrawl_Xml_Sitemap::get_extra_urls();
371
+ if ( is_array( $extra_urls ) ) {
372
+ $arguments['extra_urls'] = ! empty( $extra_urls )
373
+ ? implode( "\n", $extra_urls )
374
+ : '';
375
+ }
376
+
377
+ $ignore_urls = Smartcrawl_Xml_Sitemap::get_ignore_urls();
378
+ if ( is_array( $ignore_urls ) ) {
379
+ $arguments['ignore_urls'] = ! empty( $ignore_urls )
380
+ ? implode( "\n", $ignore_urls )
381
+ : '';
382
+ }
383
+
384
+ $ignore_post_ids = Smartcrawl_Xml_Sitemap::get_ignore_ids();
385
+ if ( is_array( $ignore_post_ids ) ) {
386
+ $arguments['ignore_post_ids'] = ! empty( $ignore_post_ids )
387
+ ? implode( ',', $ignore_post_ids )
388
+ : '';
389
+ }
390
+
391
+ wp_enqueue_script( 'wds-admin-sitemaps' );
392
+ $this->_render_page( 'sitemap/sitemap-settings', $arguments );
393
+ }
394
+
395
+ /**
396
+ * Default settings
397
+ */
398
+ public function defaults() {
399
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
400
+ $this->options = get_site_option( $this->option_name );
401
+ } else {
402
+ $this->options = get_option( $this->option_name );
403
+ }
404
+
405
+ $dir = wp_upload_dir();
406
+ $path = trailingslashit( $dir['basedir'] );
407
+
408
+ if ( empty( $this->options['wds_sitemap-setup'] ) ) {
409
+ if ( ! isset( $this->options['sitemap-stylesheet'] ) ) {
410
+ $this->options['sitemap-stylesheet'] = 1;
411
+ }
412
+ }
413
+
414
+ if ( empty( $this->options['sitemappath'] ) ) {
415
+ $this->options['sitemappath'] = $path . 'sitemap.xml';
416
+ }
417
+
418
+ if ( empty( $this->options['sitemapurl'] ) ) {
419
+ $this->options['sitemapurl'] = get_bloginfo( 'url' ) . '/sitemap.xml';
420
+ }
421
+
422
+ if ( empty( $this->options['sitemap-images'] ) ) {
423
+ $this->options['sitemap-images'] = 0;
424
+ }
425
+
426
+ if ( empty( $this->options['sitemap-stylesheet'] ) ) {
427
+ $this->options['sitemap-stylesheet'] = 0;
428
+ }
429
+
430
+ if ( empty( $this->options['sitemap-dashboard-widget'] ) ) {
431
+ $this->options['sitemap-dashboard-widget'] = 0;
432
+ }
433
+
434
+ if ( empty( $this->options['sitemap-disable-automatic-regeneration'] ) ) {
435
+ $this->options['sitemap-disable-automatic-regeneration'] = 0;
436
+ }
437
+
438
+ if ( empty( $this->options['verification-pages'] ) ) {
439
+ $this->options['verification-pages'] = '';
440
+ }
441
+
442
+ if ( empty( $this->options['sitemap-buddypress-groups'] ) ) {
443
+ $this->options['sitemap-buddypress-groups'] = 0;
444
+ }
445
+
446
+ if ( empty( $this->options['sitemap-buddypress-profiles'] ) ) {
447
+ $this->options['sitemap-buddypress-profiles'] = 0;
448
+ }
449
+
450
+ if ( empty( $this->options['verification-google-meta'] ) ) {
451
+ $this->options['verification-google-meta'] = '';
452
+ }
453
+ if ( empty( $this->options['verification-bing-meta'] ) ) {
454
+ $this->options['verification-bing-meta'] = '';
455
+ }
456
+ if ( empty( $this->options['additional-metas'] ) ) {
457
+ $this->options['additiona-metas'] = array();
458
+ }
459
+
460
+ if ( ! isset( $this->options['crawler-cron-enable'] ) ) {
461
+ $this->options['crawler-cron-enable'] = false;
462
+ }
463
+ if ( ! isset( $this->options['crawler-frequency'] ) ) {
464
+ $this->options['crawler-frequency'] = Smartcrawl_Controller_Cron::get()->get_default_frequency();
465
+ }
466
+ if ( ! isset( $this->options['crawler-dow'] ) ) {
467
+ $this->options['crawler-dow'] = rand( 0, 6 );
468
+ }
469
+ if ( ! isset( $this->options['crawler-tod'] ) ) {
470
+ $this->options['crawler-tod'] = rand( 0, 23 );
471
+ }
472
+
473
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
474
+ update_site_option( $this->option_name, $this->options );
475
+ } else {
476
+ update_option( $this->option_name, $this->options );
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Handles sitemap active toggle request
482
+ */
483
+ public function json_toggle_sitemap_status() {
484
+ $data = $this->get_request_data();
485
+ $status = (bool) smartcrawl_get_array_value( $data, 'sitemap_active' );
486
+ $return = array( 'success' => false );
487
+
488
+ if ( null === $status ) {
489
+ wp_send_json( $return );
490
+
491
+ return;
492
+ }
493
+
494
+ $options = self::get_specific_options( 'wds_settings_options' );
495
+ $options['sitemap'] = $status;
496
+ self::update_specific_options( 'wds_settings_options', $options );
497
+
498
+ $return['success'] = true;
499
+ wp_send_json( $return );
500
+ }
501
+
502
+ private function get_request_data() {
503
+ return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( $_POST['_wds_nonce'], 'wds-nonce' ) ? stripslashes_deep( $_POST ) : array();
504
+ }
505
+ }
506
+
includes/admin/settings/social.php CHANGED
@@ -1,203 +1,227 @@
1
- <?php
2
-
3
- class Smartcrawl_Social_Settings extends Smartcrawl_Settings_Admin {
4
-
5
-
6
- private static $_instance;
7
-
8
- public static function get_instance() {
9
- if ( empty( self::$_instance ) ) {
10
- self::$_instance = new self;
11
- }
12
- return self::$_instance;
13
- }
14
-
15
- /**
16
- * Validate submitted options
17
- *
18
- * @param array $input Raw input
19
- *
20
- * @return array Validated input
21
- */
22
- public function validate( $input ) {
23
- $result = array();
24
-
25
- if ( ! empty( $input['wds_social-setup'] ) ) { $result['wds_social-setup'] = true; }
26
-
27
- $result['disable-schema'] = ! empty( $input['disable-schema'] );
28
-
29
- $urls = array(
30
- 'facebook_url',
31
- 'instagram_url',
32
- 'linkedin_url',
33
- 'pinterest_url',
34
- 'gplus_url',
35
- 'youtube_url',
36
- );
37
- foreach ( $urls as $type ) {
38
- if ( empty( $input[ $type ] ) ) { continue; }
39
- if ( ! preg_match( '/^https?:\/\//', $input[ $type ] ) ) { continue; }
40
- $result[ $type ] = $input[ $type ];
41
- }
42
-
43
- if ( ! empty( $input['sitename'] ) ) { $result['sitename'] = sanitize_text_field( $input['sitename'] ); }
44
- if ( ! empty( $input['override_name'] ) ) { $result['override_name'] = sanitize_text_field( $input['override_name'] ); }
45
- if ( ! empty( $input['organization_name'] ) ) { $result['organization_name'] = sanitize_text_field( $input['organization_name'] ); }
46
- if ( ! empty( $input['organization_logo'] ) ) { $result['organization_logo'] = sanitize_text_field( $input['organization_logo'] ); }
47
- if ( ! empty( $input['schema_type'] ) ) { $result['schema_type'] = sanitize_text_field( $input['schema_type'] ); }
48
- if ( ! empty( $input['twitter_username'] ) ) { $result['twitter_username'] = sanitize_text_field( $input['twitter_username'] ); }
49
- if ( ! empty( $input['twitter-card-type'] ) ) { $result['twitter-card-type'] = sanitize_text_field( $input['twitter-card-type'] ); }
50
- if ( ! empty( $input['fb-app-id'] ) ) { $result['fb-app-id'] = sanitize_text_field( $input['fb-app-id'] ); }
51
-
52
- $result['og-enable'] = ! empty( $input['og-enable'] );
53
- $result['twitter-card-enable'] = ! empty( $input['twitter-card-enable'] );
54
-
55
- $this->_toggle_og_globally(
56
- $result['og-enable']
57
- );
58
-
59
- $this->_toggle_twitter_cards_globally(
60
- $result['twitter-card-enable']
61
- );
62
-
63
- if ( ! empty( $input['pinterest-verify'] ) ) {
64
- if ( ! class_exists( 'Smartcrawl_Pinterest_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_pinterest_printer.php' ); }
65
- $pin = Smartcrawl_Pinterest_Printer::get();
66
- $raw = trim( $input['pinterest-verify'] );
67
- $tag = $pin->get_verified_tag( $raw );
68
- $result['pinterest-verify'] = str_replace( ' ', '', $raw ) === str_replace( ' ', '', $tag ) ? $tag : false;
69
- $result['pinterest-verification-status'] = str_replace( ' ', '', $raw ) === str_replace( ' ', '', $tag ) ? '' : 'fail';
70
- } else { $result['pinterest-verification-status'] = false; }
71
-
72
- return $result;
73
- }
74
-
75
- private function _toggle_og_globally( $new_value ) {
76
- $this->toggle_setting_globally('og-active', $new_value);
77
- }
78
-
79
- private function _toggle_twitter_cards_globally( $new_value ) {
80
- $this->toggle_setting_globally('twitter-active', $new_value);
81
- }
82
-
83
- private function toggle_setting_globally( $prefix, $new_value ) {
84
- $existing_settings = Smartcrawl_Settings::get_specific_options( 'wds_onpage_options' );
85
- $strings = array(
86
- 'home',
87
- 'author',
88
- 'date',
89
- 'search',
90
- '404',
91
- 'category',
92
- 'post_tag',
93
- 'bp_groups',
94
- 'bp_profile',
95
- 'mp_marketplace-base',
96
- 'mp_marketplace-categories',
97
- 'mp_marketplace-tags',
98
- );
99
-
100
- foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
101
- $strings[] = $taxonomy->name;
102
- }
103
-
104
- foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
105
- $strings[] = $post_type;
106
- }
107
-
108
- foreach ($strings as $string) {
109
- $existing_settings[ sprintf('%s-%s', $prefix, $string) ] = $new_value;
110
- }
111
-
112
- Smartcrawl_Settings::update_specific_options( 'wds_onpage_options', $existing_settings );
113
- }
114
-
115
- public function init() {
116
- $this->option_name = 'wds_social_options';
117
- $this->name = Smartcrawl_Settings::COMP_SOCIAL;
118
- $this->slug = Smartcrawl_Settings::TAB_SOCIAL;
119
- $this->action_url = admin_url( 'options.php' );
120
- $this->title = __( 'Social', 'wds' );
121
- $this->page_title = __( 'SmartCrawl Wizard: Social', 'wds' );
122
-
123
- parent::init();
124
- }
125
-
126
- /**
127
- * Add admin settings page
128
- */
129
- public function options_page() {
130
- parent::options_page();
131
-
132
- $options = Smartcrawl_Settings::get_component_options( $this->name );
133
- $options = wp_parse_args(
134
- (is_array( $options ) ? $options : array()),
135
- $this->get_default_options()
136
- );
137
-
138
- $arguments = array(
139
- 'options' => $options,
140
- );
141
- if ( ! class_exists( 'Smartcrawl_Schema_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_schema_printer.php' ); }
142
- if ( ! class_exists( 'Smartcrawl_Twitter_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_twitter_printer.php' ); }
143
-
144
- $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_accounts' );
145
- wp_enqueue_script( 'wds-admin-social' );
146
- wp_enqueue_media();
147
-
148
- $this->_render_page( 'social/social-settings', $arguments );
149
- }
150
-
151
- /**
152
- * Gets default options set and their initial values
153
- *
154
- * @return array
155
- */
156
- public function get_default_options() {
157
- return array(
158
- // Accounts
159
- 'sitename' => get_bloginfo( 'name' ),
160
- 'disable-schema' => false,
161
- 'schema_type' => '',
162
- 'override_name' => '',
163
- 'organization_name' => '',
164
- 'organization_logo' => '',
165
- 'twitter_username' => '',
166
- 'facebook_url' => '',
167
- 'instagram_url' => '',
168
- 'linkedin_url' => '',
169
- 'pinterest_url' => '',
170
- 'gplus_url' => '',
171
- 'youtube_url' => '',
172
- // Twitter
173
- 'twitter-card-enable' => false,
174
- 'twitter-card-type' => '',
175
- // Pinterest
176
- 'pinterest-verify' => '',
177
- // OpenGraph
178
- 'og-enable' => true,
179
- // Facebook-specific
180
- 'fb-app-id' => '',
181
- );
182
- }
183
-
184
- /**
185
- * Default settings
186
- */
187
- public function defaults() {
188
- $options = Smartcrawl_Settings::get_component_options( $this->name );
189
- $options = is_array( $options ) ? $options : array();
190
-
191
- foreach ( $this->get_default_options() as $opt => $default ) {
192
- if ( ! isset( $options[ $opt ] ) ) { $options[ $opt ] = $default; }
193
- }
194
-
195
- if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
196
- update_site_option( $this->option_name, $options );
197
- } else {
198
- update_option( $this->option_name, $options );
199
- }
200
- }
201
-
202
- }
203
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smartcrawl_Social_Settings extends Smartcrawl_Settings_Admin {
4
+
5
+
6
+ private static $_instance;
7
+
8
+ public static function get_instance() {
9
+ if ( empty( self::$_instance ) ) {
10
+ self::$_instance = new self();
11
+ }
12
+
13
+ return self::$_instance;
14
+ }
15
+
16
+ /**
17
+ * Validate submitted options
18
+ *
19
+ * @param array $input Raw input
20
+ *
21
+ * @return array Validated input
22
+ */
23
+ public function validate( $input ) {
24
+ $result = array();
25
+
26
+ if ( ! empty( $input['wds_social-setup'] ) ) {
27
+ $result['wds_social-setup'] = true;
28
+ }
29
+
30
+ $result['disable-schema'] = ! empty( $input['disable-schema'] );
31
+
32
+ $urls = array(
33
+ 'facebook_url',
34
+ 'instagram_url',
35
+ 'linkedin_url',
36
+ 'pinterest_url',
37
+ 'gplus_url',
38
+ 'youtube_url',
39
+ );
40
+ foreach ( $urls as $type ) {
41
+ if ( empty( $input[ $type ] ) ) {
42
+ continue;
43
+ }
44
+ if ( ! preg_match( '/^https?:\/\//', $input[ $type ] ) ) {
45
+ continue;
46
+ }
47
+ $result[ $type ] = $input[ $type ];
48
+ }
49
+
50
+ if ( ! empty( $input['sitename'] ) ) {
51
+ $result['sitename'] = sanitize_text_field( $input['sitename'] );
52
+ }
53
+ if ( ! empty( $input['override_name'] ) ) {
54
+ $result['override_name'] = sanitize_text_field( $input['override_name'] );
55
+ }
56
+ if ( ! empty( $input['organization_name'] ) ) {
57
+ $result['organization_name'] = sanitize_text_field( $input['organization_name'] );
58
+ }
59
+ if ( ! empty( $input['organization_logo'] ) ) {
60
+ $result['organization_logo'] = sanitize_text_field( $input['organization_logo'] );
61
+ }
62
+ if ( ! empty( $input['schema_type'] ) ) {
63
+ $result['schema_type'] = sanitize_text_field( $input['schema_type'] );
64
+ }
65
+ if ( ! empty( $input['twitter_username'] ) ) {
66
+ $result['twitter_username'] = sanitize_text_field( $input['twitter_username'] );
67
+ }
68
+ if ( ! empty( $input['twitter-card-type'] ) ) {
69
+ $result['twitter-card-type'] = sanitize_text_field( $input['twitter-card-type'] );
70
+ }
71
+ if ( ! empty( $input['fb-app-id'] ) ) {
72
+ $result['fb-app-id'] = sanitize_text_field( $input['fb-app-id'] );
73
+ }
74
+
75
+ $result['og-enable'] = ! empty( $input['og-enable'] );
76
+ $result['twitter-card-enable'] = ! empty( $input['twitter-card-enable'] );
77
+
78
+ $this->_toggle_og_globally(
79
+ $result['og-enable']
80
+ );
81
+
82
+ $this->_toggle_twitter_cards_globally(
83
+ $result['twitter-card-enable']
84
+ );
85
+
86
+ if ( ! empty( $input['pinterest-verify'] ) ) {
87
+ $pin = Smartcrawl_Pinterest_Printer::get();
88
+ $raw = trim( $input['pinterest-verify'] );
89
+ $tag = $pin->get_verified_tag( $raw );
90
+ $result['pinterest-verify'] = str_replace( ' ', '', $raw ) === str_replace( ' ', '', $tag ) ? $tag : false;
91
+ $result['pinterest-verification-status'] = str_replace( ' ', '', $raw ) === str_replace( ' ', '', $tag ) ? '' : 'fail';
92
+ } else {
93
+ $result['pinterest-verification-status'] = false;
94
+ }
95
+
96
+ return $result;
97
+ }
98
+
99
+ private function _toggle_og_globally( $new_value ) {
100
+ $this->toggle_setting_globally( 'og-active', $new_value );
101
+ }
102
+
103
+ private function toggle_setting_globally( $prefix, $new_value ) {
104
+ $existing_settings = Smartcrawl_Settings::get_specific_options( 'wds_onpage_options' );
105
+ $strings = array(
106
+ 'home',
107
+ 'author',
108
+ 'date',
109
+ 'search',
110
+ '404',
111
+ 'category',
112
+ 'post_tag',
113
+ 'bp_groups',
114
+ 'bp_profile',
115
+ );
116
+
117
+ foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
118
+ $strings[] = $taxonomy->name;
119
+ }
120
+
121
+ foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
122
+ $strings[] = $post_type;
123
+ }
124
+
125
+ foreach ( smartcrawl_get_archive_post_types() as $archive_post_type ) {
126
+ $strings[] = $archive_post_type;
127
+ }
128
+
129
+ foreach ( $strings as $string ) {
130
+ $existing_settings[ sprintf( '%s-%s', $prefix, $string ) ] = $new_value;
131
+ }
132
+
133
+ Smartcrawl_Settings::update_specific_options( 'wds_onpage_options', $existing_settings );
134
+ }
135
+
136
+ private function _toggle_twitter_cards_globally( $new_value ) {
137
+ $this->toggle_setting_globally( 'twitter-active', $new_value );
138
+ }
139
+
140
+ public function init() {
141
+ $this->option_name = 'wds_social_options';
142
+ $this->name = Smartcrawl_Settings::COMP_SOCIAL;
143
+ $this->slug = Smartcrawl_Settings::TAB_SOCIAL;
144
+ $this->action_url = admin_url( 'options.php' );
145
+ $this->title = __( 'Social', 'wds' );
146
+ $this->page_title = __( 'SmartCrawl Wizard: Social', 'wds' );
147
+
148
+ parent::init();
149
+ }
150
+
151
+ /**
152
+ * Add admin settings page
153
+ */
154
+ public function options_page() {
155
+ parent::options_page();
156
+
157
+ $options = Smartcrawl_Settings::get_component_options( $this->name );
158
+ $options = wp_parse_args(
159
+ ( is_array( $options ) ? $options : array() ),
160
+ $this->get_default_options()
161
+ );
162
+
163
+ $arguments = array(
164
+ 'options' => $options,
165
+ );
166
+ $arguments['active_tab'] = $this->_get_last_active_tab( 'tab_accounts' );
167
+ wp_enqueue_script( 'wds-admin-social' );
168
+ wp_enqueue_media();
169
+
170
+ $this->_render_page( 'social/social-settings', $arguments );
171
+ }
172
+
173
+ /**
174
+ * Gets default options set and their initial values
175
+ *
176
+ * @return array
177
+ */
178
+ public function get_default_options() {
179
+ return array(
180
+ // Accounts
181
+ 'sitename' => get_bloginfo( 'name' ),
182
+ 'disable-schema' => false,
183
+ 'schema_type' => '',
184
+ 'override_name' => '',
185
+ 'organization_name' => '',
186
+ 'organization_logo' => '',
187
+ 'twitter_username' => '',
188
+ 'facebook_url' => '',
189
+ 'instagram_url' => '',
190
+ 'linkedin_url' => '',
191
+ 'pinterest_url' => '',
192
+ 'gplus_url' => '',
193
+ 'youtube_url' => '',
194
+ // Twitter
195
+ 'twitter-card-enable' => false,
196
+ 'twitter-card-type' => '',
197
+ // Pinterest
198
+ 'pinterest-verify' => '',
199
+ // OpenGraph
200
+ 'og-enable' => true,
201
+ // Facebook-specific
202
+ 'fb-app-id' => '',
203
+ );
204
+ }
205
+
206
+ /**
207
+ * Default settings
208
+ */
209
+ public function defaults() {
210
+ $options = Smartcrawl_Settings::get_component_options( $this->name );
211
+ $options = is_array( $options ) ? $options : array();
212
+
213
+ foreach ( $this->get_default_options() as $opt => $default ) {
214
+ if ( ! isset( $options[ $opt ] ) ) {
215
+ $options[ $opt ] = $default;
216
+ }
217
+ }
218
+
219
+ if ( is_multisite() && SMARTCRAWL_SITEWIDE ) {
220
+ update_site_option( $this->option_name, $options );
221
+ } else {
222
+ update_option( $this->option_name, $options );
223
+ }
224
+ }
225
+
226
+ }
227
+
includes/admin/taxonomy.php CHANGED
@@ -1,137 +1,193 @@
1
- <?php
2
-
3
- class Smartcrawl_Taxonomy extends Smartcrawl_Renderable {
4
- protected function _get_view_defaults() {
5
- return array(); }
6
-
7
- public function __construct() {
8
- if ( is_admin() && ! empty( $_GET['taxonomy'] ) ) {
9
- add_action( sanitize_key( $_GET['taxonomy'] ) . '_edit_form', array( &$this, 'term_additions_form' ), 10, 2 );
10
- }
11
-
12
- add_action( 'edit_term', array( &$this, 'update_term' ), 10, 3 );
13
-
14
- }
15
-
16
- public function form_row( $id, $label, $desc, $tax_meta, $type = 'text' ) {
17
- $val = ! empty( $tax_meta[ $id ] ) ? stripslashes( $tax_meta[ $id ] ) : '';
18
-
19
- include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/taxonomy-form-row.php';
20
-
21
- }
22
-
23
- public function term_additions_form( $term, $taxonomy ) {
24
- $smartcrawl_options = Smartcrawl_Settings::get_options();
25
- $tax_meta = get_option( 'wds_taxonomy_meta' );
26
-
27
- if ( isset( $tax_meta[ $taxonomy ][ $term->term_id ] ) ) {
28
- $tax_meta = $tax_meta[ $taxonomy ][ $term->term_id ];
29
- }
30
-
31
- $taxonomy_object = get_taxonomy( $taxonomy );
32
- $taxonomy_labels = $taxonomy_object->labels;
33
-
34
- $global_noindex = ! empty( $smartcrawl_options[ 'meta_robots-noindex-' . $term->taxonomy ] )
35
- ? $smartcrawl_options[ 'meta_robots-noindex-' . $term->taxonomy ]
36
- : false
37
- ;
38
- $global_nofollow = ! empty( $smartcrawl_options[ 'meta_robots-nofollow-' . $term->taxonomy ] )
39
- ? $smartcrawl_options[ 'meta_robots-nofollow-' . $term->taxonomy ]
40
- : false
41
- ;
42
-
43
- $version = Smartcrawl_Loader::get_version();
44
- Smartcrawl_Settings_Admin::enqueue_shared_ui( false );
45
-
46
- wp_enqueue_style( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . '/css/wds-opengraph.css', null, $version );
47
- wp_enqueue_style( 'wds-qtip2-style', SMARTCRAWL_PLUGIN_URL . '/css/external/jquery.qtip.min.css', null, $version );
48
- wp_enqueue_style( 'wds-app', SMARTCRAWL_PLUGIN_URL . 'css/app.css', array( 'wds-qtip2-style' ), $version );
49
-
50
- wp_enqueue_media();
51
-
52
- wp_enqueue_script( 'wds-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin.js', array( 'jquery' ), $version );
53
- wp_enqueue_script( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-opengraph.js', array( 'underscore', 'jquery', 'wds-admin' ), $version );
54
-
55
- include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/term-additions-form.php';
56
-
57
- }
58
-
59
- public function update_term( $term_id, $tt_id, $taxonomy ) {
60
- $smartcrawl_options = Smartcrawl_Settings::get_options();
61
-
62
- $tax_meta = get_option( 'wds_taxonomy_meta' );
63
-
64
- foreach ( array( 'title', 'desc', 'bctitle', 'canonical' ) as $key ) {
65
- $value = isset( $_POST[ "wds_{$key}" ] )
66
- ? $_POST[ "wds_{$key}" ]
67
- : ''
68
- ;
69
- if ( 'canonical' === $key ) {
70
- $value = esc_url_raw( $value );
71
- } else {
72
- $value = sanitize_text_field( $value );
73
- }
74
- $tax_meta[ $taxonomy ][ $term_id ][ "wds_{$key}" ] = $value;
75
- }
76
-
77
- foreach ( array( 'noindex', 'nofollow' ) as $key ) {
78
- $global = ! empty( $smartcrawl_options[ "meta_robots-{$key}-{$taxonomy}" ] ) ? (bool) $smartcrawl_options[ "meta_robots-{$key}-{$taxonomy}" ] : false;
79
-
80
- if ( ! $global ) {
81
- $tax_meta[ $taxonomy ][ $term_id ][ 'wds_' . $key ] = isset( $_POST[ "wds_{$key}" ] )
82
- ? (bool) $_POST[ "wds_{$key}" ]
83
- : false
84
- ;
85
- } else {
86
- $tax_meta[ $taxonomy ][ $term_id ][ "wds_override_{$key}" ] = isset( $_POST[ "wds_override_{$key}" ] )
87
- ? (bool) $_POST[ "wds_override_{$key}" ]
88
- : false
89
- ;
90
- }
91
- }
92
-
93
- if ( ! empty( $_POST['wds-opengraph'] ) ) {
94
- $data = is_array( $_POST['wds-opengraph'] ) ? stripslashes_deep( $_POST['wds-opengraph'] ) : array();
95
- $tax_meta[ $taxonomy ][ $term_id ]['opengraph'] = array();
96
- if ( ! empty( $data['title'] ) ) { $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['title'] = sanitize_text_field( $data['title'] ); }
97
- if ( ! empty( $data['description'] ) ) { $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['description'] = sanitize_text_field( $data['description'] ); }
98
- if ( ! empty( $data['images'] ) && is_array( $data['images'] ) ) {
99
- $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['images'] = array();
100
- foreach ( $data['images'] as $img ) {
101
- $img = esc_url_raw( $img );
102
- $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['images'][] = $img;
103
- }
104
- }
105
- }
106
-
107
- if ( ! empty( $_POST['wds-twitter'] ) ) {
108
- $data = is_array( $_POST['wds-twitter'] ) ? stripslashes_deep( $_POST['wds-twitter'] ) : array();
109
- $tax_meta[ $taxonomy ][ $term_id ]['twitter'] = array();
110
- if ( ! empty( $data['title'] ) ) { $tax_meta[ $taxonomy ][ $term_id ]['twitter']['title'] = sanitize_text_field( $data['title'] ); }
111
- if ( ! empty( $data['description'] ) ) { $tax_meta[ $taxonomy ][ $term_id ]['twitter']['description'] = sanitize_text_field( $data['description'] ); }
112
- if (!empty($data['images']) && is_array($data['images'])) {
113
- $tax_meta[$taxonomy][$term_id]['twitter']['images'] = array();
114
- foreach ($data['images'] as $img) {
115
- $img = esc_url_raw($img);
116
- $tax_meta[$taxonomy][$term_id]['twitter']['images'][] = $img;
117
- }
118
- }
119
- }
120
-
121
- update_option( 'wds_taxonomy_meta', $tax_meta );
122
-
123
- if ( function_exists( 'w3tc_flush_all' ) ) {
124
- // Use W3TC API v0.9.5+
125
- w3tc_flush_all();
126
- } elseif ( defined( 'W3TC_DIR' ) && is_readable( W3TC_DIR . '/lib/W3/ObjectCache.php' ) ) {
127
- // Old (very old) API
128
- require_once W3TC_DIR . '/lib/W3/ObjectCache.php';
129
- $w3_objectcache = & W3_ObjectCache::instance();
130
-
131
- $w3_objectcache->flush();
132
- }
133
-
134
- }
135
- }
136
-
137
- $smartcrawl_taxonomy = new Smartcrawl_Taxonomy();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Smartcrawl_Taxonomy extends Smartcrawl_Renderable {
4
+ /**
5
+ * Static instance
6
+ *
7
+ * @var Smartcrawl_Taxonomy
8
+ */
9
+ private static $_instance;
10
+ /**
11
+ * State flag
12
+ *
13
+ * @var bool
14
+ */
15
+ private $_is_running = false;
16
+
17
+ public function __construct() {
18
+ }
19
+
20
+ /**
21
+ * Boot the hooking part
22
+ */
23
+ public static function run() {
24
+ self::get()->_add_hooks();
25
+ }
26
+
27
+ public function _add_hooks() {
28
+ if ( $this->_is_running ) {
29
+ return false;
30
+ }
31
+
32
+ $taxonomy = smartcrawl_get_array_value( $_GET, 'taxonomy' ); // phpcs:ignore -- Can't add nonce to the request
33
+ if ( is_admin() && ! empty( $taxonomy ) ) {
34
+ add_action( sanitize_key( $taxonomy ) . '_edit_form', array(
35
+ &$this,
36
+ 'term_additions_form',
37
+ ), 10, 2 );
38
+ }
39
+
40
+ add_action( 'edit_term', array( &$this, 'update_term' ), 10, 3 );
41
+
42
+ $this->_is_running = true;
43
+ }
44
+
45
+ /**
46
+ * Static instance getter
47
+ */
48
+ public static function get() {
49
+ if ( empty( self::$_instance ) ) {
50
+ self::$_instance = new self();
51
+ }
52
+
53
+ return self::$_instance;
54
+ }
55
+
56
+ public function form_row( $id, $label, $desc, $tax_meta, $type = 'text' ) {
57
+ $val = ! empty( $tax_meta[ $id ] ) ? stripslashes( $tax_meta[ $id ] ) : '';
58
+
59
+ include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/taxonomy-form-row.php';
60
+
61
+ }
62
+
63
+ public function term_additions_form( $term, $taxonomy ) {
64
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
65
+ $tax_meta = get_option( 'wds_taxonomy_meta' );
66
+
67
+ if ( isset( $tax_meta[ $taxonomy ][ $term->term_id ] ) ) {
68
+ $tax_meta = $tax_meta[ $taxonomy ][ $term->term_id ];
69
+ }
70
+
71
+ $taxonomy_object = get_taxonomy( $taxonomy );
72
+ $taxonomy_labels = $taxonomy_object->labels;
73
+
74
+ $global_noindex = ! empty( $smartcrawl_options[ 'meta_robots-noindex-' . $term->taxonomy ] )
75
+ ? $smartcrawl_options[ 'meta_robots-noindex-' . $term->taxonomy ]
76
+ : false;
77
+ $global_nofollow = ! empty( $smartcrawl_options[ 'meta_robots-nofollow-' . $term->taxonomy ] )
78
+ ? $smartcrawl_options[ 'meta_robots-nofollow-' . $term->taxonomy ]
79
+ : false;
80
+
81
+ $version = Smartcrawl_Loader::get_version();
82
+ Smartcrawl_Settings_Admin::enqueue_shared_ui( false );
83
+
84
+ wp_enqueue_style( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . '/css/wds-opengraph.css', null, $version );
85
+ wp_enqueue_style( 'wds-qtip2-style', SMARTCRAWL_PLUGIN_URL . '/css/external/jquery.qtip.min.css', null, $version );
86
+ wp_enqueue_style( 'wds-app', SMARTCRAWL_PLUGIN_URL . 'css/app.css', array( 'wds-qtip2-style' ), $version );
87
+
88
+ wp_enqueue_media();
89
+
90
+ wp_enqueue_script( 'wds-admin', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin.js', array( 'jquery' ), $version );
91
+
92
+ wp_localize_script( 'wds-admin', '_wds_admin', array(
93
+ 'nonce' => wp_create_nonce( 'wds-admin-nonce' ),
94
+ ) );
95
+ wp_enqueue_script( 'wds-admin-opengraph', SMARTCRAWL_PLUGIN_URL . 'js/wds-admin-opengraph.js', array(
96
+ 'underscore',
97
+ 'jquery',
98
+ 'wds-admin',
99
+ ), $version );
100
+
101
+ include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/term-additions-form.php';
102
+
103
+ }
104
+
105
+ public function update_term( $term_id, $tt_id, $taxonomy ) {
106
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
107
+
108
+ $tax_meta = get_option( 'wds_taxonomy_meta' );
109
+ $post_data = isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'update-tag_' . $term_id )
110
+ ? stripslashes_deep( $_POST )
111
+ : array();
112
+
113
+ foreach ( array( 'title', 'desc', 'bctitle', 'canonical' ) as $key ) {
114
+ $value = isset( $post_data["wds_{$key}"] )
115
+ ? $post_data["wds_{$key}"]
116
+ : '';
117
+ if ( 'canonical' === $key ) {
118
+ $value = esc_url_raw( $value );
119
+ } else {
120
+ $value = sanitize_text_field( $value );
121
+ }
122
+ $tax_meta[ $taxonomy ][ $term_id ]["wds_{$key}"] = $value;
123
+ }
124
+
125
+ foreach ( array( 'noindex', 'nofollow' ) as $key ) {
126
+ $global = ! empty( $smartcrawl_options["meta_robots-{$key}-{$taxonomy}"] ) ? (bool) $smartcrawl_options["meta_robots-{$key}-{$taxonomy}"] : false;
127
+
128
+ if ( ! $global ) {
129
+ $tax_meta[ $taxonomy ][ $term_id ][ 'wds_' . $key ] = isset( $post_data["wds_{$key}"] )
130
+ ? (bool) $post_data["wds_{$key}"]
131
+ : false;
132
+ } else {
133
+ $tax_meta[ $taxonomy ][ $term_id ]["wds_override_{$key}"] = isset( $post_data["wds_override_{$key}"] )
134
+ ? (bool) $post_data["wds_override_{$key}"]
135
+ : false;
136
+ }
137
+ }
138
+
139
+ if ( ! empty( $post_data['wds-opengraph'] ) ) {
140
+ $data = is_array( $post_data['wds-opengraph'] ) ? stripslashes_deep( $post_data['wds-opengraph'] ) : array();
141
+ $tax_meta[ $taxonomy ][ $term_id ]['opengraph'] = array();
142
+ if ( ! empty( $data['title'] ) ) {
143
+ $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['title'] = sanitize_text_field( $data['title'] );
144
+ }
145
+ if ( ! empty( $data['description'] ) ) {
146
+ $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['description'] = sanitize_text_field( $data['description'] );
147
+ }
148
+ if ( ! empty( $data['images'] ) && is_array( $data['images'] ) ) {
149
+ $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['images'] = array();
150
+ foreach ( $data['images'] as $img ) {
151
+ $img = esc_url_raw( $img );
152
+ $tax_meta[ $taxonomy ][ $term_id ]['opengraph']['images'][] = $img;
153
+ }
154
+ }
155
+ }
156
+
157
+ if ( ! empty( $post_data['wds-twitter'] ) ) {
158
+ $data = is_array( $post_data['wds-twitter'] ) ? stripslashes_deep( $post_data['wds-twitter'] ) : array();
159
+ $tax_meta[ $taxonomy ][ $term_id ]['twitter'] = array();
160
+ if ( ! empty( $data['title'] ) ) {
161
+ $tax_meta[ $taxonomy ][ $term_id ]['twitter']['title'] = sanitize_text_field( $data['title'] );
162
+ }
163
+ if ( ! empty( $data['description'] ) ) {
164
+ $tax_meta[ $taxonomy ][ $term_id ]['twitter']['description'] = sanitize_text_field( $data['description'] );
165
+ }
166
+ if ( ! empty( $data['images'] ) && is_array( $data['images'] ) ) {
167
+ $tax_meta[ $taxonomy ][ $term_id ]['twitter']['images'] = array();
168
+ foreach ( $data['images'] as $img ) {
169
+ $img = esc_url_raw( $img );
170
+ $tax_meta[ $taxonomy ][ $term_id ]['twitter']['images'][] = $img;
171
+ }
172
+ }
173
+ }
174
+
175
+ update_option( 'wds_taxonomy_meta', $tax_meta );
176
+
177
+ if ( function_exists( 'w3tc_flush_all' ) ) {
178
+ // Use W3TC API v0.9.5+
179
+ w3tc_flush_all();
180
+ } elseif ( defined( 'W3TC_DIR' ) && is_readable( W3TC_DIR . '/lib/W3/ObjectCache.php' ) ) {
181
+ // Old (very old) API
182
+ require_once W3TC_DIR . '/lib/W3/ObjectCache.php';
183
+ $w3_objectcache = &W3_ObjectCache::instance();
184
+
185
+ $w3_objectcache->flush();
186
+ }
187
+
188
+ }
189
+
190
+ protected function _get_view_defaults() {
191
+ return array();
192
+ }
193
+ }
includes/admin/templates/_forms/autolinks.php CHANGED
@@ -1,10 +1,12 @@
1
- <?php
2
- $autolinks_enabled = $autolinks_network_enabled && $autolinks_locally_enabled;
3
- $form_action = $autolinks_enabled ? $_view['action_url'] : '';
4
- ?>
5
- <form action='<?php echo esc_attr( $form_action ); ?>' method='post' class="wds-form">
6
- <?php if ( $autolinks_enabled ) : ?>
7
- <?php settings_fields( $_view['option_name'] ); ?>
8
-
9
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1">
10
- <?php endif; ?>
 
 
1
+ <?php
2
+ $autolinks_enabled = $autolinks_network_enabled && $autolinks_locally_enabled;
3
+ $form_action = $autolinks_enabled ? $_view['action_url'] : '';
4
+ ?>
5
+ <form action='<?php echo esc_attr( $form_action ); ?>' method='post' class="wds-form">
6
+ <?php if ( $autolinks_enabled ) : ?>
7
+ <?php settings_fields( $_view['option_name'] ); ?>
8
+
9
+ <input type="hidden"
10
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
11
+ value="1">
12
+ <?php endif; ?>
includes/admin/templates/_forms/import-export.php CHANGED
@@ -1,4 +1,6 @@
1
- <form method='post' enctype="multipart/form-data" class="wds-form">
2
- <?php settings_fields( $_view['option_name'] ); ?>
3
-
4
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1"/>
 
 
1
+ <form method='post' enctype="multipart/form-data" class="wds-form">
2
+ <?php settings_fields( $_view['option_name'] ); ?>
3
+
4
+ <input type="hidden"
5
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
6
+ value="1"/>
includes/admin/templates/_forms/settings.php CHANGED
@@ -1,4 +1,6 @@
1
- <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
2
- <?php settings_fields( $_view['option_name'] ); ?>
3
-
4
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1"/>
 
 
1
+ <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
2
+ <?php settings_fields( $_view['option_name'] ); ?>
3
+
4
+ <input type="hidden"
5
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
6
+ value="1"/>
includes/admin/templates/advanced-tools/advanced-section-automatic-linking-settings.php CHANGED
@@ -1,79 +1,88 @@
1
- <?php
2
- /**
3
- * Automatic links settings template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $additional_settings = empty( $additional_settings ) ? array() : $additional_settings;
9
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
10
- ?>
11
-
12
- <div class="wds-table-fields wds-separator-top">
13
- <div class="label">
14
- <label class="wds-label"><?php _e( 'Min lengths', 'wds' ); ?></label>
15
- <p class="wds-label-description"><?php _e( 'Define the shortest title and taxonomy length to autolink. Smaller titles will be ignored.', 'wds' ); ?></p>
16
- </div>
17
-
18
- <div class="fields">
19
- <div class="row">
20
- <div class="wds-table-fields wds-table-fields-stacked col-half">
21
- <div class="label">
22
- <label for="cpt_char_limit" class="wds-label"><?php esc_html_e( 'Posts & pages' , 'wds' ); ?></label>
23
- </div>
24
- <div class="fields wds-allow-macros">
25
- <input id='cpt_char_limit' name='<?php echo esc_attr( $option_name ); ?>[cpt_char_limit]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['cpt_char_limit'] ); ?>'>
26
- </div>
27
- </div>
28
-
29
- <div class="wds-table-fields wds-table-fields-stacked col-half">
30
- <div class="label">
31
- <label for="tax_char_limit" class="wds-label"><?php esc_html_e( 'Archives & taxonomies' , 'wds' ); ?></label>
32
- </div>
33
- <div class="fields wds-allow-macros">
34
- <input id='tax_char_limit' name='<?php echo esc_attr( $option_name ); ?>[tax_char_limit]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['tax_char_limit'] ); ?>'>
35
- </div>
36
- </div>
37
- </div>
38
- <p class="wds-label-description"><?php _e( 'We recommend a minimum of 10 chars for each type.', 'wds' ); ?></p>
39
- </div>
40
- </div>
41
-
42
- <div class="wds-table-fields wds-separator-top">
43
- <div class="label">
44
- <label class="wds-label"><?php _e( 'Max limits', 'wds' ); ?></label>
45
- <p class="wds-label-description"><?php _e( 'Set the max amount of links you want to appear per post.', 'wds' ); ?></p>
46
- </div>
47
-
48
- <div class="fields">
49
- <div class="row">
50
- <div class="wds-table-fields wds-table-fields-stacked col-half">
51
- <div class="label">
52
- <label for="link_limit" class="wds-label"><?php esc_html_e( 'Per post total' , 'wds' ); ?></label>
53
- </div>
54
- <div class="fields wds-allow-macros">
55
- <input id='link_limit' name='<?php echo esc_attr( $option_name ); ?>[link_limit]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['link_limit'] ); ?>'>
56
- </div>
57
- </div>
58
-
59
- <div class="wds-table-fields wds-table-fields-stacked col-half">
60
- <div class="label">
61
- <label for="single_link_limit" class="wds-label"><?php esc_html_e( 'Per keyword group' , 'wds' ); ?></label>
62
- </div>
63
- <div class="fields wds-allow-macros">
64
- <input id='single_link_limit' name='<?php echo esc_attr( $option_name ); ?>[single_link_limit]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['single_link_limit'] ); ?>'>
65
- </div>
66
- </div>
67
- </div>
68
- <p class="wds-label-description"><?php _e( 'Use 0 to allow unlimited automatic links.', 'wds' ); ?></p>
69
- </div>
70
- </div>
71
-
72
- <?php
73
- $this->_render('toggle-group', array(
74
- 'label' => __( 'Optional Settings', 'wds' ),
75
- 'description' => __( 'Configure extra settings for absolute control over autolinking.', 'wds' ),
76
- 'items' => $additional_settings,
77
- 'separator' => true,
78
- ));
79
- ?>
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Automatic links settings template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $additional_settings = empty( $additional_settings ) ? array() : $additional_settings;
9
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
10
+ ?>
11
+
12
+ <div class="wds-table-fields wds-separator-top">
13
+ <div class="label">
14
+ <label class="wds-label"><?php esc_html_e( 'Min lengths', 'wds' ); ?></label>
15
+ <p class="wds-label-description"><?php esc_html_e( 'Define the shortest title and taxonomy length to autolink. Smaller titles will be ignored.', 'wds' ); ?></p>
16
+ </div>
17
+
18
+ <div class="fields">
19
+ <div class="row">
20
+ <div class="wds-table-fields wds-table-fields-stacked col-half">
21
+ <div class="label">
22
+ <label for="cpt_char_limit" class="wds-label"><?php esc_html_e( 'Posts & pages', 'wds' ); ?></label>
23
+ </div>
24
+ <div class="fields wds-allow-macros">
25
+ <input id='cpt_char_limit' name='<?php echo esc_attr( $option_name ); ?>[cpt_char_limit]'
26
+ type='text' class='wds-field'
27
+ value='<?php echo esc_attr( $_view['options']['cpt_char_limit'] ); ?>'>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="wds-table-fields wds-table-fields-stacked col-half">
32
+ <div class="label">
33
+ <label for="tax_char_limit"
34
+ class="wds-label"><?php esc_html_e( 'Archives & taxonomies', 'wds' ); ?></label>
35
+ </div>
36
+ <div class="fields wds-allow-macros">
37
+ <input id='tax_char_limit' name='<?php echo esc_attr( $option_name ); ?>[tax_char_limit]'
38
+ type='text' class='wds-field'
39
+ value='<?php echo esc_attr( $_view['options']['tax_char_limit'] ); ?>'>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <p class="wds-label-description"><?php esc_html_e( 'We recommend a minimum of 10 chars for each type.', 'wds' ); ?></p>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="wds-table-fields wds-separator-top">
48
+ <div class="label">
49
+ <label class="wds-label"><?php esc_html_e( 'Max limits', 'wds' ); ?></label>
50
+ <p class="wds-label-description"><?php esc_html_e( 'Set the max amount of links you want to appear per post.', 'wds' ); ?></p>
51
+ </div>
52
+
53
+ <div class="fields">
54
+ <div class="row">
55
+ <div class="wds-table-fields wds-table-fields-stacked col-half">
56
+ <div class="label">
57
+ <label for="link_limit" class="wds-label"><?php esc_html_e( 'Per post total', 'wds' ); ?></label>
58
+ </div>
59
+ <div class="fields wds-allow-macros">
60
+ <input id='link_limit' name='<?php echo esc_attr( $option_name ); ?>[link_limit]' type='text'
61
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['link_limit'] ); ?>'>
62
+ </div>
63
+ </div>
64
+
65
+ <div class="wds-table-fields wds-table-fields-stacked col-half">
66
+ <div class="label">
67
+ <label for="single_link_limit"
68
+ class="wds-label"><?php esc_html_e( 'Per keyword group', 'wds' ); ?></label>
69
+ </div>
70
+ <div class="fields wds-allow-macros">
71
+ <input id='single_link_limit' name='<?php echo esc_attr( $option_name ); ?>[single_link_limit]'
72
+ type='text' class='wds-field'
73
+ value='<?php echo esc_attr( $_view['options']['single_link_limit'] ); ?>'>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ <p class="wds-label-description"><?php esc_html_e( 'Use 0 to allow unlimited automatic links.', 'wds' ); ?></p>
78
+ </div>
79
+ </div>
80
+
81
+ <?php
82
+ $this->_render( 'toggle-group', array(
83
+ 'label' => __( 'Optional Settings', 'wds' ),
84
+ 'description' => __( 'Configure extra settings for absolute control over autolinking.', 'wds' ),
85
+ 'items' => $additional_settings,
86
+ 'separator' => true,
87
+ ) );
88
+ ?>
includes/admin/templates/advanced-tools/advanced-section-automatic-linking.php CHANGED
@@ -1,57 +1,64 @@
1
- <?php
2
- $insert = empty( $insert ) ? array() : $insert;
3
- $linkto = empty( $linkto ) ? array() : $linkto;
4
- ?>
5
-
6
- <div class="wds-automatic-linking">
7
- <div class="cf">
8
- <div class="wds-automatic-linking-insert-links">
9
- <?php
10
- $this->_render('toggle-group', array(
11
- 'label' => __( 'Insert Links', 'wds' ),
12
- 'description' => __( 'Specify what post types to insert links into.', 'wds' ),
13
- 'items' => $insert,
14
- ));
15
- ?>
16
- </div>
17
-
18
- <div class="wds-automatic-linking-link-to">
19
- <?php
20
- $this->_render('toggle-group', array(
21
- 'label' => __( 'Link to', 'wds' ),
22
- 'description' => __( 'Choose content you want to convert to links.', 'wds' ),
23
- 'items' => $linkto,
24
- ));
25
- ?>
26
- </div>
27
- </div>
28
-
29
- <div class="wds-table-fields wds-separator-top">
30
- <label class="wds-label"><?php _e( 'Custom keywords', 'wds' ); ?></label>
31
- <p class="wds-label-description"><?php _e( 'Choose additional keywords you want to auto-link and tell SmartCrawl where to link to. Add as many as you like.', 'wds' ); ?></p>
32
- </div>
33
-
34
- <div class="box-autolinks-custom-keywords-settings">
35
- <div class="wds-replaceable">
36
- <div class="group wds-group wds-group-field">
37
- <label for="customkey" class="wds-label"><?php esc_html_e( 'Custom Keywords' , 'wds' ); ?></label>
38
- <textarea id='customkey' name='<?php echo esc_attr( $_view['option_name'] ); ?>[customkey]' class='wds-textarea'><?php
39
- echo esc_textarea( $_view['options']['customkey'] );
40
- ?></textarea>
41
- </div>
42
- </div>
43
- </div>
44
-
45
- <div class="wds-table-fields wds-separator-top">
46
- <label for="ignore" class="wds-label"><?php esc_html_e( 'Exclusions' , 'wds' ); ?></label>
47
- <p class="wds-label-description"><?php esc_html_e( 'Provide a comma-separated list of keywords that you would like to exclude. You can also select individual posts for exclusion.' , 'wds' ); ?></p>
48
- <input id='ignore' name='<?php echo esc_attr( $_view['option_name'] ); ?>[ignore]' size='' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['ignore'] ); ?>'>
49
- </div>
50
- <div class="group wds-group wds-group-field">
51
- <div class="wds-replaceable">
52
- <label for="ignorepost" class="wds-label"><?php esc_html_e( 'Exclude Posts, Pages & CPTs' , 'wds' ); ?></label>
53
- <input id='ignorepost' name='<?php echo esc_attr( $_view['option_name'] ); ?>[ignorepost]' size='' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['ignorepost'] ); ?>'>
54
- <span class="wds-field-legend"><?php esc_html_e( 'Paste in the IDs, slugs or titles for the post/pages you wish to exclude and separate them by commas' , 'wds' ); ?></span>
55
- </div>
56
- </div>
57
- </div>
 
 
 
 
 
 
 
1
+ <?php
2
+ $insert = empty( $insert ) ? array() : $insert;
3
+ $linkto = empty( $linkto ) ? array() : $linkto;
4
+ ?>
5
+
6
+ <div class="wds-automatic-linking">
7
+ <div class="cf">
8
+ <div class="wds-automatic-linking-insert-links">
9
+ <?php
10
+ $this->_render( 'toggle-group', array(
11
+ 'label' => __( 'Insert Links', 'wds' ),
12
+ 'description' => __( 'Specify what post types to insert links into.', 'wds' ),
13
+ 'items' => $insert,
14
+ ) );
15
+ ?>
16
+ </div>
17
+
18
+ <div class="wds-automatic-linking-link-to">
19
+ <?php
20
+ $this->_render( 'toggle-group', array(
21
+ 'label' => __( 'Link to', 'wds' ),
22
+ 'description' => __( 'Choose content you want to convert to links.', 'wds' ),
23
+ 'items' => $linkto,
24
+ ) );
25
+ ?>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="wds-table-fields wds-separator-top">
30
+ <label class="wds-label"><?php esc_html_e( 'Custom keywords', 'wds' ); ?></label>
31
+ <p class="wds-label-description"><?php esc_html_e( 'Choose additional keywords you want to auto-link and tell SmartCrawl where to link to. Add as many as you like.', 'wds' ); ?></p>
32
+ </div>
33
+
34
+ <div class="box-autolinks-custom-keywords-settings">
35
+ <div class="wds-replaceable">
36
+ <div class="group wds-group wds-group-field">
37
+ <label for="customkey" class="wds-label"><?php esc_html_e( 'Custom Keywords', 'wds' ); ?></label>
38
+ <?php // phpcs:disable ?>
39
+ <textarea id='customkey' name='<?php echo esc_attr( $_view['option_name'] ); ?>[customkey]'
40
+ class='wds-textarea'><?php
41
+ echo esc_textarea( $_view['options']['customkey'] );
42
+ ?></textarea>
43
+ <?php // phpcs:enable ?>
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="wds-table-fields wds-separator-top">
49
+ <label for="ignore" class="wds-label"><?php esc_html_e( 'Exclusions', 'wds' ); ?></label>
50
+ <p class="wds-label-description"><?php esc_html_e( 'Provide a comma-separated list of keywords that you would like to exclude. You can also select individual posts for exclusion.', 'wds' ); ?></p>
51
+ <input id='ignore' name='<?php echo esc_attr( $_view['option_name'] ); ?>[ignore]' size='' type='text'
52
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['ignore'] ); ?>'>
53
+ </div>
54
+ <div class="group wds-group wds-group-field">
55
+ <div class="wds-replaceable">
56
+ <label for="ignorepost"
57
+ class="wds-label"><?php esc_html_e( 'Exclude Posts, Pages & CPTs', 'wds' ); ?></label>
58
+ <input id='ignorepost' name='<?php echo esc_attr( $_view['option_name'] ); ?>[ignorepost]' size=''
59
+ type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['ignorepost'] ); ?>'>
60
+ <span
61
+ class="wds-field-legend"><?php esc_html_e( 'Paste in the IDs, slugs or titles for the post/pages you wish to exclude and separate them by commas', 'wds' ); ?></span>
62
+ </div>
63
+ </div>
64
+ </div>
includes/admin/templates/advanced-tools/advanced-section-moz.php CHANGED
@@ -1,62 +1,69 @@
1
- <?php
2
- $smartcrawl_options = Smartcrawl_Settings::get_options();
3
- $access_id = empty( $smartcrawl_options['access-id'] ) ? '' : $smartcrawl_options['access-id'];
4
- $secret_key = empty( $smartcrawl_options['secret-key'] ) ? '' : $smartcrawl_options['secret-key'];
5
- ?>
6
-
7
- <?php if ( empty( $access_id ) || empty( $secret_key ) ) : ?>
8
- <div class="wds-disabled-component">
9
- <p>
10
- <img src="<?php echo SMARTCRAWL_PLUGIN_URL; ?>/images/<?php echo esc_attr( 'moz-disabled.png' ); ?>" alt="<?php esc_html_e( '', 'wds' ); ?>" class="wds-disabled-image"/>
11
- </p>
12
- <p><?php _e( 'Moz provides reports that tell you how your site stacks up against the competition with all of the important SEO measurement tools - ranking, links, and much more.', 'wds' ); ?></p>
13
- </div>
14
- <div class="wds-moz-api-credentials">
15
- <p>
16
- <?php
17
- printf(
18
- __( 'Connect your Moz account. You can get the API credentials %s.', 'wds' ),
19
- sprintf( '<a href="https://moz.com/products/api">%s</a>', __( 'here', 'wds' ) )
20
- );
21
- ?>
22
- </p>
23
- <form method="POST" class="wds-form">
24
- <div class="row">
25
- <div class="col-half wds-table-fields wds-table-fields-stacked">
26
- <div class="label">
27
- <label class="wds-label" for="wds-moz-access-id"><?php _e( 'Access ID', 'wds' ); ?></label>
28
- </div>
29
- <div class="fields">
30
- <input
31
- type="text"
32
- id="wds-moz-access-id"
33
- name="wds-moz-access-id"
34
- placeholder="<?php _e( 'Enter your Moz Access ID', 'wds' ); ?>"
35
- value="<?php echo esc_attr( $access_id ); ?>" />
36
- </div>
37
- </div>
38
-
39
- <div class="col-half wds-table-fields wds-table-fields-stacked">
40
- <div class="label">
41
- <label class="wds-label" for="wds-moz-secret-key"><?php _e( 'Secret Key', 'wds' ); ?></label>
42
- </div>
43
- <div class="fields">
44
- <input
45
- type="text"
46
- id="wds-moz-secret-key"
47
- name="wds-moz-secret-key"
48
- placeholder="<?php _e( 'Enter your Moz Secret Key', 'wds' ); ?>"
49
- value="<?php echo esc_attr( $secret_key ); ?>" />
50
- </div>
51
- </div>
52
- </div>
53
- <input name='submit' type='submit' class='button' value='<?php _e( 'Connect', 'wds' ); ?>'/>
54
- </form>
55
- </div>
56
- <?php else : ?>
57
- <p class="wds-content-tabs-description">
58
- <?php _e( 'Here’s how your site stacks up against the competition as defined by Moz. You can also see individual stats per post in the post editor under the Moz module.', 'wds' ); ?>
59
- </p>
60
- <button type="submit" class="button button-small button-dark button-dark-o" name="reset-moz-credentials" value="1"><?php esc_html_e( 'Reset API Credentials', 'wds' ); ?></button>
61
- <?php Smartcrawl_Seomoz_Dashboard_Widget::widget(); ?>
62
- <?php endif; ?>
 
 
 
 
 
 
 
1
+ <?php
2
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
3
+ $access_id = empty( $smartcrawl_options['access-id'] ) ? '' : $smartcrawl_options['access-id'];
4
+ $secret_key = empty( $smartcrawl_options['secret-key'] ) ? '' : $smartcrawl_options['secret-key'];
5
+ ?>
6
+
7
+ <?php if ( empty( $access_id ) || empty( $secret_key ) ) : ?>
8
+ <div class="wds-disabled-component">
9
+ <p>
10
+ <img
11
+ src="<?php echo esc_attr( SMARTCRAWL_PLUGIN_URL ); ?>/images/<?php echo esc_attr( 'moz-disabled.png' ); ?>"
12
+ alt="<?php esc_attr_e( 'MOZ Disabled', 'wds' ); ?>" class="wds-disabled-image"/>
13
+ </p>
14
+ <p><?php esc_html_e( 'Moz provides reports that tell you how your site stacks up against the competition with all of the important SEO measurement tools - ranking, links, and much more.', 'wds' ); ?></p>
15
+ </div>
16
+ <div class="wds-moz-api-credentials">
17
+ <p>
18
+ <?php
19
+ printf(
20
+ esc_html__( 'Connect your Moz account. You can get the API credentials %s.', 'wds' ),
21
+ sprintf( '<a href="https://moz.com/products/api" target="_blank">%s</a>', esc_html__( 'here', 'wds' ) )
22
+ );
23
+ ?>
24
+ </p>
25
+ <form method="POST" class="wds-form">
26
+ <div class="row">
27
+ <div class="col-half wds-table-fields wds-table-fields-stacked">
28
+ <div class="label">
29
+ <label class="wds-label"
30
+ for="wds-moz-access-id"><?php esc_html_e( 'Access ID', 'wds' ); ?></label>
31
+ </div>
32
+ <div class="fields">
33
+ <input
34
+ type="text"
35
+ id="wds-moz-access-id"
36
+ name="wds-moz-access-id"
37
+ placeholder="<?php esc_attr_e( 'Enter your Moz Access ID', 'wds' ); ?>"
38
+ value="<?php echo esc_attr( $access_id ); ?>"/>
39
+ </div>
40
+ </div>
41
+
42
+ <div class="col-half wds-table-fields wds-table-fields-stacked">
43
+ <div class="label">
44
+ <label class="wds-label"
45
+ for="wds-moz-secret-key"><?php esc_html_e( 'Secret Key', 'wds' ); ?></label>
46
+ </div>
47
+ <div class="fields">
48
+ <input
49
+ type="text"
50
+ id="wds-moz-secret-key"
51
+ name="wds-moz-secret-key"
52
+ placeholder="<?php esc_attr_e( 'Enter your Moz Secret Key', 'wds' ); ?>"
53
+ value="<?php echo esc_attr( $secret_key ); ?>"/>
54
+ </div>
55
+ </div>
56
+ <?php wp_nonce_field( 'wds-settings-nonce', '_wds_nonce' ); ?>
57
+ </div>
58
+ <input name='submit' type='submit' class='button' value='<?php esc_attr_e( 'Connect', 'wds' ); ?>'/>
59
+ </form>
60
+ </div>
61
+ <?php else : ?>
62
+ <p class="wds-content-tabs-description">
63
+ <?php esc_html_e( 'Here’s how your site stacks up against the competition as defined by Moz. You can also see individual stats per post in the post editor under the Moz module.', 'wds' ); ?>
64
+ </p>
65
+ <button type="submit" class="button button-small button-dark button-dark-o" name="reset-moz-credentials"
66
+ value="1"><?php esc_html_e( 'Reset API Credentials', 'wds' ); ?></button>
67
+ <?php wp_nonce_field( 'wds-autolinks-nonce', '_wds_nonce' ); ?>
68
+ <?php Smartcrawl_Seomoz_Dashboard_Widget::widget(); ?>
69
+ <?php endif; ?>
includes/admin/templates/advanced-tools/advanced-section-redirects.php CHANGED
@@ -1,106 +1,109 @@
1
- <?php
2
- $redirections = empty( $redirections ) ? array() : $redirections;
3
- $types = empty( $types ) ? array() : $types;
4
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
5
- $plugin_settings = Smartcrawl_Settings::get_specific_options( 'wds_settings_options' );
6
- ?>
7
-
8
- <div class="wds-redirect-attachments wds-separator-top">
9
- <?php
10
- $this->_render('toggle-group', array(
11
- 'label' => __( 'Redirect attachments', 'wds' ),
12
- 'description' => __( 'Redirect attachments to their parent post, preventing them from appearing in SERPs.', 'wds' ),
13
- 'items' => array(
14
- 'redirect-attachments' => __( 'Redirect attachments', 'wds' ),
15
- 'redirect-attachments-images_only' => __( '... but only if the attachment is image', 'wds' ),
16
- ),
17
- ));
18
- ?>
19
- </div>
20
-
21
- <div class="wds-table-fields wds-separator-top">
22
- <div class="label">
23
- <label class="wds-label" for="wds-default-redirection-type">
24
- <?php esc_html_e( 'Default Redirection Type', 'wds' ); ?>
25
- </label>
26
- <p class="wds-label-description">
27
- <?php esc_html_e( 'Select the redirection type that you would like to be used as default.', 'wds' ); ?>
28
- </p>
29
- </div>
30
- <div class="fields">
31
- <select id="wds-default-redirection-type"
32
- name="<?php echo esc_attr( $option_name ); ?>[redirections-code]"
33
- autocomplete="off"
34
- class="select-container"
35
- style="width: 100%">
36
- <?php foreach ( array( 301 => __( 'Permanent (301)', 'wds' ), 302 => __( 'Temporary (302)', 'wds' ) ) as $redirection_type => $redirection_type_label ) : ?>
37
- <?php
38
- $current_redirection_code = smartcrawl_get_array_value( $plugin_settings, 'redirections-code' );
39
- $selected = selected( $redirection_type, $current_redirection_code, false );
40
- ?>
41
-
42
- <option value="<?php echo esc_attr( $redirection_type ); ?>" <?php echo $selected; ?>>
43
- <?php echo esc_html( $redirection_type_label ); ?>
44
- </option>
45
- <?php endforeach; ?>
46
- </select>
47
- </div>
48
- </div>
49
-
50
- <input type="hidden" value="1" name="<?php echo esc_attr( $option_name ); ?>[save_redirects]" />
51
- <div class="wds-redirects wds-separator-top">
52
- <label class="wds-label"><?php esc_html_e( 'Redirects', 'wds' ); ?></label>
53
- <p class="wds-small-text">
54
- <?php esc_html_e( 'Adding entries here will set up a redirect from one URL to another.', 'wds' ); ?>
55
- </p>
56
- <p class="wds-small-text">
57
- <?php esc_html_e( 'Formats include relative (E.g. /cats) or absolute URLs (E.g. www.website.com/cats or https://website.com/cats).', 'wds' ); ?>
58
- </p>
59
- <div class="wds-redirects-buttons-top">
60
- <button class="wds-bulk-update button button-small button-dark"><?php esc_html_e( 'Bulk Update', 'wds' ); ?></button>
61
- <button class="wds-bulk-remove button button-small button-dark-o"><?php esc_html_e( 'Remove Redirects', 'wds' ); ?></button>
62
- </div>
63
- <div class="wds-notice wds-notice-warning wds-redirects-unsaved-notice">
64
- <p><?php esc_html_e( "You've made changes to your Sitemap structure. You need to save the changes to make them live.", 'wds' ); ?></p>
65
- </div>
66
- <table class="wds-redirects-table wds-list-table">
67
- <thead>
68
- <tr>
69
- <th class="selector"><input type="checkbox" class="wds-checkbox" autocomplete="off" title=""/></th>
70
- <th class="source"><?php esc_html_e( 'Old URL', 'wds' ); ?></th>
71
- <th class="destination"><?php esc_html_e( 'New URL', 'wds' ); ?></th>
72
- <th class="type" colspan="2"><?php esc_html_e( 'Redirect Type', 'wds' ); ?></th>
73
- </tr>
74
- </thead>
75
- <tbody>
76
- <?php
77
- $redirection_index = 0;
78
- ?>
79
- <?php foreach ( $redirections as $source => $destination ) : ?>
80
- <?php
81
- $type = ! empty( $types[ $source ] ) ? $types[ $source ] : '';
82
-
83
- $this->_render('advanced-tools/advanced-tools-redirect-item', array(
84
- 'source' => esc_attr( $source ),
85
- 'destination' => esc_attr( $destination ),
86
- 'index' => esc_attr( $redirection_index ),
87
- 'string_permanent' => esc_html__( 'Permanent (301)', 'wds' ),
88
- 'string_temporary' => esc_html__( 'Temporary (302)', 'wds' ),
89
- 'string_options' => esc_html__( 'Options', 'wds' ),
90
- 'string_remove' => esc_html__( 'Remove', 'wds' ),
91
- 'maybe_permanent_selected' => selected( $type, 301, false ),
92
- 'maybe_temporary_selected' => selected( $type, 302, false ),
93
- ));
94
- ?>
95
- <?php $redirection_index++; ?>
96
- <?php endforeach; ?>
97
- </tbody>
98
- <tfoot>
99
- <tr class="wds-redirects-buttons-bottom">
100
- <td colspan="5">
101
- <button class="wds-add-redirect button button-dark"><?php esc_html_e( 'Add New', 'wds' ); ?></button>
102
- </td>
103
- </tr>
104
- </tfoot>
105
- </table>
106
- </div>
 
 
 
1
+ <?php
2
+ $redirections = empty( $redirections ) ? array() : $redirections;
3
+ $types = empty( $types ) ? array() : $types;
4
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
5
+ $plugin_settings = Smartcrawl_Settings::get_specific_options( 'wds_settings_options' );
6
+ $current_redirection_code = smartcrawl_get_array_value( $plugin_settings, 'redirections-code' );
7
+ $redirection_types = array(
8
+ 301 => __( 'Permanent (301)', 'wds' ),
9
+ 302 => __( 'Temporary (302)', 'wds' ),
10
+ );
11
+ ?>
12
+
13
+ <div class="wds-redirect-attachments wds-separator-top">
14
+ <?php
15
+ $this->_render( 'toggle-group', array(
16
+ 'label' => __( 'Redirect attachments', 'wds' ),
17
+ 'description' => __( 'Redirect attachments to their parent post, preventing them from appearing in SERPs.', 'wds' ),
18
+ 'items' => array(
19
+ 'redirect-attachments' => __( 'Redirect attachments', 'wds' ),
20
+ 'redirect-attachments-images_only' => __( '... but only if the attachment is image', 'wds' ),
21
+ ),
22
+ ) );
23
+ ?>
24
+ </div>
25
+
26
+ <div class="wds-table-fields wds-separator-top">
27
+ <div class="label">
28
+ <label class="wds-label" for="wds-default-redirection-type">
29
+ <?php esc_html_e( 'Default Redirection Type', 'wds' ); ?>
30
+ </label>
31
+ <p class="wds-label-description">
32
+ <?php esc_html_e( 'Select the redirection type that you would like to be used as default.', 'wds' ); ?>
33
+ </p>
34
+ </div>
35
+ <div class="fields">
36
+ <select id="wds-default-redirection-type"
37
+ name="<?php echo esc_attr( $option_name ); ?>[redirections-code]"
38
+ autocomplete="off"
39
+ class="select-container"
40
+ style="width: 100%">
41
+ <?php foreach ( $redirection_types as $redirection_type => $redirection_type_label ): ?>
42
+ <option value="<?php echo esc_attr( $redirection_type ); ?>"
43
+ <?php echo selected( $redirection_type, $current_redirection_code, false ); ?>>
44
+ <?php echo esc_html( $redirection_type_label ); ?>
45
+ </option>
46
+ <?php endforeach; ?>
47
+ </select>
48
+ </div>
49
+ </div>
50
+
51
+ <input type="hidden" value="1" name="<?php echo esc_attr( $option_name ); ?>[save_redirects]"/>
52
+ <div class="wds-redirects wds-separator-top">
53
+ <label class="wds-label"><?php esc_html_e( 'Redirects', 'wds' ); ?></label>
54
+ <p class="wds-small-text">
55
+ <?php esc_html_e( 'Adding entries here will set up a redirect from one URL to another.', 'wds' ); ?>
56
+ </p>
57
+ <p class="wds-small-text">
58
+ <?php esc_html_e( 'Formats include relative (E.g. /cats) or absolute URLs (E.g. www.website.com/cats or https://website.com/cats).', 'wds' ); ?>
59
+ </p>
60
+ <div class="wds-redirects-buttons-top">
61
+ <button
62
+ class="wds-bulk-update button button-small button-dark"><?php esc_html_e( 'Bulk Update', 'wds' ); ?></button>
63
+ <button
64
+ class="wds-bulk-remove button button-small button-dark-o"><?php esc_html_e( 'Remove Redirects', 'wds' ); ?></button>
65
+ </div>
66
+ <div class="wds-notice wds-notice-warning wds-redirects-unsaved-notice">
67
+ <p><?php esc_html_e( "You've made changes to your Sitemap structure. You need to save the changes to make them live.", 'wds' ); ?></p>
68
+ </div>
69
+ <table class="wds-redirects-table wds-list-table">
70
+ <thead>
71
+ <tr>
72
+ <th class="selector"><input type="checkbox" class="wds-checkbox" autocomplete="off" title=""/></th>
73
+ <th class="source"><?php esc_html_e( 'Old URL', 'wds' ); ?></th>
74
+ <th class="destination"><?php esc_html_e( 'New URL', 'wds' ); ?></th>
75
+ <th class="type" colspan="2"><?php esc_html_e( 'Redirect Type', 'wds' ); ?></th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+ <?php
80
+ $redirection_index = 0;
81
+ ?>
82
+ <?php foreach ( $redirections as $source => $destination ) : ?>
83
+ <?php
84
+ $type = ! empty( $types[ $source ] ) ? $types[ $source ] : '';
85
+
86
+ $this->_render( 'advanced-tools/advanced-tools-redirect-item', array(
87
+ 'source' => esc_attr( $source ),
88
+ 'destination' => esc_attr( $destination ),
89
+ 'index' => esc_attr( $redirection_index ),
90
+ 'string_permanent' => esc_html__( 'Permanent (301)', 'wds' ),
91
+ 'string_temporary' => esc_html__( 'Temporary (302)', 'wds' ),
92
+ 'string_options' => esc_html__( 'Options', 'wds' ),
93
+ 'string_remove' => esc_html__( 'Remove', 'wds' ),
94
+ 'maybe_permanent_selected' => selected( $type, 301, false ),
95
+ 'maybe_temporary_selected' => selected( $type, 302, false ),
96
+ ) );
97
+ ?>
98
+ <?php $redirection_index ++; ?>
99
+ <?php endforeach; ?>
100
+ </tbody>
101
+ <tfoot>
102
+ <tr class="wds-redirects-buttons-bottom">
103
+ <td colspan="5">
104
+ <button class="wds-add-redirect button button-dark"><?php esc_html_e( 'Add New', 'wds' ); ?></button>
105
+ </td>
106
+ </tr>
107
+ </tfoot>
108
+ </table>
109
+ </div>
includes/admin/templates/advanced-tools/advanced-tools-redirect-item.php CHANGED
@@ -1,69 +1,71 @@
1
- <?php
2
- $source = empty( $source ) ? '' : $source;
3
- $destination = empty( $destination ) ? '' : $destination;
4
- $index = empty( $index ) ? 0 : $index;
5
- $maybe_permanent_selected = empty( $maybe_permanent_selected ) ? '' : $maybe_permanent_selected;
6
- $maybe_temporary_selected = empty( $maybe_temporary_selected ) ? '' : $maybe_temporary_selected;
7
-
8
- $string_permanent = empty( $string_permanent ) ? '' : $string_permanent;
9
- $string_temporary = empty( $string_temporary ) ? '' : $string_temporary;
10
- $string_options = empty( $string_options ) ? '' : $string_options;
11
- $string_remove = empty( $string_remove ) ? '' : $string_remove;
12
-
13
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
14
- ?>
15
-
16
- <tr data-index="<?php echo $index; ?>">
17
- <td>
18
- <input type="checkbox"
19
- autocomplete="off"
20
- class="wds-checkbox"
21
- name="<?php echo $option_name; ?>[bulk][]"
22
- value="<?php echo $index; ?>" title=""/>
23
- </td>
24
-
25
- <td>
26
- <div class="wds-redirection_item-source">
27
- <input type="text"
28
- class="wds-field"
29
- placeholder="<?php esc_html_e( 'E.g. /cats', 'wds' ); ?>"
30
- value="<?php echo $source; ?>"
31
- name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][source]"
32
- title=""/>
33
- </div>
34
- </td>
35
-
36
- <td>
37
- <div class="wds-redirection_item-destination">
38
- <input id="<?php echo $option_name; ?>"
39
- name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][destination]"
40
- type="text"
41
- placeholder="<?php esc_html_e( 'E.g. /cats-new', 'wds' ); ?>"
42
- class="wds-field"
43
- value="<?php echo $destination; ?>"
44
- title=""/>
45
- </div>
46
- </td>
47
-
48
- <td>
49
- <div class="wds-redirection_item-type select-container select-container-no-style">
50
- <select title=""
51
- style="width: 100%;"
52
- name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][type]">
53
- <option <?php echo $maybe_permanent_selected; ?> value="301"><?php echo $string_permanent; ?></option>
54
- <option <?php echo $maybe_temporary_selected; ?> value="302"><?php echo $string_temporary; ?></option>
55
- </select>
56
- </div>
57
- </td>
58
-
59
- <td>
60
- <?php
61
- $this->_render('links-dropdown', array(
62
- 'label' => $string_options,
63
- 'links' => array(
64
- '#remove' => $string_remove,
65
- ),
66
- ));
67
- ?>
68
- </td>
69
- </tr>
 
 
1
+ <?php
2
+ // All values passed to this template are expected to be escaped already so phpcs is disabled
3
+ // phpcs:ignoreFile
4
+ $source = empty( $source ) ? '' : $source;
5
+ $destination = empty( $destination ) ? '' : $destination;
6
+ $index = empty( $index ) ? 0 : $index;
7
+ $maybe_permanent_selected = empty( $maybe_permanent_selected ) ? '' : $maybe_permanent_selected;
8
+ $maybe_temporary_selected = empty( $maybe_temporary_selected ) ? '' : $maybe_temporary_selected;
9
+
10
+ $string_permanent = empty( $string_permanent ) ? '' : $string_permanent;
11
+ $string_temporary = empty( $string_temporary ) ? '' : $string_temporary;
12
+ $string_options = empty( $string_options ) ? '' : $string_options;
13
+ $string_remove = empty( $string_remove ) ? '' : $string_remove;
14
+
15
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
16
+ ?>
17
+
18
+ <tr data-index="<?php echo $index; ?>">
19
+ <td>
20
+ <input type="checkbox"
21
+ autocomplete="off"
22
+ class="wds-checkbox"
23
+ name="<?php echo $option_name; ?>[bulk][]"
24
+ value="<?php echo $index; ?>" title=""/>
25
+ </td>
26
+
27
+ <td>
28
+ <div class="wds-redirection_item-source">
29
+ <input type="text"
30
+ class="wds-field"
31
+ placeholder="<?php esc_html_e( 'E.g. /cats', 'wds' ); ?>"
32
+ value="<?php echo $source; ?>"
33
+ name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][source]"
34
+ title=""/>
35
+ </div>
36
+ </td>
37
+
38
+ <td>
39
+ <div class="wds-redirection_item-destination">
40
+ <input id="<?php echo $option_name; ?>"
41
+ name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][destination]"
42
+ type="text"
43
+ placeholder="<?php esc_html_e( 'E.g. /cats-new', 'wds' ); ?>"
44
+ class="wds-field"
45
+ value="<?php echo $destination; ?>"
46
+ title=""/>
47
+ </div>
48
+ </td>
49
+
50
+ <td>
51
+ <div class="wds-redirection_item-type select-container select-container-no-style">
52
+ <select title=""
53
+ style="width: 100%;"
54
+ name="<?php echo $option_name; ?>[urls][<?php echo $index; ?>][type]">
55
+ <option <?php echo $maybe_permanent_selected; ?> value="301"><?php echo $string_permanent; ?></option>
56
+ <option <?php echo $maybe_temporary_selected; ?> value="302"><?php echo $string_temporary; ?></option>
57
+ </select>
58
+ </div>
59
+ </td>
60
+
61
+ <td>
62
+ <?php
63
+ $this->_render( 'links-dropdown', array(
64
+ 'label' => $string_options,
65
+ 'links' => array(
66
+ '#remove' => $string_remove,
67
+ ),
68
+ ) );
69
+ ?>
70
+ </td>
71
+ </tr>
includes/admin/templates/advanced-tools/advanced-tools-settings.php CHANGED
@@ -1,149 +1,157 @@
1
- <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
-
3
- <section id="header">
4
- <?php $this->_render( 'settings-message-top' ); ?>
5
- <h1><?php esc_html_e( 'Advanced Tools' , 'wds' ); ?></h1>
6
- </section><!-- end header -->
7
-
8
- <div>
9
- <div class="cf"></div>
10
- <div class="vertical-tabs">
11
- <?php
12
- $autolinks_disabled_section = array(
13
- array(
14
- 'section_template' => 'disabled-component-inner',
15
- 'section_args' => array(
16
- 'content' => sprintf(
17
- '%s<br/>%s<br/>%s',
18
- __( 'Configure SmartCrawl to automatically link certain key words to a page on your blog or even', 'wds' ),
19
- __( 'a whole new site all together. Internal linking can help boost SEO but giving search engines', 'wds' ),
20
- __( 'ample ways to index your site.', 'wds' )
21
- ),
22
- 'image' => 'autolinking-disabled.png',
23
- 'component' => 'autolinks',
24
- 'premium_feature' => true,
25
- 'button_text' => __( 'Activate Keyword Linking', 'wds' ),
26
- ),
27
- ),
28
- );
29
-
30
- $autolinks_sections = array(
31
- array(
32
- 'section_title' => __( 'Automatic Links', 'wds' ),
33
- 'section_description' => __( 'SmartCrawl will look for keywords that match posts/pages around your website and automatically link them. Specify what post types you want to include in this tool, and what post types you want those to automatically link to.', 'wds' ),
34
- 'section_template' => 'advanced-tools/advanced-section-automatic-linking',
35
- 'section_args' => array(
36
- 'insert' => $insert,
37
- 'linkto' => $linkto,
38
- ),
39
- ),
40
- array(
41
- 'section_title' => __( 'Settings', 'wds' ),
42
- 'section_description' => __( 'Control the overall linking engine to work how you want it to.', 'wds' ),
43
- 'section_template' => 'advanced-tools/advanced-section-automatic-linking-settings',
44
- 'section_args' => array(
45
- 'additional_settings' => array(
46
- 'allow_empty_tax' => array(
47
- 'label' => __( 'Allow autolinks to empty taxonomies', 'wds' ),
48
- 'description' => __( 'Allows autolinking to taxonomies that have no posts assigned to them.', 'wds' ),
49
- ),
50
- 'excludeheading' => array(
51
- 'label' => __( 'Prevent linking in heading tags', 'wds' ),
52
- 'description' => __( 'Excludes headings from autolinking.', 'wds' ),
53
- ),
54
- 'onlysingle' => array(
55
- 'label' => __( 'Process only single posts and pages', 'wds' ),
56
- 'description' => __( 'Process only single posts and pages', 'wds' ),
57
- ),
58
- 'allowfeed' => array(
59
- 'label' => __( 'Process RSS feeds', 'wds' ),
60
- 'description' => __( 'Autolinking will also occur in RSS feeds.', 'wds' ),
61
- ),
62
- 'casesens' => array(
63
- 'label' => __( 'Case sensitive matching', 'wds' ),
64
- 'description' => __( 'Only autolink the exact string match.', 'wds' ),
65
- ),
66
- 'customkey_preventduplicatelink' => array(
67
- 'label' => __( 'Prevent duplicate links', 'wds' ),
68
- 'description' => __( 'TBC', 'wds' ),
69
- ),
70
- 'target_blank' => array(
71
- 'label' => __( 'Open links in new tab', 'wds' ),
72
- 'description' => __( 'Adds the target=“_blank” tag to links to open a new tab when clicked.', 'wds' ),
73
- ),
74
- 'rel_nofollow' => array(
75
- 'label' => __( 'Nofollow autolinks', 'wds' ),
76
- 'description' => __( 'Adds the nofollow meta tag to autolinks to prevent search engines following those URLs when crawling your website.', 'wds' ),
77
- ),
78
- ),
79
- ),
80
- ),
81
- );
82
-
83
- $autolinks_network_enabled = smartcrawl_is_allowed_tab( $_view['slug'] );
84
- $autolinks_locally_enabled = 'settings' === $_view['name'] || Smartcrawl_Settings::get_setting( $_view['name'] );
85
- $is_member = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member();
86
-
87
- if ( $autolinks_network_enabled ) {
88
-
89
- $autolinks_tab = array(
90
- 'tab_id' => 'tab_automatic_linking',
91
- 'tab_name' => __( 'Automatic Linking', 'wds' ),
92
- 'is_active' => $active_tab == 'tab_automatic_linking',
93
- 'tab_sections' => $autolinks_locally_enabled && $is_member ? $autolinks_sections : $autolinks_disabled_section,
94
- 'before_output' => $this->_load('_forms/autolinks', array(
95
- 'autolinks_network_enabled' => $autolinks_network_enabled,
96
- 'autolinks_locally_enabled' => $autolinks_locally_enabled,
97
- )),
98
- 'after_output' => '</form>',
99
- );
100
-
101
- if ( ! $autolinks_locally_enabled || ! $is_member ) {
102
- $autolinks_tab['button_text'] = false;
103
- }
104
-
105
- $this->_render( 'vertical-tab', $autolinks_tab );
106
- }
107
- ?>
108
-
109
- <?php
110
- $this->_render('vertical-tab', array(
111
- 'tab_id' => 'tab_url_redirection',
112
- 'tab_name' => __( 'URL Redirection', 'wds' ),
113
- 'is_active' => $active_tab == 'tab_url_redirection',
114
- 'tab_sections' => array(
115
- array(
116
- 'section_description' => __( 'Automatically redirect traffic from one URL to another. Use this tool if you have changed a page’s URL and wish to keep traffic flowing to the new page.', 'wds' ),
117
- 'section_template' => 'advanced-tools/advanced-section-redirects',
118
- 'section_args' => array(
119
- 'redirections' => $redirections,
120
- 'types' => $redirection_types,
121
- ),
122
- ),
123
- ),
124
- 'before_output' => $this->_load( '_forms/redirections' ),
125
- 'after_output' => '</form>',
126
- ));
127
- ?>
128
-
129
- <?php
130
- $this->_render('vertical-tab', array(
131
- 'tab_id' => 'tab_moz',
132
- 'tab_name' => __( 'Moz', 'wds' ),
133
- 'is_active' => $active_tab == 'tab_moz',
134
- 'button_text' => false,
135
- 'tab_sections' => array(
136
- array(
137
- 'section_template' => 'advanced-tools/advanced-section-moz',
138
- 'section_args' => array(),
139
- ),
140
- ),
141
- 'before_output' => '<form method="post" class="wds-form">',
142
- 'after_output' => '</form>',
143
- ));
144
- ?>
145
- </div>
146
- </div>
147
- <?php $this->_render( 'upsell-modal' ); ?>
148
-
149
- </div><!-- end wds-page-autolinks -->
 
 
 
 
 
 
 
 
1
+ <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
+
3
+ <section id="header">
4
+ <div class="actions">
5
+ <a target="_blank" class="button button-small button-light actions-button"
6
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-5">
7
+ <i class="wds-icon-academy"></i>
8
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
9
+ </a>
10
+ </div>
11
+
12
+ <?php $this->_render( 'settings-message-top' ); ?>
13
+ <h1><?php esc_html_e( 'Advanced Tools', 'wds' ); ?></h1>
14
+ </section><!-- end header -->
15
+
16
+ <div>
17
+ <div class="cf"></div>
18
+ <div class="vertical-tabs">
19
+ <?php
20
+ $autolinks_disabled_section = array(
21
+ array(
22
+ 'section_template' => 'disabled-component-inner',
23
+ 'section_args' => array(
24
+ 'content' => sprintf(
25
+ '%s<br/>%s<br/>%s',
26
+ __( 'Configure SmartCrawl to automatically link certain key words to a page on your blog or even', 'wds' ),
27
+ __( 'a whole new site all together. Internal linking can help boost SEO but giving search engines', 'wds' ),
28
+ __( 'ample ways to index your site.', 'wds' )
29
+ ),
30
+ 'image' => 'autolinking-disabled.png',
31
+ 'component' => 'autolinks',
32
+ 'premium_feature' => true,
33
+ 'button_text' => __( 'Activate Keyword Linking', 'wds' ),
34
+ ),
35
+ ),
36
+ );
37
+
38
+ $autolinks_sections = array(
39
+ array(
40
+ 'section_title' => __( 'Automatic Links', 'wds' ),
41
+ 'section_description' => __( 'SmartCrawl will look for keywords that match posts/pages around your website and automatically link them. Specify what post types you want to include in this tool, and what post types you want those to automatically link to.', 'wds' ),
42
+ 'section_template' => 'advanced-tools/advanced-section-automatic-linking',
43
+ 'section_args' => array(
44
+ 'insert' => $insert,
45
+ 'linkto' => $linkto,
46
+ ),
47
+ ),
48
+ array(
49
+ 'section_title' => __( 'Settings', 'wds' ),
50
+ 'section_description' => __( 'Control the overall linking engine to work how you want it to.', 'wds' ),
51
+ 'section_template' => 'advanced-tools/advanced-section-automatic-linking-settings',
52
+ 'section_args' => array(
53
+ 'additional_settings' => array(
54
+ 'allow_empty_tax' => array(
55
+ 'label' => __( 'Allow autolinks to empty taxonomies', 'wds' ),
56
+ 'description' => __( 'Allows autolinking to taxonomies that have no posts assigned to them.', 'wds' ),
57
+ ),
58
+ 'excludeheading' => array(
59
+ 'label' => __( 'Prevent linking in heading tags', 'wds' ),
60
+ 'description' => __( 'Excludes headings from autolinking.', 'wds' ),
61
+ ),
62
+ 'onlysingle' => array(
63
+ 'label' => __( 'Process only single posts and pages', 'wds' ),
64
+ 'description' => __( 'Process only single posts and pages', 'wds' ),
65
+ ),
66
+ 'allowfeed' => array(
67
+ 'label' => __( 'Process RSS feeds', 'wds' ),
68
+ 'description' => __( 'Autolinking will also occur in RSS feeds.', 'wds' ),
69
+ ),
70
+ 'casesens' => array(
71
+ 'label' => __( 'Case sensitive matching', 'wds' ),
72
+ 'description' => __( 'Only autolink the exact string match.', 'wds' ),
73
+ ),
74
+ 'customkey_preventduplicatelink' => array(
75
+ 'label' => __( 'Prevent duplicate links', 'wds' ),
76
+ 'description' => __( 'Only link to a specific URL once per page/post.', 'wds' ),
77
+ ),
78
+ 'target_blank' => array(
79
+ 'label' => __( 'Open links in new tab', 'wds' ),
80
+ 'description' => __( 'Adds the target=“_blank” tag to links to open a new tab when clicked.', 'wds' ),
81
+ ),
82
+ 'rel_nofollow' => array(
83
+ 'label' => __( 'Nofollow autolinks', 'wds' ),
84
+ 'description' => __( 'Adds the nofollow meta tag to autolinks to prevent search engines following those URLs when crawling your website.', 'wds' ),
85
+ ),
86
+ ),
87
+ ),
88
+ ),
89
+ );
90
+
91
+ $autolinks_network_enabled = smartcrawl_is_allowed_tab( $_view['slug'] );
92
+ $autolinks_locally_enabled = 'settings' === $_view['name'] || Smartcrawl_Settings::get_setting( $_view['name'] );
93
+ $is_member = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member();
94
+
95
+ if ( $autolinks_network_enabled ) {
96
+
97
+ $autolinks_tab = array(
98
+ 'tab_id' => 'tab_automatic_linking',
99
+ 'tab_name' => __( 'Automatic Linking', 'wds' ),
100
+ 'is_active' => 'tab_automatic_linking' === $active_tab,
101
+ 'tab_sections' => $autolinks_locally_enabled && $is_member ? $autolinks_sections : $autolinks_disabled_section,
102
+ 'before_output' => $this->_load( '_forms/autolinks', array(
103
+ 'autolinks_network_enabled' => $autolinks_network_enabled,
104
+ 'autolinks_locally_enabled' => $autolinks_locally_enabled,
105
+ ) ),
106
+ 'after_output' => '</form>',
107
+ );
108
+
109
+ if ( ! $autolinks_locally_enabled || ! $is_member ) {
110
+ $autolinks_tab['button_text'] = false;
111
+ }
112
+
113
+ $this->_render( 'vertical-tab', $autolinks_tab );
114
+ }
115
+ ?>
116
+
117
+ <?php
118
+ $this->_render( 'vertical-tab', array(
119
+ 'tab_id' => 'tab_url_redirection',
120
+ 'tab_name' => __( 'URL Redirection', 'wds' ),
121
+ 'is_active' => 'tab_url_redirection' === $active_tab,
122
+ 'tab_sections' => array(
123
+ array(
124
+ 'section_description' => __( 'Automatically redirect traffic from one URL to another. Use this tool if you have changed a page’s URL and wish to keep traffic flowing to the new page.', 'wds' ),
125
+ 'section_template' => 'advanced-tools/advanced-section-redirects',
126
+ 'section_args' => array(
127
+ 'redirections' => $redirections,
128
+ 'types' => $redirection_types,
129
+ ),
130
+ ),
131
+ ),
132
+ 'before_output' => $this->_load( '_forms/redirections' ),
133
+ 'after_output' => '</form>',
134
+ ) );
135
+ ?>
136
+
137
+ <?php
138
+ $this->_render( 'vertical-tab', array(
139
+ 'tab_id' => 'tab_moz',
140
+ 'tab_name' => __( 'Moz', 'wds' ),
141
+ 'is_active' => 'tab_moz' === $active_tab,
142
+ 'button_text' => false,
143
+ 'tab_sections' => array(
144
+ array(
145
+ 'section_template' => 'advanced-tools/advanced-section-moz',
146
+ 'section_args' => array(),
147
+ ),
148
+ ),
149
+ 'before_output' => '<form method="post" class="wds-form">',
150
+ 'after_output' => '</form>',
151
+ ) );
152
+ ?>
153
+ </div>
154
+ </div>
155
+ <?php $this->_render( 'upsell-modal' ); ?>
156
+
157
+ </div><!-- end wds-page-autolinks -->
includes/admin/templates/{underscore-keywords-custom.php → advanced-tools/underscore-keywords-custom.php} RENAMED
@@ -1,17 +1,18 @@
1
- <div class="wds-keyword-pairs">
2
-
3
- {{ if (pairs) { }}
4
- <table class="wds-keyword-pairs-existing wds-list-table">
5
- <tr>
6
- <th>{{- Wds.l10n('keywords', 'Keyword') }}</th>
7
- <th colspan="3">{{- Wds.l10n('keywords', 'Auto-Linked URL') }}</th>
8
- </tr>
9
- {{= pairs }}
10
- </table>
11
- {{ } }}
12
-
13
- <div class="wds-keyword-pair-new">
14
- <button type="button" class="button button-dark">{{- Wds.l10n('keywords', 'Add New') }}</button>
15
- </div><!-- end wds-keyword-pair-new -->
16
-
17
- </div>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <div class="wds-keyword-pairs">
3
+
4
+ {{ if (pairs) { }}
5
+ <table class="wds-keyword-pairs-existing wds-list-table">
6
+ <tr>
7
+ <th>{{- Wds.l10n('keywords', 'Keyword') }}</th>
8
+ <th colspan="3">{{- Wds.l10n('keywords', 'Auto-Linked URL') }}</th>
9
+ </tr>
10
+ {{= pairs }}
11
+ </table>
12
+ {{ } }}
13
+
14
+ <div class="wds-keyword-pair-new">
15
+ <button type="button" class="button button-dark">{{- Wds.l10n('keywords', 'Add New') }}</button>
16
+ </div><!-- end wds-keyword-pair-new -->
17
+
18
+ </div>
includes/admin/templates/{underscore-keywords-form.php → advanced-tools/underscore-keywords-form.php} RENAMED
@@ -1,31 +1,32 @@
1
- <dialog class="dev-overlay wds-modal wds-custom-keywords-modal" id="wds-custom-keywords" title="{{- idx == 0 ? Wds.l10n('keywords', 'Add Custom Keywords') : Wds.l10n('keywords', 'Update Custom Keywords') }}">
2
- <form class="wds-form">
3
- <input type="hidden" class="wds-custom-idx" value="{{- idx }}"/>
4
- <label class="wds-label">{{- Wds.l10n('keywords', 'Keyword group') }}</label>
5
- <p class="wds-label-description">{{- Wds.l10n('keywords', 'Choose your keywords, and then specify the URL to auto-link to.') }}</p>
6
-
7
- <div class="wds-table-fields wds-table-fields-stacked">
8
- <div class="label">
9
- <label class="wds-label">{{- Wds.l10n('keywords', 'Keyword group') }} <span>{{- Wds.l10n('keywords', '- Usually related terms') }}</span></label>
10
- </div>
11
- <div class="fields">
12
- <input type="text" class="wds-field wds-custom-keywords" value="{{- keywords }}" placeholder="{{- Wds.l10n('keywords', 'E.g. Cats, Kittens, Felines') }}"/>
13
- </div>
14
- </div>
15
-
16
- <div class="wds-table-fields wds-table-fields-stacked">
17
- <div class="label">
18
- <label class="wds-label">{{- Wds.l10n('keywords', 'Link URL') }} <span>{{- Wds.l10n('keywords', '- Both internal and external links are supported') }}</span></label>
19
- </div>
20
- <div class="fields">
21
- <input type="text" class="wds-custom-url" value="{{- url }}" placeholder="{{- Wds.l10n('keywords', 'E.g. /cats') }}"/>
22
- <p class="wds-field-legend">{{= Wds.l10n('keywords', 'Formats include relative (E.g. <b>/cats</b>) or absolute URLs (E.g. <b>www.website.com/cats</b> or <b>https://website.com/cats</b>).') }}</p>
23
- </div>
24
- </div>
25
-
26
- <div class="wds-box-footer">
27
- <button type="button" class="wds-cancel-button button button-dark-o">{{- Wds.l10n('keywords', 'Cancel') }}</button>
28
- <button type="button" class="wds-action-button button">{{- idx == 0 ? Wds.l10n('keywords', 'Add') : Wds.l10n('keywords', 'Update') }}</button>
29
- </div>
30
- </form>
31
- </dialog>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <dialog class="dev-overlay wds-modal wds-custom-keywords-modal" id="wds-custom-keywords" title="{{- idx == 0 ? Wds.l10n('keywords', 'Add Custom Keywords') : Wds.l10n('keywords', 'Update Custom Keywords') }}">
3
+ <form class="wds-form">
4
+ <input type="hidden" class="wds-custom-idx" value="{{- idx }}"/>
5
+ <label class="wds-label">{{- Wds.l10n('keywords', 'Keyword group') }}</label>
6
+ <p class="wds-label-description">{{- Wds.l10n('keywords', 'choose-your-keywords-and-url') }}</p>
7
+
8
+ <div class="wds-table-fields wds-table-fields-stacked">
9
+ <div class="label">
10
+ <label class="wds-label">{{- Wds.l10n('keywords', 'Keyword group') }} <span>{{- Wds.l10n('keywords', '- Usually related terms') }}</span></label>
11
+ </div>
12
+ <div class="fields">
13
+ <input type="text" class="wds-field wds-custom-keywords" value="{{- keywords }}" placeholder="{{- Wds.l10n('keywords', 'E.g. Cats, Kittens, Felines') }}"/>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="wds-table-fields wds-table-fields-stacked">
18
+ <div class="label">
19
+ <label class="wds-label">{{- Wds.l10n('keywords', 'Link URL') }} <span>{{- Wds.l10n('keywords', 'internal-external-links-supported') }}</span></label>
20
+ </div>
21
+ <div class="fields">
22
+ <input type="text" class="wds-custom-url" value="{{- url }}" placeholder="{{- Wds.l10n('keywords', 'E.g. /cats') }}"/>
23
+ <p class="wds-field-legend">{{= Wds.l10n('keywords', 'url-formats-explanation') }}</p>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="wds-box-footer">
28
+ <button type="button" class="wds-cancel-button button button-dark-o">{{- Wds.l10n('keywords', 'Cancel') }}</button>
29
+ <button type="button" class="wds-action-button button">{{- idx == 0 ? Wds.l10n('keywords', 'Add') : Wds.l10n('keywords', 'Update') }}</button>
30
+ </div>
31
+ </form>
32
+ </dialog>
includes/admin/templates/{underscore-keywords-pairs.php → advanced-tools/underscore-keywords-pairs.php} RENAMED
@@ -1,21 +1,21 @@
1
- <tr class="wds-keyword-pair" data-idx="{{- idx }}">
2
- <td class="wds-pair-keyword">{{- keywords }}</td>
3
- <td class="wds-pair-url">{{- url }}</td>
4
- <td class="wds-pair-actions">
5
- {{ if (idx) { }}
6
- <?php
7
- $this->_render('links-dropdown', array(
8
- 'label' => "{{- Wds.l10n('keywords', 'Options') }}",
9
- 'links' => array(
10
- '#edit' => "{{- Wds.l10n('keywords', 'Edit') }}",
11
- '#remove' => "{{- Wds.l10n('keywords', 'Remove') }}",
12
- ),
13
- ));
14
- ?>
15
- {{ } }}
16
- </td>
17
- <td class="wds-pair-hidden-fields">
18
- <input type="hidden" class="wds-pair-keyword-field" value="{{- keywords }}" />
19
- <input type="hidden" class="wds-pair-url-field" value="{{- url }}" />
20
- </td>
21
- </tr>
1
+ <tr class="wds-keyword-pair" data-idx="{{- idx }}">
2
+ <td class="wds-pair-keyword">{{- keywords }}</td>
3
+ <td class="wds-pair-url">{{- url }}</td>
4
+ <td class="wds-pair-actions">
5
+ {{ if (idx) { }}
6
+ <?php
7
+ $this->_render('links-dropdown', array(
8
+ 'label' => "{{- Wds.l10n('keywords', 'Options') }}",
9
+ 'links' => array(
10
+ '#edit' => "{{- Wds.l10n('keywords', 'Edit') }}",
11
+ '#remove' => "{{- Wds.l10n('keywords', 'Remove') }}",
12
+ ),
13
+ ));
14
+ ?>
15
+ {{ } }}
16
+ </td>
17
+ <td class="wds-pair-hidden-fields">
18
+ <input type="hidden" class="wds-pair-keyword-field" value="{{- keywords }}" />
19
+ <input type="hidden" class="wds-pair-url-field" value="{{- url }}" />
20
+ </td>
21
+ </tr>
includes/admin/templates/{underscore-postlist-exclusion-item.php → advanced-tools/underscore-postlist-exclusion-item.php} RENAMED
@@ -1,9 +1,10 @@
1
- <tr data-id="{{- id }}">
2
- {{ if (is_loaded) { }}
3
- <td class="wds-postlist-item-title">{{= title }}</td>
4
- <td class="wds-postlist-item-type">{{= type }}</td>
5
- <td class="wds-postlist-item-remove"><a href="#remove" class="wds-postlist-list-item-remove button button-dark-o button-small">{{= Wds.l10n('postlist', 'Remove') }}</a></td>
6
- {{ } else { }}
7
- <td colspan="3">Loading post {{= id }}...</td>
8
- {{ } }}
9
- </tr>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <tr data-id="{{- id }}">
3
+ {{ if (is_loaded) { }}
4
+ <td class="wds-postlist-item-title">{{= title }}</td>
5
+ <td class="wds-postlist-item-type">{{= type }}</td>
6
+ <td class="wds-postlist-item-remove"><a href="#remove" class="wds-postlist-list-item-remove button button-dark-o button-small">{{= Wds.l10n('postlist', 'Remove') }}</a></td>
7
+ {{ } else { }}
8
+ <td colspan="3">Loading post {{= id }}...</td>
9
+ {{ } }}
10
+ </tr>
includes/admin/templates/{underscore-postlist-exclusion.php → advanced-tools/underscore-postlist-exclusion.php} RENAMED
@@ -1,16 +1,17 @@
1
- <div class="wds-postlist-list wds-postlist-list-exclude">
2
- {{ if (loaded) { }}
3
- <table class="wds-postlist wds-list-table {{= (!!posts ? '' : 'wds-postlist-empty_list') }}">
4
- <tr>
5
- <th>{{= Wds.l10n('postlist', 'Post') }}</th>
6
- <th colspan="2">{{= Wds.l10n('postlist', 'Post Type') }}</th>
7
- </tr>
8
- {{= posts }}
9
- </table>
10
- {{ } else { }}
11
- <p><i>Loading posts, please hold on</i></p>
12
- {{ } }}
13
- <div class="wds-postlist-add-post">
14
- <a href="#wds-postlist-selector" rel="dialog" class="button button-dark">{{= Wds.l10n('postlist', 'Add Posts') }}</a>
15
- </div>
16
- </div>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <div class="wds-postlist-list wds-postlist-list-exclude">
3
+ {{ if (loaded) { }}
4
+ <table class="wds-postlist wds-list-table {{= (!!posts ? '' : 'wds-postlist-empty_list') }}">
5
+ <tr>
6
+ <th>{{= Wds.l10n('postlist', 'Post') }}</th>
7
+ <th colspan="2">{{= Wds.l10n('postlist', 'Post Type') }}</th>
8
+ </tr>
9
+ {{= posts }}
10
+ </table>
11
+ {{ } else { }}
12
+ <p><i>Loading posts, please hold on</i></p>
13
+ {{ } }}
14
+ <div class="wds-postlist-add-post">
15
+ <a href="#wds-postlist-selector" rel="dialog" class="button button-dark">{{= Wds.l10n('postlist', 'Add Posts') }}</a>
16
+ </div>
17
+ </div>
includes/admin/templates/{underscore-postlist-selector-list-item.php → advanced-tools/underscore-postlist-selector-list-item.php} RENAMED
@@ -1,20 +1,21 @@
1
- <li class="wds-postlist-list-item">
2
- <p class="group">
3
- <input
4
- id="{{- type }}-{{- id }}"
5
- class="wds-checkbox wds-checkbox-with-label wds-postlist-selector-list-item"
6
- value='{{- id }}'
7
- data-id="{{- id }}"
8
- data-title="{{- title }}"
9
- data-type="{{- type }}"
10
- data-date="{{- date }}"
11
- type='checkbox'
12
- {{ if (existing) { }}
13
- checked
14
- readonly
15
- disabled
16
- {{ } }}
17
- />
18
- <label for="{{- type }}-{{- id }}" class="wds-label wds-label-radio wds-label-inline wds-label-inline-right">{{= title }} ({{= date }})</label>
19
- </p>
20
- </li>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <li class="wds-postlist-list-item">
3
+ <p class="group">
4
+ <input
5
+ id="{{- type }}-{{- id }}"
6
+ class="wds-checkbox wds-checkbox-with-label wds-postlist-selector-list-item"
7
+ value='{{- id }}'
8
+ data-id="{{- id }}"
9
+ data-title="{{- title }}"
10
+ data-type="{{- type }}"
11
+ data-date="{{- date }}"
12
+ type='checkbox'
13
+ {{ if (existing) { }}
14
+ checked
15
+ readonly
16
+ disabled
17
+ {{ } }}
18
+ />
19
+ <label for="{{- type }}-{{- id }}" class="wds-label wds-label-radio wds-label-inline wds-label-inline-right">{{= title }} ({{= date }})</label>
20
+ </p>
21
+ </li>
includes/admin/templates/{underscore-postlist-selector-list.php → advanced-tools/underscore-postlist-selector-list.php} RENAMED
@@ -1,44 +1,45 @@
1
- <section class="tab wds-postlist-list">
2
-
3
- <input type="radio" name="tab_postlist_group" id="tab_{{- tab }}" {{= checked }} value="{{-tab }}">
4
- <label for="tab_{{- tab }}">{{- tab_label }}</label>
5
-
6
- <div class="content wds-content-tabs">
7
-
8
- <h2 class="tab-title">{{= tab }}</h2>
9
-
10
- <div class="wds-content-tabs-inner">
11
- {{ if (is_loading) { }}
12
- <p>{{= Wds.l10n('postlist', 'Loading post items, please hold on') }}</p>
13
- {{ } else { }}
14
- <ul class="wds-postlist-list-items">
15
- {{= posts }}
16
- </ul>
17
- {{ } }}
18
-
19
- {{ if (meta.total > 1) { }}
20
- <div class="wds-postslist-list-pagination">
21
- <p class="group wds-group wds-group-field">
22
- <label for="wds-postslist-list-pagination-select" class="wds-label">{{= Wds.l10n('postlist', 'Jump to page') }}</label>
23
- <select id='wds-postslist-list-pagination-select' class="wds-select">
24
- {{ _.each(_.range(1, meta.total+1), function (idx) { }}
25
- <option
26
- value="{{- idx }}"
27
- {{ if (meta.page === idx) { }}
28
- selected="selected"
29
- {{ } }}
30
- >
31
- {{= idx }}
32
- </option>
33
- {{ }) }}
34
- </select>
35
- <span class="wds-field-legend">{{= Wds.l10n('postlist', 'Total Pages') }} {{= meta.total }}</span>
36
- </p>
37
- </div>
38
- {{ } }}
39
-
40
- </div><!-- end wds-content-tabs-inner -->
41
-
42
- </div><!-- end wds-content-tabs -->
43
-
44
- </section><!-- end wds-postlist-list -->
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <section class="tab wds-postlist-list">
3
+
4
+ <input type="radio" name="tab_postlist_group" id="tab_{{- tab }}" {{= checked }} value="{{-tab }}">
5
+ <label for="tab_{{- tab }}">{{- tab_label }}</label>
6
+
7
+ <div class="content wds-content-tabs">
8
+
9
+ <h2 class="tab-title">{{= tab }}</h2>
10
+
11
+ <div class="wds-content-tabs-inner">
12
+ {{ if (is_loading) { }}
13
+ <p>{{= Wds.l10n('postlist', 'Loading post items, please hold on') }}</p>
14
+ {{ } else { }}
15
+ <ul class="wds-postlist-list-items">
16
+ {{= posts }}
17
+ </ul>
18
+ {{ } }}
19
+
20
+ {{ if (meta.total > 1) { }}
21
+ <div class="wds-postslist-list-pagination">
22
+ <p class="group wds-group wds-group-field">
23
+ <label for="wds-postslist-list-pagination-select" class="wds-label">{{= Wds.l10n('postlist', 'Jump to page') }}</label>
24
+ <select id='wds-postslist-list-pagination-select' class="wds-select">
25
+ {{ _.each(_.range(1, meta.total+1), function (idx) { }}
26
+ <option
27
+ value="{{- idx }}"
28
+ {{ if (meta.page === idx) { }}
29
+ selected="selected"
30
+ {{ } }}
31
+ >
32
+ {{= idx }}
33
+ </option>
34
+ {{ }) }}
35
+ </select>
36
+ <span class="wds-field-legend">{{= Wds.l10n('postlist', 'Total Pages') }} {{= meta.total }}</span>
37
+ </p>
38
+ </div>
39
+ {{ } }}
40
+
41
+ </div><!-- end wds-content-tabs-inner -->
42
+
43
+ </div><!-- end wds-content-tabs -->
44
+
45
+ </section><!-- end wds-postlist-list -->
includes/admin/templates/{underscore-postlist-selector.php → advanced-tools/underscore-postlist-selector.php} RENAMED
@@ -1,14 +1,14 @@
1
- <dialog class="dev-overlay wds-modal wds-postlist-selector-modal" id="wds-postlist-selector" title="<?php esc_html_e( 'Choose Posts, Pages & Custom Post Types to exclude', 'wds' ); ?>">
2
- <div class="box-content wds-postlist-selector">
3
-
4
- <div class="vertical-tabs" id="content-type-excludes">
5
- {{= lists }}
6
- </div>
7
-
8
- </div>
9
-
10
- <div class="box-footer buttons">
11
- <button type="button" class="button button-cta-dark">Add to Excludes</button>
12
- </div>
13
-
14
- </dialog>
1
+ <dialog class="dev-overlay wds-modal wds-postlist-selector-modal" id="wds-postlist-selector" title="<?php esc_html_e( 'Choose Posts, Pages & Custom Post Types to exclude', 'wds' ); ?>">
2
+ <div class="box-content wds-postlist-selector">
3
+
4
+ <div class="vertical-tabs" id="content-type-excludes">
5
+ {{= lists }}
6
+ </div>
7
+
8
+ </div>
9
+
10
+ <div class="box-footer buttons">
11
+ <button type="button" class="button button-cta-dark">Add to Excludes</button>
12
+ </div>
13
+
14
+ </dialog>
includes/admin/templates/checkup/checkup-checkup-results.php CHANGED
@@ -1,82 +1,83 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- $results = $service->result();
4
- $show_upsell_message = isset( $show_upsell_message ) ? $show_upsell_message : true;
5
- ?>
6
-
7
- <?php if ( ! empty( $results['error'] ) ) : ?>
8
- <!--
9
- We have encountered an error. So let's show that.
10
- -->
11
- <div class="wds-notice wds-notice-error">
12
- <p><?php echo esc_html( $results['error'] ); ?></p>
13
- </div>
14
- <?php endif; ?>
15
-
16
- <?php if ( ! empty( $results['items'] ) ) { ?>
17
- <p><?php esc_html_e( 'Here are your outstanding SEO issues. We recommend actioning as many as possible to ensure your site is as search engine and social media friendly as possible.', 'wds' ); ?></p>
18
- <!--
19
- This is where we store the actual result items.
20
- Let's iterate through them.
21
- -->
22
- <div class="wds-accordion">
23
- <?php foreach ( $results['items'] as $idx => $item ) : ?>
24
- <?php
25
- $item_id = "wds-checkup-item-{$idx}";
26
- $type_class = ! empty( $item['type'] )
27
- ? sanitize_html_class( $item['type'] )
28
- : '';
29
- $custom_class = ! empty( $item['class'] )
30
- ? sanitize_html_class( $item['class'] )
31
- : '';
32
- $style_class_map = array(
33
- 'ok' => 'wds-check-success',
34
- 'info' => 'wds-check-invalid',
35
- 'warning' => 'wds-check-warning',
36
- 'critical' => 'wds-check-error',
37
- );
38
- $style_class = isset( $style_class_map[ $item['type'] ] ) ? $style_class_map[ $item['type'] ] : '';
39
- $details = ! empty( $item['tooltip'] ) ? $item['tooltip'] : '';
40
- $title = ! empty( $item['title'] ) ? $item['title'] : '';
41
- $body = ! empty( $item['body'] ) ? $item['body'] : '';
42
- $fix = ! empty( $item['fix'] ) ? $item['fix'] : '';
43
- ?>
44
- <div class="wds-accordion-section wds-check-item <?php echo esc_attr( $type_class ); ?> <?php echo esc_attr( $custom_class ); ?> <?php echo esc_attr( $style_class ); ?>"
45
- id="<?php echo esc_attr( $item_id ); ?>">
46
- <div class="wds-accordion-handle">
47
- <?php echo esc_html( $title ); ?>
48
- </div>
49
- <div class="wds-accordion-content">
50
- <?php if ( $body || $fix ) : ?>
51
- <div class="wds-recommendation">
52
- <strong><?php esc_html_e( 'Recommendation', 'wds' ); ?></strong>
53
-
54
- <?php echo wp_kses( $body, 'post' ); ?>
55
- <?php echo wp_kses( $fix, 'post' ); ?>
56
- </div>
57
- <?php endif; ?>
58
-
59
- <?php if ( $details ) : ?>
60
- <div class="wds-more-info">
61
- <strong><?php esc_html_e( 'More Info', 'wds' ); ?></strong>
62
- <p><?php echo esc_attr( $details ); ?></p>
63
- </div>
64
- <?php endif; ?>
65
- </div>
66
- </div>
67
- <?php endforeach; ?>
68
- </div>
69
- <?php if ( ! $service->is_member() && $show_upsell_message ) { ?>
70
- <?php
71
- $this->_render('mascot-message', array(
72
- 'key' => 'seo-checkup-upsell',
73
- 'dismissible' => false,
74
- 'message' => sprintf(
75
- '%s <a href="#upgrade-to-pro">%s</a>',
76
- esc_html__( 'Grab the Pro version of SmartCrawl to unlock unlimited SEO Checkups plus automated scheduled reports to always stay on top of any issues.. These features are included in a WPMU DEV membership along with 100+ plugins &amp; themes, 24/7 support and lots of handy site management tools.', 'wds' ),
77
- esc_html__( '- Try it all FREE today', 'wds' )
78
- ),
79
- ));
80
- ?>
81
- <?php } ?>
82
- <?php } ?>
 
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ $results = $service->result();
4
+ $show_upsell_message = isset( $show_upsell_message ) ? $show_upsell_message : true;
5
+ ?>
6
+
7
+ <?php if ( ! empty( $results['error'] ) ) : ?>
8
+ <!--
9
+ We have encountered an error. So let's show that.
10
+ -->
11
+ <div class="wds-notice wds-notice-error">
12
+ <p><?php echo esc_html( $results['error'] ); ?></p>
13
+ </div>
14
+ <?php endif; ?>
15
+
16
+ <?php if ( ! empty( $results['items'] ) ) { ?>
17
+ <p><?php esc_html_e( 'Here are your outstanding SEO issues. We recommend actioning as many as possible to ensure your site is as search engine and social media friendly as possible.', 'wds' ); ?></p>
18
+ <!--
19
+ This is where we store the actual result items.
20
+ Let's iterate through them.
21
+ -->
22
+ <div class="wds-accordion">
23
+ <?php foreach ( $results['items'] as $idx => $item ) : ?>
24
+ <?php
25
+ $item_id = "wds-checkup-item-{$idx}";
26
+ $type_class = ! empty( $item['type'] )
27
+ ? sanitize_html_class( $item['type'] )
28
+ : '';
29
+ $custom_class = ! empty( $item['class'] )
30
+ ? sanitize_html_class( $item['class'] )
31
+ : '';
32
+ $style_class_map = array(
33
+ 'ok' => 'wds-check-success',
34
+ 'info' => 'wds-check-invalid',
35
+ 'warning' => 'wds-check-warning',
36
+ 'critical' => 'wds-check-error',
37
+ );
38
+ $style_class = isset( $style_class_map[ $item['type'] ] ) ? $style_class_map[ $item['type'] ] : '';
39
+ $details = ! empty( $item['tooltip'] ) ? $item['tooltip'] : '';
40
+ $title = ! empty( $item['title'] ) ? $item['title'] : '';
41
+ $body = ! empty( $item['body'] ) ? $item['body'] : '';
42
+ $fix = ! empty( $item['fix'] ) ? $item['fix'] : '';
43
+ ?>
44
+ <div
45
+ class="wds-accordion-section wds-check-item <?php echo esc_attr( $type_class ); ?> <?php echo esc_attr( $custom_class ); ?> <?php echo esc_attr( $style_class ); ?>"
46
+ id="<?php echo esc_attr( $item_id ); ?>">
47
+ <div class="wds-accordion-handle">
48
+ <?php echo esc_html( $title ); ?>
49
+ </div>
50
+ <div class="wds-accordion-content">
51
+ <?php if ( $body || $fix ) : ?>
52
+ <div class="wds-recommendation">
53
+ <strong><?php esc_html_e( 'Recommendation', 'wds' ); ?></strong>
54
+
55
+ <?php echo wp_kses_post( $body ); ?>
56
+ <?php echo wp_kses_post( $fix ); ?>
57
+ </div>
58
+ <?php endif; ?>
59
+
60
+ <?php if ( $details ) : ?>
61
+ <div class="wds-more-info">
62
+ <strong><?php esc_html_e( 'More Info', 'wds' ); ?></strong>
63
+ <p><?php echo esc_html( $details ); ?></p>
64
+ </div>
65
+ <?php endif; ?>
66
+ </div>
67
+ </div>
68
+ <?php endforeach; ?>
69
+ </div>
70
+ <?php if ( ! $service->is_member() && $show_upsell_message ) { ?>
71
+ <?php
72
+ $this->_render( 'mascot-message', array(
73
+ 'key' => 'seo-checkup-upsell',
74
+ 'dismissible' => false,
75
+ 'message' => sprintf(
76
+ '%s <a href="#upgrade-to-pro">%s</a>',
77
+ esc_html__( 'Grab the Pro version of SmartCrawl to unlock unlimited SEO Checkups plus automated scheduled reports to always stay on top of any issues.. These features are included in a WPMU DEV membership along with 100+ plugins &amp; themes, 24/7 support and lots of handy site management tools.', 'wds' ),
78
+ esc_html__( '- Try it all FREE today', 'wds' )
79
+ ),
80
+ ) );
81
+ ?>
82
+ <?php } ?>
83
+ <?php } ?>
includes/admin/templates/checkup/checkup-checkup-running.php CHANGED
@@ -1,16 +1,18 @@
1
- <?php
2
-
3
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
4
- $percentage = $service->status();
5
- $progress = (int) $percentage;
6
-
7
- if ( $progress > 100 ) { $progress = 100; }
8
-
9
- $this->_render('progress-bar', array(
10
- 'progress' => $progress,
11
- ));
12
- ?>
13
-
14
- <div class="wds-checkup-progress-notice">
15
- <?php $this->_render( 'progress-notice' ); ?>
16
- </div>
 
 
1
+ <?php
2
+
3
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
4
+ $percentage = $service->status();
5
+ $progress = (int) $percentage;
6
+
7
+ if ( $progress > 100 ) {
8
+ $progress = 100;
9
+ }
10
+
11
+ $this->_render( 'progress-bar', array(
12
+ 'progress' => $progress,
13
+ ) );
14
+ ?>
15
+
16
+ <div class="wds-checkup-progress-notice">
17
+ <?php $this->_render( 'progress-notice' ); ?>
18
+ </div>
includes/admin/templates/checkup/checkup-checkup.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- ?>
4
-
5
- <div class="wds-report">
6
- <?php
7
- if ( $service->in_progress() ) {
8
- $this->_render( 'checkup/checkup-checkup-running' );
9
- } else {
10
- $this->_render( 'checkup/checkup-checkup-results' );
11
- }
12
- ?>
13
- </div>
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ ?>
4
+
5
+ <div class="wds-report">
6
+ <?php
7
+ if ( $service->in_progress() ) {
8
+ $this->_render( 'checkup/checkup-checkup-running' );
9
+ } else {
10
+ $this->_render( 'checkup/checkup-checkup-results' );
11
+ }
12
+ ?>
13
+ </div>
includes/admin/templates/checkup/checkup-reporting.php CHANGED
@@ -1,129 +1,131 @@
1
- <?php
2
- $cron = Smartcrawl_Controller_Cron::get();
3
-
4
- // This does the actual rescheduling
5
- $cron->set_up_schedule();
6
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
7
-
8
- $disabled = ! $service->is_member() ? 'disabled' : '';
9
- $option_name = $_view['option_name'];
10
- $toggle_field_name = $option_name . '[checkup-cron-enable]';
11
- $checkup_cron_enabled = $_view['options']['checkup-cron-enable'];
12
- ?>
13
-
14
- <?php if ( ! $service->is_member() ) : ?>
15
- <div class="wds-obfuscate-section"></div>
16
- <?php endif; ?>
17
-
18
- <div class="wds-table-fields wds-toggleable">
19
- <div class="label">
20
- <label class="wds-label"
21
- for="<?php echo esc_attr( $toggle_field_name ); ?>">
22
-
23
- <?php esc_html_e( 'Schedule automatic checkups', 'wds' ); ?>
24
- </label>
25
- <p class="wds-label-description">
26
- <?php esc_html_e( 'Configure SmartCrawl to automatically email you a comprehensive SEO report for this website.', 'wds' ); ?>
27
- </p>
28
- </div>
29
- <div class="fields wds-toggleable <?php echo $checkup_cron_enabled ? '' : 'inactive'; ?>">
30
- <?php
31
- $this->_render('toggle-item', array(
32
- 'field_name' => $toggle_field_name,
33
- 'field_id' => $toggle_field_name,
34
- 'checked' => checked( $checkup_cron_enabled, true, false ),
35
- 'item_label' => esc_html__( 'Enable regular checkups', 'wds' ),
36
- ));
37
- ?>
38
- <div class="wds-toggleable-inside wds-toggleable-inside-box">
39
- <div class="wds-table-fields wds-table-fields-stacked">
40
- <div class="label">
41
- <label for="wds-checkup-frequency" class="wds-label"><?php esc_html_e( 'Frequency', 'wds' ); ?></label>
42
- </div>
43
- <div class="fields">
44
- <select <?php echo $disabled; ?>
45
- style="width: 100%"
46
- class="select-container wds-conditional-parent"
47
- id="wds-checkup-frequency"
48
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-frequency]">
49
-
50
- <?php $checkup_freq = isset( $_view['options']['checkup-frequency'] ) ? $_view['options']['checkup-frequency'] : false; ?>
51
-
52
- <?php foreach ( $cron->get_frequencies() as $key => $label ) : ?>
53
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $checkup_freq ); ?>>
54
- <?php echo esc_html( $label ); ?>
55
- </option>
56
- <?php endforeach; ?>
57
- </select>
58
- </div>
59
- </div>
60
-
61
- <div class="wds-table-fields wds-table-fields-stacked wds-conditional-child"
62
- data-parent="wds-checkup-frequency"
63
- data-parent-val="weekly,monthly">
64
-
65
- <div class="label">
66
- <label for="wds-checkup-dow" class="wds-label"><?php esc_html_e( 'Day of the week', 'wds' ); ?></label>
67
- </div>
68
- <div class="fields">
69
- <select <?php echo $disabled; ?>
70
- style="width: 100%"
71
- class="select-container"
72
- id="wds-checkup-dow"
73
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-dow]">
74
-
75
- <?php $monday = strtotime( 'this Monday' ); ?>
76
- <?php $checkup_dow = isset( $_view['options']['checkup-dow'] ) ? $_view['options']['checkup-dow'] : false; ?>
77
- <?php foreach ( range( 0, 6 ) as $dow ) : ?>
78
- <option value="<?php echo esc_attr( $dow ); ?>" <?php selected( $dow, $checkup_dow ); ?>>
79
- <?php echo esc_html( date_i18n( 'l', $monday + ($dow * DAY_IN_SECONDS) ) ); ?>
80
- </option>
81
- <?php endforeach; ?>
82
- </select>
83
- </div>
84
- </div>
85
-
86
- <div class="wds-table-fields wds-table-fields-stacked">
87
- <div class="label">
88
- <label for="wds-checkup-tod" class="wds-label"><?php esc_html_e( 'Time of day', 'wds' ); ?></label>
89
- </div>
90
- <div class="fields">
91
-
92
- <select <?php echo $disabled; ?>
93
- style="width: 100%"
94
- class="select-container"
95
- id="wds-checkup-tod"
96
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-tod]">
97
-
98
- <?php $midnight = strtotime( 'today' ); ?>
99
- <?php $checkup_tod = isset( $_view['options']['checkup-tod'] ) ? $_view['options']['checkup-tod'] : false; ?>
100
- <?php foreach ( range( 0, 23 ) as $tod ) : ?>
101
- <option value="<?php echo esc_attr( $tod ); ?>" <?php selected( $tod, $checkup_tod ); ?>>
102
- <?php echo esc_html( date_i18n( get_option( 'time_format' ), $midnight + ($tod * HOUR_IN_SECONDS) ) ); ?>
103
- </option>
104
- <?php endforeach; ?>
105
- </select>
106
- </div>
107
- </div>
108
- </div>
109
- </div>
110
- </div>
111
-
112
- <div class="wds-table-fields wds-separator-top">
113
- <div class="label">
114
- <label class="wds-label"><?php esc_html_e( 'Email recipients', 'wds' ); ?></label>
115
- <p class="wds-label-description">
116
- <?php esc_html_e( 'Choose which of your website’s users will receive the SEO report.', 'wds' ); ?>
117
- </p>
118
- </div>
119
- <div class="fields">
120
- <?php
121
- $this->_render('user-search', array(
122
- 'users' => (isset( $_view['options']['email-recipients'] ) ? $_view['options']['email-recipients'] : array()),
123
- 'option_name' => $option_name,
124
- 'users_key' => 'email-recipients',
125
- 'new_user_key' => 'new-user',
126
- ));
127
- ?>
128
- </div>
129
- </div>
 
 
1
+ <?php
2
+ $cron = Smartcrawl_Controller_Cron::get();
3
+
4
+ // This does the actual rescheduling
5
+ $cron->set_up_schedule();
6
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
7
+
8
+ $disabled = ! $service->is_member() ? 'disabled' : '';
9
+ $option_name = $_view['option_name'];
10
+ $toggle_field_name = $option_name . '[checkup-cron-enable]';
11
+ $checkup_cron_enabled = $_view['options']['checkup-cron-enable'];
12
+ ?>
13
+
14
+ <?php if ( ! $service->is_member() ) : ?>
15
+ <div class="wds-obfuscate-section"></div>
16
+ <?php endif; ?>
17
+
18
+ <div class="wds-table-fields wds-toggleable">
19
+ <div class="label">
20
+ <label class="wds-label"
21
+ for="<?php echo esc_attr( $toggle_field_name ); ?>">
22
+
23
+ <?php esc_html_e( 'Schedule automatic checkups', 'wds' ); ?>
24
+ </label>
25
+ <p class="wds-label-description">
26
+ <?php esc_html_e( 'Configure SmartCrawl to automatically email you a comprehensive SEO report for this website.', 'wds' ); ?>
27
+ </p>
28
+ </div>
29
+ <div class="fields wds-toggleable <?php echo $checkup_cron_enabled ? '' : 'inactive'; ?>">
30
+ <?php
31
+ $this->_render( 'toggle-item', array(
32
+ 'field_name' => $toggle_field_name,
33
+ 'field_id' => $toggle_field_name,
34
+ 'checked' => checked( $checkup_cron_enabled, true, false ),
35
+ 'item_label' => esc_html__( 'Enable regular checkups', 'wds' ),
36
+ ) );
37
+ ?>
38
+ <div class="wds-toggleable-inside wds-toggleable-inside-box">
39
+ <div class="wds-table-fields wds-table-fields-stacked">
40
+ <div class="label">
41
+ <label for="wds-checkup-frequency"
42
+ class="wds-label"><?php esc_html_e( 'Frequency', 'wds' ); ?></label>
43
+ </div>
44
+ <div class="fields">
45
+ <select <?php echo esc_attr($disabled); ?>
46
+ style="width: 100%"
47
+ class="select-container wds-conditional-parent"
48
+ id="wds-checkup-frequency"
49
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-frequency]">
50
+
51
+ <?php $checkup_freq = isset( $_view['options']['checkup-frequency'] ) ? $_view['options']['checkup-frequency'] : false; ?>
52
+
53
+ <?php foreach ( $cron->get_frequencies() as $key => $label ) : ?>
54
+ <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $checkup_freq ); ?>>
55
+ <?php echo esc_html( $label ); ?>
56
+ </option>
57
+ <?php endforeach; ?>
58
+ </select>
59
+ </div>
60
+ </div>
61
+
62
+ <div class="wds-table-fields wds-table-fields-stacked wds-conditional-child"
63
+ data-parent="wds-checkup-frequency"
64
+ data-parent-val="weekly,monthly">
65
+
66
+ <div class="label">
67
+ <label for="wds-checkup-dow"
68
+ class="wds-label"><?php esc_html_e( 'Day of the week', 'wds' ); ?></label>
69
+ </div>
70
+ <div class="fields">
71
+ <select <?php echo esc_attr($disabled); ?>
72
+ style="width: 100%"
73
+ class="select-container"
74
+ id="wds-checkup-dow"
75
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-dow]">
76
+
77
+ <?php $monday = strtotime( 'this Monday' ); ?>
78
+ <?php $checkup_dow = isset( $_view['options']['checkup-dow'] ) ? $_view['options']['checkup-dow'] : false; ?>
79
+ <?php foreach ( range( 0, 6 ) as $dow ) : ?>
80
+ <option value="<?php echo esc_attr( $dow ); ?>" <?php selected( $dow, $checkup_dow ); ?>>
81
+ <?php echo esc_html( date_i18n( 'l', $monday + ( $dow * DAY_IN_SECONDS ) ) ); ?>
82
+ </option>
83
+ <?php endforeach; ?>
84
+ </select>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="wds-table-fields wds-table-fields-stacked">
89
+ <div class="label">
90
+ <label for="wds-checkup-tod" class="wds-label"><?php esc_html_e( 'Time of day', 'wds' ); ?></label>
91
+ </div>
92
+ <div class="fields">
93
+
94
+ <select <?php echo esc_attr($disabled); ?>
95
+ style="width: 100%"
96
+ class="select-container"
97
+ id="wds-checkup-tod"
98
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[checkup-tod]">
99
+
100
+ <?php $midnight = strtotime( 'today' ); ?>
101
+ <?php $checkup_tod = isset( $_view['options']['checkup-tod'] ) ? $_view['options']['checkup-tod'] : false; ?>
102
+ <?php foreach ( range( 0, 23 ) as $tod ) : ?>
103
+ <option value="<?php echo esc_attr( $tod ); ?>" <?php selected( $tod, $checkup_tod ); ?>>
104
+ <?php echo esc_html( date_i18n( get_option( 'time_format' ), $midnight + ( $tod * HOUR_IN_SECONDS ) ) ); ?>
105
+ </option>
106
+ <?php endforeach; ?>
107
+ </select>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <div class="wds-table-fields wds-separator-top">
115
+ <div class="label">
116
+ <label class="wds-label"><?php esc_html_e( 'Email recipients', 'wds' ); ?></label>
117
+ <p class="wds-label-description">
118
+ <?php esc_html_e( 'Choose which of your website’s users will receive the SEO report.', 'wds' ); ?>
119
+ </p>
120
+ </div>
121
+ <div class="fields">
122
+ <?php
123
+ $this->_render( 'user-search', array(
124
+ 'users' => ( isset( $_view['options']['email-recipients'] ) ? $_view['options']['email-recipients'] : array() ),
125
+ 'option_name' => $option_name,
126
+ 'users_key' => 'email-recipients',
127
+ 'new_user_key' => 'new-user',
128
+ ) );
129
+ ?>
130
+ </div>
131
+ </div>
includes/admin/templates/checkup/checkup-settings.php CHANGED
@@ -1,89 +1,78 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- ?>
4
- <div id="container" class="wrap wrap-wds wds-page wds-checkup-settings <?php echo $service->is_member() ? 'wds-is-member' : 'wds-is-not-member'; ?>">
5
-
6
- <section id="header">
7
- <?php $this->_render( 'settings-message-top' ); ?>
8
- <div class="actions">
9
- <?php
10
- printf(
11
- __( 'Last checked: %s', 'wds' ),
12
- $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
13
- );
14
- ?>
15
- <a href="<?php echo esc_url( add_query_arg( 'run-checkup', 'yes' ) ); ?>" class="button button-small">
16
- <?php esc_html_e( 'Run checkup', 'wds' ); ?>
17
- </a>
18
- </div>
19
- <h1><?php esc_html_e( 'SEO Checkup' , 'wds' ); ?></h1>
20
- </section><!-- end header -->
21
-
22
- <div class="wds-seo-checkup-stats-container">
23
- <?php $this->_render( 'checkup/checkup-top' ); ?>
24
- </div>
25
-
26
- <?php
27
- $smartcrawl_options = Smartcrawl_Settings::get_options();
28
- if ( ! smartcrawl_is_allowed_tab( $_view['slug'] ) ) {
29
- printf( __( "Your network admin prevented access to '%s', please move onto next step.", 'wds' ), __( 'SEO Checkup' , 'wds' ) );
30
- } elseif ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
31
-
32
- ?>
33
- <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
34
- <?php settings_fields( $_view['option_name'] ); ?>
35
-
36
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1">
37
-
38
- <div class="vertical-tabs" id="checkup-settings-tabs">
39
- <?php
40
- $this->_render('report-vertical-tab', array(
41
- 'tab_id' => 'tab_checkup',
42
- 'tab_name' => __( 'Checkup', 'wds' ),
43
- 'is_active' => $active_tab == 'tab_checkup',
44
- 'tab_sections' => array(
45
- array(
46
- 'section_template' => 'checkup/checkup-checkup',
47
- ),
48
- ),
49
- ));
50
- ?>
51
- <?php
52
- $is_member = $service->is_member();
53
- $this->_render(
54
- $is_member ? 'vertical-tab' : 'report-vertical-tab',
55
- array(
56
- 'tab_id' => 'tab_settings',
57
- 'tab_name' => __( 'Reporting', 'wds' ),
58
- 'is_active' => $active_tab == 'tab_settings',
59
- 'title_button' => 'upgrade',
60
- 'tab_sections' => array(
61
- array(
62
- 'section_description' => esc_html__( 'Set up SmartCrawl to automatically run a comprehensive checkup daily, weekly or monthly and receive an email report.', 'wds' ),
63
- 'section_template' => 'checkup/checkup-reporting',
64
- ),
65
- ),
66
- )
67
- );
68
- ?>
69
-
70
- </div>
71
- </form>
72
-
73
- <?php
74
- } else {
75
- $this->_render('disabled-component', array(
76
- 'content' => sprintf(
77
- '%s<br/>%s',
78
- __( 'Automatically generate a full sitemap, regularly send updates to search engines and set up', 'wds' ),
79
- __( 'SmartCrawl to automatically check URLs are discoverable by search engines.', 'wds' )
80
- ),
81
- 'image' => 'sitemap-disabled.png',
82
- 'component' => 'sitemap',
83
- 'button_text' => __( 'Activate Sitemap', 'wds' ),
84
- ));
85
- }
86
- ?>
87
- <?php $this->_render( 'upsell-modal' ); ?>
88
- </div>
89
-
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ $checkup_url = Smartcrawl_Checkup_Settings::checkup_url();
4
+ $last_checked = $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) );
5
+ ?>
6
+ <div id="container"
7
+ class="wrap wrap-wds wds-page wds-checkup-settings <?php echo $service->is_member() ? 'wds-is-member' : 'wds-is-not-member'; ?>">
8
+
9
+ <section id="header">
10
+ <?php $this->_render( 'settings-message-top' ); ?>
11
+ <div class="actions">
12
+ <?php
13
+ printf(
14
+ esc_html__( 'Last checked: %s', 'wds' ),
15
+ esc_html( $last_checked )
16
+ );
17
+ ?>
18
+ <a href="<?php echo esc_attr( $checkup_url ); ?>" class="button button-small">
19
+ <?php esc_html_e( 'Run checkup', 'wds' ); ?>
20
+ </a>
21
+ <a target="_blank" class="button button-small button-light actions-button"
22
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-1">
23
+ <i class="wds-icon-academy"></i>
24
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
25
+ </a>
26
+ </div>
27
+ <h1><?php esc_html_e( 'SEO Checkup', 'wds' ); ?></h1>
28
+ </section><!-- end header -->
29
+
30
+ <div class="wds-seo-checkup-stats-container">
31
+ <?php $this->_render( 'checkup/checkup-top' ); ?>
32
+ </div>
33
+
34
+ <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
35
+ <?php settings_fields( $_view['option_name'] ); ?>
36
+
37
+ <input type="hidden"
38
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
39
+ value="1">
40
+
41
+ <div class="vertical-tabs" id="checkup-settings-tabs">
42
+ <?php
43
+ $this->_render( 'report-vertical-tab', array(
44
+ 'tab_id' => 'tab_checkup',
45
+ 'tab_name' => __( 'Checkup', 'wds' ),
46
+ 'is_active' => 'tab_checkup' === $active_tab,
47
+ 'tab_sections' => array(
48
+ array(
49
+ 'section_template' => 'checkup/checkup-checkup',
50
+ ),
51
+ ),
52
+ ) );
53
+ ?>
54
+ <?php
55
+ $is_member = $service->is_member();
56
+ $this->_render(
57
+ $is_member ? 'vertical-tab' : 'report-vertical-tab',
58
+ array(
59
+ 'tab_id' => 'tab_settings',
60
+ 'tab_name' => __( 'Reporting', 'wds' ),
61
+ 'is_active' => 'tab_settings' === $active_tab,
62
+ 'title_button' => 'upgrade',
63
+ 'tab_sections' => array(
64
+ array(
65
+ 'section_description' => esc_html__( 'Set up SmartCrawl to automatically run a comprehensive checkup daily, weekly or monthly and receive an email report.', 'wds' ),
66
+ 'section_template' => 'checkup/checkup-reporting',
67
+ ),
68
+ ),
69
+ )
70
+ );
71
+ ?>
72
+
73
+ </div>
74
+ </form>
75
+
76
+ <?php $this->_render( 'upsell-modal' ); ?>
77
+ </div>
78
+
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/checkup/checkup-top.php CHANGED
@@ -1,96 +1,98 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- if ( $service->in_progress() ) {
4
- return;
5
- }
6
-
7
- $results = $service->result();
8
- $counts = smartcrawl_get_array_value( $results, 'counts' );
9
- $score = smartcrawl_get_array_value( $results, 'score' );
10
-
11
- if ( $counts === null || $score === null || false === $score ) {
12
- return;
13
- }
14
-
15
- $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
16
- $score_class = $issue_count > 0 ? 'wds-score-warning' : 'wds-score-success';
17
- $opts = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_CHECKUP );
18
- $reporting_enabled = ! empty( $opts['checkup-cron-enable'] );
19
- ?>
20
- <div class="wds-seo-checkup-stats wds-report-stats" data-issue-count="<?php echo esc_attr( $issue_count ); ?>">
21
- <div class="wds-report-score">
22
- <div class="wds-score <?php echo esc_attr( $score_class ); ?>">
23
- <?php echo esc_html( $score ); ?><span class="wds-total"><?php esc_html_e( '/100', 'wds' ); ?></span>
24
- </div>
25
- <div class="wds-small-text"><?php esc_html_e( 'Current SEO Score', 'wds' ); ?></div>
26
- </div>
27
-
28
- <div>
29
- <div class="wds-stacked-stats">
30
- <div>
31
- <div class="wds-stat-name"><?php esc_html_e( 'Last checked:', 'wds' ); ?></div>
32
- <div class="wds-stat-value"><?php echo esc_html( $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ); ?></div>
33
- </div>
34
-
35
- <div>
36
- <div class="wds-stat-name"><?php esc_html_e( 'SEO Issues', 'wds' ); ?></div>
37
- <div class="wds-stat-value">
38
- <span class="wds-issues <?php echo $issue_count > 0 ? esc_attr( 'wds-issues-warning' ) : ''; ?>">
39
- <span><?php echo esc_html( $issue_count ); ?></span>
40
- </span>
41
- </div>
42
- </div>
43
-
44
- <div>
45
- <div class="wds-stat-name"><?php esc_html_e( 'Scheduled reports', 'wds' ); ?></div>
46
- <div class="wds-stat-value" style="line-height: 1">
47
- <?php if ( $service->is_member() ) : ?>
48
- <?php if ( $reporting_enabled ) : ?>
49
-
50
- <?php
51
- $monday = strtotime( 'this Monday' );
52
- $midnight = strtotime( 'today' );
53
- $checkup_frequency = smartcrawl_get_array_value( $opts, 'checkup-frequency' );
54
- $checkup_dow = smartcrawl_get_array_value( $opts, 'checkup-dow' );
55
- $checkup_tod = smartcrawl_get_array_value( $opts, 'checkup-tod' );
56
- ?>
57
-
58
- <span class="wds-checkup-frequency"><?php echo esc_html( $checkup_frequency ); ?></span><br/>
59
- <span class="wds-checkup-frequency-details">
60
- <?php
61
- if ( $checkup_frequency == 'daily' ) {
62
- printf(
63
- __( 'at %s' ),
64
- esc_html( date_i18n( get_option( 'time_format' ), $midnight + ($checkup_tod * HOUR_IN_SECONDS) ) )
65
- );
66
- } else {
67
- printf(
68
- __( 'Every %1$s at %1$s' ),
69
- esc_html( date_i18n( 'l', $monday + ($checkup_dow * DAY_IN_SECONDS) ) ),
70
- esc_html( date_i18n( get_option( 'time_format' ), $midnight + ($checkup_tod * HOUR_IN_SECONDS) ) )
71
- );
72
- }
73
- ?>
74
- </span>
75
-
76
- <?php else : ?>
77
- <button class="button button-small wds-enable-reporting">
78
- <?php esc_html_e( 'Enable', 'wds' ); ?>
79
- </button>
80
- <button class="button button-small wds-disable-reporting"
81
- style="display: none;">
82
- <?php esc_html_e( 'Disable', 'wds' ); ?>
83
- </button>
84
- <?php endif; ?>
85
- <?php else : /* Not a member, this is a pro feature */ ?>
86
- <button class="wds-upgrade-button button-pro wds-has-tooltip"
87
- data-content="<?php _e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
88
- type="button">
89
- <?php esc_html_e( 'Pro feature', 'wds' ); ?>
90
- </button>
91
- <?php endif; ?>
92
- </div>
93
- </div>
94
- </div>
95
- </div>
96
- </div>
 
 
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ if ( $service->in_progress() ) {
4
+ return;
5
+ }
6
+
7
+ $results = $service->result();
8
+ $counts = smartcrawl_get_array_value( $results, 'counts' );
9
+ $score = smartcrawl_get_array_value( $results, 'score' );
10
+
11
+ if ( null === $counts || null === $score || false === $score ) {
12
+ return;
13
+ }
14
+
15
+ $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
16
+ $score_class = $issue_count > 0 ? 'wds-score-warning' : 'wds-score-success';
17
+ $opts = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_CHECKUP );
18
+ $reporting_enabled = ! empty( $opts['checkup-cron-enable'] );
19
+ ?>
20
+ <div class="wds-seo-checkup-stats wds-report-stats" data-issue-count="<?php echo esc_attr( $issue_count ); ?>">
21
+ <div class="wds-report-score">
22
+ <div class="wds-score <?php echo esc_attr( $score_class ); ?>">
23
+ <?php echo esc_html( $score ); ?><span class="wds-total"><?php esc_html_e( '/100', 'wds' ); ?></span>
24
+ </div>
25
+ <div class="wds-small-text"><?php esc_html_e( 'Current SEO Score', 'wds' ); ?></div>
26
+ </div>
27
+
28
+ <div>
29
+ <div class="wds-stacked-stats">
30
+ <div>
31
+ <div class="wds-stat-name"><?php esc_html_e( 'Last checked:', 'wds' ); ?></div>
32
+ <div
33
+ class="wds-stat-value"><?php echo esc_html( $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ); ?></div>
34
+ </div>
35
+
36
+ <div>
37
+ <div class="wds-stat-name"><?php esc_html_e( 'SEO Issues', 'wds' ); ?></div>
38
+ <div class="wds-stat-value">
39
+ <span class="wds-issues <?php echo $issue_count > 0 ? esc_attr( 'wds-issues-warning' ) : ''; ?>">
40
+ <span><?php echo esc_html( $issue_count ); ?></span>
41
+ </span>
42
+ </div>
43
+ </div>
44
+
45
+ <div>
46
+ <div class="wds-stat-name"><?php esc_html_e( 'Scheduled reports', 'wds' ); ?></div>
47
+ <div class="wds-stat-value" style="line-height: 1">
48
+ <?php if ( $service->is_member() ) : ?>
49
+ <?php if ( $reporting_enabled ) : ?>
50
+
51
+ <?php
52
+ $monday = strtotime( 'this Monday' );
53
+ $midnight = strtotime( 'today' );
54
+ $checkup_frequency = smartcrawl_get_array_value( $opts, 'checkup-frequency' );
55
+ $checkup_dow = smartcrawl_get_array_value( $opts, 'checkup-dow' );
56
+ $checkup_tod = smartcrawl_get_array_value( $opts, 'checkup-tod' );
57
+ ?>
58
+
59
+ <span class="wds-checkup-frequency"><?php echo esc_html( $checkup_frequency ); ?></span>
60
+ <br/>
61
+ <span class="wds-checkup-frequency-details">
62
+ <?php
63
+ if ( 'daily' === $checkup_frequency ) {
64
+ printf(
65
+ esc_html__( 'at %s' ),
66
+ esc_html( date_i18n( get_option( 'time_format' ), $midnight + ( $checkup_tod * HOUR_IN_SECONDS ) ) )
67
+ );
68
+ } else {
69
+ printf(
70
+ esc_html__( 'Every %1$s at %2$s' ),
71
+ esc_html( date_i18n( 'l', $monday + ( $checkup_dow * DAY_IN_SECONDS ) ) ),
72
+ esc_html( date_i18n( get_option( 'time_format' ), $midnight + ( $checkup_tod * HOUR_IN_SECONDS ) ) )
73
+ );
74
+ }
75
+ ?>
76
+ </span>
77
+
78
+ <?php else : ?>
79
+ <button class="button button-small wds-enable-reporting">
80
+ <?php esc_html_e( 'Enable', 'wds' ); ?>
81
+ </button>
82
+ <button class="button button-small wds-disable-reporting"
83
+ style="display: none;">
84
+ <?php esc_html_e( 'Disable', 'wds' ); ?>
85
+ </button>
86
+ <?php endif; ?>
87
+ <?php else : /* Not a member, this is a pro feature */ ?>
88
+ <button class="wds-upgrade-button button-pro wds-has-tooltip"
89
+ data-content="<?php esc_attr_e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
90
+ type="button">
91
+ <?php esc_html_e( 'Pro feature', 'wds' ); ?>
92
+ </button>
93
+ <?php endif; ?>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
includes/admin/templates/dashboard-dialog-has_dashboard-service_seo.php DELETED
@@ -1,231 +0,0 @@
1
- <?php do_action( 'wds-template-seo_service-box-full-before' ); ?>
2
-
3
- <?php
4
- // We have Dashboard installed and set up, we're ready to go
5
- ?>
6
- <?php if ( empty( $status['start'] ) /*&& empty($status['end'])*/ ) { ?>
7
- <section class="box-dashboard-run-seo-anaysis dev-box">
8
- <div class="box-title">
9
- <h3><span class="dashicons dashicons-dashboard wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Run SEO analysis of your site', 'wds' ); ?></h3>
10
- </div>
11
- <?php if ( ! empty( $errors ) ) { ?>
12
- <div class="box-content">
13
- <?php foreach ( $errors as $error ) { ?>
14
- <div class="wds-notice wds-notice-error">
15
- <p><?php echo $error; ?></p>
16
- </div>
17
- <?php } ?>
18
- </div>
19
- <?php } ?>
20
-
21
- <div class="box-content wds-seo_service-results-parent">
22
- <?php do_action( 'wds-template-seo_service-box-full-before_body' ); ?>
23
- <p><?php esc_html_e( 'Let our servers run a comprehensive scan of your entire website & compile a list of suggestions on how you can improve the SEO of your website.', 'wds' ); ?></p>
24
- </div>
25
- <div class="box-footer buttons">
26
- <a href="#run-seo-analysis-modal" rel="dialog" class="button button-cta-alt"><?php esc_html_e( 'Run SEO analysis', 'wds' ); ?></a>
27
- </div>
28
-
29
- </section><!-- end box-dashboard-run-seo-anaysis -->
30
- <?php } ?>
31
-
32
-
33
- <?php
34
- // SEO Report Test still on progress
35
- ?>
36
- <?php if ( ! empty( $status['start'] ) ) { ?>
37
- <section class="box-dashboard-run-seo-anaysis dev-box">
38
- <div class="box-title">
39
- <h3><span class="dashicons dashicons-dashboard wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Run SEO analysis of your site', 'wds' ); ?></h3>
40
- </div>
41
-
42
- <div class="box-content">
43
- <?php if ( ! empty( $errors ) ) { foreach ( $errors as $error ) { ?>
44
- <div class="wds-notice wds-notice-error">
45
- <p><?php echo $error; ?></p>
46
- </div>
47
- <?php }
48
- } ?>
49
-
50
- <?php if ( $report->has_state_messages() ) { ?>
51
- <div class="result state-messages">
52
- <?php foreach ( $report->get_state_messages() as $message ) { ?>
53
- <div class="wds-notice wds-notice-error">
54
- <p><?php echo esc_html( $message ); ?></p>
55
- </div>
56
- <?php } ?>
57
- </div>
58
- </div>
59
- <?php } ?>
60
-
61
- <?php if ( empty( $status['end'] ) ) { ?>
62
- <?php $this->_render( 'dashboard-dialog-seo_service-run', array( 'status' => $status ) ); ?>
63
- <?php } elseif ( ! empty( $has_result ) ) { ?>
64
- <?php
65
- // --- SEO check is done, let's go for results ---
66
- ?>
67
- <div class="box-content no-padding wds-seo_service-results-parent">
68
- <?php do_action( 'wds-template-seo_service-box-full-before_body' ); ?>
69
- <div class="wds-seo_service-results">
70
-
71
- <div class="wds-overview">
72
- <?php if ( $report->has_meta( 'total' ) ) { ?>
73
- <div class="wds-overview-item">
74
- <strong><?php echo (int) $report->get_meta( 'total' ); ?></strong>
75
- <span><?php esc_html_e( 'Total Discovered URLs', 'wds' ); ?></span>
76
- </div>
77
- <?php } ?>
78
- <?php if ( $report->has_meta( 'discovered' ) ) { ?>
79
- <div class="wds-overview-item">
80
- <strong><?php echo (int) $report->get_meta( 'discovered' ); ?></strong>
81
- <span><?php esc_html_e( 'Newly Discovered URLs', 'wds' ); ?></span>
82
- </div>
83
- <?php } ?>
84
- <?php if ( $report->has_issues( 'inaccessible' ) ) { ?>
85
- <div class="wds-overview-item">
86
- <strong><?php echo (int) $report->get_issues_count( 'inaccessible' ); ?></strong>
87
- <span><?php esc_html_e( 'Invisible URLs', 'wds' ); ?></span>
88
- </div>
89
- <?php } ?>
90
- <?php if ( $report->has_meta( 'sitemap_total' ) ) { ?>
91
- <div class="wds-overview-item">
92
- <strong><?php echo (int) $report->get_meta( 'sitemap_total' ); ?></strong>
93
- <span><?php esc_html_e( 'URLs in the Sitemap', 'wds' ); ?></span>
94
- </div>
95
- <?php } ?>
96
- </div>
97
-
98
- <?php /* "Not processed" notice, displayed as warning, outside the main report */ ?>
99
- <?php if ( $report->get_issues_count( 'not_processed' ) ) { ?>
100
- <div class="result not-processed">
101
- <div class="wds-notice wds-notice-warning">
102
- <p><?php esc_html_e( 'Some parts of your site were too slow to respond and were not included in our crawl.', 'wds' ); ?></p>
103
- </div>
104
- </div>
105
- <?php } ?>
106
-
107
- <?php if ( $report->has_issues() ) { ?>
108
- <div class="wds-breakdown">
109
- <h4><?php echo esc_html_e( 'We have found a few issues with URLs:', 'wds' ); ?></h4>
110
- <?php
111
- if ( $report->has_issues( '5xx' ) ) {
112
- $this->_render('dashboard-report-issue', array(
113
- 'type' => '5xx',
114
- 'msg' => __( 'URLs that result in server error (500 etc)', 'wds' ),
115
- 'report' => $report,
116
- 'issues' => $report->get_issues_by_type( '5xx' ),
117
- 'redirections' => $redirections,
118
- ));
119
- }
120
- if ( $report->has_issues( '4xx' ) ) {
121
- $this->_render('dashboard-report-issue', array(
122
- 'type' => '4xx',
123
- 'msg' => __( 'URLs that result in soft error (404 etc)', 'wds' ),
124
- 'report' => $report,
125
- 'issues' => $report->get_issues_by_type( '4xx' ),
126
- 'redirections' => $redirections,
127
- ));
128
- }
129
- if ( $report->has_issues( '3xx' ) ) {
130
- $this->_render('dashboard-report-issue', array(
131
- 'type' => '3xx',
132
- 'msg' => __( 'URLs that have multiple re-directs', 'wds' ),
133
- 'report' => $report,
134
- 'issues' => $report->get_issues_by_type( '3xx' ),
135
- 'redirections' => $redirections,
136
- ));
137
- }
138
- ?>
139
- </div>
140
- <?php } else { // if issues count ?>
141
- <div class="wds-breakdown">
142
- <div class="wds-service-no_issue">
143
- <?php if ( ! $report->has_state_messages() ) { ?>
144
- <div class="wds-crawl-result wds-crawl-success">
145
- <p><?php esc_html_e( 'Your latest crawl revealed no SEO issues, well done!', 'wds' ); ?></p>
146
- <?php if ( $report->has_ignored_issues() ) { ?>
147
- <p>
148
- <em><small><?php esc_html_e( 'Well, that\'s not entirely true, but you opted to ignore a couple of them ;)', 'wds' ); ?></small></em>
149
- <a href="#purge-ignores"><?php esc_html_e( 'Purge ignored list', 'wds' ); ?></a>
150
- </p>
151
- <?php } ?>
152
- </div>
153
- <?php } else { ?>
154
- <p><?php
155
- esc_html_e( 'Please, have a look into the displayed messages and re-crawl your site.', 'wds' );
156
- ?></p>
157
- <?php } ?>
158
- </div>
159
- </div>
160
- <?php } // if issues count ?>
161
-
162
- <?php if ( $report->get_sitemap_misses() ) { ?>
163
- <div class="wds-sitemap">
164
- <div class="wds-seo_service-warning wds-seo_service-warning-sitemap">
165
- <p>
166
- <?php printf( __( '%d URLs are not in the Sitemap', 'wds' ), ($report->get_sitemap_misses()) ); ?>
167
- <button
168
- class="wds-update-sitemap button button-yellow-alt"
169
- data-working="<?php esc_attr_e( 'Updating...', 'wds' ); ?>"
170
- data-static="<?php esc_attr_e( 'Update Sitemap', 'wds' ); ?>"
171
- data-done="<?php esc_attr_e( 'Sitemap updated, please hold on...', 'wds' ); ?>"
172
- type="button" >
173
- <?php esc_html_e( 'Update Sitemap', 'wds' ); ?>
174
- </button>
175
- <span class="info">
176
- <small><i>
177
- <?php esc_html_e( 'This number might not be indicative of an actual issue on your site. These URLs could also be things that don\'t make sense to be found in the sitemap, such as date archives.', 'wds' ); ?>
178
- <?php if ( $report->has_issues( 'sitemap' ) ) { ?>
179
- <a href="#toggle-sitemap-urls"><?php esc_html_e( 'Show', 'wds' ); ?></a>
180
- <?php } ?>
181
- </i></small>
182
- </span>
183
- </p>
184
- <?php if ( $report->has_issues( 'sitemap' ) ) { ?>
185
- <div class="wds-sitemap-issues_list" style="display:none">
186
- <ul>
187
- <?php foreach ( $report->get_issues_by_type( 'sitemap' ) as $key ) { ?>
188
- <?php $info = $report->get_issue( $key ); ?>
189
- <?php if ( empty( $info['path'] ) ) { continue; } ?>
190
- <li
191
- data-issue_id="<?php echo esc_attr( $key ); ?>"
192
- data-path="<?php echo esc_attr( $info['path'] ); ?>"
193
- >
194
- <a href="<?php echo esc_url( $info['path'] ); ?>">
195
- <?php echo esc_html( $info['path'] ); ?>
196
- </a>
197
- <a class="wds-sitemap-action wds-sitemap-ignore" href="#ignore"><?php esc_html_e( 'Ignore', 'wds' ); ?></a>
198
- <a class="wds-sitemap-action wds-sitemap-add" href="#add"><?php esc_html_e( 'Add to sitemap', 'wds' ); ?></a>
199
- </li>
200
- <?php } ?>
201
- </ul>
202
- </div>
203
- <?php } ?>
204
- </div>
205
- </div>
206
- <?php } ?>
207
-
208
- <?php if ( $report->has_ignored_issues() ) { ?>
209
- <p class="wds-crawl-result wds-action-purge_ignored">
210
- <a href="#purge-ignores">
211
- <?php echo esc_html(sprintf(
212
- _n( 'Purge %d ignored issue', 'Purge %d ignored issues', $report->get_ignored_issues_count(), 'wds' ),
213
- $report->get_ignored_issues_count()
214
- )); ?>
215
- </a>
216
- </p>
217
- <?php } ?>
218
-
219
- </div>
220
- </div><!-- end box-content -->
221
-
222
- <div class="box-footer buttons bordered-top">
223
- <a href="#run-seo-analysis-modal" rel="dialog" class="button button-cta-alt"><?php esc_html_e( 'Run SEO analysis', 'wds' ); ?></a>
224
- </div>
225
-
226
- <?php } ?>
227
-
228
- </section><!-- end box-dashboard-run-seo-anaysis -->
229
- <?php } ?>
230
-
231
- <?php do_action( 'wds-template-seo_service-box-full-after' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-dialog-has_dashboard-service_uptime.php DELETED
@@ -1,30 +0,0 @@
1
- <section class="box-dashboard-performance-info dev-box">
2
- <div class="box-content">
3
- <p class="uptime-message">
4
- <span class="dashicons dashicons-chart-line wds-dashicons wds-dashicons-box-title"></span>
5
- <?php if ( ! empty( $data['availability'] ) ) { ?>
6
- <span class="uptime">
7
- <span class="uptime-result"><?php echo esc_html( $data['availability'] ); ?></span>
8
- <span class="uptime-label"><?php esc_html_e( 'Uptime', 'wds' ); ?></span>
9
- </span>
10
- <?php } ?>
11
- <?php if ( ! class_exists( 'WP_Hummingbird' ) ) { ?>
12
- <span class="content">
13
- <?php printf( __( 'Install %s for more info.' , 'wds' ), sprintf( '<a href="https://premium.wpmudev.org/project/wp-hummingbird/">%s</a>', __( 'Hummingbird', 'wds' ) ) ); ?>
14
- </span>
15
- <?php } ?>
16
- </p>
17
-
18
- <?php
19
- if ( ! empty( $errors ) ) { foreach ( $errors as $error ) {
20
- ?>
21
- <div class="wds-notice wds-notice-error">
22
- <p><?php echo esc_html( $error ); ?></p>
23
- </div>
24
- <?php
25
- }
26
- }
27
- ?>
28
-
29
- </div>
30
- </section><!-- end box-dashboard-performance-info -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-dialog-not_installed-service_seo.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- // We don't have Dashboard installed
3
- $dashboardLoginLink = admin_url( 'admin.php?page=wpmudev' );
4
- $dashboardDownloadLink = 'https://premium.wpmudev.org/api/dashboard/v1/download-dashboard';
5
- $dashboardHubLink = 'https://premium.wpmudev.org/membership/#profile-menu-tabs';
6
- ?>
7
- <section class="box-dashboard-install-dashboard-plugin dev-box">
8
- <div class="box-title">
9
- <h3><?php esc_html_e( 'Install WPMU DEV Dashboard', 'wds' ); ?></h3>
10
- </div>
11
- <div class="box-content">
12
- <p>
13
- <?php echo sprintf(
14
- esc_html( '%s, WPMU DEV Dashboard Plugin is required in order to make advantage of SEO Analysus & Reporting. Once you Install, Activate & Login, you will be able to preform SEO Analysis sancs of your entire website, receive tips about improving your SEO Rankings.', 'wds' ),
15
- Smartcrawl_Model_User::current()->get_first_name()
16
- ); ?>
17
- </p>
18
- </div>
19
- <div class="box-footer buttons">
20
- <a href="<?php echo esc_url( $dashboardDownloadLink ); ?>" class="button block button-cta-alt large"><?php esc_html_e( 'Download WPMU DEV Dashboard', 'wds' ); ?></a>
21
- </div>
22
- </section><!-- end box-dashboard-install-dashboard-plugin -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-dialog-not_installed-service_uptime.php DELETED
@@ -1,11 +0,0 @@
1
- <section class="box-dashboard-performance-info dev-box">
2
- <div class="box-title">
3
- <h3><span class="dashicons dashicons-chart-line wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Quickly check your site performance', 'wds' ); ?></h3>
4
- </div>
5
- <div class="box-content">
6
- <p><?php esc_html_e( 'This service requires an active WPMU DEV Membership, get one today!', 'wds' ); ?></p>
7
- </div>
8
- <div class="box-footer buttons">
9
- <a href="https://premium.wpmudev.org/membership/#profile-menu-tabs" target="_blank" class="button button-cta"><?php esc_html_e( 'Update Membership', 'wds' ); ?></a>
10
- </div>
11
- </section><!-- end box-dashboard-performance-info -->
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-dialog-not_logged_in-service_seo.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- // We have Dashboard installed, but the user didn't log in yet
3
- $dashboardLoginLink = admin_url( 'admin.php?page=wpmudev' );
4
- $dashboardDownloadLink = 'https://premium.wpmudev.org/api/dashboard/v1/download-dashboard';
5
- $dashboardHubLink = 'https://premium.wpmudev.org/membership/#profile-menu-tabs';
6
- ?>
7
- <section class="box-dashboard-upgrade-membership dev-box">
8
- <div class="box-title">
9
- <h3><?php esc_html_e( 'Upgrade Membership', 'wds' ); ?></h3>
10
- </div>
11
- <div class="box-content">
12
- <p>
13
- <?php echo sprintf(
14
- esc_html( '%s SEO Analysis & Reporting is a feature available to people with active WPMU DEV memberships. Get access to all of our Premium Plugins and Themes as well as 24/7 Support today. It´s easy to join and only takes a few minutes!', 'wds' ),
15
- Smartcrawl_Model_User::current()->get_first_name()
16
- ); ?>
17
- </p>
18
- <ul class="listing bold wds-listing">
19
- <li class="cta-alt"><?php _e( 'Access to 140+ plugins & Upfront themes', 'wds' ); ?></li>
20
- <li class="cta-alt"><?php _e( 'Access to security, backups, SEO and performance services', 'wds' ); ?></li>
21
- <li class="cta-alt"><?php _e( '24/7 expert WordPress support', 'wds' ); ?></li>
22
- </ul>
23
- </div>
24
- <div class="box-footer buttons">
25
- <a href="<?php echo $dashboardHubLink; ?>" class="button block button-cta-alt large"><?php esc_html_e( 'Upgrade Membership', 'wds' ); ?></a>
26
- <p class="wds-footer-text"><?php echo sprintf( __( 'Already a member? You need to <a href="%1$s">download</a> the WPMU DEV Plugin & <a href="%1$s">login</a>!', 'wds' ), $dashboardDownloadLink, $dashboardLoginLink ); ?></p>
27
- </div>
28
- </section><!-- end box-dashboard-upgrade-membership -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-dialog-seo_service-run.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- $progress = isset( $status ) && ! empty( $status['percentage'] ) && is_numeric( $status['percentage'] )
3
- ? (int) $status['percentage']
4
- : 0
5
- ;
6
- if ( $progress > 100 ) { $progress = 100; }
7
- ?>
8
- <div class="box-content wds-seo_service-run">
9
- <div class="wds-block-test wds-block-test-standalone">
10
- <h4 class="wds-block-test-sub-title"><?php _e( 'SEO analysis in progress', 'wds' ); ?></h4>
11
- <div class="wds-progress">
12
- <div class="wds-progress-bar wds-progress-bar-with-percent wds-progress-bar-animated" role="progressbar" aria-valuenow="<?php echo (int) $progress; ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?php echo (int) $progress; ?>%;">
13
- <span class="wds-progress-bar-current-percent"><?php echo (int) $progress; ?>%</span>
14
- </div>
15
- </div><!-- end wds-progress -->
16
- <div class="wds-progress-state">
17
- <span class="wds-progress-state-text"><?php _e( 'Checking the site ...', 'wds' ); ?></span>
18
- </div><!-- end wds-progress-state -->
19
- <div class="wds-progress-note">
20
- <?php
21
- $admin_email = false;
22
- $dash_email = false;
23
- if ( class_exists( 'WPMUDEV_Dashboard' ) && ! empty( WPMUDEV_Dashboard::$site ) ) {
24
- if ( is_callable( array( WPMUDEV_Dashboard::$site, 'get_option' ) ) ) {
25
- $dash_email = WPMUDEV_Dashboard::$site->get_option( 'auth_user' );
26
- if ( false !== strpos( $dash_email, '@' ) ) { $admin_email = $dash_email; }
27
- }
28
- }
29
- $scan_msg = __( "A full scan can take quite a while, especially if you have a large site!<br>Feel free to close this page; we'll send an e-mail to %s once the results are in.", 'wds' );
30
- ?>
31
- <p>
32
- <?php if ( ! empty( $dash_email ) && ! empty( $admin_email ) ) { ?>
33
- <?php $admin_email = sprintf( '<a href="mailto: %1$s">%1$s</a>', $admin_email ); ?>
34
- <?php } else { ?>
35
- <?php $admin_email = __( 'your DEV account email', 'wds' ); ?>
36
- <?php } ?>
37
- <?php
38
- printf(
39
- $scan_msg,
40
- $admin_email
41
- );
42
- ?>
43
- <br>
44
- <?php esc_html_e( 'You can change that e-mail address if you want, on your DEV account page', 'wds' ); ?>
45
- <a href="https://premium.wpmudev.org/hub/account" target="_blank"><?php esc_html_e( 'here', 'wds' ); ?></a>
46
- </p>
47
- </div>
48
- </div><!-- end wds-block-test -->
49
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-report-issue.php DELETED
@@ -1,114 +0,0 @@
1
- <div class="wds-service-issue wds-seo_service-issue wds-seo_service-issue-<?php echo esc_attr( $type ); ?>">
2
- <p>
3
- <strong><?php echo (int) count( $issues ); ?></strong>
4
- <?php echo esc_html( $msg ); ?>
5
- <button type="button" class="wds-fix button button-white"><?php esc_html_e( 'Fix', 'wds' ); ?></button>
6
- </p>
7
-
8
- <?php if ( ! empty( $issues ) ) { ?>
9
- <div class="wds-issue-items">
10
- <header>
11
- <div class="wds-issue-item-part wds-issue-occurences">
12
- Occurences
13
- </div>
14
- <div class="wds-issue-item-part wds-issue-path">
15
- URL
16
- </div>
17
- </header>
18
- <?php foreach ( $issues as $issue_id ) { ?>
19
- <?php $issue = $report->get_issue( $issue_id ); ?>
20
- <div class="wds-issue-item" data-issue_id="<?php echo esc_attr( $issue_id ); ?>" >
21
-
22
- <!-- Occurences list modal for this URL -->
23
- <dialog class="dev-overlay wds-modal wds-occurences" id="wds-issue-occurences-<?php echo esc_attr( $issue_id ); ?>" title="<?php echo esc_attr( $issue['path'] ); ?>">
24
- <div class="box-content">
25
- <div class="wds-issue-occurences-list">
26
- <ul class="wds-listing wds-path-occurences">
27
- <li class="wds-listing-label"><?php esc_html_e( 'Link Location', 'wds' ); ?></li>
28
- <?php if ( ! empty( $issue['origin'] ) ) { foreach ( $issue['origin'] as $origin ) { ?>
29
- <li>
30
- <?php
31
- $origin = is_array( $origin ) && ! empty( $origin[0] ) ? $origin[0] : $origin;
32
- ?>
33
- <a href="<?php echo is_string( $origin ) ? esc_url( $origin ) : esc_url( $origin[0] ); ?>">
34
- <?php echo is_string( $origin ) ? esc_html( $origin ) : esc_html( $origin[0] ); ?>
35
- </a>
36
- </li>
37
- <?php }
38
- } ?>
39
- </ul>
40
- </div>
41
- </div>
42
- </dialog>
43
-
44
- <!-- Redirection modal for this URL -->
45
- <dialog class="dev-overlay wds-modal wds-redirect" id="wds-issue-redirect-<?php echo esc_attr( $issue_id ); ?>" title="<?php echo esc_attr( $issue['path'] ); ?>">
46
- <div class="box-content modal">
47
- <p class="group wds-group">
48
- <label for="" class="wds-label"><?php esc_html_e( 'Enter re-direct URL', 'wds' ); ?></label>
49
- <input type="url" name="redirect" value="<?php echo (
50
- ! empty( $redirections[ $issue['path'] ] )
51
- ? esc_url( $redirections[ $issue['path'] ] )
52
- : ''
53
- ); ?>" class="wds-field">
54
- </p>
55
- </div>
56
-
57
- <div class="box-footer buttons modal">
58
- <input type="hidden" name="source" value="<?php echo esc_url( $issue['path'] ); ?>" />
59
- <?php wp_nonce_field( 'wds-redirect', 'wds-redirect' ); ?>
60
- <button type="button" class="button button-cta-alt wds-submit-redirect"><?php echo esc_html_e( 'Save', 'wds' ); ?></button>
61
- </div>
62
- </dialog>
63
-
64
- <!-- Occurences count part -->
65
- <div class="wds-issue-item-part wds-issue-occurences">
66
- <span><?php echo count( $issue['origin'] ); ?></span>
67
- </div>
68
-
69
- <!-- Issue URL part -->
70
- <div class="wds-issue-item-part wds-issue-path">
71
- <a href="<?php echo esc_url( $issue['path'] ); ?>">
72
- <?php echo esc_html( $issue['path'] ); ?>
73
- <?php if ( in_array( $issue['path'], array_keys( $redirections ) ) ) { ?>
74
- [redirected]
75
- <?php } ?>
76
- </a>
77
- </div>
78
-
79
- <!-- Actions list dropdown -->
80
- <div class="wds-issue-item-part wds-issue-actions">
81
- <a href="#actions">
82
- &hellip;
83
- </a>
84
- <div class="wds-issue-actions-options">
85
- <ul>
86
- <li class="heading">Options <i class="wdv-icon wdv-icon-fw wdv-icon-remove"></i></li>
87
- <li>
88
- <a href="#list">
89
- <i class="wds-icon wds-icon-inline wds-icon-inline-left wds-icon-list"></i>
90
- <?php esc_html_e( 'List occurences', 'wds' ); ?>
91
- </a>
92
- </li>
93
- <li>
94
- <a href="#redirect">
95
- <i class="wds-icon wds-icon-inline wds-icon-inline-left wds-icon-redirect"></i>
96
- <?php esc_html_e( 'Re-direct', 'wds' ); ?>
97
- </a>
98
- </li>
99
- <li>
100
- <a href="#ignore" data-issue_id="<?php echo esc_attr( $issue_id ); ?>">
101
- <i class="wds-icon wds-icon-inline wds-icon-inline-left wds-icon-ignore"></i>
102
- <?php esc_html_e( 'Ignore', 'wds' ); ?>
103
- </a>
104
- </li>
105
- </ul>
106
- </div>
107
- </div>
108
-
109
- </div> <!-- .wds-issue-item -->
110
- <?php } ?>
111
- </div> <!-- .wds-issue-items -->
112
- <?php } ?>
113
-
114
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard-settings.php DELETED
@@ -1,237 +0,0 @@
1
- <?php
2
- $smartcrawl_options = Smartcrawl_Settings::get_options();
3
- ?>
4
- <div id="container" class="wrap wrap-wds wds-page wds-page-dashboard">
5
- <!--
6
- <div class="wds-notice wds-notice-success">
7
- <p><?php esc_html_e( 'Settings Updated', 'wds' ); ?></p>
8
- </div>
9
-
10
- <div class="wds-notice wds-notice-error can-close">
11
- <span class="close"></span>
12
- <p><?php esc_html_e( 'Settings Updated', 'wds' ); ?></p>
13
- </div>
14
-
15
- <div class="wds-notice wds-notice-warning">
16
- <p><?php esc_html_e( 'Settings Updated', 'wds' ); ?></p>
17
- </div>
18
-
19
- <div class="wds-notice wds-notice-success wds-notice-box">
20
- <p><?php esc_html_e( 'Settings Updated', 'wds' ); ?></p>
21
- </div>
22
-
23
- <div class="wds-notice wds-notice-error wds-notice-box can-close">
24
- <span class="close"></span>
25
- <p><?php esc_html_e( 'Settings Updated', 'wds' ); ?></p>
26
- </div>
27
- -->
28
- <section id="page-header">
29
- <h1 class="wds-title-alt"><?php esc_html_e( 'Welcome to SmartCrawl' , 'wds' ); ?></h1>
30
- <p class="wds-page-desc">
31
- <?php esc_html_e( 'Ahoy Cap\'n! Welcome to SmartCrawl. This plugin will help you improve the SEO of your website and get better', 'wds' ); ?>
32
- <br>
33
- <?php esc_html_e( 'Search Results Rankings across various search engines.', 'wds' ); ?>
34
- </p>
35
- </section><!-- end page-header -->
36
-
37
- <?php
38
- $dashboardLoginLink = admin_url( 'admin.php?page=wpmudev' );
39
- $dashboardDownloadLink = 'https://premium.wpmudev.org/api/dashboard/v1/download-dashboard';
40
- $dashboardHubLink = 'https://premium.wpmudev.org/membership/#profile-menu-tabs';
41
- ?>
42
-
43
- <div class="row">
44
-
45
- <div class="col-half col-half-dashboard col-half-dashboard-left">
46
-
47
-
48
-
49
-
50
-
51
- <?php
52
- /**
53
- * Pre-built Uptime service dashboard box
54
- */
55
- if ( ! empty( $uptime_message_box ) ) { echo $uptime_message_box; }
56
- ?>
57
-
58
-
59
- <?php
60
- /**
61
- * Pre-built SEO service dashboard box
62
- */
63
- if ( ! empty( $seo_message_box ) ) { echo $seo_message_box; }
64
- ?>
65
-
66
- <?php if ( ! empty( $smartcrawl_options['sitemap'] ) && ! empty( $smartcrawl_options['wds_sitemap-setup'] ) ) { ?>
67
- <section class="box-dashboard-sitemap-settings dev-box">
68
- <div class="box-title">
69
- <div class="buttons buttons-icon">
70
- <a href="<?php echo $current_admin_url; ?>?page=wds_sitemap" class="edit"><span class="dashicons dashicons-admin-generic wds-dashicons wds-dashicons-link"></span></a>
71
- </div>
72
- <h3><span class="dashicons dashicons-networking wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Sitemaps', 'wds' ); ?></h3>
73
- </div>
74
- <div class="box-content">
75
- <?php if ( ! empty( $smartcrawl_options['sitemappath'] ) ) { ?>
76
- <p><?php esc_html_e( 'Path to the XML Sitemap', 'wds' ); ?></p>
77
- <div class="wds-block-content wds-block-content-grey">
78
- <pre><?php echo esc_html( $smartcrawl_options['sitemappath'] ); ?></pre>
79
- </div>
80
- <?php } ?>
81
- <?php if ( function_exists( 'wds_get_sitemap_url' ) ) { ?>
82
- <p><?php esc_html_e( 'URL to the XML Sitemap', 'wds' ); ?>: <a target="_blank" href="<?php echo smartcrawl_get_sitemap_url(); ?>"><?php echo smartcrawl_get_sitemap_url(); ?></a></p>
83
- <?php } ?>
84
- </div>
85
- </section><!-- end box-dashboard-sitemap-settings -->
86
- <?php } ?>
87
-
88
- </div><!-- end col-half-dashboard-left -->
89
-
90
- <div class="col-half col-half-dashboard col-half-dashboard-right">
91
-
92
- <?php if ( ! empty( $smartcrawl_options['onpage'] ) && (is_network_admin() || Smartcrawl_Settings_Admin::is_tab_allowed( Smartcrawl_Settings::TAB_ONPAGE )) ) { ?>
93
- <?php if ( empty( $smartcrawl_options['wds_onpage-setup'] ) ) { ?>
94
-
95
- <section class="box-dashboard-improve-seo dev-box">
96
- <div class="box-title">
97
- <h3><span class="dashicons dashicons-admin-settings wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Manually improve SEO', 'wds' ); ?></h3>
98
- </div>
99
- <div class="box-content">
100
- <p>
101
- <?php esc_html_e( 'Manually improve your site\'s SEO by configuring various settings.', 'wds' ); ?>
102
- <br />
103
- <?php esc_html_e( 'We recommend by starting with Title & Meta as it is generally considered the most valuable area and most likely to be indexed.', 'wds' ); ?></p>
104
- </div>
105
- <div class="box-footer buttons">
106
- <a href="<?php echo esc_url( Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE ) ); ?>" class="button button-cta-dark button-configure-seo"><?php esc_html_e( 'Configure SEO', 'wds' ); ?></a>
107
- </div>
108
- </section><!-- end box-dashboard-performance-info -->
109
-
110
- <?php } else { ?>
111
-
112
- <section class="box-dashboard-titles-and-meta dev-box">
113
- <div class="box-title">
114
- <div class="buttons buttons-icon">
115
- <a href="<?php echo esc_url( Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE ) ); ?>" class="edit"><span class="dashicons dashicons-admin-generic wds-dashicons wds-dashicons-link"></span></a>
116
- </div>
117
- <h3><span class="dashicons dashicons-edit wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'Titles & Meta', 'wds' ); ?></h3>
118
- </div>
119
- <div class="box-content">
120
- <div class="wds-links-list-group">
121
- <ul class="wds-links-list">
122
- <li class="wds-links-list-item">
123
- <a class="wds-links-list-item-link" href="<?php echo $current_admin_url; ?>?page=wds_onpage#tab_homepage">
124
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Homepage', 'wds' ) ?></span>
125
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
126
- </a>
127
- </li><!-- end wds-links-list-item -->
128
-
129
- <?php
130
- foreach ( get_post_types( array( 'public' => true ) ) as $posttype ) {
131
- if ( in_array( $posttype, array( 'revision', 'nav_menu_item' ) ) ) { continue; }
132
-
133
- $type_obj = get_post_type_object( $posttype );
134
- if ( ! is_object( $type_obj ) ) { continue; }
135
-
136
- ?>
137
-
138
- <li class="wds-links-list-item">
139
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_<?php echo esc_attr( $posttype ); ?>">
140
- <span class="wds-links-list-item-label"><?php echo esc_html( $type_obj->labels->name ); ?></span>
141
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
142
- </a>
143
- </li><!-- end wds-links-list-item -->
144
-
145
- <?php
146
- }
147
- ?>
148
- <li class="wds-links-list-item">
149
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_post-categories">
150
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Post Categories', 'wds' ) ?></span>
151
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
152
- </a>
153
- </li>
154
-
155
- </ul><!-- end wds-links-list -->
156
-
157
- <ul class="wds-links-list">
158
- <?php
159
- foreach ( get_taxonomies( array( '_builtin' => false ), 'objects' ) as $taxonomy ) {
160
- ?>
161
-
162
- <li class="wds-links-list-item">
163
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_<<?php echo esc_attr( $taxonomy->name ); ?>">
164
- <span class="wds-links-list-item-label"><?php echo esc_html( ucfirst( $taxonomy->label ) ); ?></span>
165
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
166
- </a>
167
- </li><!-- end wds-links-list-item -->
168
-
169
- <?php
170
- }
171
- ?>
172
-
173
- <li class="wds-links-list-item">
174
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_post-tags">
175
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Post Tags', 'wds' ) ?></span>
176
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
177
- </a>
178
- </li>
179
-
180
- <li class="wds-links-list-item">
181
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_author-archive">
182
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Author Archive', 'wds' ) ?></span>
183
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
184
- </a>
185
- </li>
186
-
187
- <li class="wds-links-list-item">
188
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_date-archive">
189
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Date Archive', 'wds' ) ?></span>
190
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
191
- </a>
192
- </li>
193
-
194
- <li class="wds-links-list-item">
195
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_search-page">
196
- <span class="wds-links-list-item-label"><?php esc_html_e( 'Search Page', 'wds' ) ?></span>
197
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
198
- </a>
199
- </li>
200
-
201
- <li class="wds-links-list-item">
202
- <a class="wds-links-list-item-link" href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_onpage#tab_404-page">
203
- <span class="wds-links-list-item-label"><?php esc_html_e( '404 Page', 'wds' ) ?></span>
204
- <span class="wds-links-list-item-edit"><?php esc_html_e( 'Edit', 'wds' ) ?></span>
205
- </a>
206
- </li>
207
-
208
- </ul><!-- end wds-links-list -->
209
-
210
- </div>
211
- </div>
212
- </section><!-- end box-dashboard-titles-and-meta -->
213
-
214
- <?php } ?>
215
-
216
- <?php } // end if tab is allowed ?>
217
-
218
- <?php if ( ! empty( $smartcrawl_options['access-id'] ) && ! empty( $smartcrawl_options['secret-key'] ) ) { ?>
219
- <section class="box-dashboard-seo-moz-stats dev-box">
220
- <div class="box-title">
221
- <div class="buttons buttons-icon">
222
- <a href="<?php echo esc_attr( $current_admin_url ); ?>?page=wds_settings" class="edit"><span class="dashicons dashicons-admin-generic wds-dashicons wds-dashicons-link"></span></a>
223
- </div>
224
- <h3><span class="dashicons dashicons-chart-area wds-dashicons wds-dashicons-box-title"></span><?php esc_html_e( 'SEO Moz Stats', 'wds' ); ?></h3>
225
- </div>
226
- <div class="box-content"><?php Smartcrawl_Seomoz_Dashboard_Widget::widget(); ?></div>
227
- </section><!-- end box-dashboard-seo-moz-stats -->
228
-
229
- <?php } ?>
230
-
231
- </div>
232
-
233
- </div>
234
-
235
- </div><!-- end container -->
236
-
237
- <?php do_action( 'wds-dshboard-after_settings' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/dashboard/dashboard-box-title-url-crawl-stats.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- $report = empty( $report ) ? null : $report;
3
-
4
- if ( is_null( $report ) ) {
5
- return;
6
- }
7
-
8
- $active_issues = $report->get_issues_count();
9
- ?>
10
-
11
- <?php if ( $active_issues > 0 ) : ?>
12
- <span class="wds-issues wds-issues-warning wds-has-tooltip"
13
- data-content="<?php printf( __( 'You have %s sitemap issues', 'wds' ), $active_issues ); ?>">
14
-
15
- <?php echo $active_issues; ?>
16
- </span>
17
- <?php endif; ?>
1
+ <?php
2
+ $report = empty( $report ) ? null : $report;
3
+
4
+ if ( is_null( $report ) ) {
5
+ return;
6
+ }
7
+
8
+ $active_issues = $report->get_issues_count();
9
+ ?>
10
+
11
+ <?php if ( $active_issues > 0 ) : ?>
12
+ <span class="wds-issues wds-issues-warning wds-has-tooltip"
13
+ data-content="<?php printf( esc_attr__( 'You have %s sitemap issues', 'wds' ), intval( $active_issues ) ); ?>">
14
+
15
+ <?php echo intval( $active_issues ); ?>
16
+ </span>
17
+ <?php endif; ?>
includes/admin/templates/dashboard/dashboard-checkup-progress.php CHANGED
@@ -1,27 +1,29 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- $percentage = $service->status();
4
- $progress = (int) $percentage;
5
- if ( $progress > 100 ) { $progress = 100; }
6
- ?>
7
- <p><?php esc_html_e( 'SmartCrawl is performing a full SEO checkup which will take a few moments. You can close this page if you need to, we’ll let you know when it’s complete.', 'wds' ); ?></p>
8
- <div class="wds-box-refresh-required"></div>
9
- <?php
10
- $this->_render('progress-bar', array(
11
- 'progress' => $progress,
12
- ));
13
- ?>
14
-
15
- <?php
16
- if ( ! Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member() ) {
17
- $this->_render('mascot-message', array(
18
- 'key' => 'dash-seo-checkup-upsell',
19
- 'dismissible' => false,
20
- 'message' => sprintf(
21
- '%s <a href="#upgrade-to-pro">%s</a>',
22
- esc_html__( 'Did you know with SmartCrawl Pro you can schedule automated SEO checkups and send whitelabel email reports direct to yours and your clients inboxes?', 'wds' ),
23
- esc_html__( '- Try it all FREE today', 'wds' )
24
- ),
25
- ));
26
- }
27
- ?>
 
 
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ $percentage = $service->status();
4
+ $progress = (int) $percentage;
5
+ if ( $progress > 100 ) {
6
+ $progress = 100;
7
+ }
8
+ ?>
9
+ <p><?php esc_html_e( 'SmartCrawl is performing a full SEO checkup which will take a few moments. You can close this page if you need to, we’ll let you know when it’s complete.', 'wds' ); ?></p>
10
+ <div class="wds-box-refresh-required"></div>
11
+ <?php
12
+ $this->_render( 'progress-bar', array(
13
+ 'progress' => $progress,
14
+ ) );
15
+ ?>
16
+
17
+ <?php
18
+ if ( ! Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member() ) {
19
+ $this->_render( 'mascot-message', array(
20
+ 'key' => 'dash-seo-checkup-upsell',
21
+ 'dismissible' => false,
22
+ 'message' => sprintf(
23
+ '%s <a href="#upgrade-to-pro">%s</a>',
24
+ esc_html__( 'Did you know with SmartCrawl Pro you can schedule automated SEO checkups and send whitelabel email reports direct to yours and your clients inboxes?', 'wds' ),
25
+ esc_html__( '- Try it all FREE today', 'wds' )
26
+ ),
27
+ ) );
28
+ }
29
+ ?>
includes/admin/templates/dashboard/dashboard-content-analysis-readability-overview.php CHANGED
@@ -1,89 +1,88 @@
1
- <?php
2
- /**
3
- * Readability analysis dashboard widget template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $analysis_model = new Smartcrawl_Model_Analysis();
9
- $overview = $analysis_model->get_overall_readability_analysis();
10
-
11
- if ( ! $overview ) {
12
- return;
13
- }
14
-
15
- $total = smartcrawl_get_array_value( $overview, 'total' );
16
- $passed = smartcrawl_get_array_value( $overview, 'passed' );
17
- $type_breakdown = smartcrawl_get_array_value( $overview, 'post-types' );
18
-
19
- if ( is_null( $total ) || is_null( $passed ) || is_null( $type_breakdown ) ) {
20
- return;
21
- }
22
-
23
- $percentage = ! empty( $total )
24
- ? intval( ceil( ($passed / $total) * 100 ) )
25
- : 0
26
- ;
27
-
28
- if ( 0 === $passed && 0 === $total ) {
29
- $class = 'wds-check-invalid';
30
- $indicator = esc_html__( 'No data yet', 'wds' );
31
- } elseif ( $percentage > 79 ) {
32
- $class = 'wds-check-success';
33
- $indicator = esc_html__( 'Easy', 'wds' );
34
- } elseif ( $percentage > 59 ) {
35
- $class = 'wds-check-warning';
36
- $indicator = esc_html__( 'Difficult', 'wds' );
37
- } else {
38
- $class = 'wds-check-error';
39
- $indicator = esc_html__( 'Difficult', 'wds' );
40
- }
41
- ?>
42
- <div class="wds-accordion">
43
- <div class="wds-accordion-section wds-check-item <?php echo esc_attr( $class ); ?>">
44
-
45
- <div class="wds-accordion-handle">
46
- <div class="wds-accordion-handle-part"><?php esc_html_e( 'Overall Readability Analysis', 'wds' ); ?></div>
47
- <div class="wds-accordion-handle-part">
48
- <span class="wds-check-item-indicator"><?php echo $indicator; ?></span>
49
- </div>
50
- </div>
51
-
52
- <div class="wds-accordion-content">
53
- <p class="wds-small-text">
54
- <?php esc_html_e( "Here's a breakdown of where you can make improvements.", 'wds' ); ?>
55
- </p>
56
-
57
- <table class="wds-list-table">
58
- <tr>
59
- <th><?php esc_html_e( 'Post Type', 'wds' ); ?></th>
60
- <th><?php esc_html_e( 'Difficult', 'wds' ); ?></th>
61
- <th><?php esc_html_e( 'Okay', 'wds' ); ?></th>
62
- <th><?php esc_html_e( 'Easy', 'wds' ); ?></th>
63
- </tr>
64
- <?php foreach ( $type_breakdown as $post_type => $type_overview ) : ?>
65
- <?php
66
- $difficult = intval( smartcrawl_get_array_value( $type_overview, 'error' ) );
67
- $okay = intval( smartcrawl_get_array_value( $type_overview, 'warning' ) );;
68
- $easy = intval( smartcrawl_get_array_value( $type_overview, 'success' ) );
69
-
70
- $edit_url = admin_url( 'edit.php?wds_readability_threshold=' );
71
- ?>
72
- <tr>
73
- <td><?php echo esc_html( $post_type ); ?></td>
74
- <td>
75
- <?php $difficult > 0 ? printf( '<span class="wds-issues wds-issues-error"><a href="%s">%s</a></span>', esc_url( add_query_arg( 'post_type', $post_type, "{$edit_url}0" ) ), $difficult ) : print(0); ?>
76
- </td>
77
- <td>
78
- <?php $okay > 0 ? printf( '<span class="wds-issues wds-issues-warning"><a href="%s">%s</a></span>', esc_url( add_query_arg( 'post_type', $post_type, "{$edit_url}1" ) ), $okay ) : print(0); ?>
79
- </td>
80
- <td>
81
- <?php $easy > 0 ? printf( '<span class="wds-issues wds-issues-success-bg">%s</span>', $easy ) : print(0); ?>
82
- </td>
83
- </tr>
84
- <?php endforeach; ?>
85
- </table>
86
- </div>
87
-
88
- </div>
89
- </div>
1
+ <?php
2
+ /**
3
+ * Readability analysis dashboard widget template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $analysis_model = new Smartcrawl_Model_Analysis();
9
+ $overview = $analysis_model->get_overall_readability_analysis();
10
+
11
+ if ( ! $overview ) {
12
+ return;
13
+ }
14
+
15
+ $total = smartcrawl_get_array_value( $overview, 'total' );
16
+ $passed = smartcrawl_get_array_value( $overview, 'passed' );
17
+ $type_breakdown = smartcrawl_get_array_value( $overview, 'post-types' );
18
+
19
+ if ( is_null( $total ) || is_null( $passed ) || is_null( $type_breakdown ) ) {
20
+ return;
21
+ }
22
+
23
+ $percentage = ! empty( $total )
24
+ ? intval( ceil( ( $passed / $total ) * 100 ) )
25
+ : 0;
26
+
27
+ if ( 0 === $passed && 0 === $total ) {
28
+ $class = 'wds-check-invalid';
29
+ $indicator = esc_html__( 'No data yet', 'wds' );
30
+ } elseif ( $percentage > 79 ) {
31
+ $class = 'wds-check-success';
32
+ $indicator = esc_html__( 'Easy', 'wds' );
33
+ } elseif ( $percentage > 59 ) {
34
+ $class = 'wds-check-warning';
35
+ $indicator = esc_html__( 'Difficult', 'wds' );
36
+ } else {
37
+ $class = 'wds-check-error';
38
+ $indicator = esc_html__( 'Difficult', 'wds' );
39
+ }
40
+ ?>
41
+ <div class="wds-accordion wds-readability-analysis-overview">
42
+ <div class="wds-accordion-section wds-check-item <?php echo esc_attr( $class ); ?>">
43
+
44
+ <div class="wds-accordion-handle">
45
+ <div class="wds-accordion-handle-part"><?php esc_html_e( 'Overall Readability Analysis', 'wds' ); ?></div>
46
+ <div class="wds-accordion-handle-part">
47
+ <span class="wds-check-item-indicator"><?php echo esc_html( $indicator ); ?></span>
48
+ </div>
49
+ </div>
50
+
51
+ <div class="wds-accordion-content">
52
+ <p class="wds-small-text">
53
+ <?php esc_html_e( "Here's a breakdown of where you can make improvements.", 'wds' ); ?>
54
+ </p>
55
+
56
+ <table class="wds-list-table">
57
+ <tr>
58
+ <th><?php esc_html_e( 'Post Type', 'wds' ); ?></th>
59
+ <th><?php esc_html_e( 'Difficult', 'wds' ); ?></th>
60
+ <th><?php esc_html_e( 'Okay', 'wds' ); ?></th>
61
+ <th><?php esc_html_e( 'Easy', 'wds' ); ?></th>
62
+ </tr>
63
+ <?php foreach ( $type_breakdown as $post_type => $type_overview ) : ?>
64
+ <?php
65
+ $difficult = intval( smartcrawl_get_array_value( $type_overview, 'error' ) );
66
+ $okay = intval( smartcrawl_get_array_value( $type_overview, 'warning' ) );
67
+ $easy = intval( smartcrawl_get_array_value( $type_overview, 'success' ) );
68
+
69
+ $edit_url = admin_url( 'edit.php?wds_readability_threshold=' );
70
+ ?>
71
+ <tr>
72
+ <td><?php echo esc_html( $post_type ); ?></td>
73
+ <td>
74
+ <?php $difficult > 0 ? printf( '<span class="wds-issues wds-readability-difficult wds-issues-error"><a href="%s">%s</a></span>', esc_url( add_query_arg( 'post_type', $post_type, "{$edit_url}0" ) ), intval( $difficult ) ) : print( 0 ); ?>
75
+ </td>
76
+ <td>
77
+ <?php $okay > 0 ? printf( '<span class="wds-issues wds-readability-okay wds-issues-warning"><a href="%s">%s</a></span>', esc_url( add_query_arg( 'post_type', $post_type, "{$edit_url}1" ) ), intval( $okay ) ) : print( 0 ); ?>
78
+ </td>
79
+ <td>
80
+ <?php $easy > 0 ? printf( '<span class="wds-issues wds-readability-easy wds-issues-success-bg">%s</span>', intval( $easy ) ) : print( 0 ); ?>
81
+ </td>
82
+ </tr>
83
+ <?php endforeach; ?>
84
+ </table>
85
+ </div>
86
+
87
+ </div>
88
+ </div>
 
includes/admin/templates/dashboard/dashboard-content-analysis-seo-overview.php CHANGED
@@ -1,83 +1,82 @@
1
- <?php
2
- /**
3
- * SEO analyis dashboard widget template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $analysis_model = new Smartcrawl_Model_Analysis();
9
- $overview = $analysis_model->get_overall_seo_analysis();
10
-
11
- if ( ! $overview ) {
12
- return;
13
- }
14
-
15
- $total = smartcrawl_get_array_value( $overview, 'total' );
16
- $passed = smartcrawl_get_array_value( $overview, 'passed' );
17
- $type_breakdown = smartcrawl_get_array_value( $overview, 'post-types' );
18
-
19
- if ( is_null( $total ) || is_null( $passed ) || is_null( $type_breakdown ) ) {
20
- return;
21
- }
22
-
23
- $percentage = ! empty( $total )
24
- ? intval( ceil( ($passed / $total) * 100 ) )
25
- : 0
26
- ;
27
-
28
- if ( 0 === $passed && 0 === $total ) {
29
- $class = 'wds-check-invalid';
30
- $indicator = esc_html__( 'No data yet', 'wds' );
31
- } elseif ( $percentage > 60 ) {
32
- $class = 'wds-check-success';
33
- $indicator = esc_html__( 'Good', 'wds' );
34
- } else {
35
- $class = 'wds-check-warning';
36
- $indicator = esc_html__( 'Poor', 'wds' );
37
- }
38
- ?>
39
- <div class="wds-accordion">
40
- <div class="wds-accordion-section wds-check-item <?php echo esc_attr( $class ); ?>">
41
-
42
- <div class="wds-accordion-handle">
43
- <div class="wds-accordion-handle-part"><?php esc_html_e( 'Overall SEO Analysis', 'wds' ); ?></div>
44
- <div class="wds-accordion-handle-part">
45
- <span class="wds-check-item-indicator"><?php echo $indicator; ?></span>
46
- </div>
47
- </div>
48
-
49
- <div class="wds-accordion-content">
50
- <p class="wds-small-text">
51
- <?php esc_html_e( "Here's a breakdown of where you can make improvements.", 'wds' ); ?>
52
- </p>
53
-
54
- <table class="wds-list-table">
55
- <tr>
56
- <th><?php esc_html_e( 'Post Type', 'wds' ); ?></th>
57
- <th><?php esc_html_e( 'Poor', 'wds' ); ?></th>
58
- <th><?php esc_html_e( 'Good', 'wds' ); ?></th>
59
- </tr>
60
- <?php foreach ( $type_breakdown as $post_type => $type_overview ) : ?>
61
- <?php
62
- $total_for_type = intval( smartcrawl_get_array_value( $type_overview, 'total' ) );
63
- $passed_for_type = intval( smartcrawl_get_array_value( $type_overview, 'passed' ) );
64
- $failed_for_type = $total_for_type - $passed_for_type;
65
-
66
- $fail_url = esc_url( admin_url( "edit.php?post_type={$post_type}&wds_analysis_threshold=99" ) );
67
- $success_url = esc_url( admin_url( "edit.php?post_type={$post_type}&wds_analysis_threshold=100" ) );
68
- ?>
69
- <tr>
70
- <td><?php echo esc_html( $post_type ); ?></td>
71
- <td>
72
- <?php $failed_for_type > 0 ? printf( '<span class="wds-issues wds-issues-warning"><a href="%s">%s</a></span>', $fail_url, $failed_for_type ) : print(0); ?>
73
- </td>
74
- <td>
75
- <?php $passed_for_type > 0 ? printf( '<span class="wds-issues wds-issues-success-bg"><a href="%s">%s</a></span>', $success_url, $passed_for_type ) : print(0); ?>
76
- </td>
77
- </tr>
78
- <?php endforeach; ?>
79
- </table>
80
- </div>
81
-
82
- </div>
83
- </div>
1
+ <?php
2
+ /**
3
+ * SEO analyis dashboard widget template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $analysis_model = new Smartcrawl_Model_Analysis();
9
+ $overview = $analysis_model->get_overall_seo_analysis();
10
+
11
+ if ( ! $overview ) {
12
+ return;
13
+ }
14
+
15
+ $total = smartcrawl_get_array_value( $overview, 'total' );
16
+ $passed = smartcrawl_get_array_value( $overview, 'passed' );
17
+ $type_breakdown = smartcrawl_get_array_value( $overview, 'post-types' );
18
+
19
+ if ( is_null( $total ) || is_null( $passed ) || is_null( $type_breakdown ) ) {
20
+ return;
21
+ }
22
+
23
+ $percentage = ! empty( $total )
24
+ ? intval( ceil( ( $passed / $total ) * 100 ) )
25
+ : 0;
26
+
27
+ if ( 0 === $passed && 0 === $total ) {
28
+ $class = 'wds-check-invalid';
29
+ $indicator = esc_html__( 'No data yet', 'wds' );
30
+ } elseif ( $percentage > 60 ) {
31
+ $class = 'wds-check-success';
32
+ $indicator = esc_html__( 'Good', 'wds' );
33
+ } else {
34
+ $class = 'wds-check-warning';
35
+ $indicator = esc_html__( 'Poor', 'wds' );
36
+ }
37
+ ?>
38
+ <div class="wds-accordion wds-seo-analysis-overview">
39
+ <div class="wds-accordion-section wds-check-item <?php echo esc_attr( $class ); ?>">
40
+
41
+ <div class="wds-accordion-handle">
42
+ <div class="wds-accordion-handle-part"><?php esc_html_e( 'Overall SEO Analysis', 'wds' ); ?></div>
43
+ <div class="wds-accordion-handle-part">
44
+ <span class="wds-check-item-indicator"><?php echo esc_html( $indicator ); ?></span>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="wds-accordion-content">
49
+ <p class="wds-small-text">
50
+ <?php esc_html_e( "Here's a breakdown of where you can make improvements.", 'wds' ); ?>
51
+ </p>
52
+
53
+ <table class="wds-list-table">
54
+ <tr>
55
+ <th><?php esc_html_e( 'Post Type', 'wds' ); ?></th>
56
+ <th><?php esc_html_e( 'Poor', 'wds' ); ?></th>
57
+ <th><?php esc_html_e( 'Good', 'wds' ); ?></th>
58
+ </tr>
59
+ <?php foreach ( $type_breakdown as $post_type => $type_overview ) : ?>
60
+ <?php
61
+ $total_for_type = intval( smartcrawl_get_array_value( $type_overview, 'total' ) );
62
+ $passed_for_type = intval( smartcrawl_get_array_value( $type_overview, 'passed' ) );
63
+ $failed_for_type = $total_for_type - $passed_for_type;
64
+
65
+ $fail_url = admin_url( "edit.php?post_type={$post_type}&wds_analysis_threshold=99" );
66
+ $success_url = admin_url( "edit.php?post_type={$post_type}&wds_analysis_threshold=100" );
67
+ ?>
68
+ <tr>
69
+ <td><?php echo esc_html( $post_type ); ?></td>
70
+ <td>
71
+ <?php $failed_for_type > 0 ? printf( '<span class="wds-issues wds-seo-analysis-poor wds-issues-warning"><a href="%s">%s</a></span>', esc_url( $fail_url ), intval( $failed_for_type ) ) : print( 0 ); ?>
72
+ </td>
73
+ <td>
74
+ <?php $passed_for_type > 0 ? printf( '<span class="wds-issues wds-seo-analysis-good wds-issues-success-bg"><a href="%s">%s</a></span>', esc_url( $success_url ), intval( $passed_for_type ) ) : print( 0 ); ?>
75
+ </td>
76
+ </tr>
77
+ <?php endforeach; ?>
78
+ </table>
79
+ </div>
80
+
81
+ </div>
82
+ </div>
 
includes/admin/templates/dashboard/dashboard-mini-checkup-report.php CHANGED
@@ -1,30 +1,31 @@
1
- <?php
2
- $results = empty( $results ) ? null : $results;
3
- $issue_count = empty( $issue_count ) ? 0 : $issue_count;
4
- $page_url = ! empty( $page_url ) ? $page_url : Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_CHECKUP );
5
- ?>
6
-
7
- <?php if ( $issue_count > 0 || ! empty( $results['error'] ) ) : ?>
8
- <div class="wds-report">
9
- <?php $this->_render( 'checkup/checkup-checkup-results', array( 'show_upsell_message' => false ) ); ?>
10
- </div>
11
- <?php else : ?>
12
- <p><?php esc_html_e( 'A comprehensive report on how optimized your website is for search engines and social media.', 'wds' ); ?></p>
13
- <?php
14
- $this->_render('notice', array(
15
- 'message' => esc_html__( 'You have no outstanding SEO issues. Awesome work!', 'wds' ),
16
- 'class' => 'wds-notice-success',
17
- ));
18
- ?>
19
- <?php endif; ?>
20
-
21
- <div class="wds-box-report-details wds-box-footer">
22
- <a href="<?php echo esc_attr( $page_url ); ?>#tab_checkup"
23
- class="button button-small button-dark button-dark-o wds-dash-view-report-button">
24
-
25
- <?php esc_html_e( 'View Report', 'wds' ); ?>
26
- </a>
27
- <?php if ( ! empty( $reporting_enabled ) ) : ?>
28
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Automatic checkups are enabled', 'wds' ); ?></span>
29
- <?php endif; ?>
30
- </div>
 
1
+ <?php
2
+ $results = empty( $results ) ? null : $results;
3
+ $issue_count = empty( $issue_count ) ? 0 : $issue_count;
4
+ $page_url = ! empty( $page_url ) ? $page_url : Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_CHECKUP );
5
+ ?>
6
+
7
+ <?php if ( $issue_count > 0 || ! empty( $results['error'] ) ) : ?>
8
+ <div class="wds-report">
9
+ <?php $this->_render( 'checkup/checkup-checkup-results', array( 'show_upsell_message' => false ) ); ?>
10
+ </div>
11
+ <?php else : ?>
12
+ <p><?php esc_html_e( 'A comprehensive report on how optimized your website is for search engines and social media.', 'wds' ); ?></p>
13
+ <?php
14
+ $this->_render( 'notice', array(
15
+ 'message' => esc_html__( 'You have no outstanding SEO issues. Awesome work!', 'wds' ),
16
+ 'class' => 'wds-notice-success',
17
+ ) );
18
+ ?>
19
+ <?php endif; ?>
20
+
21
+ <div class="wds-box-report-details wds-box-footer">
22
+ <a href="<?php echo esc_attr( $page_url ); ?>#tab_checkup"
23
+ class="button button-small button-dark button-dark-o wds-dash-view-report-button">
24
+
25
+ <?php esc_html_e( 'View Report', 'wds' ); ?>
26
+ </a>
27
+ <?php if ( ! empty( $reporting_enabled ) ) : ?>
28
+ <span
29
+ class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Automatic checkups are enabled', 'wds' ); ?></span>
30
+ <?php endif; ?>
31
+ </div>
includes/admin/templates/dashboard/dashboard-top.php CHANGED
@@ -1,85 +1,113 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
- $last_checked = (boolean) $service->get_last_checked_timestamp();
4
- $in_progress = $last_checked ? false : $service->in_progress();
5
- $dashboard_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_DASHBOARD );
6
- $options = $_view['options'];
7
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
8
- $sitemap_enabled = smartcrawl_get_array_value( $options, 'sitemap' );
9
- $results = $last_checked ? $service->result() : array();
10
- $counts = smartcrawl_get_array_value( $results, 'counts' );
11
- $score = smartcrawl_get_array_value( $results, 'score' );
12
-
13
- $issue_count = 0;
14
- if ( $score === null || false === $score ) {
15
- $score_class = 'wds-score-invalid';
16
- } else {
17
- $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
18
- $score_class = $issue_count > 0 ? 'wds-score-warning' : 'wds-score-success';
19
- }
20
- ?>
21
-
22
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_TOP_STATS; ?>"
23
- class="wds-seo-checkup-stats wds-report-stats wds-dash-stats dev-box"
24
- data-issue-count="<?php echo $issue_count; ?>" data-dependent="<?php echo Smartcrawl_Settings_Dashboard::BOX_SITEMAP; ?>">
25
-
26
- <div class="wds-report-score">
27
- <?php if ( ! $last_checked && ! $in_progress ) : ?>
28
- <div class="wds-last-checkup-never">
29
- <span class="wds-strong-text"><?php esc_html_e( 'Welcome!', 'wds' ); ?></span>
30
- <p class="wds-small-text">
31
- <?php esc_html_e( 'Run your first SEO checkup to see what needs improving!', 'wds' ); ?>
32
- </p>
33
- <a href="<?php echo esc_url( add_query_arg( 'run-checkup', 'yes', $dashboard_url ) ); ?>"
34
- class="button button-small">
35
-
36
- <?php esc_html_e( 'Run checkup', 'wds' ); ?>
37
- </a>
38
- </div>
39
- <?php else : ?>
40
- <div class="wds-score <?php echo esc_attr( $score_class ); ?>">
41
- <?php echo esc_html( intval( $score ) ); ?>
42
- <span class="wds-total"><?php esc_html_e( '/100', 'wds' ); ?></span>
43
- </div>
44
- <div class="wds-small-text"><?php esc_html_e( 'Current SEO Score', 'wds' ); ?></div>
45
- <?php endif; ?>
46
- </div>
47
-
48
- <div>
49
- <div class="wds-stacked-stats">
50
- <div>
51
- <div class="wds-stat-name"><?php esc_html_e( 'Last checkup:', 'wds' ); ?></div>
52
- <div class="wds-stat-value"><?php echo $in_progress ? __( 'In Progress', 'wds' ) : $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ); ?></div>
53
- </div>
54
-
55
- <div>
56
- <div class="wds-stat-name"><?php esc_html_e( 'Sitemap:', 'wds' ); ?></div>
57
- <div class="wds-stat-value">
58
- <?php if ( $sitemap_enabled ) : ?>
59
-
60
- <?php
61
- $this->_render('url-crawl-master', array(
62
- 'ready_template' => 'dashboard/dashboard-url-crawl-stats',
63
- 'progress_template' => 'dashboard/dashboard-url-crawl-in-progress-small',
64
- 'no_data_template' => 'dashboard/dashboard-url-crawl-no-data-small',
65
- ));
66
- ?>
67
-
68
- <?php else : ?>
69
-
70
- <button type="button"
71
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
72
- data-flag="<?php echo 'sitemap'; ?>"
73
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request">
74
-
75
- <?php esc_html_e( 'Activate Sitemap', 'wds' ); ?>
76
- </button>
77
-
78
- <?php endif; ?>
79
- </div>
80
- </div>
81
- </div>
82
- </div>
83
-
84
-
85
- </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
3
+ $last_checked = (boolean) $service->get_last_checked_timestamp();
4
+ $in_progress = $service->in_progress();
5
+ $last_checked_timestamp = $service->get_last_checked( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) );
6
+ $checkup_url = Smartcrawl_Settings_Dashboard::checkup_url();
7
+ $options = $_view['options'];
8
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
9
+ $sitemap_enabled = smartcrawl_get_array_value( $options, 'sitemap' );
10
+ $results = $last_checked ? $service->result() : array();
11
+ $counts = smartcrawl_get_array_value( $results, 'counts' );
12
+ $score = smartcrawl_get_array_value( $results, 'score' );
13
+ $checkup_enabled = smartcrawl_get_array_value( $options, 'checkup' );
14
+ $dependents = array( Smartcrawl_Settings_Dashboard::BOX_SITEMAP, Smartcrawl_Settings_Dashboard::BOX_SEO_CHECKUP );
15
+ $dependents_attr = implode( ';', $dependents );
16
+
17
+ $issue_count = 0;
18
+ if ( null === $score || false === $score ) {
19
+ $score_class = 'wds-score-invalid';
20
+ } else {
21
+ $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
22
+ $score_class = $issue_count > 0 ? 'wds-score-warning' : 'wds-score-success';
23
+ }
24
+ ?>
25
+
26
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_TOP_STATS ); ?>"
27
+ class="wds-seo-checkup-stats wds-report-stats wds-dash-stats dev-box"
28
+ data-issue-count="<?php echo intval( $issue_count ); ?>"
29
+ data-dependent="<?php echo esc_attr( $dependents_attr ); ?>">
30
+
31
+ <div class="wds-report-score">
32
+ <?php if ( ! $checkup_enabled ): ?>
33
+ <div class="wds-last-checkup-never">
34
+ <span class="wds-strong-text"><?php esc_html_e( 'Welcome!', 'wds' ); ?></span>
35
+ <p class="wds-small-text">
36
+ <?php esc_html_e( 'Activate SEO checkup to see what needs improving!', 'wds' ); ?>
37
+ </p>
38
+ <button type="button"
39
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
40
+ data-flag="<?php echo esc_attr( 'checkup' ); ?>"
41
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
42
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
43
+ </button>
44
+ </div>
45
+ <?php elseif ( $in_progress ) : ?>
46
+ <div class="wds-last-checkup-never">
47
+ <span class="wds-strong-text"><?php esc_html_e( 'Welcome!', 'wds' ); ?></span>
48
+ <p class="wds-small-text">
49
+ <?php esc_html_e( 'Please wait while we finish the checkup ...', 'wds' ); ?>
50
+ </p>
51
+ <div class="wds-box-refresh-required"></div>
52
+ </div>
53
+ <?php elseif ( ! $last_checked ) : ?>
54
+ <div class="wds-last-checkup-never">
55
+ <span class="wds-strong-text"><?php esc_html_e( 'Welcome!', 'wds' ); ?></span>
56
+ <p class="wds-small-text">
57
+ <?php esc_html_e( 'Run your first SEO checkup to see what needs improving!', 'wds' ); ?>
58
+ </p>
59
+ <a href="<?php echo esc_attr( $checkup_url ); ?>"
60
+ class="button button-small">
61
+
62
+ <?php esc_html_e( 'Run checkup', 'wds' ); ?>
63
+ </a>
64
+ </div>
65
+ <?php else : ?>
66
+ <div class="wds-score <?php echo esc_attr( $score_class ); ?>">
67
+ <?php echo esc_html( intval( $score ) ); ?><span
68
+ class="wds-total"><?php esc_html_e( '/100', 'wds' ); ?></span>
69
+ </div>
70
+ <div class="wds-small-text"><?php esc_html_e( 'Current SEO Score', 'wds' ); ?></div>
71
+ <?php endif; ?>
72
+ </div>
73
+
74
+ <div>
75
+ <div class="wds-stacked-stats">
76
+ <div>
77
+ <div class="wds-stat-name"><?php esc_html_e( 'Last checkup:', 'wds' ); ?></div>
78
+ <div class="wds-stat-value">
79
+ <?php echo $in_progress ? esc_html__( 'In Progress', 'wds' ) : esc_html( $last_checked_timestamp ); ?>
80
+ </div>
81
+ </div>
82
+
83
+ <div>
84
+ <div class="wds-stat-name"><?php esc_html_e( 'Sitemap:', 'wds' ); ?></div>
85
+ <div class="wds-stat-value">
86
+ <?php if ( $sitemap_enabled ) : ?>
87
+
88
+ <?php
89
+ $this->_render( 'url-crawl-master', array(
90
+ 'ready_template' => 'dashboard/dashboard-url-crawl-stats',
91
+ 'progress_template' => 'dashboard/dashboard-url-crawl-in-progress-small',
92
+ 'no_data_template' => 'dashboard/dashboard-url-crawl-no-data-small',
93
+ ) );
94
+ ?>
95
+
96
+ <?php else : ?>
97
+
98
+ <button type="button"
99
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
100
+ data-flag="<?php echo 'sitemap'; ?>"
101
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request">
102
+
103
+ <?php esc_html_e( 'Activate Sitemap', 'wds' ); ?>
104
+ </button>
105
+
106
+ <?php endif; ?>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ </div>
111
+
112
+
113
+ </section>
includes/admin/templates/dashboard/dashboard-url-crawl-in-progress.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- $progress = empty( $progress ) ? 0 : $progress;
3
- ?>
4
- <div class="wds-box-refresh-required"></div>
5
- <p class="wds-small-text"><?php esc_html_e( 'SmartCrawl is performing a URL crawl, please wait…', 'wds' ); ?></p>
6
-
7
- <?php
8
- $this->_render('progress-bar', array(
9
- 'progress' => $progress,
10
- ));
11
- ?>
1
+ <?php
2
+ $progress = empty( $progress ) ? 0 : $progress;
3
+ ?>
4
+ <div class="wds-box-refresh-required"></div>
5
+ <p class="wds-small-text"><?php esc_html_e( 'SmartCrawl is performing a URL crawl, please wait…', 'wds' ); ?></p>
6
+
7
+ <?php
8
+ $this->_render( 'progress-bar', array(
9
+ 'progress' => $progress,
10
+ ) );
11
+ ?>
includes/admin/templates/dashboard/dashboard-url-crawl-no-data-small.php CHANGED
@@ -1,5 +1,5 @@
1
- <div class="wds-box-crawl-stats">
2
- <span class="wds-issues wds-issues-invalid">
3
- <?php esc_html_e( 'No Data Available', 'wds' ) ?>
4
- </span>
5
- </div>
1
+ <div class="wds-box-crawl-stats">
2
+ <span class="wds-issues wds-issues-invalid">
3
+ <?php esc_html_e( 'No Data Available', 'wds' ); ?>
4
+ </span>
5
+ </div>
includes/admin/templates/dashboard/dashboard-url-crawl-stats.php CHANGED
@@ -1,23 +1,24 @@
1
- <?php
2
- $report = empty( $report ) ? null : $report;
3
-
4
- if ( is_null( $report ) ) {
5
- return;
6
- }
7
-
8
- $active_issues = $report->get_issues_count();
9
- $missing_urls = $report->get_issues_count( 'sitemap' );
10
- ?>
11
-
12
- <?php if ( $active_issues > 0 ) : ?>
13
- <div class="wds-box-crawl-stats">
14
- <span class="wds-issues wds-issues-warning wds-has-tooltip"
15
- data-content="<?php printf( __( 'You have %s sitemap issues', 'wds' ), $active_issues ); ?>">
16
-
17
- <?php echo $active_issues; ?><?php esc_html_e( ' issues', 'wds' ); ?>
18
- </span>
19
- <span class="wds-issues wds-issues-invalid"><?php echo $missing_urls; ?><?php esc_html_e( ' missing URLs', 'wds' ); ?></span>
20
- </div>
21
- <?php else : ?>
22
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'No issues', 'wds' ); ?></span>
23
- <?php endif; ?>
 
1
+ <?php
2
+ $report = empty( $report ) ? null : $report;
3
+
4
+ if ( is_null( $report ) ) {
5
+ return;
6
+ }
7
+
8
+ $active_issues = $report->get_issues_count();
9
+ $missing_urls = $report->get_issues_count( 'sitemap' );
10
+ ?>
11
+
12
+ <?php if ( $active_issues > 0 ) : ?>
13
+ <div class="wds-box-crawl-stats">
14
+ <span class="wds-issues wds-issues-warning wds-has-tooltip"
15
+ data-content="<?php printf( esc_attr__( 'You have %s sitemap issues', 'wds' ), intval( $active_issues ) ); ?>">
16
+
17
+ <?php echo intval( $active_issues ); ?><?php esc_html_e( ' issues', 'wds' ); ?>
18
+ </span>
19
+ <span
20
+ class="wds-issues wds-issues-invalid"><?php echo intval( $missing_urls ); ?><?php esc_html_e( ' missing URLs', 'wds' ); ?></span>
21
+ </div>
22
+ <?php else : ?>
23
+ <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'No issues', 'wds' ); ?></span>
24
+ <?php endif; ?>
includes/admin/templates/dashboard/dashboard-widget-advanced-tools.php CHANGED
@@ -1,106 +1,112 @@
1
- <?php
2
- $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
3
-
4
- $redirection_model = new Smartcrawl_Model_Redirection;
5
- $redirection_count = count( $redirection_model->get_all_redirections() );
6
-
7
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
8
- $options = $_view['options'];
9
- $autolinking_enabled = smartcrawl_get_array_value( $options, 'autolinks' );
10
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
11
- $is_member = $service->is_member();
12
- $moz_connected = ! empty( $options['access-id'] ) && ! empty( $options['secret-key'] );
13
- ?>
14
-
15
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_ADVANCED_TOOLS; ?>" class="dev-box">
16
- <div class="box-title">
17
- <div class="buttons buttons-icon">
18
- <a href="<?php echo esc_attr( $page_url ); ?>" class="wds-settings-link">
19
- <i class="wds-icon-arrow-right-carats"></i>
20
- </a>
21
- </div>
22
- <h3>
23
- <i class="wds-icon-wand-magic"></i> <?php esc_html_e( 'Advanced Tools', 'wds' ); ?>
24
- </h3>
25
- </div>
26
-
27
- <div class="box-content">
28
- <p><?php esc_html_e( 'Advanced tools focus on the finer details of SEO including internal linking, redirections and Moz analysis.', 'wds' ); ?></p>
29
-
30
- <div class="wds-separator-top">
31
- <span class="wds-small-text"><strong><?php esc_html_e( 'URL Redirects', 'wds' ); ?></strong></span>
32
- <span class="wds-box-stat-value"><?php echo esc_html( $redirection_count ); ?>
33
- </div>
34
-
35
- <div class="wds-separator-top cf">
36
- <span class="wds-small-text"><strong><?php esc_html_e( 'Moz Integration', 'wds' ); ?></strong></span>
37
-
38
- <?php if ( $moz_connected ) : ?>
39
- <span class="wds-box-stat-value">
40
- <a href="<?php echo esc_attr( $page_url ); ?>#tab_moz"
41
- class="button button-small button-dark button-dark-o">
42
-
43
- <?php esc_html_e( 'View Report', 'wds' ); ?>
44
- </a>
45
- </span>
46
- <?php else : ?>
47
- <p class="wds-small-text">
48
- <?php esc_html_e( 'Moz provides reports that tell you how your site stacks up against the competition with all of the important SEO measurement tools.', 'wds' ); ?>
49
- </p>
50
- <a href="<?php echo esc_attr( $page_url ); ?>#tab_moz"
51
- class="button button-small">
52
-
53
- <?php esc_html_e( 'Connect', 'wds' ); ?>
54
- </a>
55
- <?php endif; ?>
56
- </div>
57
-
58
- <div class="wds-separator-top wds-autolinking-section <?php echo ! $is_member ? 'wds-box-blocked-area' : ''; ?>">
59
- <span class="wds-small-text"><strong><?php esc_html_e( 'Automatic Linking', 'wds' ); ?></strong></span>
60
- <?php if ( $autolinking_enabled && $is_member ) : ?>
61
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Active', 'wds' ); ?></span>
62
- <?php else : ?>
63
- <p class="wds-small-text">
64
- <?php esc_html_e( 'Configure SmartCrawl to automatically link certain key words to a page on your blog or even a whole new site all together.', 'wds' ); ?>
65
- </p>
66
- <button type="button"
67
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
68
- data-flag="<?php echo 'autolinks'; ?>"
69
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
70
-
71
- <?php esc_html_e( 'Activate', 'wds' ); ?>
72
- </button>
73
- <?php if ( ! $is_member ) : ?>
74
- <button class="wds-upgrade-button button-pro wds-has-tooltip"
75
- data-content="<?php _e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
76
- type="button">
77
- <?php esc_html_e( 'Pro feature', 'wds' ); ?>
78
- </button>
79
- <?php endif; ?>
80
- <?php endif; ?>
81
- </div>
82
-
83
- <div class="wds-box-footer" style="margin-top: 0;">
84
- <a href="<?php echo esc_attr( $page_url ); ?>"
85
- class="button button-small button-dark button-dark-o wds-dash-configure-button">
86
-
87
- <?php esc_html_e( 'Configure', 'wds' ); ?>
88
- </a>
89
-
90
- <?php
91
- if ( ! $is_member ) {
92
-
93
- $this->_render('mascot-message', array(
94
- 'key' => 'seo-checkup-upsell',
95
- 'dismissible' => false,
96
- 'message' => sprintf(
97
- '%s <a href="#upgrade-to-pro">%s</a>',
98
- esc_html__( 'Upgrade to Pro and automatically link your articles both internally and externally with automatic linking - a favourite among SEO pros.', 'wds' ),
99
- esc_html__( '- Try SmartCrawl Pro FREE today!', 'wds' )
100
- ),
101
- ));
102
- }
103
- ?>
104
- </div>
105
- </div>
106
- </section>
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! smartcrawl_subsite_setting_page_enabled( 'wds_autolinks' ) ) {
3
+ return;
4
+ }
5
+
6
+ $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
7
+
8
+ $redirection_model = new Smartcrawl_Model_Redirection();
9
+ $redirection_count = count( $redirection_model->get_all_redirections() );
10
+
11
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
12
+ $options = $_view['options'];
13
+ $autolinking_enabled = smartcrawl_get_array_value( $options, 'autolinks' );
14
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
15
+ $is_member = $service->is_member();
16
+ $moz_connected = ! empty( $options['access-id'] ) && ! empty( $options['secret-key'] );
17
+ ?>
18
+
19
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_ADVANCED_TOOLS ); ?>" class="dev-box">
20
+ <div class="box-title">
21
+ <div class="buttons buttons-icon">
22
+ <a href="<?php echo esc_attr( $page_url ); ?>" class="wds-settings-link">
23
+ <i class="wds-icon-arrow-right-carats"></i>
24
+ </a>
25
+ </div>
26
+ <h3>
27
+ <i class="wds-icon-wand-magic"></i> <?php esc_html_e( 'Advanced Tools', 'wds' ); ?>
28
+ </h3>
29
+ </div>
30
+
31
+ <div class="box-content">
32
+ <p><?php esc_html_e( 'Advanced tools focus on the finer details of SEO including internal linking, redirections and Moz analysis.', 'wds' ); ?></p>
33
+
34
+ <div class="wds-separator-top">
35
+ <span class="wds-small-text"><strong><?php esc_html_e( 'URL Redirects', 'wds' ); ?></strong></span>
36
+ <span class="wds-box-stat-value"><?php echo esc_html( $redirection_count ); ?>
37
+ </div>
38
+
39
+ <div class="wds-separator-top cf">
40
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Moz Integration', 'wds' ); ?></strong></span>
41
+
42
+ <?php if ( $moz_connected ) : ?>
43
+ <span class="wds-box-stat-value">
44
+ <a href="<?php echo esc_attr( $page_url ); ?>#tab_moz"
45
+ class="button button-small button-dark button-dark-o">
46
+
47
+ <?php esc_html_e( 'View Report', 'wds' ); ?>
48
+ </a>
49
+ </span>
50
+ <?php else : ?>
51
+ <p class="wds-small-text">
52
+ <?php esc_html_e( 'Moz provides reports that tell you how your site stacks up against the competition with all of the important SEO measurement tools.', 'wds' ); ?>
53
+ </p>
54
+ <a href="<?php echo esc_attr( $page_url ); ?>#tab_moz"
55
+ class="button button-small">
56
+
57
+ <?php esc_html_e( 'Connect', 'wds' ); ?>
58
+ </a>
59
+ <?php endif; ?>
60
+ </div>
61
+
62
+ <div
63
+ class="wds-separator-top wds-autolinking-section <?php echo ! $is_member ? 'wds-box-blocked-area' : ''; ?>">
64
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Automatic Linking', 'wds' ); ?></strong></span>
65
+ <?php if ( $autolinking_enabled && $is_member ) : ?>
66
+ <span
67
+ class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Active', 'wds' ); ?></span>
68
+ <?php else : ?>
69
+ <p class="wds-small-text">
70
+ <?php esc_html_e( 'Configure SmartCrawl to automatically link certain key words to a page on your blog or even a whole new site all together.', 'wds' ); ?>
71
+ </p>
72
+ <button type="button"
73
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
74
+ data-flag="<?php echo 'autolinks'; ?>"
75
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
76
+
77
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
78
+ </button>
79
+ <?php if ( ! $is_member ) : ?>
80
+ <button class="wds-upgrade-button button-pro wds-has-tooltip"
81
+ data-content="<?php esc_attr_e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
82
+ type="button">
83
+ <?php esc_html_e( 'Pro feature', 'wds' ); ?>
84
+ </button>
85
+ <?php endif; ?>
86
+ <?php endif; ?>
87
+ </div>
88
+
89
+ <div class="wds-box-footer" style="margin-top: 0;">
90
+ <a href="<?php echo esc_attr( $page_url ); ?>"
91
+ class="button button-small button-dark button-dark-o wds-dash-configure-button">
92
+
93
+ <?php esc_html_e( 'Configure', 'wds' ); ?>
94
+ </a>
95
+
96
+ <?php
97
+ if ( ! $is_member ) {
98
+
99
+ $this->_render( 'mascot-message', array(
100
+ 'key' => 'seo-checkup-upsell',
101
+ 'dismissible' => false,
102
+ 'message' => sprintf(
103
+ '%s <a href="#upgrade-to-pro">%s</a>',
104
+ esc_html__( 'Upgrade to Pro and automatically link your articles both internally and externally with automatic linking - a favourite among SEO pros.', 'wds' ),
105
+ esc_html__( '- Try SmartCrawl Pro FREE today!', 'wds' )
106
+ ),
107
+ ) );
108
+ }
109
+ ?>
110
+ </div>
111
+ </div>
112
+ </section>
includes/admin/templates/dashboard/dashboard-widget-content-analysis.php CHANGED
@@ -1,79 +1,85 @@
1
- <?php
2
- $options = $_view['options'];
3
- $seo_analysis_enabled = smartcrawl_get_array_value( $options, 'analysis-seo' );
4
- $readability_analysis_enabled = smartcrawl_get_array_value( $options, 'analysis-readability' );
5
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
6
- $is_ajax_request = defined( 'DOING_AJAX' ) && DOING_AJAX;
7
- $refresh_required = ! $is_ajax_request && ($seo_analysis_enabled || $readability_analysis_enabled);
8
-
9
- $classes = array();
10
- if ( $refresh_required ) {
11
- $classes[] = 'wds-box-refresh-required';
12
- }
13
- if ( $seo_analysis_enabled ) {
14
- $classes[] = 'wds-seo-analysis-enabled';
15
- }
16
- if ( $readability_analysis_enabled ) {
17
- $classes[] = 'wds-readability-analysis-enabled';
18
- }
19
- ?>
20
-
21
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_CONTENT_ANALYSIS; ?>"
22
- class="dev-box <?php echo implode( ' ', $classes ); ?>">
23
-
24
- <div class="box-title">
25
- <h3>
26
- <i class="wds-icon-magnifying-glass-search"></i> <?php esc_html_e( 'Content Analysis', 'wds' ); ?>
27
- </h3>
28
- </div>
29
-
30
- <div class="box-content">
31
- <p><?php esc_html_e( 'SEO and Readability Analysis recommend improvements to your content to give it the best chance of ranking highly, as well as being easy for average person to read.', 'wds' ); ?></p>
32
-
33
- <div class="wds-report">
34
- <?php if ( $seo_analysis_enabled ) : ?>
35
- <?php if ( $is_ajax_request ) { $this->_render( 'dashboard/dashboard-content-analysis-seo-overview' ); } ?>
36
- <?php else : ?>
37
- <div class="wds-separator-top">
38
- <span class="wds-small-text"><strong><?php esc_html_e( 'SEO Analysis', 'wds' ); ?></strong></span>
39
- <p class="wds-small-text">
40
- <?php esc_html_e( 'Analyses your content against recommend SEO practice and gives recommendations for improvement to make sure content is as optimized as possible.', 'wds' ); ?>
41
- </p>
42
- <button type="button"
43
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
44
- data-flag="analysis-seo"
45
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
46
-
47
- <?php esc_html_e( 'Activate', 'wds' ); ?>
48
- </button>
49
- </div>
50
- <?php endif; ?>
51
-
52
- <?php if ( $readability_analysis_enabled ) : ?>
53
- <?php if ( $is_ajax_request ) { $this->_render( 'dashboard/dashboard-content-analysis-readability-overview' ); } ?>
54
- <?php else : ?>
55
- <div class="wds-separator-top">
56
- <span class="wds-small-text"><strong><?php esc_html_e( 'Readability Analysis', 'wds' ); ?></strong></span>
57
- <p class="wds-small-text">
58
- <?php esc_html_e( 'Benchmarks the readability of your content for the average visitor and gives recommendations for improvement.', 'wds' ); ?>
59
- </p>
60
- <button type="button"
61
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
62
- data-flag="analysis-readability"
63
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
64
-
65
- <?php esc_html_e( 'Activate', 'wds' ); ?>
66
- </button>
67
- </div>
68
- <?php endif; ?>
69
- </div>
70
-
71
- <div class="wds-box-footer">
72
- <a href="<?php echo esc_attr( admin_url( 'edit.php' ) ); ?>"
73
- class="button button-small button-dark button-dark-o wds-dash-edit-posts-button">
74
-
75
- <?php esc_html_e( 'Edit Posts', 'wds' ); ?>
76
- </a>
77
- </div>
78
- </div>
79
- </section>
 
 
 
 
 
 
1
+ <?php
2
+ $options = $_view['options'];
3
+ $seo_analysis_enabled = smartcrawl_get_array_value( $options, 'analysis-seo' );
4
+ $readability_analysis_enabled = smartcrawl_get_array_value( $options, 'analysis-readability' );
5
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
6
+ $is_ajax_request = defined( 'DOING_AJAX' ) && DOING_AJAX;
7
+ $refresh_required = ! $is_ajax_request && ( $seo_analysis_enabled || $readability_analysis_enabled );
8
+
9
+ $classes = array();
10
+ if ( $refresh_required ) {
11
+ $classes[] = 'wds-box-refresh-required';
12
+ }
13
+ if ( $seo_analysis_enabled ) {
14
+ $classes[] = 'wds-seo-analysis-enabled';
15
+ }
16
+ if ( $readability_analysis_enabled ) {
17
+ $classes[] = 'wds-readability-analysis-enabled';
18
+ }
19
+ ?>
20
+
21
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_CONTENT_ANALYSIS ); ?>"
22
+ class="dev-box <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
23
+
24
+ <div class="box-title">
25
+ <h3>
26
+ <i class="wds-icon-magnifying-glass-search"></i> <?php esc_html_e( 'Content Analysis', 'wds' ); ?>
27
+ </h3>
28
+ </div>
29
+
30
+ <div class="box-content">
31
+ <p><?php esc_html_e( 'SEO and Readability Analysis recommend improvements to your content to give it the best chance of ranking highly, as well as being easy for average person to read.', 'wds' ); ?></p>
32
+
33
+ <div class="wds-report">
34
+ <?php if ( $seo_analysis_enabled ) : ?>
35
+ <?php if ( $is_ajax_request ) : ?>
36
+ <?php $this->_render( 'dashboard/dashboard-content-analysis-seo-overview' ); ?>
37
+ <?php endif; ?>
38
+ <?php else : ?>
39
+ <div class="wds-separator-top">
40
+ <span class="wds-small-text"><strong><?php esc_html_e( 'SEO Analysis', 'wds' ); ?></strong></span>
41
+ <p class="wds-small-text">
42
+ <?php esc_html_e( 'Analyses your content against recommend SEO practice and gives recommendations for improvement to make sure content is as optimized as possible.', 'wds' ); ?>
43
+ </p>
44
+ <button type="button"
45
+ id="wds-activate-analysis-seo"
46
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
47
+ data-flag="analysis-seo"
48
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
49
+
50
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
51
+ </button>
52
+ </div>
53
+ <?php endif; ?>
54
+
55
+ <?php if ( $readability_analysis_enabled ) : ?>
56
+ <?php if ( $is_ajax_request ) : ?>
57
+ <?php $this->_render( 'dashboard/dashboard-content-analysis-readability-overview' ); ?>
58
+ <?php endif; ?>
59
+ <?php else : ?>
60
+ <div class="wds-separator-top">
61
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Readability Analysis', 'wds' ); ?></strong></span>
62
+ <p class="wds-small-text">
63
+ <?php esc_html_e( 'Benchmarks the readability of your content for the average visitor and gives recommendations for improvement.', 'wds' ); ?>
64
+ </p>
65
+ <button type="button"
66
+ id="wds-activate-analysis-readability"
67
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
68
+ data-flag="analysis-readability"
69
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
70
+
71
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
72
+ </button>
73
+ </div>
74
+ <?php endif; ?>
75
+ </div>
76
+
77
+ <div class="wds-box-footer">
78
+ <a href="<?php echo esc_attr( admin_url( 'edit.php' ) ); ?>"
79
+ class="button button-small button-dark button-dark-o wds-dash-edit-posts-button">
80
+
81
+ <?php esc_html_e( 'Edit Posts', 'wds' ); ?>
82
+ </a>
83
+ </div>
84
+ </div>
85
+ </section>
includes/admin/templates/dashboard/dashboard-widget-onpage.php CHANGED
@@ -1,54 +1,60 @@
1
- <?php
2
- $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE );
3
- $public_post_types = get_post_types( array( 'public' => true ) );
4
- $show_on_front = get_option( 'show_on_front' );
5
- $options = $_view['options'];
6
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
7
- $onpage_enabled = smartcrawl_get_array_value( $options, 'onpage' );
8
- ?>
9
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_ONPAGE; ?>" class="dev-box">
10
- <div class="box-title">
11
- <?php if ( $onpage_enabled ) : ?>
12
- <div class="buttons buttons-icon">
13
- <a href="<?php echo esc_attr( $page_url ); ?>">
14
- <i class="wds-icon-arrow-right-carats"></i>
15
- </a>
16
- </div>
17
- <?php endif; ?>
18
- <h3>
19
- <i class="wds-icon-pencil"></i> <?php esc_html_e( 'Titles & Meta', 'wds' ); ?>
20
- </h3>
21
- </div>
22
-
23
- <div class="box-content">
24
- <p><?php esc_html_e( 'Control how your website’s pages, posts and custom post types appear in search engines like Google and Bing.', 'wds' ); ?></p>
25
-
26
- <?php if ( $onpage_enabled ) : ?>
27
- <div class="wds-separator-top">
28
- <span class="wds-small-text"><strong><?php esc_html_e( 'Homepage', 'wds' ); ?></strong></span>
29
- <span class="wds-box-stat-value"><?php $show_on_front == 'page' ? esc_html_e( 'A Static Page', 'wds' ) : esc_html_e( 'Latest Posts', 'wds' ); ?></span>
30
- </div>
31
-
32
- <div class="wds-separator-top">
33
- <span class="wds-small-text"><strong><?php esc_html_e( 'Public post types', 'wds' ); ?></strong></span>
34
- <span class="wds-box-stat-value"><?php echo esc_html( count( $public_post_types ) ); ?></span>
35
- </div>
36
-
37
- <div class="wds-box-footer">
38
- <a href="<?php echo esc_attr( $page_url ); ?>"
39
- class="button button-small button-dark button-dark-o wds-dash-configure-button">
40
-
41
- <?php esc_html_e( 'Configure', 'wds' ); ?>
42
- </a>
43
- </div>
44
- <?php else : ?>
45
- <button type="button"
46
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
47
- data-flag="<?php echo esc_attr( 'onpage' ); ?>"
48
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
49
-
50
- <?php esc_html_e( 'Activate', 'wds' ); ?>
51
- </button>
52
- <?php endif; ?>
53
- </div>
54
- </section>
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! smartcrawl_subsite_setting_page_enabled( 'wds_onpage' ) ) {
3
+ return;
4
+ }
5
+
6
+ $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE );
7
+ $public_post_types = get_post_types( array( 'public' => true ) );
8
+ $show_on_front = get_option( 'show_on_front' );
9
+ $options = $_view['options'];
10
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
11
+ $onpage_enabled = smartcrawl_get_array_value( $options, 'onpage' );
12
+ ?>
13
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_ONPAGE ); ?>" class="dev-box">
14
+ <div class="box-title">
15
+ <?php if ( $onpage_enabled ) : ?>
16
+ <div class="buttons buttons-icon">
17
+ <a href="<?php echo esc_attr( $page_url ); ?>">
18
+ <i class="wds-icon-arrow-right-carats"></i>
19
+ </a>
20
+ </div>
21
+ <?php endif; ?>
22
+ <h3>
23
+ <i class="wds-icon-pencil"></i> <?php esc_html_e( 'Titles & Meta', 'wds' ); ?>
24
+ </h3>
25
+ </div>
26
+
27
+ <div class="box-content">
28
+ <p><?php esc_html_e( 'Control how your website’s pages, posts and custom post types appear in search engines like Google and Bing.', 'wds' ); ?></p>
29
+
30
+ <?php if ( $onpage_enabled ) : ?>
31
+ <div class="wds-separator-top">
32
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Homepage', 'wds' ); ?></strong></span>
33
+ <span class="wds-box-stat-value">
34
+ <?php 'page' === $show_on_front ? esc_html_e( 'A Static Page', 'wds' ) : esc_html_e( 'Latest Posts', 'wds' ); ?>
35
+ </span>
36
+ </div>
37
+
38
+ <div class="wds-separator-top">
39
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Public post types', 'wds' ); ?></strong></span>
40
+ <span class="wds-box-stat-value"><?php echo esc_html( count( $public_post_types ) ); ?></span>
41
+ </div>
42
+
43
+ <div class="wds-box-footer">
44
+ <a href="<?php echo esc_attr( $page_url ); ?>"
45
+ class="button button-small button-dark button-dark-o wds-dash-configure-button">
46
+
47
+ <?php esc_html_e( 'Configure', 'wds' ); ?>
48
+ </a>
49
+ </div>
50
+ <?php else : ?>
51
+ <button type="button"
52
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
53
+ data-flag="<?php echo esc_attr( 'onpage' ); ?>"
54
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
55
+
56
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
57
+ </button>
58
+ <?php endif; ?>
59
+ </div>
60
+ </section>
includes/admin/templates/dashboard/dashboard-widget-seo-checkup.php CHANGED
@@ -1,72 +1,78 @@
1
- <?php
2
- $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_CHECKUP );
3
- $dashboard_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_DASHBOARD );
4
- /**
5
- * @var $service Smartcrawl_Checkup_Service
6
- */
7
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
8
- $options = $_view['options'];
9
- $reporting_enabled = smartcrawl_get_array_value( $options, 'checkup-cron-enable' );
10
- $last_checked = (boolean) $service->get_last_checked_timestamp();
11
- $in_progress = $last_checked ? false : $service->in_progress();
12
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
13
- $checkup_enabled = smartcrawl_get_array_value( $options, 'checkup' );
14
- $checkup_text = esc_html__( 'Get a comprehensive report on how optimized your website is for search engines and social media. We recommend running this checkup first to see what needs improving.', 'wds' );
15
- $results = $in_progress ? array() : $service->result();
16
- $counts = smartcrawl_get_array_value( $results, 'counts' );
17
- $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
18
- ?>
19
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_SEO_CHECKUP; ?>" class="dev-box">
20
- <div class="box-title">
21
- <?php if ( $checkup_enabled ) : ?>
22
- <div class="buttons buttons-icon">
23
- <a href="<?php echo esc_attr( $page_url ); ?>">
24
- <i class="wds-icon-arrow-right-carats"></i>
25
- </a>
26
- </div>
27
- <?php endif; ?>
28
- <h3>
29
- <i class="wds-icon-icon-smart-crawl"></i> <?php esc_html_e( 'SEO Checkup', 'wds' ); ?>
30
- <?php if ( $issue_count > 0 ) : ?>
31
- <span class="wds-issues wds-issues-warning wds-has-tooltip"
32
- data-content="<?php printf( __( 'You have %s outstanding SEO issues to fix up', 'wds' ), $issue_count ); ?>">
33
- <?php echo $issue_count; ?>
34
- </span>
35
- <?php endif; ?>
36
- </h3>
37
- </div>
38
- <div class="box-content">
39
- <?php if ( $checkup_enabled ) : ?>
40
- <?php
41
- if ( ! $last_checked && ! $in_progress ) {
42
- ?>
43
- <p><?php echo $checkup_text; ?></p>
44
-
45
- <div class="wds-box-footer">
46
- <a href="<?php echo esc_url( add_query_arg( 'run-checkup', 'yes', $dashboard_url ) ); ?>"
47
- class="button button-small">
48
- <?php esc_html_e( 'Run checkup', 'wds' ); ?>
49
- </a>
50
- </div>
51
- <?php
52
- } elseif ( $service->in_progress() ) {
53
- $this->_render( 'dashboard/dashboard-checkup-progress' );
54
- } else {
55
- $this->_render('dashboard/dashboard-mini-checkup-report', array(
56
- 'results' => $results,
57
- 'issue_count' => $issue_count,
58
- ));
59
- }
60
- ?>
61
- <?php else : ?>
62
- <p><?php echo $checkup_text; ?></p>
63
- <button type="button"
64
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
65
- data-flag="<?php echo esc_attr( 'checkup' ); ?>"
66
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
67
-
68
- <?php esc_html_e( 'Activate', 'wds' ); ?>
69
- </button>
70
- <?php endif; ?>
71
- </div>
72
- </section>
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! smartcrawl_subsite_setting_page_enabled( 'wds_checkup' ) ) {
3
+ return;
4
+ }
5
+
6
+ $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_CHECKUP );
7
+ $checkup_url = Smartcrawl_Settings_Dashboard::checkup_url();
8
+ /**
9
+ * @var $service Smartcrawl_Checkup_Service
10
+ */
11
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
12
+ $options = $_view['options'];
13
+ $reporting_enabled = smartcrawl_get_array_value( $options, 'checkup-cron-enable' );
14
+ $last_checked = (boolean) $service->get_last_checked_timestamp();
15
+ $in_progress = $last_checked ? false : $service->in_progress();
16
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
17
+ $checkup_enabled = smartcrawl_get_array_value( $options, 'checkup' );
18
+ $checkup_text = esc_html__( 'Get a comprehensive report on how optimized your website is for search engines and social media. We recommend running this checkup first to see what needs improving.', 'wds' );
19
+ $results = $in_progress ? array() : $service->result();
20
+ $counts = smartcrawl_get_array_value( $results, 'counts' );
21
+ $issue_count = intval( smartcrawl_get_array_value( $counts, 'warning' ) ) + intval( smartcrawl_get_array_value( $counts, 'critical' ) );
22
+ ?>
23
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_SEO_CHECKUP ); ?>"
24
+ data-dependent="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_TOP_STATS ); ?>"
25
+ class="dev-box">
26
+ <div class="box-title">
27
+ <?php if ( $checkup_enabled ) : ?>
28
+ <div class="buttons buttons-icon">
29
+ <a href="<?php echo esc_attr( $page_url ); ?>">
30
+ <i class="wds-icon-arrow-right-carats"></i>
31
+ </a>
32
+ </div>
33
+ <?php endif; ?>
34
+ <h3>
35
+ <i class="wds-icon-icon-smart-crawl"></i> <?php esc_html_e( 'SEO Checkup', 'wds' ); ?>
36
+ <?php if ( $issue_count > 0 && $checkup_enabled ) : ?>
37
+ <span class="wds-issues wds-issues-warning wds-has-tooltip"
38
+ data-content="<?php printf( esc_attr__( 'You have %s outstanding SEO issues to fix up', 'wds' ), intval( $issue_count ) ); ?>">
39
+ <?php echo intval( $issue_count ); ?>
40
+ </span>
41
+ <?php endif; ?>
42
+ </h3>
43
+ </div>
44
+ <div class="box-content">
45
+ <?php if ( $checkup_enabled ) : ?>
46
+ <?php
47
+ if ( ! $last_checked && ! $in_progress ) {
48
+ ?>
49
+ <p><?php echo esc_html( $checkup_text ); ?></p>
50
+
51
+ <div class="wds-box-footer">
52
+ <a href="<?php echo esc_attr( $checkup_url ); ?>"
53
+ class="button button-small">
54
+ <?php esc_html_e( 'Run checkup', 'wds' ); ?>
55
+ </a>
56
+ </div>
57
+ <?php
58
+ } elseif ( $service->in_progress() ) {
59
+ $this->_render( 'dashboard/dashboard-checkup-progress' );
60
+ } else {
61
+ $this->_render( 'dashboard/dashboard-mini-checkup-report', array(
62
+ 'results' => $results,
63
+ 'issue_count' => $issue_count,
64
+ ) );
65
+ }
66
+ ?>
67
+ <?php else : ?>
68
+ <p><?php echo esc_html( $checkup_text ); ?></p>
69
+ <button type="button"
70
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
71
+ data-flag="<?php echo esc_attr( 'checkup' ); ?>"
72
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
73
+
74
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
75
+ </button>
76
+ <?php endif; ?>
77
+ </div>
78
+ </section>
includes/admin/templates/dashboard/dashboard-widget-sitemap.php CHANGED
@@ -1,105 +1,111 @@
1
- <?php
2
- $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SITEMAP );
3
- $options = $_view['options'];
4
- $sitemap_enabled = smartcrawl_get_array_value( $options, 'sitemap' );
5
- $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
6
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
7
- $is_member = $service->is_member();
8
- ?>
9
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_SITEMAP; ?>"
10
- class="dev-box"
11
- data-dependent="<?php echo Smartcrawl_Settings_Dashboard::BOX_TOP_STATS; ?>">
12
-
13
- <div class="box-title">
14
- <div class="buttons buttons-icon">
15
- <a href="<?php echo esc_attr( $page_url ); ?>">
16
- <i class="wds-icon-arrow-right-carats"></i>
17
- </a>
18
- </div>
19
- <h3>
20
- <i class="wds-icon-web-globe-world"></i> <?php esc_html_e( 'Sitemap', 'wds' ); ?>
21
- <?php
22
- $this->_render('url-crawl-master', array(
23
- 'ready_template' => 'dashboard/dashboard-box-title-url-crawl-stats',
24
- ));
25
- ?>
26
- </h3>
27
- </div>
28
- <div class="box-content">
29
- <p><?php esc_html_e( 'Automatically generate detailed sitemaps to tell search engines what content you want them to crawl and index.', 'wds' ); ?></p>
30
-
31
- <div class="wds-separator-top">
32
- <span class="wds-small-text"><strong><?php esc_html_e( 'XML Sitemap', 'wds' ); ?></strong></span>
33
- <?php if ( $sitemap_enabled ) : ?>
34
-
35
- <?php
36
- $this->_render('notice', array(
37
- 'class' => 'wds-notice-success',
38
- 'message' => sprintf(
39
- __( 'Your sitemap is available at %s', 'wds' ),
40
- sprintf( '<a href="%s">/sitemap.xml</a>', esc_attr( smartcrawl_get_sitemap_url() ) )
41
- ),
42
- ));
43
- ?>
44
-
45
- <?php else : ?>
46
- <p class="wds-small-text">
47
- <?php esc_html_e( 'Enables an XML page that search engines will use to crawl and index your website pages.', 'wds' ); ?>
48
- </p>
49
-
50
- <?php
51
- $this->_render('dismissable-notice', array(
52
- 'key' => 'dashboard-sitemap-disabled-warning',
53
- 'message' => __( 'Your sitemap is currently disabled. We highly recommend you enable this feature if you don’t already have a sitemap.', 'wds' ),
54
- 'class' => 'wds-notice-warning',
55
- ));
56
- ?>
57
- <button type="button"
58
- data-option-id="<?php echo esc_attr( $option_name ); ?>"
59
- data-flag="<?php echo 'sitemap'; ?>"
60
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
61
-
62
- <?php esc_html_e( 'Activate', 'wds' ); ?>
63
- </button>
64
- <?php endif; ?>
65
- </div>
66
-
67
- <div class="wds-separator-top <?php echo $is_member ? '' : 'wds-box-blocked-area'; ?>">
68
- <span class="wds-small-text"><strong><?php esc_html_e( 'URL Crawler', 'wds' ); ?></strong></span>
69
- <?php if ( $sitemap_enabled ) : ?>
70
- <?php
71
- $this->_render('url-crawl-master', array(
72
- 'ready_template' => 'dashboard/dashboard-url-crawl-stats',
73
- 'progress_template' => 'dashboard/dashboard-url-crawl-in-progress',
74
- 'no_data_template' => 'dashboard/dashboard-url-crawl-no-data-small',
75
- ));
76
- ?>
77
- <?php else : ?>
78
- <?php if ( $is_member ) : ?>
79
- <div class="wds-box-crawl-stats">
80
- <span class="wds-issues wds-issues-invalid">
81
- <?php esc_html_e( 'Sitemaps must be activated', 'wds' ) ?>
82
- </span>
83
- </div>
84
- <?php else : ?>
85
- <p class="wds-small-text">
86
- <?php esc_html_e( 'Automatically schedule SmartCrawl to run check for URLs that are missing from your Sitemap.', 'wds' ) ?>
87
- </p>
88
- <button class="wds-upgrade-button button-pro wds-has-tooltip"
89
- data-content="<?php _e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
90
- type="button">
91
- <?php esc_html_e( 'Pro feature', 'wds' ); ?>
92
- </button>
93
- <?php endif; ?>
94
- <?php endif; ?>
95
- </div>
96
-
97
- <div class="wds-box-footer" style="<?php echo $is_member ? '' : 'margin-top:0;'; ?>">
98
- <a href="<?php echo esc_attr( $page_url ); ?>"
99
- class="button button-small button-dark button-dark-o wds-dash-configure-button">
100
-
101
- <?php esc_html_e( 'Configure', 'wds' ); ?>
102
- </a>
103
- </div>
104
- </div>
105
- </section>
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! smartcrawl_subsite_setting_page_enabled( 'wds_sitemap' ) ) {
3
+ return;
4
+ }
5
+
6
+ $page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SITEMAP );
7
+ $options = $_view['options'];
8
+ $sitemap_enabled = smartcrawl_get_array_value( $options, 'sitemap' );
9
+ $option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
10
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_CHECKUP );
11
+ $is_member = $service->is_member();
12
+ ?>
13
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_SITEMAP ); ?>"
14
+ class="dev-box"
15
+ data-dependent="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_TOP_STATS ); ?>">
16
+
17
+ <div class="box-title">
18
+ <div class="buttons buttons-icon">
19
+ <a href="<?php echo esc_attr( $page_url ); ?>">
20
+ <i class="wds-icon-arrow-right-carats"></i>
21
+ </a>
22
+ </div>
23
+ <h3>
24
+ <i class="wds-icon-web-globe-world"></i> <?php esc_html_e( 'Sitemap', 'wds' ); ?>
25
+ <?php
26
+ if ( $sitemap_enabled ) {
27
+ $this->_render( 'url-crawl-master', array(
28
+ 'ready_template' => 'dashboard/dashboard-box-title-url-crawl-stats',
29
+ ) );
30
+ }
31
+ ?>
32
+ </h3>
33
+ </div>
34
+ <div class="box-content">
35
+ <p><?php esc_html_e( 'Automatically generate detailed sitemaps to tell search engines what content you want them to crawl and index.', 'wds' ); ?></p>
36
+
37
+ <div class="wds-separator-top">
38
+ <span class="wds-small-text"><strong><?php esc_html_e( 'XML Sitemap', 'wds' ); ?></strong></span>
39
+ <?php if ( $sitemap_enabled ) : ?>
40
+
41
+ <?php
42
+ $this->_render( 'notice', array(
43
+ 'class' => 'wds-notice-success',
44
+ 'message' => sprintf(
45
+ __( 'Your sitemap is available at %s', 'wds' ),
46
+ sprintf( '<a target="_blank" href="%s">/sitemap.xml</a>', esc_attr( smartcrawl_get_sitemap_url() ) )
47
+ ),
48
+ ) );
49
+ ?>
50
+
51
+ <?php else : ?>
52
+ <p class="wds-small-text">
53
+ <?php esc_html_e( 'Enables an XML page that search engines will use to crawl and index your website pages.', 'wds' ); ?>
54
+ </p>
55
+
56
+ <?php
57
+ $this->_render( 'dismissable-notice', array(
58
+ 'key' => 'dashboard-sitemap-disabled-warning',
59
+ 'message' => __( 'Your sitemap is currently disabled. We highly recommend you enable this feature if you don’t already have a sitemap.', 'wds' ),
60
+ 'class' => 'wds-notice-warning',
61
+ ) );
62
+ ?>
63
+ <button type="button"
64
+ data-option-id="<?php echo esc_attr( $option_name ); ?>"
65
+ data-flag="<?php echo 'sitemap'; ?>"
66
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
67
+
68
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
69
+ </button>
70
+ <?php endif; ?>
71
+ </div>
72
+
73
+ <div class="wds-separator-top <?php echo $is_member ? '' : 'wds-box-blocked-area'; ?>">
74
+ <span class="wds-small-text"><strong><?php esc_html_e( 'URL Crawler', 'wds' ); ?></strong></span>
75
+ <?php if ( $sitemap_enabled ) : ?>
76
+ <?php
77
+ $this->_render( 'url-crawl-master', array(
78
+ 'ready_template' => 'dashboard/dashboard-url-crawl-stats',
79
+ 'progress_template' => 'dashboard/dashboard-url-crawl-in-progress',
80
+ 'no_data_template' => 'dashboard/dashboard-url-crawl-no-data-small',
81
+ ) );
82
+ ?>
83
+ <?php else : ?>
84
+ <?php if ( $is_member ) : ?>
85
+ <div class="wds-box-crawl-stats">
86
+ <span class="wds-issues wds-issues-invalid">
87
+ <?php esc_html_e( 'Sitemaps must be activated', 'wds' ); ?>
88
+ </span>
89
+ </div>
90
+ <?php else : ?>
91
+ <p class="wds-small-text">
92
+ <?php esc_html_e( 'Automatically schedule SmartCrawl to run check for URLs that are missing from your Sitemap.', 'wds' ); ?>
93
+ </p>
94
+ <button class="wds-upgrade-button button-pro wds-has-tooltip"
95
+ data-content="<?php esc_attr_e( 'Get SmartCrawl Pro today Free', 'wds' ); ?>"
96
+ type="button">
97
+ <?php esc_html_e( 'Pro feature', 'wds' ); ?>
98
+ </button>
99
+ <?php endif; ?>
100
+ <?php endif; ?>
101
+ </div>
102
+
103
+ <div class="wds-box-footer" style="<?php echo $is_member ? '' : 'margin-top:0;'; ?>">
104
+ <a href="<?php echo esc_attr( $page_url ); ?>"
105
+ class="button button-small button-dark button-dark-o wds-dash-configure-button">
106
+
107
+ <?php esc_html_e( 'Configure', 'wds' ); ?>
108
+ </a>
109
+ </div>
110
+ </div>
111
+ </section>
includes/admin/templates/dashboard/dashboard-widget-social.php CHANGED
@@ -1,105 +1,113 @@
1
- <?php
2
- if ( ! class_exists( 'Smartcrawl_Twitter_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_twitter_printer.php' ); }
3
-
4
- $options = $_view['options'];
5
- $og_enabled = smartcrawl_get_array_value( $options, 'og-enable' );
6
- $twitter_card_enabled = smartcrawl_get_array_value( $options, 'twitter-card-enable' );
7
- $twitter_card_type = smartcrawl_get_array_value( $options, 'twitter-card-type' );
8
- $twitter_card_status_text = $twitter_card_type == Smartcrawl_Twitter_Printer::CARD_IMAGE ? esc_html__( 'Summary Card with Large Image', 'wds' ) : esc_html__( 'Summary Card', 'wds' );
9
- $pinterest_verification_status = smartcrawl_get_array_value( $options, 'pinterest-verification-status' );
10
- $pinterest_tag = smartcrawl_get_array_value( $options, 'pinterest-verify' );
11
-
12
- $social_page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SOCIAL );
13
- $social_option_name = Smartcrawl_Settings::TAB_SOCIAL . '_options';
14
- $settings_option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
15
- $social_enabled = smartcrawl_get_array_value( $options, 'social' );
16
- ?>
17
- <section id="<?php echo Smartcrawl_Settings_Dashboard::BOX_SOCIAL; ?>" class="dev-box">
18
- <div class="box-title">
19
- <?php if ( $social_enabled ) : ?>
20
- <div class="buttons buttons-icon">
21
- <a href="<?php echo esc_attr( $social_page_url ); ?>" class="wds-settings-link">
22
- <i class="wds-icon-arrow-right-carats"></i>
23
- </a>
24
- </div>
25
- <?php endif; ?>
26
- <h3>
27
- <i class="wds-icon-social-twitter"></i> <?php esc_html_e( 'Social', 'wds' ); ?>
28
- </h3>
29
- </div>
30
-
31
- <div class="box-content">
32
- <p><?php esc_html_e( 'Control and optimize how your website appears when shared on social platforms like Facebook and Twitter.', 'wds' ); ?></p>
33
-
34
- <?php if ( $social_enabled ) : ?>
35
- <div class="wds-separator-top">
36
- <span class="wds-small-text"><strong><?php esc_html_e( 'OpenGraph', 'wds' ); ?></strong></span>
37
- <?php if ( ! $og_enabled ) : ?>
38
- <p class="wds-small-text">
39
- <?php esc_html_e( 'Add meta data to your pages to make them look great when shared platforms such as Facebook and other popular social networks.', 'wds' ); ?>
40
- </p>
41
- <button
42
- type="button"
43
- data-option-id="<?php echo esc_attr( $social_option_name ); ?>"
44
- data-flag="<?php echo 'og-enable'; ?>"
45
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
46
-
47
- <?php esc_html_e( 'Activate', 'wds' ); ?>
48
- </button>
49
- <?php else : ?>
50
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Active', 'wds' ); ?></span>
51
- <?php endif; ?>
52
- </div>
53
-
54
- <div class="wds-separator-top">
55
- <span class="wds-small-text"><strong><?php esc_html_e( 'Twitter Cards', 'wds' ); ?></strong></span>
56
- <?php if ( ! $twitter_card_enabled ) : ?>
57
- <p class="wds-small-text">
58
- <?php esc_attr_e( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping to drive traffic to your website.', 'wds' ); ?>
59
- </p>
60
- <button type="button"
61
- data-option-id="<?php echo esc_attr( $social_option_name ); ?>"
62
- data-flag="<?php echo 'twitter-card-enable'; ?>"
63
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
64
-
65
- <?php esc_html_e( 'Activate', 'wds' ); ?>
66
- </button>
67
- <?php else : ?>
68
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php echo $twitter_card_status_text; ?></span>
69
- <?php endif; ?>
70
- </div>
71
-
72
- <div class="wds-separator-top">
73
- <span class="wds-small-text"><strong><?php esc_html_e( 'Pinterest Verification', 'wds' ); ?></strong></span>
74
- <?php if ( ! $pinterest_tag || $pinterest_verification_status === 'fail' ) : ?>
75
- <p class="wds-small-text">
76
- <?php esc_html_e( 'Verify your website with Pinterest to attribute your website when your website content is pinned to the platform.', 'wds' ); ?>
77
- </p>
78
- <a href="<?php echo esc_attr( $social_page_url ); ?>#tab_pinterest_verification"
79
- class="button button-small">
80
-
81
- <?php esc_html_e( 'Connect', 'wds' ); ?>
82
- </a>
83
- <?php else : ?>
84
- <span class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Verification tag added' ); ?></span>
85
- <?php endif; ?>
86
- </div>
87
-
88
- <div class="wds-box-footer">
89
- <a href="<?php echo esc_attr( $social_page_url ); ?>"
90
- class="button button-small button-dark button-dark-o wds-dash-configure-button">
91
-
92
- <?php esc_html_e( 'Configure', 'wds' ); ?>
93
- </a>
94
- </div>
95
- <?php else : ?>
96
- <button type="button"
97
- data-option-id="<?php echo esc_attr( $settings_option_name ); ?>"
98
- data-flag="<?php echo esc_attr( 'social' ); ?>"
99
- class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
100
-
101
- <?php esc_html_e( 'Activate', 'wds' ); ?>
102
- </button>
103
- <?php endif; ?>
104
- </div>
105
- </section>
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! smartcrawl_subsite_setting_page_enabled( 'wds_social' ) ) {
3
+ return;
4
+ }
5
+
6
+ $options = $_view['options'];
7
+ $og_enabled = smartcrawl_get_array_value( $options, 'og-enable' );
8
+ $twitter_card_enabled = smartcrawl_get_array_value( $options, 'twitter-card-enable' );
9
+ $twitter_card_type = smartcrawl_get_array_value( $options, 'twitter-card-type' );
10
+ $twitter_card_status_text = Smartcrawl_Twitter_Printer::CARD_IMAGE === $twitter_card_type ? esc_html__( 'Summary Card with Large Image', 'wds' ) : esc_html__( 'Summary Card', 'wds' );
11
+ $pinterest_verification_status = smartcrawl_get_array_value( $options, 'pinterest-verification-status' );
12
+ $pinterest_tag = smartcrawl_get_array_value( $options, 'pinterest-verify' );
13
+
14
+ $social_page_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SOCIAL );
15
+ $social_option_name = Smartcrawl_Settings::TAB_SOCIAL . '_options';
16
+ $settings_option_name = Smartcrawl_Settings::TAB_SETTINGS . '_options';
17
+ $social_enabled = smartcrawl_get_array_value( $options, 'social' );
18
+ ?>
19
+ <section id="<?php echo esc_attr( Smartcrawl_Settings_Dashboard::BOX_SOCIAL ); ?>" class="dev-box">
20
+ <div class="box-title">
21
+ <?php if ( $social_enabled ) : ?>
22
+ <div class="buttons buttons-icon">
23
+ <a href="<?php echo esc_attr( $social_page_url ); ?>" class="wds-settings-link">
24
+ <i class="wds-icon-arrow-right-carats"></i>
25
+ </a>
26
+ </div>
27
+ <?php endif; ?>
28
+ <h3>
29
+ <i class="wds-icon-social-twitter"></i> <?php esc_html_e( 'Social', 'wds' ); ?>
30
+ </h3>
31
+ </div>
32
+
33
+ <div class="box-content">
34
+ <p><?php esc_html_e( 'Control and optimize how your website appears when shared on social platforms like Facebook and Twitter.', 'wds' ); ?></p>
35
+
36
+ <?php if ( $social_enabled ) : ?>
37
+ <div class="wds-separator-top">
38
+ <span class="wds-small-text"><strong><?php esc_html_e( 'OpenGraph', 'wds' ); ?></strong></span>
39
+ <?php if ( ! $og_enabled ) : ?>
40
+ <p class="wds-small-text">
41
+ <?php esc_html_e( 'Add meta data to your pages to make them look great when shared platforms such as Facebook and other popular social networks.', 'wds' ); ?>
42
+ </p>
43
+ <button
44
+ type="button"
45
+ data-option-id="<?php echo esc_attr( $social_option_name ); ?>"
46
+ data-flag="<?php echo 'og-enable'; ?>"
47
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
48
+
49
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
50
+ </button>
51
+ <?php else : ?>
52
+ <span
53
+ class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Active', 'wds' ); ?></span>
54
+ <?php endif; ?>
55
+ </div>
56
+
57
+ <div class="wds-separator-top">
58
+ <span class="wds-small-text"><strong><?php esc_html_e( 'Twitter Cards', 'wds' ); ?></strong></span>
59
+ <?php if ( ! $twitter_card_enabled ) : ?>
60
+ <p class="wds-small-text">
61
+ <?php esc_attr_e( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping to drive traffic to your website.', 'wds' ); ?>
62
+ </p>
63
+ <button type="button"
64
+ data-option-id="<?php echo esc_attr( $social_option_name ); ?>"
65
+ data-flag="<?php echo 'twitter-card-enable'; ?>"
66
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
67
+
68
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
69
+ </button>
70
+ <?php else : ?>
71
+ <span class="wds-box-stat-value wds-box-stat-value-success">
72
+ <?php echo esc_html( $twitter_card_status_text ); ?>
73
+ </span>
74
+ <?php endif; ?>
75
+ </div>
76
+
77
+ <div class="wds-separator-top">
78
+ <span class="wds-small-text">
79
+ <strong><?php esc_html_e( 'Pinterest Verification', 'wds' ); ?></strong>
80
+ </span>
81
+ <?php if ( ! $pinterest_tag || 'fail' === $pinterest_verification_status ) : ?>
82
+ <p class="wds-small-text">
83
+ <?php esc_html_e( 'Verify your website with Pinterest to attribute your website when your website content is pinned to the platform.', 'wds' ); ?>
84
+ </p>
85
+ <a href="<?php echo esc_attr( $social_page_url ); ?>#tab_pinterest_verification"
86
+ class="button button-small">
87
+
88
+ <?php esc_html_e( 'Connect', 'wds' ); ?>
89
+ </a>
90
+ <?php else : ?>
91
+ <span
92
+ class="wds-box-stat-value wds-box-stat-value-success"><?php esc_html_e( 'Verification tag added' ); ?></span>
93
+ <?php endif; ?>
94
+ </div>
95
+
96
+ <div class="wds-box-footer">
97
+ <a href="<?php echo esc_attr( $social_page_url ); ?>"
98
+ class="button button-small button-dark button-dark-o wds-dash-configure-button">
99
+
100
+ <?php esc_html_e( 'Configure', 'wds' ); ?>
101
+ </a>
102
+ </div>
103
+ <?php else : ?>
104
+ <button type="button"
105
+ data-option-id="<?php echo esc_attr( $settings_option_name ); ?>"
106
+ data-flag="<?php echo esc_attr( 'social' ); ?>"
107
+ class="wds-activate-component button button-small wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request">
108
+
109
+ <?php esc_html_e( 'Activate', 'wds' ); ?>
110
+ </button>
111
+ <?php endif; ?>
112
+ </div>
113
+ </section>
includes/admin/templates/dashboard/dashboard.php CHANGED
@@ -1,53 +1,61 @@
1
- <?php
2
- /**
3
- * Dashboard root template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
- ?>
8
- <div id="container" class="wrap wrap-wds wds-page wds-dashboard">
9
- <section id="header">
10
- <h1><?php esc_html_e( 'Dashboard', 'wds' ); ?></h1>
11
- </section>
12
-
13
- <div class="row">
14
- <?php $this->_render( 'dashboard/dashboard-top' ); ?>
15
- </div>
16
-
17
- <div class="row">
18
- <div class="col-half col-half-dashboard col-half-dashboard-left">
19
- <?php
20
- if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_CHECKUP ) ) {
21
- $this->_render( 'dashboard/dashboard-widget-seo-checkup' );
22
- }
23
- ?>
24
- <?php $this->_render( 'dashboard/dashboard-widget-content-analysis' ); ?>
25
- <?php
26
- if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_SOCIAL ) ) {
27
- $this->_render( 'dashboard/dashboard-widget-social' );
28
- }
29
- ?>
30
- </div>
31
-
32
- <div class="col-half col-half-dashboard col-half-dashboard-right">
33
- <?php
34
- if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_ONPAGE ) ) {
35
- $this->_render( 'dashboard/dashboard-widget-onpage' );
36
- }
37
- ?>
38
- <?php
39
- if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_SITEMAP ) ) {
40
- $this->_render( 'dashboard/dashboard-widget-sitemap' );
41
- }
42
- ?>
43
- <?php
44
- if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_AUTOLINKS ) ) {
45
- $this->_render( 'dashboard/dashboard-widget-advanced-tools' );
46
- }
47
- ?>
48
- </div>
49
- </div>
50
-
51
- <?php $this->_render( 'upsell-modal' ); ?>
52
- </div>
53
- <?php do_action( 'wds-dshboard-after_settings' ); ?>
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard root template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+ ?>
8
+ <div id="container" class="wrap wrap-wds wds-page wds-dashboard">
9
+ <section id="header">
10
+ <div class="actions">
11
+ <a target="_blank" class="button button-small button-light actions-button"
12
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-7">
13
+ <i class="wds-icon-academy"></i>
14
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
15
+ </a>
16
+ </div>
17
+
18
+ <h1><?php esc_html_e( 'Dashboard', 'wds' ); ?></h1>
19
+ </section>
20
+
21
+ <div class="row">
22
+ <?php $this->_render( 'dashboard/dashboard-top' ); ?>
23
+ </div>
24
+
25
+ <div class="row">
26
+ <div class="col-half col-half-dashboard col-half-dashboard-left">
27
+ <?php
28
+ if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_CHECKUP ) ) {
29
+ $this->_render( 'dashboard/dashboard-widget-seo-checkup' );
30
+ }
31
+ ?>
32
+ <?php $this->_render( 'dashboard/dashboard-widget-content-analysis' ); ?>
33
+ <?php
34
+ if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_SOCIAL ) ) {
35
+ $this->_render( 'dashboard/dashboard-widget-social' );
36
+ }
37
+ ?>
38
+ </div>
39
+
40
+ <div class="col-half col-half-dashboard col-half-dashboard-right">
41
+ <?php
42
+ if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_ONPAGE ) ) {
43
+ $this->_render( 'dashboard/dashboard-widget-onpage' );
44
+ }
45
+ ?>
46
+ <?php
47
+ if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_SITEMAP ) ) {
48
+ $this->_render( 'dashboard/dashboard-widget-sitemap' );
49
+ }
50
+ ?>
51
+ <?php
52
+ if ( smartcrawl_can_show_dash_widget_for( Smartcrawl_Settings_Settings::TAB_AUTOLINKS ) ) {
53
+ $this->_render( 'dashboard/dashboard-widget-advanced-tools' );
54
+ }
55
+ ?>
56
+ </div>
57
+ </div>
58
+
59
+ <?php $this->_render( 'upsell-modal' ); ?>
60
+ </div>
61
+ <?php do_action( 'wds-dshboard-after_settings' ); ?>
includes/admin/templates/dashboard/onboard-progress.php CHANGED
@@ -1,7 +1,7 @@
1
- <p><?php esc_html_e( 'Please wait a few moments while we activate those services', 'wds' ); ?></p>
2
- <?php
3
- $this->_render('progress-bar', array(
4
- 'progress' => 0,
5
- ));
6
- ?>
7
- <div class="processing-item-desc"></div>
1
+ <p><?php esc_html_e( 'Please wait a few moments while we activate those services', 'wds' ); ?></p>
2
+ <?php
3
+ $this->_render( 'progress-bar', array(
4
+ 'progress' => 0,
5
+ ) );
6
+ ?>
7
+ <div class="processing-item-desc"></div>
includes/admin/templates/dashboard/onboarding.php CHANGED
@@ -1,112 +1,113 @@
1
- <dialog class="auto-show wds-modal wds-onboard-dialog" id="wds-onboarding" data-title="<?php esc_attr_e( 'Quick setup', 'wds' ); ?>">
2
- <div class="intro">
3
- <p>
4
- <?php esc_html_e( "Welcome to SmartCrawl, the hottest SEO plugin for WordPress! Let's quickly set up the basics for you, then you can fine tweak each setting as you go - our recommendations are on by default.", 'wds' ); ?>
5
- </p>
6
- </div>
7
-
8
- <?php $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE ); ?>
9
-
10
- <div class="wds-separator-top wds-onboarding-item">
11
- <?php if ( $service->is_member() ) : ?>
12
- <?php
13
- $this->_render('toggle-item', array(
14
- 'field_name' => 'checkup-enable',
15
- 'item_label' => esc_html__( 'Automatic SEO Checkups & Reporting', 'wds' ),
16
- 'item_description' => esc_html__( 'Schedule daily, weekly or monthly comprehensive checkups of your homepage SEO and have the results emailed to your inbox', 'wds' ),
17
- 'attributes' => array(
18
- 'data-processing' => esc_attr__( 'Activating Automatic SEO Checkups & Reporting', 'wds' ),
19
- 'checked' => true,
20
- ),
21
- ));
22
- ?>
23
- <?php else : ?>
24
- <?php
25
- $this->_render('toggle-item', array(
26
- 'field_name' => 'checkup-run',
27
- 'item_label' => esc_html__( 'Run a full SEO Checkup', 'wds' ),
28
- 'item_description' => esc_html__( 'Get a comprehensive checkup of your homepage and have the results emailed to your inbox.', 'wds' ),
29
- 'attributes' => array(
30
- 'data-processing' => esc_attr__( 'Running a full SEO Checkup', 'wds' ),
31
- 'checked' => true,
32
- ),
33
- ));
34
- ?>
35
- <?php endif; ?>
36
- </div>
37
-
38
- <div class="wds-separator-top wds-onboarding-item">
39
- <?php
40
- $this->_render('toggle-item', array(
41
- 'field_name' => 'analysis-enable',
42
- 'item_label' => esc_html__( 'SEO & Readability Analysis', 'wds' ),
43
- 'item_description' => esc_html__( 'Have your pages and posts analyzed for SEO and readability improvements to improve your search ranking', 'wds' ),
44
- 'attributes' => array(
45
- 'data-processing' => esc_attr__( 'Activating SEO & Readability Analysis', 'wds' ),
46
- 'checked' => true,
47
- ),
48
- ));
49
- ?>
50
- </div>
51
-
52
- <div class="wds-separator-top wds-onboarding-item">
53
- <?php
54
- $this->_render('toggle-item', array(
55
- 'field_name' => 'opengraph-enable',
56
- 'item_label' => esc_html__( 'OpenGraph', 'wds' ),
57
- 'item_description' => esc_html__( 'OpenGraph support enhances how your content appears when shared on social networks such as Facebook', 'wds' ),
58
- 'attributes' => array(
59
- 'data-processing' => esc_attr__( 'Activating OpenGraph', 'wds' ),
60
- 'checked' => true,
61
- ),
62
- ));
63
- ?>
64
- </div>
65
-
66
- <div class="wds-separator-top wds-onboarding-item">
67
- <?php
68
- $this->_render('toggle-item', array(
69
- 'field_name' => 'sitemaps-enable',
70
- 'item_label' => esc_html__( 'Sitemaps', 'wds' ),
71
- 'item_description' => esc_html__( 'Sitemaps expose your site content to search engines and allow them to discover it more easily.', 'wds' ),
72
- 'attributes' => array(
73
- 'data-processing' => esc_attr__( 'Activating Sitemaps', 'wds' ),
74
- 'checked' => true,
75
- ),
76
- ));
77
- ?>
78
- </div>
79
-
80
- <div class="wds-separator-top wds-onboarding-item">
81
- <?php
82
- $this->_render('toggle-item', array(
83
- 'field_name' => 'twitter-enable',
84
- 'item_label' => esc_html__( 'Twitter Cards', 'wds' ),
85
- 'item_description' => esc_html__( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping drive traffic to your site.', 'wds' ),
86
- 'attributes' => array(
87
- 'data-processing' => esc_attr__( 'Activating Twitter Cards', 'wds' ),
88
- 'checked' => true,
89
- ),
90
- ));
91
- ?>
92
- </div>
93
-
94
- <div class="wds-separator-top">
95
- <div class="wds-notice wds-notice-info">
96
- <p class="wds-small-text">
97
- <?php esc_html_e( 'These services will be configured with recommended settings.', 'wds' ); ?>
98
- <?php esc_html_e( 'You can change these at any time.', 'wds' ); ?>
99
- </p>
100
- </div>
101
- </div>
102
-
103
- <div class="action wds-box-footer">
104
- <button class="button button-dark button-dark-o onboard-skip" type="button">
105
- <?php esc_html_e( 'Skip', 'wds' ); ?>
106
- </button>
107
-
108
- <button type="button" class="button wds-onboarding-setup">
109
- <?php esc_html_e( 'Get started', 'wds' ); ?>
110
- </button>
111
- </div>
112
- </dialog>
 
1
+ <dialog class="auto-show wds-modal wds-onboard-dialog" id="wds-onboarding"
2
+ data-title="<?php esc_attr_e( 'Quick setup', 'wds' ); ?>">
3
+ <div class="intro">
4
+ <p>
5
+ <?php esc_html_e( "Welcome to SmartCrawl, the hottest SEO plugin for WordPress! Let's quickly set up the basics for you, then you can fine tweak each setting as you go - our recommendations are on by default.", 'wds' ); ?>
6
+ </p>
7
+ </div>
8
+
9
+ <?php $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE ); ?>
10
+
11
+ <div class="wds-separator-top wds-onboarding-item">
12
+ <?php if ( $service->is_member() ) : ?>
13
+ <?php
14
+ $this->_render( 'toggle-item', array(
15
+ 'field_name' => 'checkup-enable',
16
+ 'item_label' => esc_html__( 'Automatic SEO Checkups & Reporting', 'wds' ),
17
+ 'item_description' => esc_html__( 'Schedule daily, weekly or monthly comprehensive checkups of your homepage SEO and have the results emailed to your inbox', 'wds' ),
18
+ 'attributes' => array(
19
+ 'data-processing' => esc_attr__( 'Activating Automatic SEO Checkups & Reporting', 'wds' ),
20
+ 'checked' => true,
21
+ ),
22
+ ) );
23
+ ?>
24
+ <?php else : ?>
25
+ <?php
26
+ $this->_render( 'toggle-item', array(
27
+ 'field_name' => 'checkup-run',
28
+ 'item_label' => esc_html__( 'Run a full SEO Checkup', 'wds' ),
29
+ 'item_description' => esc_html__( 'Get a comprehensive checkup of your homepage and have the results emailed to your inbox.', 'wds' ),
30
+ 'attributes' => array(
31
+ 'data-processing' => esc_attr__( 'Running a full SEO Checkup', 'wds' ),
32
+ 'checked' => true,
33
+ ),
34
+ ) );
35
+ ?>
36
+ <?php endif; ?>
37
+ </div>
38
+
39
+ <div class="wds-separator-top wds-onboarding-item">
40
+ <?php
41
+ $this->_render( 'toggle-item', array(
42
+ 'field_name' => 'analysis-enable',
43
+ 'item_label' => esc_html__( 'SEO & Readability Analysis', 'wds' ),
44
+ 'item_description' => esc_html__( 'Have your pages and posts analyzed for SEO and readability improvements to improve your search ranking', 'wds' ),
45
+ 'attributes' => array(
46
+ 'data-processing' => esc_attr__( 'Activating SEO & Readability Analysis', 'wds' ),
47
+ 'checked' => true,
48
+ ),
49
+ ) );
50
+ ?>
51
+ </div>
52
+
53
+ <div class="wds-separator-top wds-onboarding-item">
54
+ <?php
55
+ $this->_render( 'toggle-item', array(
56
+ 'field_name' => 'opengraph-enable',
57
+ 'item_label' => esc_html__( 'OpenGraph', 'wds' ),
58
+ 'item_description' => esc_html__( 'OpenGraph support enhances how your content appears when shared on social networks such as Facebook', 'wds' ),
59
+ 'attributes' => array(
60
+ 'data-processing' => esc_attr__( 'Activating OpenGraph', 'wds' ),
61
+ 'checked' => true,
62
+ ),
63
+ ) );
64
+ ?>
65
+ </div>
66
+
67
+ <div class="wds-separator-top wds-onboarding-item">
68
+ <?php
69
+ $this->_render( 'toggle-item', array(
70
+ 'field_name' => 'sitemaps-enable',
71
+ 'item_label' => esc_html__( 'Sitemaps', 'wds' ),
72
+ 'item_description' => esc_html__( 'Sitemaps expose your site content to search engines and allow them to discover it more easily.', 'wds' ),
73
+ 'attributes' => array(
74
+ 'data-processing' => esc_attr__( 'Activating Sitemaps', 'wds' ),
75
+ 'checked' => true,
76
+ ),
77
+ ) );
78
+ ?>
79
+ </div>
80
+
81
+ <div class="wds-separator-top wds-onboarding-item">
82
+ <?php
83
+ $this->_render( 'toggle-item', array(
84
+ 'field_name' => 'twitter-enable',
85
+ 'item_label' => esc_html__( 'Twitter Cards', 'wds' ),
86
+ 'item_description' => esc_html__( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping drive traffic to your site.', 'wds' ),
87
+ 'attributes' => array(
88
+ 'data-processing' => esc_attr__( 'Activating Twitter Cards', 'wds' ),
89
+ 'checked' => true,
90
+ ),
91
+ ) );
92
+ ?>
93
+ </div>
94
+
95
+ <div class="wds-separator-top">
96
+ <div class="wds-notice wds-notice-info">
97
+ <p class="wds-small-text">
98
+ <?php esc_html_e( 'These services will be configured with recommended settings.', 'wds' ); ?>
99
+ <?php esc_html_e( 'You can change these at any time.', 'wds' ); ?>
100
+ </p>
101
+ </div>
102
+ </div>
103
+
104
+ <div class="action wds-box-footer">
105
+ <button class="button button-dark button-dark-o onboard-skip" type="button">
106
+ <?php esc_html_e( 'Skip', 'wds' ); ?>
107
+ </button>
108
+
109
+ <button type="button" class="button wds-onboarding-setup">
110
+ <?php esc_html_e( 'Get started', 'wds' ); ?>
111
+ </button>
112
+ </div>
113
+ </dialog>
includes/admin/templates/disabled-component-inner.php CHANGED
@@ -1,36 +1,38 @@
1
- <?php
2
- $content = empty( $content ) ? '' : $content;
3
- $image = empty( $image ) ? '' : $image;
4
- $component = empty( $component ) ? '' : $component;
5
- $button_text = empty( $button_text ) ? '' : $button_text;
6
- $is_member = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member();
7
- $premium_feature = empty( $premium_feature ) ? false : $premium_feature;
8
- $notice = empty( $notice ) ? '' : $notice;
9
- $button_url = empty( $button_url ) ? '' : $button_url;
10
- ?>
11
- <div class="wds-disabled-component">
12
- <p>
13
- <img src="<?php echo SMARTCRAWL_PLUGIN_URL; ?>/images/<?php echo esc_attr( $image ); ?>" alt="<?php esc_html_e( '', 'wds' ); ?>" class="wds-disabled-image"/>
14
- </p>
15
- <p><?php echo $content; ?></p>
16
-
17
- <?php if ( $notice ) : ?>
18
- <div class="wds-notice wds-notice-warning">
19
- <p><?php echo esc_html( $notice ); ?></p>
20
- </div>
21
- <?php endif; ?>
22
-
23
- <?php if ( $component ) : ?>
24
- <input type="hidden" name="wds-activate-component" value="<?php echo esc_attr( $component ); ?>"/>
25
- <?php endif; ?>
26
-
27
- <?php if ( $premium_feature && ! $is_member ) : ?>
28
- <button class="wds-upgrade-button button-green"><?php esc_html_e( 'Upgrade to Pro', 'wds' ); ?></button>
29
- <?php else : ?>
30
- <?php if ( $button_url ) : ?>
31
- <a class="button" href="<?php echo $button_url; ?>"><?php esc_html_e( $button_text ); ?></a>
32
- <?php else : ?>
33
- <input name="submit" class="button" value="<?php esc_attr_e( $button_text ); ?>" type="submit"/>
34
- <?php endif; ?>
35
- <?php endif; ?>
36
- </div>
 
 
1
+ <?php
2
+ $content = empty( $content ) ? '' : $content;
3
+ $image = empty( $image ) ? '' : $image;
4
+ $component = empty( $component ) ? '' : $component;
5
+ $button_text = empty( $button_text ) ? '' : $button_text;
6
+ $is_member = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member();
7
+ $premium_feature = empty( $premium_feature ) ? false : $premium_feature;
8
+ $notice = empty( $notice ) ? '' : $notice;
9
+ $button_url = empty( $button_url ) ? '' : $button_url;
10
+ ?>
11
+ <div class="wds-disabled-component">
12
+ <p>
13
+ <img src="<?php echo esc_attr( SMARTCRAWL_PLUGIN_URL ); ?>/images/<?php echo esc_attr( $image ); ?>"
14
+ alt="<?php esc_attr_e( 'Disabled', 'wds' ); ?>" class="wds-disabled-image"/>
15
+ </p>
16
+ <p><?php echo wp_kses_post( $content ); ?></p>
17
+
18
+ <?php if ( $notice ) : ?>
19
+ <div class="wds-notice wds-notice-warning">
20
+ <p><?php echo esc_html( $notice ); ?></p>
21
+ </div>
22
+ <?php endif; ?>
23
+
24
+ <?php if ( $component ) : ?>
25
+ <input type="hidden" name="wds-activate-component" value="<?php echo esc_attr( $component ); ?>"/>
26
+ <?php wp_nonce_field( 'wds-settings-nonce', '_wds_nonce' ); ?>
27
+ <?php endif; ?>
28
+
29
+ <?php if ( $premium_feature && ! $is_member ) : ?>
30
+ <button class="wds-upgrade-button button-green"><?php esc_html_e( 'Upgrade to Pro', 'wds' ); ?></button>
31
+ <?php else : ?>
32
+ <?php if ( $button_url ) : ?>
33
+ <a class="button" href="<?php echo esc_attr( $button_url ); ?>"><?php echo esc_html( $button_text ); ?></a>
34
+ <?php else : ?>
35
+ <input name="submit" class="button" value="<?php echo esc_attr( $button_text ); ?>" type="submit"/>
36
+ <?php endif; ?>
37
+ <?php endif; ?>
38
+ </div>
includes/admin/templates/disabled-component.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- $content = empty( $content ) ? '' : $content;
3
- $image = empty( $image ) ? '' : $image;
4
- $component = empty( $component ) ? '' : $component;
5
- $button_text = empty( $button_text ) ? '' : $button_text;
6
- ?>
7
- <form method='post'>
8
- <section class="dev-box">
9
- <div class="box-title">
10
- <h3><?php _e( 'Get Started', 'wds' ); ?></h3>
11
- </div>
12
- <div class="box-content">
13
- <?php
14
- $this->_render('disabled-component-inner', array(
15
- 'content' => $content,
16
- 'image' => $image,
17
- 'component' => $component,
18
- 'button_text' => $button_text,
19
- ));
20
- ?>
21
- </div>
22
- </section>
23
- </form>
1
+ <?php
2
+ $content = empty( $content ) ? '' : $content;
3
+ $image = empty( $image ) ? '' : $image;
4
+ $component = empty( $component ) ? '' : $component;
5
+ $button_text = empty( $button_text ) ? '' : $button_text;
6
+ ?>
7
+ <form method='post'>
8
+ <section class="dev-box">
9
+ <div class="box-title">
10
+ <h3><?php esc_html_e( 'Get Started', 'wds' ); ?></h3>
11
+ </div>
12
+ <div class="box-content">
13
+ <?php
14
+ $this->_render( 'disabled-component-inner', array(
15
+ 'content' => $content,
16
+ 'image' => $image,
17
+ 'component' => $component,
18
+ 'button_text' => $button_text,
19
+ ) );
20
+ ?>
21
+ </div>
22
+ </section>
23
+ </form>
includes/admin/templates/dismissable-notice.php CHANGED
@@ -1,20 +1,21 @@
1
- <?php
2
- $message = empty( $message ) ? '' : $message;
3
- $class = empty( $class ) ? 'wds-notice-warning' : $class;
4
- $key = empty( $key ) ? '' : $key;
5
-
6
- if ( ! $key ) {
7
- return;
8
- }
9
-
10
- $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
11
- $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $key ) === true;
12
- ?>
13
- <?php if ( ! $is_message_dismissed ) : ?>
14
- <div class="wds-notice <?php echo esc_attr( $class ); ?>">
15
- <p>
16
- <?php echo wp_kses( $message, 'post' ); ?>
17
- <a href="#" class="wds-notice-dismiss"><?php esc_html_e( 'Dismiss', 'wds' ) ?></a>
18
- </p>
19
- </div>
20
- <?php endif; ?>
 
1
+ <?php
2
+ $message = empty( $message ) ? '' : $message;
3
+ $class = empty( $class ) ? 'wds-notice-warning' : $class;
4
+ $key = empty( $key ) ? '' : $key;
5
+
6
+ if ( ! $message ) {
7
+ return;
8
+ }
9
+
10
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
11
+ $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $key ) === true;
12
+ ?>
13
+ <?php if ( ! $is_message_dismissed ) : ?>
14
+ <div class="wds-notice <?php echo esc_attr( $class ); ?> <?php echo esc_attr( $key ); ?>"
15
+ data-key="<?php echo esc_attr( $key ); ?>">
16
+ <p>
17
+ <?php echo wp_kses_post( $message ); ?>
18
+ <a href="#" class="wds-notice-dismiss"><?php esc_html_e( 'Dismiss', 'wds' ); ?></a>
19
+ </p>
20
+ </div>
21
+ <?php endif; ?>
includes/admin/templates/index.php CHANGED
@@ -0,0 +1 @@
 
1
+ <?php // phpcs:ignoreFile
includes/admin/templates/links-dropdown.php CHANGED
@@ -1,17 +1,18 @@
1
- <?php
2
- $label = empty( $label ) ? '' : $label;
3
- $links = empty( $links ) ? array() : $links;
4
- ?>
5
-
6
- <div class="wds-links-dropdown">
7
- <a class="wds-links-dropdown-anchor" href="#">&hellip;</a>
8
- <ul>
9
- <?php if ( $label ) : ?>
10
- <li class="wds-links-dropdown-label"><?php echo $label; ?></li>
11
- <?php endif; ?>
12
-
13
- <?php foreach ( $links as $href => $text ) : ?>
14
- <li><a href="<?php echo esc_attr( $href ); ?>"><?php echo $text; ?></a></li>
15
- <?php endforeach; ?>
16
- </ul>
17
- </div>
 
1
+ <?php
2
+ // phpcs:ignoreFile -- All values passed to this template are expected to be escaped already
3
+ $label = empty( $label ) ? '' : $label;
4
+ $links = empty( $links ) ? array() : $links;
5
+ ?>
6
+
7
+ <div class="wds-links-dropdown">
8
+ <a class="wds-links-dropdown-anchor" href="#">&hellip;</a>
9
+ <ul>
10
+ <?php if ( $label ) : ?>
11
+ <li class="wds-links-dropdown-label"><?php echo $label; ?></li>
12
+ <?php endif; ?>
13
+
14
+ <?php foreach ( $links as $href => $text ) : ?>
15
+ <li><a href="<?php echo esc_attr( $href ); ?>"><?php echo $text; ?></a></li>
16
+ <?php endforeach; ?>
17
+ </ul>
18
+ </div>
includes/admin/templates/mascot-message.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- $key = empty( $key ) ? '' : $key;
3
- $message = empty( $message ) ? '' : $message;
4
- $dismissible = isset( $dismissible ) ? $dismissible : true;
5
-
6
- if ( $key === '' || $message === '' ) {
7
- return;
8
- }
9
-
10
- $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
11
- $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $key ) === true;
12
- ?>
13
- <?php if ( ! $is_message_dismissed ) : ?>
14
- <div class="wds-mascot-message <?php echo esc_attr( $key ); ?>">
15
- <div class="wds-mascot"></div>
16
- <div class="wds-mascot-bubble-container">
17
- <div class="wds-mascot-bubble">
18
- <?php if ( $dismissible ) : ?>
19
- <span class="wds-mascot-bubble-dismiss"><i class="wds-icon-close"></i></span>
20
- <?php endif; ?>
21
- <p class="wds-small-text"><?php echo $message; ?></p>
22
- </div>
23
- </div>
24
- </div>
25
- <?php endif; ?>
1
+ <?php
2
+ $key = empty( $key ) ? '' : $key;
3
+ $message = empty( $message ) ? '' : $message;
4
+ $dismissible = isset( $dismissible ) ? $dismissible : true;
5
+
6
+ if ( ! $message ) {
7
+ return;
8
+ }
9
+
10
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'wds_dismissed_messages', true );
11
+ $is_message_dismissed = smartcrawl_get_array_value( $dismissed_messages, $key ) === true;
12
+ ?>
13
+ <?php if ( ! $is_message_dismissed ) : ?>
14
+ <div class="wds-mascot-message <?php echo esc_attr( $key ); ?>" data-key="<?php echo esc_attr( $key ); ?>">
15
+ <div class="wds-mascot"></div>
16
+ <div class="wds-mascot-bubble-container">
17
+ <div class="wds-mascot-bubble">
18
+ <?php if ( $dismissible ) : ?>
19
+ <span class="wds-mascot-bubble-dismiss"><i class="wds-icon-close"></i></span>
20
+ <?php endif; ?>
21
+ <p class="wds-small-text"><?php echo wp_kses_post( $message ); ?></p>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <?php endif; ?>
includes/admin/templates/media-url-field.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- $options = empty( $options ) ? $_view['options'] : $options;
3
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
4
- $item = empty( $item ) ? '' : $item;
5
- $value = isset( $options[ $item ] ) ? $options[ $item ] : '';
6
- ?>
7
- <div class="wds-media-url" data-name="<?php echo esc_attr( $item ); ?>">
8
- <input class="wds-media-url-field" id="<?php echo esc_attr( $item ); ?>" type="text"
9
- name="<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $item ); ?>]"
10
- value="<?php echo esc_attr( $value ); ?>"/>
11
- <button type="button" class="wds-media-url-button button button-dark-o">
12
- <?php _e( 'Select', 'wds' ); ?>
13
- </button>
14
- </div>
1
+ <?php
2
+ $options = empty( $options ) ? $_view['options'] : $options;
3
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
4
+ $item = empty( $item ) ? '' : $item;
5
+ $value = isset( $options[ $item ] ) ? $options[ $item ] : '';
6
+ ?>
7
+ <div class="wds-media-url" data-name="<?php echo esc_attr( $item ); ?>">
8
+ <input class="wds-media-url-field" id="<?php echo esc_attr( $item ); ?>" type="text"
9
+ name="<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $item ); ?>]"
10
+ value="<?php echo esc_attr( $value ); ?>"/>
11
+ <button type="button" class="wds-media-url-button button button-dark-o">
12
+ <?php esc_html_e( 'Select', 'wds' ); ?>
13
+ </button>
14
+ </div>
includes/admin/templates/metabox.php DELETED
@@ -1,294 +0,0 @@
1
- <?php
2
-
3
- $date = '';
4
- if ( $post->post_type == 'post' ) {
5
- if ( isset( $post->post_date ) ) {
6
- $date = date( 'M j, Y', strtotime( $post->post_date ) ); } else { $date = date( 'M j, Y' ); }
7
- }
8
-
9
- ?>
10
-
11
- <table class="widefat">
12
-
13
- <?php
14
-
15
- $title = smartcrawl_get_value( 'title' );
16
- if ( empty( $title ) ) {
17
- $title = $post->post_title; }
18
- if ( empty( $title ) ) {
19
- $title = __( 'temp title', 'wds' ); }
20
-
21
- $desc = smartcrawl_get_value( 'metadesc' );
22
- if ( empty( $desc ) ) {
23
- $desc = substr( strip_tags( $post->post_content ), 0, 130 ); }
24
- if ( empty( $desc ) ) {
25
- $desc = __( 'temp description', 'wds' ); }
26
-
27
- $slug = $post->post_name;
28
- if ( empty( $slug ) ) {
29
- $slug = sanitize_title( $title ); }
30
-
31
- ?>
32
-
33
- <?php if ( apply_filters( 'wds-metabox-visible_parts-preview_area', true ) ) { ?>
34
- <tr>
35
- <th><label><?php esc_html_e( 'Preview:', 'wds' ); ?></label></th>
36
- <td>
37
- <?php
38
- $video = smartcrawl_get_value( 'video_meta',$post->ID );
39
- if ( $video && $video != 'none' ) {
40
- ?>
41
- <div id="snippet" class="video">
42
- <h4 style="margin:0;font-weight:normal;"><a class="title" href="#"><?php echo esc_html( $title ); ?></a></h4>
43
- <div style="margin:5px 10px 10px 0;width:82px;height:62px;float:left;">
44
- <img style="border: 1px solid blue;padding: 1px;width:80px;height:60px;" src="<?php echo esc_url( $video['thumbnail_loc'] ); ?>"/>
45
- <div style="margin-top:-23px;margin-right:4px;text-align:right"><img src="http://www.google.com/images/icons/sectionized_ui/play_c.gif" alt="" border="0" height="20" style="-moz-opacity:.88;filter:alpha(opacity=88);opacity:.88" width="20"></div>
46
- </div>
47
- <div style="float:left;width:440px;">
48
- <p style="color:#767676;font-size:13px;line-height:15px;"><?php echo esc_html( number_format( $video['duration'] / 60 ) ); ?> <?php esc_html_e( 'mins', 'wds' ); ?> - <?php echo esc_html( $date ); ?></p>
49
- <p style="color:#000;font-size:13px;line-height:15px;" class="desc"><span><?php echo esc_html( $desc ); ?></span></p>
50
- <a href="#" class="url"><?php echo esc_html( str_replace( 'http://','',get_bloginfo( 'url' ) ) ); ?>/<?php echo esc_html( $slug ); ?>/</a> - <a href="#" class="util"><?php esc_html_e( 'More videos &raquo;', 'wds' ); ?></a>
51
- </div>
52
- </div>
53
-
54
- <?php
55
- } else {
56
-
57
- if ( ! empty( $date ) ) {
58
- $date .= ' ... ';
59
- }
60
-
61
- ?>
62
- <div id="snippet">
63
- <p><a style="color:#2200C1;font-weight:medium;font-size:16px;text-decoration:underline;" href="#"><?php echo esc_html( $title ); ?></a></p>
64
- <p style="font-size: 12px; color: #000; line-height: 15px;"><?php echo esc_html( $date ); ?><span><?php echo esc_html( $desc ); ?></span></p>
65
- <p>
66
- <a href="#" style="font-size: 13px; color: #282; line-height: 15px;" class="url"><?php echo esc_html( str_replace( 'http://','',get_bloginfo( 'url' ) ) ); ?>/<?php echo esc_html( $slug ); ?>/</a> - <a href="#" class="util"><?php esc_html_e( 'Cached', 'wds' ); ?></a> - <a href="#" class="util"><?php esc_html_e( 'Similar', 'wds' ); ?></a>
67
- <?php if ( is_multisite() && (is_admin() || is_network_admin()) && class_exists( 'domain_map' ) ) { ?>
68
- <small style="opacity:.5"><i><?php esc_html_e( __( 'The URL preview may be thwarted by domain mapping', 'wds' ) ); ?></i></small>
69
- <?php } ?>
70
- </p>
71
- </div>
72
- <?php
73
- }
74
- ?>
75
-
76
- </td>
77
- </tr>
78
- <?php } ?>
79
-
80
- <?php
81
- $title_placeholder = smartcrawl_get_seo_title();
82
- if ( ! $title_placeholder ) { $title_placeholder = ''; }
83
-
84
- $desc_placeholder = smartcrawl_get_seo_desc();
85
- if ( ! $desc_placeholder ) { $desc_placeholder = ''; }
86
- ?>
87
-
88
- <?php if ( apply_filters( 'wds-metabox-visible_parts-focus_area', true ) ) { ?>
89
- <tr>
90
- <th valign='top'><label for='wds_focus'><?php esc_html_e( 'Focus keywords' , 'wds' ); ?></label></th>
91
- <td valign='top'>
92
- <input type='text' class='widefat' id='wds_focus' name='wds_focus' value='<?php echo esc_html( smartcrawl_get_value( 'focus-keywords' ) ); ?>' class='wds' /><br />
93
- </td>
94
- </tr>
95
- <?php } ?>
96
-
97
- <?php if ( apply_filters( 'wds-metabox-visible_parts-title_area', true ) ) { ?>
98
- <tr>
99
- <th valign='top'><label for='wds_title'><?php esc_html_e( 'Title Tag' , 'wds' ); ?></label></th>
100
- <td valign='top'>
101
- <input type='text' class='widefat' id='wds_title' placeholder='<?php echo esc_html( $title_placeholder ); ?>' name='wds_title' value='<?php echo esc_html( smartcrawl_get_value( 'title' ) ); ?>' class='wds' />
102
- <p>
103
- <?php printf( esc_html( __( 'Up to %d characters recommended' , 'wds' ) ), SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT ); ?>
104
- </p>
105
- </td>
106
- </tr>
107
- <?php } ?>
108
-
109
- <?php if ( apply_filters( 'wds-metabox-visible_parts-description_area', true ) ) { ?>
110
- <tr>
111
- <th valign='top'><label for='wds_metadesc'><?php esc_html_e( 'Meta Description' , 'wds' ); ?></label></th>
112
- <td valign='top'>
113
- <textarea rows='2' class='widefat' name='wds_metadesc' placeholder='<?php echo esc_html( $desc_placeholder ); ?>' id='wds_metadesc' class='wds'><?php echo esc_html( smartcrawl_get_value( 'metadesc' ) ); ?></textarea>
114
- <p>
115
- <?php printf( esc_html( __( '%d characters maximum' , 'wds' ) ), SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT ); ?>
116
- </p>
117
- </td>
118
- </tr>
119
- <?php } ?>
120
-
121
- <?php if ( apply_filters( 'wds-metabox-visible_parts-keywords_area', true ) ) { ?>
122
- <tr>
123
- <th valign='top'><label for='wds_keywords'><?php esc_html_e( 'Meta keywords' , 'wds' ); ?></label></th>
124
- <td valign='top'>
125
- <input type='text' class='widefat' id='wds_keywords' name='wds_keywords' value='<?php echo esc_html( smartcrawl_get_value( 'keywords' ) ); ?>' class='wds' /><br />
126
- <label for="wds_tags_to_keywords"><?php esc_html_e( 'I want to use post tags in addition to my keywords', 'wds' ); ?></label>
127
- <input type='checkbox' name='wds_tags_to_keywords' id='wds_tags_to_keywords' value='1' <?php echo esc_attr( smartcrawl_get_value( 'tags_to_keywords' ) ) ? 'checked="checked"' : ''; ?> />
128
- <div>
129
- <b><?php esc_html_e( 'News Keywords', 'wds' ); ?></b> <a href="http://support.google.com/news/publisher/bin/answer.py?hl=en&answer=68297" target="_blank">(?)</a>
130
- </div>
131
- <input type='text' class='widefat' id='wds_news_keywords' name='wds_news_keywords' value='<?php echo esc_attr( smartcrawl_get_value( 'news_keywords' ) ); ?>' class='wds' />
132
- <p>
133
- <?php esc_html_e( 'Separate keywords with commas' , 'wds' ); ?><br />
134
- <?php esc_html_e( 'If you enable using tags, post tags will be merged in with any other keywords you enter in the text box.', 'wds' ); ?>
135
- </p>
136
- </td>
137
- </tr>
138
- <?php } ?>
139
-
140
- <?php if ( apply_filters( 'wds-metabox-visible_parts-robots_area', true ) ) { ?>
141
- <tr>
142
- <th valign='top'><label for='wds_robots_follow'><?php esc_html_e( 'Meta Robots' , 'wds' ); ?></label></th>
143
- <td>
144
- <table class='wds_subtable' broder='0'>
145
- <tr>
146
- <th valign='top'><label for='wds_robots_follow'><?php esc_html_e( 'Index' , 'wds' ); ?></label></th>
147
- <td valign='top'>
148
- <input type="radio" name="wds_meta-robots-noindex" id="wds_meta-robots-noindex-index" <?php echo ( ! $ri_value ? 'checked="checked"' : ''); ?> value="0" />
149
- <label for="wds_meta-robots-noindex-index"><?php esc_html_e( 'Index' , 'wds' ); ?></label><br />
150
- <input type="radio" name="wds_meta-robots-noindex" id="wds_meta-robots-noindex-noindex" <?php echo ($ri_value ? 'checked="checked"' : ''); ?> value="1" />
151
- <label for="wds_meta-robots-noindex-noindex"><?php esc_html_e( 'Noindex' , 'wds' ); ?></label>
152
- </td>
153
- </tr>
154
- <tr>
155
- <th valign='top'><label for='wds_robots_follow'><?php esc_html_e( 'Follow' , 'wds' ); ?></label></th>
156
- <td valign='top'>
157
- <input type="radio" name="wds_meta-robots-nofollow" id="wds_meta-robots-nofollow-follow" <?php echo ( ! $rf_value ? 'checked="checked"' : ''); ?> value="0" />
158
- <label for="wds_meta-robots-nofollow-follow"><?php esc_html_e( 'Follow' , 'wds' ); ?></label><br />
159
- <input type="radio" name="wds_meta-robots-nofollow" id="wds_meta-robots-nofollow-nofollow" <?php echo ($rf_value ? 'checked="checked"' : ''); ?> value="1" />
160
- <label for="wds_meta-robots-nofollow-nofollow"><?php esc_html_e( 'Nofollow' , 'wds' ); ?></label>
161
- </td>
162
- </tr>
163
- <tr>
164
- <th valign='top'><label for='wds_meta-robots-adv'><?php esc_html_e( 'Advanced' , 'wds' ); ?></label></th>
165
- <td valign='top'>
166
- <?php
167
-
168
- foreach ( $advanced as $rkey => $rlbl ) {
169
- $checked = in_array( $rkey, $adv_value ) ? 'checked="checked"' : '';
170
- ?>
171
- <input type='hidden' name='wds_meta-robots-adv[<?php echo esc_attr( $rkey ); ?>]' value='' />
172
- <input type='checkbox' name='wds_meta-robots-adv[<?php echo esc_attr( $rkey ); ?>]' value='<?php echo esc_attr( $rkey ); ?>' id='wds_meta-robots-adv-<?php echo esc_attr( $rkey ); ?>' <?php echo $checked; ?> />&nbsp;
173
- <label for="wds_meta-robots-adv-<?php echo esc_attr( $rkey ); ?>"><?php echo esc_html( $rlbl ); ?></label><br />
174
- <?php
175
- }
176
-
177
- ?>
178
- </td>
179
- </tr>
180
- </table>
181
- <p>
182
- <?php _e( '<code>meta</code> robots settings for this page.', 'wds' ); ?>
183
- </p>
184
- </td>
185
- </tr>
186
- <?php } ?>
187
-
188
- <?php if ( apply_filters( 'wds-metabox-visible_parts-canonical_area', true ) ) { ?>
189
- <tr>
190
- <th valign='top'><label for='wds_canonical'><?php esc_html_e( 'Canonical URL' , 'wds' ); ?></label></th>
191
- <td valign='top'>
192
- <input type='text' id='wds_canonical' name='wds_canonical' value='<?php echo esc_attr( smartcrawl_get_value( 'canonical' ) ); ?>' class='wds' />
193
- </td>
194
- </tr>
195
- <?php } ?>
196
-
197
- <?php if ( apply_filters( 'wds-metabox-visible_parts-redirect_area', true ) ) { ?>
198
- <?php
199
-
200
- if ( user_can_see_seo_metabox_301_redirect() ) {
201
- ?>
202
-
203
- <tr>
204
- <th valign='top'><label for='wds_redirect'><?php esc_html_e( '301 Redirect' , 'wds' ); ?></label></th>
205
- <td valign='top'>
206
- <input type='text' id='wds_redirect' name='wds_redirect' value='<?php echo esc_attr( smartcrawl_get_value( 'redirect' ) ); ?>' class='wds' />
207
- </td>
208
- </tr>
209
-
210
- <?php
211
- }
212
-
213
- ?>
214
- <?php } ?>
215
-
216
- <?php if ( apply_filters( 'wds-metabox-visible_parts-sitemap_priority_area', true ) ) { ?>
217
- <tr>
218
- <th valign='top'><label for='wds_sitemap-priority'><?php esc_html_e( 'Sitemap Priority' , 'wds' ); ?></label></th>
219
- <td valign='top'>
220
- <select name='wds_sitemap-priority' id='wds_sitemap-priority'>
221
-
222
- <?php
223
- $value = smartcrawl_get_value( 'sitemap-priority' );
224
-
225
- foreach ( $options as $key => $label ) {
226
- ?>
227
-
228
- <option value='<?php echo esc_attr( $key ); ?>' <?php echo (($key == $value) ? 'selected="selected"' : ''); ?>><?php echo esc_html( $label ); ?></option>
229
-
230
- <?php
231
-
232
- }
233
- ?>
234
-
235
- </select>
236
- <p>
237
- <?php esc_html_e( 'The priority given to this page in the XML sitemap.', 'wds' ); ?>
238
- </p>
239
- </td>
240
- </tr>
241
- <?php } ?>
242
-
243
- <?php
244
- $og = smartcrawl_get_value( 'opengraph' );
245
- if ( ! is_array( $og ) ) { $og = array(); }
246
-
247
- $og = wp_parse_args($og, array(
248
- 'title' => false,
249
- 'description' => false,
250
- 'images' => false,
251
- ));
252
- ?>
253
- <tr>
254
- <th>
255
- <label for="og-title"><?php esc_html_e( 'OpenGraph Title', 'wds' ); ?></label>
256
- </th>
257
- <td>
258
- <input type="text" class="widefat"
259
- id="og-title" name="wds-opengraph[title]"
260
- value="<?php echo esc_attr( $og['title'] ); ?>" />
261
- </td>
262
- </tr>
263
- <tr>
264
- <th>
265
- <label for="og-description"><?php esc_html_e( 'OpenGraph Description', 'wds' ); ?></label>
266
- </th>
267
- <td>
268
- <textarea class="widefat" name="wds-opengraph[description]"
269
- id="og-description"><?php echo esc_textarea( $og['description'] ); ?></textarea>
270
- </td>
271
- </tr>
272
- <tr>
273
- <th>
274
- <label for="og-images"><?php esc_html_e( 'OpenGraph Images', 'wds' ); ?></label>
275
- </th>
276
- <td
277
- class="fields og-images"
278
- data-name='wds-opengraph[og-images]'
279
- >
280
- <div class="add-action-wrapper item">
281
- <a href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>">+</a>
282
- </div>
283
- <?php if ( ! empty( $og['images'] ) && is_array( $og['images'] ) ) { foreach ( $og['images'] as $img ) { ?>
284
- <input type="text" class="widefat"
285
- name="wds-opengraph[images][]"
286
- value="<?php echo esc_attr( $img ); ?>" />
287
- <?php }
288
- } ?>
289
- </td>
290
- </tr>
291
-
292
- </table>
293
-
294
- <?php do_action( 'wds-editor-metabox-after', $post ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/metabox/analysis-readability.php CHANGED
@@ -1,115 +1,124 @@
1
- <?php
2
- if ( ! Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) { return false; }
3
-
4
- /**
5
- * @var $model \Smartcrawl_Model_Analysis
6
- */
7
- $model = empty( $model ) ? null : $model;
8
- $readability_data = empty( $readability_data ) ? array() : $readability_data;
9
- $readability_ignored = empty( $readability_ignored ) ? false : $readability_ignored;
10
- $readability_score = smartcrawl_get_array_value( $readability_data, 'score' );
11
-
12
- if ( $model === null || $readability_score === null ) {
13
- return;
14
- }
15
-
16
- $readability_score = intval( ceil( $readability_score ) );
17
- $readability_level = $model->get_readability_level();
18
- $readability_levels_map = $model->get_readability_levels_map();
19
- $readability_strategy = Smartcrawl_String::get_readability_strategy();
20
-
21
- if ( $readability_ignored ) {
22
- $classes_array[] = 'disabled';
23
- }
24
-
25
- $total_possible_score = $readability_strategy == Smartcrawl_String::READABILITY_KINCAID ? '100' : '';
26
- $readability_level_description = $model->get_readability_level_description( $readability_level );
27
- $readability_state = $model->get_kincaid_readability_state( $readability_score, $readability_ignored );
28
- $classes_array[] = sprintf(
29
- 'wds-check-%s',
30
- $readability_state
31
- );
32
- $score_class = sprintf(
33
- 'wds-score-%s',
34
- $readability_state
35
- );
36
- $classes = implode( ' ', $classes_array );
37
- ?>
38
-
39
- <div class="wds-readability-report wds-report"
40
- data-readability-state="<?php echo esc_attr( $readability_state ); ?>">
41
-
42
- <div class="wds-readability-stats wds-report-stats">
43
- <div class="wds-report-score">
44
- <span class="wds-score <?php echo esc_attr( $score_class ); ?>">
45
- <?php echo esc_html( $readability_score ); ?><?php if ( $total_possible_score ) : ?><span class="wds-total">/<?php echo esc_html( $total_possible_score ); ?></span><?php endif; ?>
46
- </span>
47
- <span class="wds-small-text"><?php esc_html_e( 'Readability score', 'wds' ); ?></span>
48
- </div>
49
-
50
- <div class="wds-readability-level-description wds-small-text">
51
- <?php echo wp_kses( $readability_level_description, array( 'strong' => array() ) ); ?>
52
-
53
- <br />
54
- <button class="button button-small button-dark button-dark-o wds-refresh-analysis wds-analysis-readability" <?php if ('auto-draft' === get_post_status()) { echo 'disabled'; } ?> type="button">
55
- <span><?php esc_html_e( 'Refresh', 'wds' ); ?></span>
56
- </button>
57
- </div>
58
- </div>
59
-
60
- <div class="wds-accordion">
61
- <div class="wds-check-item wds-accordion-section <?php echo esc_attr( $classes ); ?>">
62
- <div class="wds-accordion-handle">
63
- <div class="wds-accordion-handle-part">
64
- <?php esc_html_e( 'Flesch-Kincaid Test', 'wds' ); ?>
65
- </div>
66
-
67
- <?php if ( $readability_ignored ) : ?>
68
- <div class="wds-unignore-container wds-accordion-handle-part">
69
- <button type="button" class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark-o" data-check_id="readability">
70
- <?php esc_html_e( 'Restore', 'wds' ); ?>
71
- </button>
72
- </div>
73
- <?php else : ?>
74
- <div class="wds-readability-level wds-accordion-handle-part">
75
- <span class="wds-check-item-indicator"><?php echo esc_html( $readability_level ); ?></span>
76
- </div>
77
- <?php endif; ?>
78
- </div>
79
- <div class="wds-accordion-content">
80
- <div class="wds-small-text"><strong><?php esc_html_e( 'Overview', 'wds' ) ?></strong></div>
81
- <p class="wds-small-text"><?php esc_html_e( 'The Flesch-Kincaid readability tests are readability tests designed to indicate how difficult a passage in English is to understand. Here are the benchmarks.', 'wds' ); ?></p>
82
- <table class="wds-list-table">
83
- <tbody>
84
- <tr>
85
- <th><?php esc_html_e( 'Score', 'wds' ); ?></th>
86
- <th><?php esc_html_e( 'Description', 'wds' ); ?></th>
87
- </tr>
88
-
89
- <?php foreach ( $readability_levels_map as $label => $level ) : ?>
90
- <tr>
91
- <?php
92
- if ( ! is_array( $level ) || ! isset( $level['max'] ) || ! isset( $level['min'] ) ) {
93
- continue;
94
- }
95
- ?>
96
- <td><?php echo esc_html( (int) ceil( $level['min'] ) ); ?>
97
- - <?php echo esc_html( (int) ceil( $level['max'] ) ); ?></td>
98
- <td><?php echo esc_html( $label ); ?></td>
99
- </tr>
100
- <?php endforeach; ?>
101
- </tbody>
102
- </table>
103
-
104
- <div class="wds-small-text"><strong><?php esc_html_e( 'How to fix', 'wds' ) ?></strong></div>
105
- <p class="wds-small-text"><?php esc_html_e( 'Try to use shorter sentences, with less difficult words to improve readability.', 'wds' ); ?></p>
106
-
107
- <div class="wds-ignore-container">
108
- <button type="button" class="wds-ignore wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o" data-check_id="readability">
109
- <?php esc_html_e( 'Ignore', 'wds' ); ?>
110
- </button>
111
- </div>
112
- </div>
113
- </div>
114
- </div>
115
- </div>
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) {
3
+ return false;
4
+ }
5
+
6
+ /**
7
+ * @var $model \Smartcrawl_Model_Analysis
8
+ */
9
+ $model = empty( $model ) ? null : $model;
10
+ $readability_data = empty( $readability_data ) ? array() : $readability_data;
11
+ $readability_ignored = empty( $readability_ignored ) ? false : $readability_ignored;
12
+ $readability_score = smartcrawl_get_array_value( $readability_data, 'score' );
13
+
14
+ if ( null === $model || null === $readability_score ) {
15
+ return;
16
+ }
17
+
18
+ $readability_score = intval( ceil( $readability_score ) );
19
+ $readability_level = $model->get_readability_level();
20
+ $readability_levels_map = $model->get_readability_levels_map();
21
+ $readability_strategy = Smartcrawl_String::get_readability_strategy();
22
+
23
+ if ( $readability_ignored ) {
24
+ $classes_array[] = 'disabled';
25
+ }
26
+
27
+ $total_possible_score = Smartcrawl_String::READABILITY_KINCAID === $readability_strategy ? '100' : '';
28
+ $readability_level_description = $model->get_readability_level_description( $readability_level );
29
+ $readability_state = $model->get_kincaid_readability_state( $readability_score, $readability_ignored );
30
+ $classes_array[] = sprintf(
31
+ 'wds-check-%s',
32
+ $readability_state
33
+ );
34
+ $score_class = sprintf(
35
+ 'wds-score-%s',
36
+ $readability_state
37
+ );
38
+ $classes = implode( ' ', $classes_array );
39
+ $refresh_analysis_disabled = 'auto-draft' === get_post_status() ? 'disabled' : '';
40
+ ?>
41
+
42
+ <div class="wds-readability-report wds-report"
43
+ data-readability-state="<?php echo esc_attr( $readability_state ); ?>">
44
+
45
+ <div class="wds-readability-stats wds-report-stats">
46
+ <div class="wds-report-score">
47
+ <div class="wds-score <?php echo esc_attr( $score_class ); ?>">
48
+ <span><?php echo esc_html( $readability_score ); ?></span><?php if ( $total_possible_score ) : ?><span
49
+ class="wds-total">/<?php echo esc_html( $total_possible_score ); ?></span><?php endif; ?>
50
+ </div>
51
+ <span class="wds-small-text"><?php esc_html_e( 'Readability score', 'wds' ); ?></span>
52
+ </div>
53
+
54
+ <div class="wds-readability-level-description wds-small-text">
55
+ <?php echo wp_kses( $readability_level_description, array( 'strong' => array() ) ); ?>
56
+
57
+ <br/>
58
+ <button class="button button-small button-dark button-dark-o wds-refresh-analysis wds-analysis-readability wds-disabled-during-request"
59
+ <?php echo esc_attr( $refresh_analysis_disabled ); ?> type="button">
60
+ <span><?php esc_html_e( 'Refresh', 'wds' ); ?></span>
61
+ </button>
62
+ </div>
63
+ </div>
64
+
65
+ <div class="wds-accordion">
66
+ <div class="wds-check-item wds-accordion-section <?php echo esc_attr( $classes ); ?>">
67
+ <div class="wds-accordion-handle">
68
+ <div class="wds-accordion-handle-part">
69
+ <?php esc_html_e( 'Flesch-Kincaid Test', 'wds' ); ?>
70
+ </div>
71
+
72
+ <?php if ( $readability_ignored ) : ?>
73
+ <div class="wds-unignore-container wds-accordion-handle-part">
74
+ <button type="button"
75
+ class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark-o"
76
+ data-check_id="readability">
77
+ <?php esc_html_e( 'Restore', 'wds' ); ?>
78
+ </button>
79
+ </div>
80
+ <?php else : ?>
81
+ <div class="wds-readability-level wds-accordion-handle-part">
82
+ <span class="wds-check-item-indicator"><?php echo esc_html( $readability_level ); ?></span>
83
+ </div>
84
+ <?php endif; ?>
85
+ </div>
86
+ <div class="wds-accordion-content">
87
+ <div class="wds-small-text"><strong><?php esc_html_e( 'Overview', 'wds' ); ?></strong></div>
88
+ <p class="wds-small-text"><?php esc_html_e( 'The Flesch-Kincaid readability tests are readability tests designed to indicate how difficult a passage in English is to understand. Here are the benchmarks.', 'wds' ); ?></p>
89
+ <table class="wds-list-table">
90
+ <tbody>
91
+ <tr>
92
+ <th><?php esc_html_e( 'Score', 'wds' ); ?></th>
93
+ <th><?php esc_html_e( 'Description', 'wds' ); ?></th>
94
+ </tr>
95
+
96
+ <?php foreach ( $readability_levels_map as $label => $level ) : ?>
97
+ <tr>
98
+ <?php
99
+ if ( ! is_array( $level ) || ! isset( $level['max'] ) || ! isset( $level['min'] ) ) {
100
+ continue;
101
+ }
102
+ ?>
103
+ <td><?php echo esc_html( (int) ceil( $level['min'] ) ); ?>
104
+ - <?php echo esc_html( (int) ceil( $level['max'] ) ); ?></td>
105
+ <td><?php echo esc_html( $label ); ?></td>
106
+ </tr>
107
+ <?php endforeach; ?>
108
+ </tbody>
109
+ </table>
110
+
111
+ <div class="wds-small-text"><strong><?php esc_html_e( 'How to fix', 'wds' ); ?></strong></div>
112
+ <p class="wds-small-text"><?php esc_html_e( 'Try to use shorter sentences, with less difficult words to improve readability.', 'wds' ); ?></p>
113
+
114
+ <div class="wds-ignore-container">
115
+ <button type="button"
116
+ class="wds-ignore wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o"
117
+ data-check_id="readability">
118
+ <?php esc_html_e( 'Ignore', 'wds' ); ?>
119
+ </button>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </div>
includes/admin/templates/metabox/analysis-seo-analysis.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) {
3
+ return false;
4
+ }
5
+
6
+ $checks = empty( $checks ) ? array() : $checks;
7
+ $error_count = empty( $error_count ) ? 0 : $error_count;
8
+ $focus_keywords_available = empty( $focus_keywords_available ) ? false : $focus_keywords_available;
9
+ ?>
10
+
11
+ <?php if ( ! $focus_keywords_available ) : ?>
12
+ <div class="wds-seo-analysis wds-no-focus-keywords">
13
+ <div class="wds-notice wds-notice-warning">
14
+ <p><?php esc_html_e( 'You need to add focus keywords to see recommendations for this article.', 'wds' ); ?></p>
15
+ </div>
16
+ </div>
17
+ <?php return; ?>
18
+ <?php endif; // phpcs:ignore -- PHPCS misfires here and complains about the return statement above ?>
19
+
20
+ <div class="wds-seo-analysis wds-report" data-errors="<?php echo esc_attr( $error_count ); ?>">
21
+
22
+ <div class="wds-notice <?php echo $error_count > 0 ? 'wds-notice-warning' : 'wds-notice-success'; ?>">
23
+ <p>
24
+ <?php if ( $error_count > 0 ) : ?>
25
+ <?php printf( esc_html__( 'You have %d SEO recommendations. We recommend you satisfy as many improvements as possible to ensure your content gets found.', 'wds' ), intval( $error_count ) ); ?>
26
+ <?php else : ?>
27
+ <?php esc_html_e( 'You have optimized your SEO to the max. Bravo!', 'wds' ); ?>
28
+ <?php endif; ?>
29
+ </p>
30
+ </div>
31
+ <div class="wds-accordion">
32
+ <?php foreach ( $checks as $check_id => $result ) : ?>
33
+ <?php
34
+ $passed = $result['status'];
35
+ $ignored = $result['ignored'];
36
+ $recommendation = $result['recommendation'];
37
+ $more_info = $result['more_info'];
38
+ $status_msg = $result['status_msg'];
39
+
40
+ $classes_array = array();
41
+ $classes_array[] = $passed ? 'wds-check-success' : 'wds-check-warning';
42
+ $classes_array[] = $ignored ? 'wds-check-invalid disabled' : '';
43
+ $classes = implode( ' ', $classes_array );
44
+ ?>
45
+ <div id="wds-check-<?php echo esc_attr( $check_id ); ?>"
46
+ class="wds-check-item wds-accordion-section <?php echo esc_attr( $classes ); ?>">
47
+ <div class="wds-accordion-handle">
48
+ <div class="wds-accordion-handle-part">
49
+ <?php echo wp_kses_post( $status_msg ); ?>
50
+ </div>
51
+ <?php if ( $ignored ) : ?>
52
+ <div class="wds-unignore-container wds-accordion-handle-part">
53
+ <button type="button"
54
+ id="wds-unignore-check-<?php echo esc_attr( $check_id ); ?>"
55
+ class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark-o"
56
+ data-check_id="<?php echo esc_attr( $check_id ); ?>">
57
+ <?php esc_html_e( 'Restore', 'wds' ); ?>
58
+ </button>
59
+ </div>
60
+ <?php endif; ?>
61
+ </div>
62
+ <div class="wds-accordion-content">
63
+ <?php if ( $recommendation ) : ?>
64
+ <div class="wds-recommendation">
65
+ <div class="wds-small-text"><strong><?php esc_html_e( 'Recommendation', 'wds' ); ?></strong>
66
+ </div>
67
+ <p class="wds-small-text"><?php echo wp_kses_post( $recommendation ); ?></p>
68
+ </div>
69
+ <?php endif; ?>
70
+
71
+ <?php if ( $more_info ) : ?>
72
+ <div class="wds-more-info">
73
+ <div class="wds-small-text"><strong><?php esc_html_e( 'More Info', 'wds' ); ?></strong>
74
+ </div>
75
+ <p class="wds-small-text"><?php echo wp_kses_post( $more_info ); ?></p>
76
+ </div>
77
+ <?php endif; ?>
78
+
79
+ <?php if ( ! $ignored ) : ?>
80
+ <div class="wds-ignore-container">
81
+ <button type="button"
82
+ id="wds-ignore-check-<?php echo esc_attr( $check_id ); ?>"
83
+ class="wds-ignore wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark-o"
84
+ data-check_id="<?php echo esc_attr( $check_id ); ?>">
85
+ <?php esc_html_e( 'Ignore', 'wds' ); ?>
86
+ </button>
87
+ </div>
88
+ <?php endif; ?>
89
+ </div>
90
+ </div>
91
+ <?php endforeach; ?>
92
+ <div class="cf"></div>
93
+ </div>
94
+ </div>
includes/admin/templates/metabox/analysis-seo_analysis.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- if ( ! Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) { return false; }
3
-
4
- $checks = empty( $checks ) ? array() : $checks;
5
- $error_count = empty( $error_count ) ? 0 : $error_count;
6
- $focus_keywords_available = empty( $focus_keywords_available ) ? false : $focus_keywords_available;
7
- ?>
8
-
9
- <?php if ( ! $focus_keywords_available ) : ?>
10
- <div class="wds-seo-analysis wds-no-focus-keywords">
11
- <div class="wds-notice wds-notice-warning">
12
- <p><?php esc_html_e( 'You need to add focus keywords to see recommendations for this article.', 'wds' ); ?></p>
13
- </div>
14
- </div>
15
- <?php return; ?>
16
- <?php endif; ?>
17
-
18
- <div class="wds-seo-analysis wds-report" data-errors="<?php echo esc_attr( $error_count ); ?>">
19
-
20
- <div class="wds-notice <?php echo $error_count > 0 ? 'wds-notice-warning' : 'wds-notice-success'; ?>">
21
- <p>
22
- <?php if ( $error_count > 0 ) : ?>
23
- <?php esc_html_e( sprintf( 'You have %d SEO recommendations. We recommend you satisfy as many improvements as possible to ensure your content gets found.', $error_count ), 'wds' ); ?>
24
- <?php else : ?>
25
- <?php esc_html_e( 'You have optimized your SEO to the max. Bravo!', 'wds' ); ?>
26
- <?php endif; ?>
27
- </p>
28
- </div>
29
- <div class="wds-accordion">
30
- <?php foreach ( $checks as $check_id => $result ) : ?>
31
- <?php
32
- /**
33
- * @var $current_check Smartcrawl_Check_Abstract
34
- */
35
- $current_check = $result['check'];
36
- $passed = $result['status'];
37
- $ignored = $result['ignored'];
38
- $recommendation = $current_check->get_recommendation();
39
- $more_info = $current_check->get_more_info();
40
-
41
- $classes_array = array();
42
- $classes_array[] = $passed ? 'wds-check-success' : 'wds-check-warning';
43
- $classes_array[] = $ignored ? 'wds-check-invalid disabled' : '';
44
- $classes = implode( ' ', $classes_array );
45
- ?>
46
- <div class="wds-check-item wds-accordion-section <?php echo esc_attr( $classes ); ?>">
47
- <div class="wds-accordion-handle">
48
- <div class="wds-accordion-handle-part">
49
- <?php echo wp_kses( $current_check->get_status_msg(), 'post' ); ?>
50
- </div>
51
- <?php if ( $ignored ) : ?>
52
- <div class="wds-unignore-container wds-accordion-handle-part">
53
- <button type="button" class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark-o" data-check_id="<?php echo esc_attr( $check_id ); ?>">
54
- <?php esc_html_e( 'Restore', 'wds' ); ?>
55
- </button>
56
- </div>
57
- <?php endif; ?>
58
- </div>
59
- <div class="wds-accordion-content">
60
- <?php if ( $recommendation ) : ?>
61
- <div class="wds-recommendation">
62
- <div class="wds-small-text"><strong><?php esc_html_e( 'Recommendation', 'wds' ); ?></strong></div>
63
- <p class="wds-small-text"><?php echo wp_kses( $recommendation, 'post' ); ?></p>
64
- </div>
65
- <?php endif; ?>
66
-
67
- <?php if ( $more_info ) : ?>
68
- <div class="wds-more-info">
69
- <div class="wds-small-text"><strong><?php esc_html_e( 'More Info', 'wds' ); ?></strong></div>
70
- <p class="wds-small-text"><?php echo wp_kses( $more_info, 'post' ); ?></p>
71
- </div>
72
- <?php endif; ?>
73
-
74
- <?php if ( ! $ignored ) : ?>
75
- <div class="wds-ignore-container">
76
- <button type="button" class="wds-ignore wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark-o" data-check_id="<?php echo esc_attr( $check_id ); ?>">
77
- <?php esc_html_e( 'Ignore', 'wds' ); ?>
78
- </button>
79
- </div>
80
- <?php endif; ?>
81
- </div>
82
- </div>
83
- <?php endforeach; ?>
84
- <div class="cf"></div>
85
- </div>
86
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/metabox/analysis.php CHANGED
@@ -1,5 +1,5 @@
1
- <div class="wds-report">
2
- <p><a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a></p>
3
- <?php include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/metabox/analysis-seo_analysis.php'; ?>
4
- <?php include SMARTCRAWL_PLUGIN_DIR . 'admin/templates/metabox/analysis-readability.php'; ?>
5
- </div>
1
+ <div class="wds-report">
2
+ <p><a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a></p>
3
+ <?php require_once SMARTCRAWL_PLUGIN_DIR . 'admin/templates/metabox/analysis-seo-analysis.php'; ?>
4
+ <?php require_once SMARTCRAWL_PLUGIN_DIR . 'admin/templates/metabox/analysis-readability.php'; ?>
5
+ </div>
includes/admin/templates/metabox/horizontal-tab-nav.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
- $tabs = empty( $tabs ) ? array() : $tabs;
3
- $first_tab = true;
4
- ?>
5
- <div class="wds-horizontal-tab-nav">
6
- <?php foreach ( $tabs as $tab_id => $tab_name ) : ?>
7
-
8
- <div class="wds-nav-item <?php echo $first_tab ? 'active' : ''; ?>">
9
- <label for="<?php echo esc_attr( $tab_id ); ?>">
10
- <?php echo wp_kses( $tab_name, 'post' ); ?>
11
- </label>
12
- </div>
13
-
14
- <?php $first_tab = false; ?>
15
- <?php endforeach; ?>
16
- </div>
1
+ <?php
2
+ $tabs = empty( $tabs ) ? array() : $tabs;
3
+ $first_tab = true;
4
+ ?>
5
+ <div class="wds-horizontal-tab-nav">
6
+ <?php foreach ( $tabs as $tab_id => $tab_name ) : ?>
7
+
8
+ <div class="wds-nav-item <?php echo $first_tab ? 'active' : ''; ?>">
9
+ <label for="<?php echo esc_attr( $tab_id ); ?>">
10
+ <?php echo wp_kses_post( $tab_name ); ?>
11
+ </label>
12
+ </div>
13
+
14
+ <?php $first_tab = false; ?>
15
+ <?php endforeach; ?>
16
+ </div>
includes/admin/templates/metabox/horizontal-tab.php CHANGED
@@ -1,19 +1,19 @@
1
- <section class="wds-horizontal-tab">
2
- <?php
3
- $tab_id = empty( $tab_id ) ? '' : $tab_id;
4
- $is_active = empty( $is_active ) ? false : $is_active;
5
- $content_template = empty( $content_template ) ? '' : $content_template;
6
- $content_args = empty( $content_args ) ? array() : $content_args;
7
- ?>
8
- <input
9
- type="radio"
10
- name="wds-horizontal-tab"
11
- autocomplete="off"
12
- id="<?php echo esc_attr( $tab_id ); ?>"
13
- value="<?php echo esc_attr( $tab_id ); ?>"
14
- <?php checked( $is_active ); ?> />
15
-
16
- <div class="wds-horizontal-tab-content <?php echo esc_attr( $tab_id ); ?>">
17
- <?php $this->_render( $content_template, $content_args ); ?>
18
- </div>
19
- </section>
1
+ <section class="wds-horizontal-tab">
2
+ <?php
3
+ $tab_id = empty( $tab_id ) ? '' : $tab_id;
4
+ $is_active = empty( $is_active ) ? false : $is_active;
5
+ $content_template = empty( $content_template ) ? '' : $content_template;
6
+ $content_args = empty( $content_args ) ? array() : $content_args;
7
+ ?>
8
+ <input
9
+ type="radio"
10
+ name="wds-horizontal-tab"
11
+ autocomplete="off"
12
+ id="<?php echo esc_attr( $tab_id ); ?>"
13
+ value="<?php echo esc_attr( $tab_id ); ?>"
14
+ <?php checked( $is_active ); ?> />
15
+
16
+ <div class="wds-horizontal-tab-content <?php echo esc_attr( $tab_id ); ?>">
17
+ <?php $this->_render( $content_template, $content_args ); ?>
18
+ </div>
19
+ </section>
includes/admin/templates/metabox/metabox-main.php CHANGED
@@ -1,88 +1,99 @@
1
- <?php
2
- /**
3
- * Metabox entry point template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $post = empty( $post ) ? null : $post;
9
- $robots_noindex_value = empty( $robots_noindex_value ) ? false : $robots_noindex_value;
10
- $robots_nofollow_value = empty( $robots_nofollow_value ) ? false : $robots_nofollow_value;
11
- $advanced_value = empty( $advanced_value ) ? array() : $advanced_value;
12
- $advanced_options = empty( $advanced_options ) ? array() : $advanced_options;
13
- $sitemap_priority_options = empty( $sitemap_priority_options ) ? array() : $sitemap_priority_options;
14
- $all_options = Smartcrawl_Settings::get_options();
15
- $og_setting_enabled = (bool) smartcrawl_get_array_value( $all_options, 'og-enable' );
16
- $og_post_type_enabled = (bool) smartcrawl_get_array_value( $all_options, 'og-active-' . get_post_type( $post ) );
17
- $twitter_post_type_enabled = (bool) smartcrawl_get_array_value( $all_options, 'twitter-active-' . get_post_type( $post ) );
18
- $twitter_setting_enabled = (bool) smartcrawl_get_array_value( $all_options, 'twitter-card-enable' );
19
- $show_social_tab = ($og_setting_enabled && $og_post_type_enabled) || ($twitter_setting_enabled && $twitter_post_type_enabled);
20
-
21
- $tabs['wds_seo'] = esc_html__( 'SEO', 'wds' ) . '<span class="wds-issues"><span></span></span>';
22
- $tabs['wds_readability'] = esc_html__( 'Readability', 'wds' ) . '<span class="wds-issues"><span></span></span>';
23
- if ( $show_social_tab ) {
24
- $tabs['wds_social'] = esc_html__( 'Social', 'wds' );
25
- }
26
- $tabs['wds_advanced'] = esc_html__( 'Advanced', 'wds' );
27
-
28
- if ( ! Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) { unset( $tabs['wds_readability'] ); }
29
- ?>
30
- <div class="wpmud wds-metabox">
31
- <div id="container" class="wds-horizontal-tabs">
32
- <?php
33
- $this->_render( 'metabox/horizontal-tab-nav', array( 'tabs' => $tabs ) );
34
- ?>
35
- <?php
36
- $this->_render('metabox/horizontal-tab', array(
37
- 'tab_id' => 'wds_seo',
38
- 'is_active' => true,
39
- 'content_template' => 'metabox/metabox-tab-seo',
40
- 'content_args' => array(
41
- 'post' => $post,
42
- ),
43
- ));
44
- ?>
45
-
46
- <?php
47
- if ( Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) {
48
- $this->_render('metabox/horizontal-tab', array(
49
- 'tab_id' => 'wds_readability',
50
- 'content_template' => 'metabox/metabox-tab-readability',
51
- 'content_args' => array(
52
- 'post' => $post,
53
- ),
54
- ));
55
- }
56
- ?>
57
-
58
- <?php
59
- if ( $show_social_tab ) {
60
- $this->_render('metabox/horizontal-tab', array(
61
- 'tab_id' => 'wds_social',
62
- 'content_template' => 'metabox/metabox-tab-social',
63
- 'content_args' => array(
64
- 'post' => $post,
65
- 'og_setting_enabled' => $og_setting_enabled,
66
- 'og_post_type_enabled' => $og_post_type_enabled,
67
- 'twitter_setting_enabled' => $twitter_setting_enabled,
68
- 'twitter_post_type_enabled' => $twitter_post_type_enabled
69
- ),
70
- ));
71
- }
72
- ?>
73
-
74
- <?php
75
- $this->_render('metabox/horizontal-tab', array(
76
- 'tab_id' => 'wds_advanced',
77
- 'content_template' => 'metabox/metabox-tab-advanced',
78
- 'content_args' => array(
79
- 'robots_noindex_value' => $robots_noindex_value,
80
- 'robots_nofollow_value' => $robots_nofollow_value,
81
- 'advanced_value' => $advanced_value,
82
- 'advanced_options' => $advanced_options,
83
- 'sitemap_priority_options' => $sitemap_priority_options,
84
- ),
85
- ));
86
- ?>
87
- </div>
88
- </div>
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Metabox entry point template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $post = empty( $post ) ? null : $post;
9
+ $robots_noindex_value = empty( $robots_noindex_value ) ? false : $robots_noindex_value;
10
+ $robots_nofollow_value = empty( $robots_nofollow_value ) ? false : $robots_nofollow_value;
11
+ $robots_index_value = empty( $robots_index_value ) ? false : $robots_index_value;
12
+ $robots_follow_value = empty( $robots_follow_value ) ? false : $robots_follow_value;
13
+ $advanced_value = empty( $advanced_value ) ? array() : $advanced_value;
14
+ $advanced_options = empty( $advanced_options ) ? array() : $advanced_options;
15
+ $sitemap_priority_options = empty( $sitemap_priority_options ) ? array() : $sitemap_priority_options;
16
+ $all_options = Smartcrawl_Settings::get_options();
17
+ $og_setting_enabled = (bool) smartcrawl_get_array_value( $all_options, 'og-enable' );
18
+ $og_post_type_enabled = (bool) smartcrawl_get_array_value( $all_options, 'og-active-' . get_post_type( $post ) );
19
+ $twitter_post_type_enabled = (bool) smartcrawl_get_array_value( $all_options, 'twitter-active-' . get_post_type( $post ) );
20
+ $twitter_setting_enabled = (bool) smartcrawl_get_array_value( $all_options, 'twitter-card-enable' );
21
+ $post_type_noindexed = (bool) smartcrawl_get_array_value( $all_options, sprintf( 'meta_robots-noindex-%s', get_post_type( $post ) ) );
22
+ $post_type_nofollowed = (bool) smartcrawl_get_array_value( $all_options, sprintf( 'meta_robots-nofollow-%s', get_post_type( $post ) ) );
23
+ $show_social_tab = ( $og_setting_enabled && $og_post_type_enabled ) || ( $twitter_setting_enabled && $twitter_post_type_enabled );
24
+
25
+ $tabs['wds_seo'] = esc_html__( 'SEO', 'wds' ) . '<span class="wds-issues"><span></span></span>';
26
+ $tabs['wds_readability'] = esc_html__( 'Readability', 'wds' ) . '<span class="wds-issues"><span></span></span>';
27
+ if ( $show_social_tab ) {
28
+ $tabs['wds_social'] = esc_html__( 'Social', 'wds' );
29
+ }
30
+ $tabs['wds_advanced'] = esc_html__( 'Advanced', 'wds' );
31
+
32
+ if ( ! Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) {
33
+ unset( $tabs['wds_readability'] );
34
+ }
35
+ ?>
36
+ <div class="wpmud wds-metabox">
37
+ <div id="container" class="wds-horizontal-tabs">
38
+ <?php wp_nonce_field( 'wds-metabox-nonce', '_wds_nonce' ); ?>
39
+ <?php
40
+ $this->_render( 'metabox/horizontal-tab-nav', array( 'tabs' => $tabs ) );
41
+ ?>
42
+ <?php
43
+ $this->_render( 'metabox/horizontal-tab', array(
44
+ 'tab_id' => 'wds_seo',
45
+ 'is_active' => true,
46
+ 'content_template' => 'metabox/metabox-tab-seo',
47
+ 'content_args' => array(
48
+ 'post' => $post,
49
+ ),
50
+ ) );
51
+ ?>
52
+
53
+ <?php
54
+ if ( Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) {
55
+ $this->_render( 'metabox/horizontal-tab', array(
56
+ 'tab_id' => 'wds_readability',
57
+ 'content_template' => 'metabox/metabox-tab-readability',
58
+ 'content_args' => array(
59
+ 'post' => $post,
60
+ ),
61
+ ) );
62
+ }
63
+ ?>
64
+
65
+ <?php
66
+ if ( $show_social_tab ) {
67
+ $this->_render( 'metabox/horizontal-tab', array(
68
+ 'tab_id' => 'wds_social',
69
+ 'content_template' => 'metabox/metabox-tab-social',
70
+ 'content_args' => array(
71
+ 'post' => $post,
72
+ 'og_setting_enabled' => $og_setting_enabled,
73
+ 'og_post_type_enabled' => $og_post_type_enabled,
74
+ 'twitter_setting_enabled' => $twitter_setting_enabled,
75
+ 'twitter_post_type_enabled' => $twitter_post_type_enabled,
76
+ ),
77
+ ) );
78
+ }
79
+ ?>
80
+
81
+ <?php
82
+ $this->_render( 'metabox/horizontal-tab', array(
83
+ 'tab_id' => 'wds_advanced',
84
+ 'content_template' => 'metabox/metabox-tab-advanced',
85
+ 'content_args' => array(
86
+ 'robots_noindex_value' => $robots_noindex_value,
87
+ 'robots_nofollow_value' => $robots_nofollow_value,
88
+ 'robots_index_value' => $robots_index_value,
89
+ 'robots_follow_value' => $robots_follow_value,
90
+ 'advanced_value' => $advanced_value,
91
+ 'advanced_options' => $advanced_options,
92
+ 'sitemap_priority_options' => $sitemap_priority_options,
93
+ 'post_type_noindexed' => $post_type_noindexed,
94
+ 'post_type_nofollowed' => $post_type_nofollowed,
95
+ ),
96
+ ) );
97
+ ?>
98
+ </div>
99
+ </div>
includes/admin/templates/metabox/metabox-meta-edit-form.php CHANGED
@@ -1,94 +1,98 @@
1
- <div class="wds-toggleable inactive wds-edit-meta-toggleable">
2
- <label>
3
- <a class="button button-dark button-small"><?php esc_html_e( 'Edit Meta', 'wds' ); ?></a>
4
- <input type="checkbox" class="toggle-checkbox"/>
5
- </label>
6
-
7
- <div class="wds-toggleable-inside wds-toggleable-inside-box">
8
- <div class="wds-table-fields wds-table-fields-stacked">
9
- <?php
10
- $title_placeholder = smartcrawl_get_seo_title();
11
- if ( ! $title_placeholder ) { $title_placeholder = ''; }
12
-
13
- $desc_placeholder = smartcrawl_get_seo_desc();
14
- if ( ! $desc_placeholder ) { $desc_placeholder = ''; }
15
- ?>
16
-
17
- <?php if ( apply_filters( 'wds-metabox-visible_parts-title_area', true ) ) : ?>
18
- <div class="label">
19
- <label class="wds-label" for="wds_title">
20
- <?php esc_html_e( 'SEO Title', 'wds' ); ?>
21
- <span><?php echo esc_html( sprintf( __( '- Include your focus keywords. 50-%d characters recommended.', 'wds' ), SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT ) ); ?></span>
22
- </label>
23
- </div>
24
- <div class="fields">
25
- <input type='text'
26
- id='wds_title'
27
- placeholder='<?php echo esc_html( $title_placeholder ); ?>'
28
- name='wds_title'
29
- value='<?php echo esc_html( smartcrawl_get_value( 'title' ) ); ?>'
30
- class='wds wds-meta-field'/>
31
- </div>
32
- <?php endif; ?>
33
-
34
- <?php if ( apply_filters( 'wds-metabox-visible_parts-description_area', true ) ) : ?>
35
- <div class="label">
36
- <label class="wds-label" for="wds_metadesc">
37
- <?php esc_html_e( 'Description', 'wds' ); ?>
38
- <span><?php echo esc_html( sprintf( __( '- Recommended minimum of 135 characters, maximum %d.', 'wds' ), SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT ) ); ?></span>
39
- </label>
40
- </div>
41
- <div class="fields">
42
- <textarea rows='2'
43
- name='wds_metadesc'
44
- placeholder='<?php echo esc_html( $desc_placeholder ); ?>'
45
- id='wds_metadesc'
46
- class='wds wds-meta-field'><?php echo esc_html( smartcrawl_get_value( 'metadesc' ) ); ?></textarea>
47
- </div>
48
- <?php endif; ?>
49
-
50
- <?php if ( apply_filters( 'wds-metabox-visible_parts-keywords_area', true ) ) : ?>
51
- <div class="label">
52
- <label class="wds-label" for="wds_keywords">
53
- <?php esc_html_e( 'Keywords', 'wds' ); ?>
54
- <span><?php esc_html_e( '- Try to avoid stop words like ‘and’ and ‘the’ which search engines ignore.', 'wds' ); ?></span>
55
- </label>
56
- </div>
57
- <div class="fields">
58
- <input type='text'
59
- id='wds_keywords'
60
- name='wds_keywords'
61
- value='<?php echo esc_html( smartcrawl_get_value( 'keywords' ) ); ?>'
62
- class='wds'/>
63
- </div>
64
-
65
- <div class="wds-extra-keyword-options">
66
- <div class="label">
67
- <label class="wds-label" for="wds_news_keywords">
68
- <?php esc_html_e( 'News Keywords', 'wds' ); ?>
69
- <span><?php esc_html_e( '- Try to avoid stop words like ‘and’ and ‘the’ which search engines ignore.', 'wds' ); ?></span>
70
- </label>
71
- </div>
72
- <div class="fields">
73
- <input type='text'
74
- id='wds_news_keywords'
75
- name='wds_news_keywords'
76
- value='<?php echo esc_attr( smartcrawl_get_value( 'news_keywords' ) ); ?>'
77
- class='wds' />
78
- </div>
79
-
80
- <div class="wds-tags-as-keyword">
81
- <?php
82
- $this->_render('toggle-item', array(
83
- 'field_name' => 'wds_tags_to_keywords',
84
- 'checked' => smartcrawl_get_value( 'tags_to_keywords' ) ? 'checked="checked"' : '',
85
- 'item_label' => esc_html__( 'Tags As Keywords' ),
86
- 'item_description' => esc_html__( 'If you enable using tags, post tags will be merged in with any other keywords you enter in the text box.' ),
87
- ));
88
- ?>
89
- </div>
90
- </div>
91
- <?php endif; ?>
92
- </div>
93
- </div>
94
- </div>
 
 
 
 
1
+ <div class="wds-toggleable inactive wds-edit-meta-toggleable">
2
+ <label>
3
+ <a class="button button-dark button-small"><?php esc_html_e( 'Edit Meta', 'wds' ); ?></a>
4
+ <input type="checkbox" class="toggle-checkbox"/>
5
+ </label>
6
+
7
+ <div class="wds-toggleable-inside wds-toggleable-inside-box">
8
+ <div class="wds-table-fields wds-table-fields-stacked">
9
+ <?php
10
+ $title_placeholder = smartcrawl_get_seo_title();
11
+ if ( ! $title_placeholder ) {
12
+ $title_placeholder = '';
13
+ }
14
+
15
+ $desc_placeholder = smartcrawl_get_seo_desc();
16
+ if ( ! $desc_placeholder ) {
17
+ $desc_placeholder = '';
18
+ }
19
+ ?>
20
+
21
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-title_area', true ) ) : ?>
22
+ <div class="label">
23
+ <label class="wds-label" for="wds_title">
24
+ <?php esc_html_e( 'SEO Title', 'wds' ); ?>
25
+ <span><?php echo esc_html( sprintf( __( '- Include your focus keywords. 50-%d characters recommended.', 'wds' ), SMARTCRAWL_TITLE_LENGTH_CHAR_COUNT_LIMIT ) ); ?></span>
26
+ </label>
27
+ </div>
28
+ <div class="fields">
29
+ <input type='text'
30
+ id='wds_title'
31
+ placeholder='<?php echo esc_html( $title_placeholder ); ?>'
32
+ name='wds_title'
33
+ value='<?php echo esc_html( smartcrawl_get_value( 'title' ) ); ?>'
34
+ class='wds wds-meta-field'/>
35
+ </div>
36
+ <?php endif; ?>
37
+
38
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-description_area', true ) ) : ?>
39
+ <div class="label">
40
+ <label class="wds-label" for="wds_metadesc">
41
+ <?php esc_html_e( 'Description', 'wds' ); ?>
42
+ <span><?php echo esc_html( sprintf( __( '- Recommended minimum of 135 characters, maximum %d.', 'wds' ), SMARTCRAWL_METADESC_LENGTH_CHAR_COUNT_LIMIT ) ); ?></span>
43
+ </label>
44
+ </div>
45
+ <div class="fields">
46
+ <textarea rows='2'
47
+ name='wds_metadesc'
48
+ placeholder='<?php echo esc_html( $desc_placeholder ); ?>'
49
+ id='wds_metadesc'
50
+ class='wds wds-meta-field'><?php echo esc_html( smartcrawl_get_value( 'metadesc' ) ); ?></textarea>
51
+ </div>
52
+ <?php endif; ?>
53
+
54
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-keywords_area', true ) ) : ?>
55
+ <div class="label">
56
+ <label class="wds-label" for="wds_keywords">
57
+ <?php esc_html_e( 'Keywords', 'wds' ); ?>
58
+ <span><?php esc_html_e( '- Try to avoid stop words like ‘and’ and ‘the’ which search engines ignore.', 'wds' ); ?></span>
59
+ </label>
60
+ </div>
61
+ <div class="fields">
62
+ <input type='text'
63
+ id='wds_keywords'
64
+ name='wds_keywords'
65
+ value='<?php echo esc_html( smartcrawl_get_value( 'keywords' ) ); ?>'
66
+ class='wds'/>
67
+ </div>
68
+
69
+ <div class="wds-extra-keyword-options">
70
+ <div class="label">
71
+ <label class="wds-label" for="wds_news_keywords">
72
+ <?php esc_html_e( 'News Keywords', 'wds' ); ?>
73
+ <span><?php esc_html_e( '- Try to avoid stop words like ‘and’ and ‘the’ which search engines ignore.', 'wds' ); ?></span>
74
+ </label>
75
+ </div>
76
+ <div class="fields">
77
+ <input type='text'
78
+ id='wds_news_keywords'
79
+ name='wds_news_keywords'
80
+ value='<?php echo esc_attr( smartcrawl_get_value( 'news_keywords' ) ); ?>'
81
+ class='wds'/>
82
+ </div>
83
+
84
+ <div class="wds-tags-as-keyword">
85
+ <?php
86
+ $this->_render( 'toggle-item', array(
87
+ 'field_name' => 'wds_tags_to_keywords',
88
+ 'checked' => smartcrawl_get_value( 'tags_to_keywords' ) ? 'checked="checked"' : '',
89
+ 'item_label' => esc_html__( 'Tags As Keywords' ),
90
+ 'item_description' => esc_html__( 'If you enable using tags, post tags will be merged in with any other keywords you enter in the text box.' ),
91
+ ) );
92
+ ?>
93
+ </div>
94
+ </div>
95
+ <?php endif; ?>
96
+ </div>
97
+ </div>
98
+ </div>
includes/admin/templates/metabox/metabox-preview.php CHANGED
@@ -1,59 +1,63 @@
1
- <?php
2
- /**
3
- * Metabox preview template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $post = empty( $post ) ? null : $post;
9
-
10
- // Date.
11
- $date = $post ? date( 'M j, Y', strtotime( $post->post_date ) ) : date( 'M j, Y' );
12
- // Title.
13
- $title = empty( $title ) ? smartcrawl_get_value( 'title' ) : $title;
14
- if ( empty( $title ) && $post ) {
15
- $title = $post->post_title;
16
- }
17
- if ( empty( $title ) ) {
18
- $title = esc_html__( 'Dummy Title', 'wds' );
19
- }
20
- if ( is_object( $post ) ) { $title = smartcrawl_replace_vars( $title, (array) $post ); }
21
-
22
- // Description.
23
- $description = empty( $description ) ? smartcrawl_get_value( 'metadesc' ) : $description;
24
- if ( empty( $description ) && $post ) {
25
- $description = $post->post_excerpt;
26
- }
27
- if ( empty( $description ) && $post ) {
28
- $description = substr( strip_tags( $post->post_content ), 0, 130 );
29
- }
30
- if ( empty( $description ) ) {
31
- $description = __( 'Dummy description', 'wds' );
32
- }
33
- if ( is_object( $post ) ) { $description = smartcrawl_replace_vars( $description, (array) $post ); }
34
-
35
- // Slug.
36
- $slug = $post ? $post->post_name : sanitize_title( $title );
37
- ?>
38
- <div class="wds-metabox-preview">
39
- <label class="wds-label"><?php esc_html_e( 'Google Preview' ); ?></label>
40
-
41
- <?php
42
- if ( apply_filters( 'wds-metabox-visible_parts-preview_area', true ) ) {
43
- $link = sprintf(
44
- '%s/%s/',
45
- str_replace( 'http://', '', get_bloginfo( 'url' ) ),
46
- $slug
47
- );
48
- if ( ! empty( $post ) && is_object( $post ) && ! empty( $post->ID ) && 'publish' === get_post_status( $post->ID ) ) {
49
- $link = get_permalink( $post->ID );
50
- }
51
-
52
- $this->_render('onpage/onpage-preview', array(
53
- 'link' => esc_url( $link ),
54
- 'title' => esc_html( $title ),
55
- 'description' => esc_html( $description ),
56
- ));
57
- }
58
- ?>
59
- </div>
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Metabox preview template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $post = empty( $post ) ? null : $post;
9
+
10
+ // Date.
11
+ $date = $post ? date( 'M j, Y', strtotime( $post->post_date ) ) : date( 'M j, Y' );
12
+ // Title.
13
+ $title = empty( $title ) ? smartcrawl_get_value( 'title' ) : $title;
14
+ if ( empty( $title ) && $post ) {
15
+ $title = $post->post_title;
16
+ }
17
+ if ( empty( $title ) ) {
18
+ $title = esc_html__( 'Dummy Title', 'wds' );
19
+ }
20
+ if ( is_object( $post ) ) {
21
+ $title = smartcrawl_replace_vars( $title, (array) $post );
22
+ }
23
+
24
+ // Description.
25
+ $description = empty( $description ) ? smartcrawl_get_value( 'metadesc' ) : $description;
26
+ if ( empty( $description ) && $post ) {
27
+ $description = $post->post_excerpt;
28
+ }
29
+ if ( empty( $description ) && $post ) {
30
+ $description = substr( strip_tags( $post->post_content ), 0, 130 );
31
+ }
32
+ if ( empty( $description ) ) {
33
+ $description = __( 'Dummy description', 'wds' );
34
+ }
35
+ if ( is_object( $post ) ) {
36
+ $description = smartcrawl_replace_vars( $description, (array) $post );
37
+ }
38
+
39
+ // Slug.
40
+ $slug = ! empty( $post->post_name ) ? $post->post_name : sanitize_title( $title );
41
+ ?>
42
+ <div class="wds-metabox-preview">
43
+ <label class="wds-label"><?php esc_html_e( 'Google Preview' ); ?></label>
44
+
45
+ <?php
46
+ if ( apply_filters( 'wds-metabox-visible_parts-preview_area', true ) ) {
47
+ $link = sprintf(
48
+ '%s/%s/',
49
+ str_replace( 'http://', '', get_bloginfo( 'url' ) ),
50
+ $slug
51
+ );
52
+ if ( ! empty( $post ) && is_object( $post ) && ! empty( $post->ID ) ) {
53
+ $link = get_permalink( $post->ID );
54
+ }
55
+
56
+ $this->_render( 'onpage/onpage-preview', array(
57
+ 'link' => esc_url( $link ),
58
+ 'title' => esc_html( $title ),
59
+ 'description' => esc_html( $description ),
60
+ ) );
61
+ }
62
+ ?>
63
+ </div>
includes/admin/templates/metabox/metabox-seo-analysis-container.php CHANGED
@@ -1,39 +1,45 @@
1
- <?php $post = empty( $post ) ? null : $post; ?>
2
-
3
- <div class="wds-seo-analysis-container">
4
- <div class="cf wds-seo-analysis-label">
5
- <label class="wds-label"><?php esc_html_e( 'SEO Analysis', 'wds' ); ?></label>
6
-
7
- <button class="button button-small button-dark button-dark-o wds-refresh-analysis wds-analysis-seo" <?php if ('auto-draft' === get_post_status()) { echo 'disabled'; } ?> type="button">
8
- <span><?php esc_html_e('Refresh', 'wds'); ?></span>
9
- </button>
10
- </div>
11
-
12
- <?php
13
- $this->_render('mascot-message', array(
14
- 'key' => 'metabox-seo-analysis',
15
- 'message' => esc_html__( 'This tool helps you optimize your content to give it the best chance of being found in search engines when people are looking for it. Start by choosing a few focus keywords that best describe your article, then SmartCrawl will give you recommendations to make sure your content is highly optimized.', 'wds' ),
16
- ));
17
- ?>
18
-
19
- <?php if ( apply_filters( 'wds-metabox-visible_parts-focus_area', true ) ) : ?>
20
- <div class="wds-focus-keyword wds-table-fields wds-table-fields-stacked">
21
- <div class="label">
22
- <label class="wds-label" for='wds_focus'>
23
- <?php esc_html_e( 'Focus keyword' , 'wds' ); ?>
24
- <span><?php esc_html_e( '- Choose a single word, phrase or part of a sentence that people will likely search for.', 'wds' ); ?></span>
25
- </label>
26
- </div>
27
- <div class="fields">
28
- <input type='text'
29
- id='wds_focus'
30
- name='wds_focus'
31
- value='<?php echo esc_html( smartcrawl_get_value( 'focus-keywords' ) ); ?>'
32
- class='wds wds-disabled-during-request' placeholder="<?php esc_html_e( 'E.g. broken iphone screen', 'wds' ); ?>"/>
33
- </div>
34
- </div>
35
- <?php endif; ?>
36
-
37
- <a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a>
38
- <?php do_action( 'wds-editor-metabox-seo-analysis', $post ); ?>
39
- </div>
 
 
 
 
 
 
1
+ <?php
2
+ $post = empty( $post ) ? null : $post;
3
+ $refresh_button_disabled = 'auto-draft' === get_post_status() ? 'disabled' : '';
4
+ ?>
5
+
6
+ <div class="wds-seo-analysis-container">
7
+ <div class="cf wds-seo-analysis-label">
8
+ <label class="wds-label"><?php esc_html_e( 'SEO Analysis', 'wds' ); ?></label>
9
+
10
+ <button <?php esc_attr( $refresh_button_disabled ); ?>
11
+ class="button button-small button-dark button-dark-o wds-refresh-analysis wds-analysis-seo wds-disabled-during-request"
12
+ type="button">
13
+ <span><?php esc_html_e( 'Refresh', 'wds' ); ?></span>
14
+ </button>
15
+ </div>
16
+
17
+ <?php
18
+ $this->_render( 'mascot-message', array(
19
+ 'key' => 'metabox-seo-analysis',
20
+ 'message' => esc_html__( 'This tool helps you optimize your content to give it the best chance of being found in search engines when people are looking for it. Start by choosing a few focus keywords that best describe your article, then SmartCrawl will give you recommendations to make sure your content is highly optimized.', 'wds' ),
21
+ ) );
22
+ ?>
23
+
24
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-focus_area', true ) ) : ?>
25
+ <div class="wds-focus-keyword wds-table-fields wds-table-fields-stacked">
26
+ <div class="label">
27
+ <label class="wds-label" for='wds_focus'>
28
+ <?php esc_html_e( 'Focus keyword', 'wds' ); ?>
29
+ <span><?php esc_html_e( '- Choose a single word, phrase or part of a sentence that people will likely search for.', 'wds' ); ?></span>
30
+ </label>
31
+ </div>
32
+ <div class="fields">
33
+ <input type='text'
34
+ id='wds_focus'
35
+ name='wds_focus'
36
+ value='<?php echo esc_html( smartcrawl_get_value( 'focus-keywords' ) ); ?>'
37
+ class='wds wds-disabled-during-request'
38
+ placeholder="<?php esc_html_e( 'E.g. broken iphone screen', 'wds' ); ?>"/>
39
+ </div>
40
+ </div>
41
+ <?php endif; ?>
42
+
43
+ <a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a>
44
+ <?php do_action( 'wds-editor-metabox-seo-analysis', $post ); ?>
45
+ </div>
includes/admin/templates/metabox/metabox-social-meta-tags.php CHANGED
@@ -1,93 +1,97 @@
1
- <?php
2
- $post = empty($post) ? null : $post;
3
- $main_title = empty($main_title) ? '' : $main_title;
4
- $main_description = empty($main_description) ? '' : $main_description;
5
- $field_name = empty($field_name) ? '' : $field_name;
6
- $disabled = empty($disabled) ? false : true;
7
- $current_title = empty($current_title) ? '' : $current_title;
8
- $title_placeholder = empty($title_placeholder) ? '' : $title_placeholder;
9
- $current_description = empty($current_description) ? '' : $current_description;
10
- $description_placeholder = empty($description_placeholder) ? '' : $description_placeholder;
11
- $images = empty($images) ? array() : $images;
12
- $images_available = !empty($images) && is_array($images);
13
- $single_image = empty($single_image) ? false : true;
14
- ?>
15
- <div class="wds-table-fields-group wds-separator-top">
16
- <div class="wds-table-fields">
17
- <div class="label">
18
- <label class="wds-label"><?php echo esc_html($main_title); ?></label>
19
- <p class="wds-label-description"><?php echo esc_html($main_description); ?></p>
20
- </div>
21
- <div class="fields">
22
- <div class="wds-toggleable inverted <?php echo $disabled ? 'inactive' : ''; ?>">
23
- <?php
24
- $this->_render('toggle-item', array(
25
- 'inverted' => true,
26
- 'field_name' => $field_name . '[disabled]',
27
- 'checked' => checked($disabled, true, false),
28
- 'item_label' => esc_html__('Enable for this post', 'wds'),
29
- ));
30
- ?>
31
- <div class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group <?php echo esc_attr($field_name); ?>-meta">
32
- <div class="wds-table-fields wds-table-fields-stacked">
33
- <div class="label">
34
- <label for="<?php echo esc_attr($field_name); ?>-title" class="wds-label"><?php esc_html_e('Title', 'wds'); ?></label>
35
- </div>
36
- <div class="fields">
37
- <input type="text"
38
- id="<?php echo esc_attr($field_name); ?>-title"
39
- name="<?php echo esc_attr($field_name); ?>[title]"
40
- placeholder="<?php echo esc_attr(smartcrawl_replace_vars($title_placeholder, $post)); ?>"
41
- value="<?php echo esc_attr($current_title); ?>"/>
42
- </div>
43
- </div>
44
-
45
- <div class="wds-table-fields wds-table-fields-stacked">
46
- <div class="label">
47
- <label for="<?php echo esc_attr($field_name); ?>-description" class="wds-label">
48
- <?php esc_html_e('Description', 'wds'); ?>
49
- </label>
50
- </div>
51
- <div class="fields">
52
- <textarea name="<?php echo esc_attr($field_name); ?>[description]"
53
- placeholder="<?php echo esc_attr(smartcrawl_replace_vars($description_placeholder, $post)); ?>"
54
- id="<?php echo esc_attr($field_name); ?>-description"><?php echo esc_textarea($current_description); ?></textarea>
55
- </div>
56
- </div>
57
-
58
- <div class="wds-table-fields wds-table-fields-stacked">
59
- <div class="label">
60
- <label for="<?php echo esc_attr($field_name); ?>-images" class="wds-label">
61
- <?php echo $single_image ? esc_html__('Featured Image', 'wds') : esc_html__('Featured Images', 'wds'); ?>
62
- </label>
63
- </div>
64
- <div class="fields og-images"
65
- data-singular="<?php echo $single_image ? 'true' : 'false'; ?>"
66
- data-name="<?php echo esc_attr($field_name); ?>[images]">
67
- <div class="add-action-wrapper item" style="<?php echo $single_image && $images_available ? 'display:none;' : ''; ?>">
68
- <a href="#add" title="<?php esc_attr_e('Add image', 'wds'); ?>">
69
- <i class="wds-icon-plus"></i>
70
- </a>
71
- </div>
72
- <?php if ($images_available) : ?>
73
- <?php foreach ($images as $img) : ?>
74
- <input type="text" class="widefat"
75
- name="<?php echo esc_attr($field_name); ?>[images][]"
76
- value="<?php echo esc_attr($img); ?>"/>
77
- <?php endforeach; ?>
78
- <?php endif; ?>
79
- </div>
80
- </div>
81
-
82
- <p class="wds-label-description">
83
- <?php if($single_image): ?>
84
- <?php esc_html_e('This image will be used as the featured image when the post is shared.', 'wds'); ?>
85
- <?php else: ?>
86
- <?php esc_html_e('Each of these images will be available to use as the featured image when the post is shared.', 'wds'); ?>
87
- <?php endif; ?>
88
- </p>
89
- </div>
90
- </div>
91
- </div>
92
- </div>
93
- </div>
 
 
 
 
1
+ <?php
2
+ $post = empty( $post ) ? null : $post;
3
+ $main_title = empty( $main_title ) ? '' : $main_title;
4
+ $main_description = empty( $main_description ) ? '' : $main_description;
5
+ $field_name = empty( $field_name ) ? '' : $field_name;
6
+ $disabled = empty( $disabled ) ? false : true;
7
+ $current_title = empty( $current_title ) ? '' : $current_title;
8
+ $title_placeholder = empty( $title_placeholder ) ? '' : $title_placeholder;
9
+ $current_description = empty( $current_description ) ? '' : $current_description;
10
+ $description_placeholder = empty( $description_placeholder ) ? '' : $description_placeholder;
11
+ $images = empty( $images ) ? array() : $images;
12
+ $images_available = ! empty( $images ) && is_array( $images );
13
+ $single_image = empty( $single_image ) ? false : true;
14
+ ?>
15
+ <div class="wds-table-fields-group wds-separator-top">
16
+ <div class="wds-table-fields">
17
+ <div class="label">
18
+ <label class="wds-label"><?php echo esc_html( $main_title ); ?></label>
19
+ <p class="wds-label-description"><?php echo esc_html( $main_description ); ?></p>
20
+ </div>
21
+ <div class="fields">
22
+ <div class="wds-toggleable inverted <?php echo $disabled ? 'inactive' : ''; ?>">
23
+ <?php
24
+ $this->_render( 'toggle-item', array(
25
+ 'inverted' => true,
26
+ 'field_name' => $field_name . '[disabled]',
27
+ 'field_id' => $field_name . '-disabled',
28
+ 'checked' => checked( $disabled, true, false ),
29
+ 'item_label' => esc_html__( 'Enable for this post', 'wds' ),
30
+ ) );
31
+ ?>
32
+ <div
33
+ class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group <?php echo esc_attr( $field_name ); ?>-meta">
34
+ <div class="wds-table-fields wds-table-fields-stacked">
35
+ <div class="label">
36
+ <label for="<?php echo esc_attr( $field_name ); ?>-title"
37
+ class="wds-label"><?php esc_html_e( 'Title', 'wds' ); ?></label>
38
+ </div>
39
+ <div class="fields">
40
+ <input type="text"
41
+ id="<?php echo esc_attr( $field_name ); ?>-title"
42
+ name="<?php echo esc_attr( $field_name ); ?>[title]"
43
+ placeholder="<?php echo esc_attr( smartcrawl_replace_vars( $title_placeholder, $post ) ); ?>"
44
+ value="<?php echo esc_attr( $current_title ); ?>"/>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="wds-table-fields wds-table-fields-stacked">
49
+ <div class="label">
50
+ <label for="<?php echo esc_attr( $field_name ); ?>-description" class="wds-label">
51
+ <?php esc_html_e( 'Description', 'wds' ); ?>
52
+ </label>
53
+ </div>
54
+ <div class="fields">
55
+ <textarea name="<?php echo esc_attr( $field_name ); ?>[description]"
56
+ placeholder="<?php echo esc_attr( smartcrawl_replace_vars( $description_placeholder, $post ) ); ?>"
57
+ id="<?php echo esc_attr( $field_name ); ?>-description"><?php echo esc_textarea( $current_description ); ?></textarea>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="wds-table-fields wds-table-fields-stacked">
62
+ <div class="label">
63
+ <label for="<?php echo esc_attr( $field_name ); ?>-images" class="wds-label">
64
+ <?php echo $single_image ? esc_html__( 'Featured Image', 'wds' ) : esc_html__( 'Featured Images', 'wds' ); ?>
65
+ </label>
66
+ </div>
67
+ <div class="fields og-images"
68
+ data-singular="<?php echo $single_image ? 'true' : 'false'; ?>"
69
+ data-name="<?php echo esc_attr( $field_name ); ?>[images]">
70
+ <div class="add-action-wrapper item"
71
+ style="<?php echo $single_image && $images_available ? 'display:none;' : ''; ?>">
72
+ <a id="<?php echo esc_attr( $field_name ); ?>-images" href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>">
73
+ <i class="wds-icon-plus"></i>
74
+ </a>
75
+ </div>
76
+ <?php if ( $images_available ) : ?>
77
+ <?php foreach ( $images as $img ) : ?>
78
+ <input type="text" class="widefat"
79
+ name="<?php echo esc_attr( $field_name ); ?>[images][]"
80
+ value="<?php echo esc_attr( $img ); ?>"/>
81
+ <?php endforeach; ?>
82
+ <?php endif; ?>
83
+ </div>
84
+ </div>
85
+
86
+ <p class="wds-label-description">
87
+ <?php if ( $single_image ): ?>
88
+ <?php esc_html_e( 'This image will be used as the featured image when the post is shared.', 'wds' ); ?>
89
+ <?php else: ?>
90
+ <?php esc_html_e( 'Each of these images will be available to use as the featured image when the post is shared.', 'wds' ); ?>
91
+ <?php endif; ?>
92
+ </p>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </div>
includes/admin/templates/metabox/metabox-tab-advanced.php CHANGED
@@ -1,136 +1,166 @@
1
- <?php
2
- $robots_noindex_value = empty( $robots_noindex_value ) ? false : $robots_noindex_value;
3
- $robots_nofollow_value = empty( $robots_nofollow_value ) ? false : $robots_nofollow_value;
4
- $advanced_value = empty( $advanced_value ) ? array() : $advanced_value;
5
- $advanced_options = empty( $advanced_options ) ? array() : $advanced_options;
6
- $sitemap_priority_options = empty( $sitemap_priority_options ) ? array() : $sitemap_priority_options;
7
- ?>
8
-
9
- <div class="wds-metabox-section wds-advanced-metabox-section wds-form">
10
- <div class="wds-table-fields-group">
11
- <?php if ( apply_filters( 'wds-metabox-visible_parts-robots_area', true ) ) : ?>
12
- <div class="wds-table-fields">
13
- <div class="label">
14
- <label class="wds-label"><?php esc_html_e( 'Indexing', 'wds' ); ?></label>
15
- <p class="wds-label-description">
16
- <?php esc_html_e( 'Choose how search engines will index this particular page.', 'wds' ); ?>
17
- </p>
18
- </div>
19
- <div class="fields">
20
- <?php
21
- $this->_render('toggle-item', array(
22
- 'inverted' => true,
23
- 'field_name' => 'wds_meta-robots-noindex',
24
- 'field_id' => 'wds_meta-robots-noindex',
25
- 'checked' => $robots_noindex_value ? 'checked="checked"' : '',
26
- 'item_label' => esc_html__( 'Index', 'wds' ),
27
- 'item_description' => esc_html__( 'Instruct search engines whether or not you want this post to appear in search results.', 'wds' ),
28
- ));
29
-
30
- $this->_render('toggle-item', array(
31
- 'inverted' => true,
32
- 'field_name' => 'wds_meta-robots-nofollow',
33
- 'field_id' => 'wds_meta-robots-nofollow',
34
- 'checked' => $robots_nofollow_value ? 'checked="checked"' : '',
35
- 'item_label' => esc_html__( 'Follow', 'wds' ),
36
- 'item_description' => esc_html__( 'Tells search engines whether or not to follow the links on your page and crawl them too.', 'wds' ),
37
- ));
38
-
39
- $this->_render('toggle-item', array(
40
- 'inverted' => true,
41
- 'item_value' => 'noarchive',
42
- 'field_name' => 'wds_meta-robots-adv[noarchive]',
43
- 'field_id' => 'wds_meta-robots-adv[noarchive]',
44
- 'checked' => in_array( 'noarchive', $advanced_value ) ? 'checked="checked"' : '',
45
- 'item_label' => esc_html__( 'Archive', 'wds' ),
46
- 'item_description' => esc_html__( 'Instructs search engines to store a cached version of this page.', 'wds' ),
47
- ));
48
-
49
- $this->_render('toggle-item', array(
50
- 'inverted' => true,
51
- 'item_value' => 'nosnippet',
52
- 'field_name' => 'wds_meta-robots-adv[nosnippet]',
53
- 'field_id' => 'wds_meta-robots-adv[nosnippet]',
54
- 'checked' => in_array( 'nosnippet', $advanced_value ) ? 'checked="checked"' : '',
55
- 'item_label' => esc_html__( 'Snippet', 'wds' ),
56
- 'item_description' => esc_html__( 'Allows search engines to show a snippet of this page in the search results and prevents them from caching the page.', 'wds' ),
57
- ));
58
- ?>
59
- </div>
60
- </div>
61
- <?php endif; ?>
62
-
63
- <?php if ( apply_filters( 'wds-metabox-visible_parts-canonical_area', true ) ) : ?>
64
- <div class="wds-table-fields wds-separator-top">
65
- <div class="label">
66
- <label for="wds_canonical" class="wds-label"><?php esc_html_e( 'Canonical', 'wds' ); ?></label>
67
- <p class="wds-label-description">
68
- <?php esc_html_e( 'If you have several similar versions of this page you can point search engines to the canonical or "genuine" version to avoid duplicate content issues.', 'wds' ); ?>
69
- </p>
70
- </div>
71
- <div class="fields">
72
- <input type='text' id='wds_canonical' name='wds_canonical' value='<?php echo esc_attr( smartcrawl_get_value( 'canonical' ) ); ?>' class='wds' />
73
- <span class="wds-field-legend"><?php esc_html_e( 'Enter the full canonical URL including http:// or https://', 'wds' ); ?></span>
74
- </div>
75
- </div>
76
- <?php endif; ?>
77
-
78
- <?php if ( apply_filters( 'wds-metabox-visible_parts-redirect_area', true ) && user_can_see_seo_metabox_301_redirect() ) : ?>
79
- <div class="wds-table-fields wds-separator-top">
80
- <div class="label">
81
- <label for="wds_redirect" class="wds-label"><?php esc_html_e( '301 Redirect', 'wds' ); ?></label>
82
- <p class="wds-label-description">
83
- <?php esc_html_e( 'Send visitors to this URL to another page.', 'wds' ); ?>
84
- </p>
85
- </div>
86
- <div class="fields">
87
- <input type='text' id='wds_redirect' name='wds_redirect' value='<?php echo esc_attr( smartcrawl_get_value( 'redirect' ) ); ?>' class='wds' />
88
- <span class="wds-field-legend"><?php esc_html_e( 'Enter the URL to send traffic to including http:// or https://', 'wds' ); ?></span>
89
- </div>
90
- </div>
91
- <?php endif; ?>
92
-
93
- <?php if ( apply_filters( 'wds-metabox-visible_parts-sitemap_priority_area', true ) ) : ?>
94
- <div class="wds-table-fields wds-separator-top">
95
- <div class="label">
96
- <label for='wds_sitemap-priority' class="wds-label"><?php esc_html_e( 'Sitemap Priority' , 'wds' ); ?></label>
97
- </div>
98
- <div class="fields">
99
- <select name='wds_sitemap-priority'
100
- id='wds_sitemap-priority'
101
- class="select-container"
102
- style="width: 100%">
103
-
104
- <?php $priority_value = smartcrawl_get_value( 'sitemap-priority' ); ?>
105
-
106
- <?php foreach ( $sitemap_priority_options as $key => $label ) : ?>
107
- <option value='<?php echo esc_attr( $key ); ?>' <?php selected( $key, $priority_value ); ?>>
108
- <?php echo esc_html( $label ); ?>
109
- </option>
110
- <?php endforeach; ?>
111
- </select>
112
- </div>
113
- </div>
114
- <?php endif; ?>
115
-
116
- <div class="wds-table-fields wds-separator-top">
117
- <div class="label">
118
- <label class="wds-label" for="wds_autolinks-exclude">
119
- <?php esc_html_e( 'Automatic Linking', 'wds' ); ?>
120
- </label>
121
- <p class="wds-label-description">
122
- <?php esc_html_e( 'You can prevent this particular post from being auto-linked', 'wds' ); ?>
123
- </p>
124
- </div>
125
- <div class="fields">
126
- <?php
127
- $this->_render('toggle-item', array(
128
- 'field_name' => 'wds_autolinks-exclude',
129
- 'checked' => smartcrawl_get_value( 'autolinks-exclude' ) ? 'checked="checked"' : '',
130
- 'item_label' => esc_html__( 'Enable automatic linking for this post', 'wds' ),
131
- ));
132
- ?>
133
- </div>
134
- </div>
135
- </div>
136
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $robots_noindex_value = empty( $robots_noindex_value ) ? false : $robots_noindex_value;
3
+ $robots_nofollow_value = empty( $robots_nofollow_value ) ? false : $robots_nofollow_value;
4
+ $robots_index_value = empty( $robots_index_value ) ? false : true;
5
+ $robots_follow_value = empty( $robots_follow_value ) ? false : true;
6
+ $advanced_value = empty( $advanced_value ) ? array() : $advanced_value;
7
+ $advanced_options = empty( $advanced_options ) ? array() : $advanced_options;
8
+ $sitemap_priority_options = empty( $sitemap_priority_options ) ? array() : $sitemap_priority_options;
9
+ $post_type_noindexed = empty( $post_type_noindexed ) ? false : true;
10
+ $post_type_nofollowed = empty( $post_type_nofollowed ) ? false : true;
11
+ ?>
12
+
13
+ <div class="wds-metabox-section wds-advanced-metabox-section wds-form">
14
+ <div class="wds-table-fields-group">
15
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-robots_area', true ) ) : ?>
16
+ <div class="wds-table-fields">
17
+ <div class="label">
18
+ <label class="wds-label"><?php esc_html_e( 'Indexing', 'wds' ); ?></label>
19
+ <p class="wds-label-description">
20
+ <?php esc_html_e( 'Choose how search engines will index this particular page.', 'wds' ); ?>
21
+ </p>
22
+ </div>
23
+ <div class="fields">
24
+ <?php
25
+ if ( $post_type_noindexed ) {
26
+ $this->_render( 'toggle-item', array(
27
+ 'field_name' => 'wds_meta-robots-index',
28
+ 'field_id' => 'wds_meta-robots-index',
29
+ 'checked' => $robots_index_value ? 'checked="checked"' : '',
30
+ 'item_label' => esc_html__( 'Index - Override Post Type Setting', 'wds' ),
31
+ 'item_description' => esc_html__( 'Instruct search engines whether or not you want this post to appear in search results.', 'wds' ),
32
+ ) );
33
+ } else {
34
+ $this->_render( 'toggle-item', array(
35
+ 'inverted' => true,
36
+ 'field_name' => 'wds_meta-robots-noindex',
37
+ 'field_id' => 'wds_meta-robots-noindex',
38
+ 'checked' => $robots_noindex_value ? 'checked="checked"' : '',
39
+ 'item_label' => esc_html__( 'Index', 'wds' ),
40
+ 'item_description' => esc_html__( 'Instruct search engines whether or not you want this post to appear in search results.', 'wds' ),
41
+ ) );
42
+ }
43
+
44
+ if ( $post_type_nofollowed ) {
45
+ $this->_render( 'toggle-item', array(
46
+ 'field_name' => 'wds_meta-robots-follow',
47
+ 'field_id' => 'wds_meta-robots-follow',
48
+ 'checked' => $robots_follow_value ? 'checked="checked"' : '',
49
+ 'item_label' => esc_html__( 'Follow - Override Post Type Setting', 'wds' ),
50
+ 'item_description' => esc_html__( 'Tells search engines whether or not to follow the links on your page and crawl them too.', 'wds' ),
51
+ ) );
52
+ } else {
53
+ $this->_render( 'toggle-item', array(
54
+ 'inverted' => true,
55
+ 'field_name' => 'wds_meta-robots-nofollow',
56
+ 'field_id' => 'wds_meta-robots-nofollow',
57
+ 'checked' => $robots_nofollow_value ? 'checked="checked"' : '',
58
+ 'item_label' => esc_html__( 'Follow', 'wds' ),
59
+ 'item_description' => esc_html__( 'Tells search engines whether or not to follow the links on your page and crawl them too.', 'wds' ),
60
+ ) );
61
+ }
62
+
63
+ $this->_render( 'toggle-item', array(
64
+ 'inverted' => true,
65
+ 'item_value' => 'noarchive',
66
+ 'field_name' => 'wds_meta-robots-adv[noarchive]',
67
+ 'field_id' => 'wds_meta-robots-noarchive',
68
+ 'checked' => in_array( 'noarchive', $advanced_value, true ) ? 'checked="checked"' : '',
69
+ 'item_label' => esc_html__( 'Archive', 'wds' ),
70
+ 'item_description' => esc_html__( 'Instructs search engines to store a cached version of this page.', 'wds' ),
71
+ ) );
72
+
73
+ $this->_render( 'toggle-item', array(
74
+ 'inverted' => true,
75
+ 'item_value' => 'nosnippet',
76
+ 'field_name' => 'wds_meta-robots-adv[nosnippet]',
77
+ 'field_id' => 'wds_meta-robots-nosnippet',
78
+ 'checked' => in_array( 'nosnippet', $advanced_value, true ) ? 'checked="checked"' : '',
79
+ 'item_label' => esc_html__( 'Snippet', 'wds' ),
80
+ 'item_description' => esc_html__( 'Allows search engines to show a snippet of this page in the search results and prevents them from caching the page.', 'wds' ),
81
+ ) );
82
+ ?>
83
+ </div>
84
+ </div>
85
+ <?php endif; ?>
86
+
87
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-canonical_area', true ) ) : ?>
88
+ <div class="wds-table-fields wds-separator-top">
89
+ <div class="label">
90
+ <label for="wds_canonical" class="wds-label"><?php esc_html_e( 'Canonical', 'wds' ); ?></label>
91
+ <p class="wds-label-description">
92
+ <?php esc_html_e( 'If you have several similar versions of this page you can point search engines to the canonical or "genuine" version to avoid duplicate content issues.', 'wds' ); ?>
93
+ </p>
94
+ </div>
95
+ <div class="fields">
96
+ <input type='text' id='wds_canonical' name='wds_canonical'
97
+ value='<?php echo esc_attr( smartcrawl_get_value( 'canonical' ) ); ?>' class='wds'/>
98
+ <span
99
+ class="wds-field-legend"><?php esc_html_e( 'Enter the full canonical URL including http:// or https://', 'wds' ); ?></span>
100
+ </div>
101
+ </div>
102
+ <?php endif; ?>
103
+
104
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-redirect_area', true ) && user_can_see_seo_metabox_301_redirect() ) : ?>
105
+ <div class="wds-table-fields wds-separator-top">
106
+ <div class="label">
107
+ <label for="wds_redirect" class="wds-label"><?php esc_html_e( '301 Redirect', 'wds' ); ?></label>
108
+ <p class="wds-label-description">
109
+ <?php esc_html_e( 'Send visitors to this URL to another page.', 'wds' ); ?>
110
+ </p>
111
+ </div>
112
+ <div class="fields">
113
+ <input type='text' id='wds_redirect' name='wds_redirect'
114
+ value='<?php echo esc_attr( smartcrawl_get_value( 'redirect' ) ); ?>' class='wds'/>
115
+ <span
116
+ class="wds-field-legend"><?php esc_html_e( 'Enter the URL to send traffic to including http:// or https://', 'wds' ); ?></span>
117
+ </div>
118
+ </div>
119
+ <?php endif; ?>
120
+
121
+ <?php if ( apply_filters( 'wds-metabox-visible_parts-sitemap_priority_area', true ) ) : ?>
122
+ <div class="wds-table-fields wds-separator-top">
123
+ <div class="label">
124
+ <label for='wds_sitemap-priority'
125
+ class="wds-label"><?php esc_html_e( 'Sitemap Priority', 'wds' ); ?></label>
126
+ </div>
127
+ <div class="fields">
128
+ <select name='wds_sitemap-priority'
129
+ id='wds_sitemap-priority'
130
+ class="select-container"
131
+ style="width: 100%">
132
+
133
+ <?php $priority_value = smartcrawl_get_value( 'sitemap-priority' ); ?>
134
+
135
+ <?php foreach ( $sitemap_priority_options as $key => $label ) : ?>
136
+ <option value='<?php echo esc_attr( $key ); ?>' <?php selected( $key, $priority_value ); ?>>
137
+ <?php echo esc_html( $label ); ?>
138
+ </option>
139
+ <?php endforeach; ?>
140
+ </select>
141
+ </div>
142
+ </div>
143
+ <?php endif; ?>
144
+
145
+ <div class="wds-table-fields wds-separator-top">
146
+ <div class="label">
147
+ <label class="wds-label" for="wds_autolinks-exclude">
148
+ <?php esc_html_e( 'Automatic Linking', 'wds' ); ?>
149
+ </label>
150
+ <p class="wds-label-description">
151
+ <?php esc_html_e( 'You can prevent this particular post from being auto-linked', 'wds' ); ?>
152
+ </p>
153
+ </div>
154
+ <div class="fields">
155
+ <?php
156
+ $this->_render( 'toggle-item', array(
157
+ 'inverted' => true,
158
+ 'field_name' => 'wds_autolinks-exclude',
159
+ 'checked' => smartcrawl_get_value( 'autolinks-exclude' ) ? 'checked="checked"' : '',
160
+ 'item_label' => esc_html__( 'Enable automatic linking for this post', 'wds' ),
161
+ ) );
162
+ ?>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ </div>
includes/admin/templates/metabox/metabox-tab-readability.php CHANGED
@@ -1,13 +1,15 @@
1
- <?php if ( ! Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) { return false; } ?>
2
- <div class="wds-metabox-section">
3
- <p><?php esc_html_e( 'We’ve analyzed your content to see how readable it is for the average person. Suggestions are based on best practice, but only you can decide what works for you and your readers.', 'wds' ); ?></p>
4
- <a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a>
5
-
6
- <p class="wds-readability-legend wds-small-text">
7
- <span><strong><?php esc_html_e( 'Difficult', 'wds' ); ?></strong> <?php esc_html_e( '= Less than 60', 'wds' ); ?></span>
8
- <span><strong><?php esc_html_e( 'OK', 'wds' ); ?></strong> <?php esc_html_e( '= 60 to 70', 'wds' ); ?></span>
9
- <span><strong><?php esc_html_e( 'Easy', 'wds' ); ?></strong> <?php esc_html_e( '= 70+', 'wds' ); ?></span>
10
- </p>
11
-
12
- <?php do_action( 'wds-editor-metabox-readability-analysis', $post ); ?>
13
- </div>
 
 
1
+ <?php if ( ! Smartcrawl_Settings::get_setting( 'analysis-readability' ) ) {
2
+ return false;
3
+ } ?>
4
+ <div class="wds-metabox-section">
5
+ <p><?php esc_html_e( 'We’ve analyzed your content to see how readable it is for the average person. Suggestions are based on best practice, but only you can decide what works for you and your readers.', 'wds' ); ?></p>
6
+ <a href="#reload"><?php esc_html_e( 'Reload', 'wds' ); ?></a>
7
+
8
+ <p class="wds-readability-legend wds-small-text">
9
+ <span><strong><?php esc_html_e( 'Difficult', 'wds' ); ?></strong> <?php esc_html_e( '= Less than 60', 'wds' ); ?></span>
10
+ <span><strong><?php esc_html_e( 'OK', 'wds' ); ?></strong> <?php esc_html_e( '= 60 to 70', 'wds' ); ?></span>
11
+ <span><strong><?php esc_html_e( 'Easy', 'wds' ); ?></strong> <?php esc_html_e( '= 70+', 'wds' ); ?></span>
12
+ </p>
13
+
14
+ <?php do_action( 'wds-editor-metabox-readability-analysis', $post ); ?>
15
+ </div>
includes/admin/templates/metabox/metabox-tab-seo.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- $post = empty( $post ) ? null : $post;
3
- ?>
4
-
5
- <div class="wds-form">
6
- <div class="wds-metabox-section">
7
- <?php
8
- $this->_render('metabox/metabox-preview', array(
9
- 'post' => $post,
10
- ));
11
- ?>
12
-
13
- <?php $this->_render( 'metabox/metabox-meta-edit-form' ); ?>
14
- </div>
15
-
16
- <?php if ( Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) { ?>
17
- <div class="wds-metabox-section">
18
- <?php
19
- $this->_render('metabox/metabox-seo-analysis-container', array(
20
- 'post' => $post,
21
- ));
22
- ?>
23
- </div>
24
- <?php } ?>
25
- </div>
1
+ <?php
2
+ $post = empty( $post ) ? null : $post;
3
+ ?>
4
+
5
+ <div class="wds-form">
6
+ <div class="wds-metabox-section">
7
+ <?php
8
+ $this->_render( 'metabox/metabox-preview', array(
9
+ 'post' => $post,
10
+ ) );
11
+ ?>
12
+
13
+ <?php $this->_render( 'metabox/metabox-meta-edit-form' ); ?>
14
+ </div>
15
+
16
+ <?php if ( Smartcrawl_Settings::get_setting( 'analysis-seo' ) ) { ?>
17
+ <div class="wds-metabox-section">
18
+ <?php
19
+ $this->_render( 'metabox/metabox-seo-analysis-container', array(
20
+ 'post' => $post,
21
+ ) );
22
+ ?>
23
+ </div>
24
+ <?php } ?>
25
+ </div>
includes/admin/templates/metabox/metabox-tab-social.php CHANGED
@@ -1,99 +1,98 @@
1
- <?php
2
- $post = empty( $post ) ? null : $post;
3
- $og_setting_enabled = empty( $og_setting_enabled ) ? false : $og_setting_enabled;
4
- $og_post_type_enabled = empty( $og_post_type_enabled ) ? false : $og_post_type_enabled;
5
- $twitter_setting_enabled = empty( $twitter_setting_enabled ) ? false : $twitter_setting_enabled;
6
- $twitter_post_type_enabled = empty( $twitter_post_type_enabled ) ? false : $twitter_post_type_enabled;
7
-
8
- if ( ! is_a( $post, 'WP_Post' ) ) {
9
- return;
10
- }
11
-
12
- $og = smartcrawl_get_value( 'opengraph' );
13
- if ( ! is_array( $og ) ) {
14
- $og = array();
15
- }
16
-
17
- $og = wp_parse_args($og, array(
18
- 'title' => false,
19
- 'description' => false,
20
- 'images' => false,
21
- 'disabled' => false,
22
- ));
23
-
24
- if ( ! class_exists( 'Smartcrawl_OpenGraph_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . 'tools/class_wds_opengraph_printer.php' ); }
25
- $og_printer = Smartcrawl_OpenGraph_Printer::get();
26
- $og_meta_disabled = (bool) smartcrawl_get_array_value( $og, 'disabled' );
27
-
28
- $twitter = smartcrawl_get_value( 'twitter' );
29
- if ( ! is_array( $twitter ) ) {
30
- $twitter = array();
31
- }
32
-
33
- $twitter = wp_parse_args($twitter, array(
34
- 'title' => false,
35
- 'description' => false,
36
- 'images' => false,
37
- 'disabled' => false,
38
- ));
39
-
40
- if ( ! class_exists( 'Smartcrawl_Twitter_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_twitter_printer.php' ); }
41
- $twitter_printer = Smartcrawl_Twitter_Printer::get();
42
- $twitter_meta_disabled = smartcrawl_get_array_value( $twitter, 'disabled' );
43
-
44
- $resolver = Smartcrawl_Endpoint_Resolver::resolve();
45
- $resolver->simulate_post( $post->ID );
46
- ?>
47
- <div class="wds-metabox-section wds-social-settings-metabox-section wds-form">
48
- <p>
49
- <?php
50
- printf(
51
- esc_html__( "Customize this posts title, description and featured images for social shares. You can also configure the default settings for this post type in SmartCrawl's %s area.", 'wds' ),
52
- sprintf(
53
- '<a href="%s">%s</a>',
54
- Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE ),
55
- esc_html__( 'Titles & Meta', 'wds' )
56
- )
57
- );
58
- ?>
59
- </p>
60
- <?php if ( $og_setting_enabled && $og_post_type_enabled ) : ?>
61
- <?php
62
- $this->_render('metabox/metabox-social-meta-tags', array(
63
- 'post' => $post,
64
- 'main_title' => __('OpenGraph', 'wds'),
65
- 'main_description' => __('OpenGraph is used on many social networks such as Facebook.', 'wds'),
66
- 'field_name' => 'wds-opengraph',
67
- 'disabled' => $og_meta_disabled,
68
- 'current_title' => $og['title'],
69
- 'title_placeholder' => $og_printer->get_tag_value('title'),
70
- 'current_description' => $og['description'],
71
- 'description_placeholder' => $og_printer->get_tag_value('description'),
72
- 'images' => $og['images'],
73
- 'single_image' => false
74
- ));
75
- ?>
76
- <?php endif; ?>
77
-
78
- <?php if ( $twitter_setting_enabled && $twitter_post_type_enabled ) : ?>
79
- <?php
80
- $this->_render('metabox/metabox-social-meta-tags', array(
81
- 'post' => $post,
82
- 'main_title' => __('Twitter', 'wds'),
83
- 'main_description' => __('These details will be used in Twitter cards.', 'wds'),
84
- 'field_name' => 'wds-twitter',
85
- 'disabled' => $twitter_meta_disabled,
86
- 'current_title' => $twitter['title'],
87
- 'title_placeholder' => $twitter_printer->get_title_content(),
88
- 'current_description' => $twitter['description'],
89
- 'description_placeholder' => $twitter_printer->get_description_content(),
90
- 'images' => $twitter['images'],
91
- 'single_image' => true
92
- ));
93
- ?>
94
- <?php endif; ?>
95
-
96
- <?php
97
- $resolver->stop_simulation();
98
- ?>
99
- </div>
1
+ <?php
2
+ $post = empty( $post ) ? null : $post;
3
+ $og_setting_enabled = empty( $og_setting_enabled ) ? false : $og_setting_enabled;
4
+ $og_post_type_enabled = empty( $og_post_type_enabled ) ? false : $og_post_type_enabled;
5
+ $twitter_setting_enabled = empty( $twitter_setting_enabled ) ? false : $twitter_setting_enabled;
6
+ $twitter_post_type_enabled = empty( $twitter_post_type_enabled ) ? false : $twitter_post_type_enabled;
7
+ $onpage_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_ONPAGE );
8
+
9
+ if ( ! is_a( $post, 'WP_Post' ) ) {
10
+ return;
11
+ }
12
+
13
+ $og = smartcrawl_get_value( 'opengraph' );
14
+ if ( ! is_array( $og ) ) {
15
+ $og = array();
16
+ }
17
+
18
+ $og = wp_parse_args( $og, array(
19
+ 'title' => false,
20
+ 'description' => false,
21
+ 'images' => false,
22
+ 'disabled' => false,
23
+ ) );
24
+
25
+ $og_printer = Smartcrawl_OpenGraph_Printer::get();
26
+ $og_meta_disabled = (bool) smartcrawl_get_array_value( $og, 'disabled' );
27
+
28
+ $twitter = smartcrawl_get_value( 'twitter' );
29
+ if ( ! is_array( $twitter ) ) {
30
+ $twitter = array();
31
+ }
32
+
33
+ $twitter = wp_parse_args( $twitter, array(
34
+ 'title' => false,
35
+ 'description' => false,
36
+ 'images' => false,
37
+ 'disabled' => false,
38
+ ) );
39
+
40
+ $twitter_printer = Smartcrawl_Twitter_Printer::get();
41
+ $twitter_meta_disabled = smartcrawl_get_array_value( $twitter, 'disabled' );
42
+
43
+ $resolver = Smartcrawl_Endpoint_Resolver::resolve();
44
+ $resolver->simulate_post( $post->ID );
45
+ ?>
46
+ <div class="wds-metabox-section wds-social-settings-metabox-section wds-form">
47
+ <p>
48
+ <?php
49
+ printf(
50
+ esc_html__( "Customize this posts title, description and featured images for social shares. You can also configure the default settings for this post type in SmartCrawl's %s area.", 'wds' ),
51
+ sprintf(
52
+ '<a href="%s">%s</a>',
53
+ esc_url_raw( $onpage_url ),
54
+ esc_html__( 'Titles & Meta', 'wds' )
55
+ )
56
+ );
57
+ ?>
58
+ </p>
59
+ <?php if ( $og_setting_enabled && $og_post_type_enabled ) : ?>
60
+ <?php
61
+ $this->_render( 'metabox/metabox-social-meta-tags', array(
62
+ 'post' => $post,
63
+ 'main_title' => __( 'OpenGraph', 'wds' ),
64
+ 'main_description' => __( 'OpenGraph is used on many social networks such as Facebook.', 'wds' ),
65
+ 'field_name' => 'wds-opengraph',
66
+ 'disabled' => $og_meta_disabled,
67
+ 'current_title' => $og['title'],
68
+ 'title_placeholder' => $og_printer->get_tag_value( 'title' ),
69
+ 'current_description' => $og['description'],
70
+ 'description_placeholder' => $og_printer->get_tag_value( 'description' ),
71
+ 'images' => $og['images'],
72
+ 'single_image' => false,
73
+ ) );
74
+ ?>
75
+ <?php endif; ?>
76
+
77
+ <?php if ( $twitter_setting_enabled && $twitter_post_type_enabled ) : ?>
78
+ <?php
79
+ $this->_render( 'metabox/metabox-social-meta-tags', array(
80
+ 'post' => $post,
81
+ 'main_title' => __( 'Twitter', 'wds' ),
82
+ 'main_description' => __( 'These details will be used in Twitter cards.', 'wds' ),
83
+ 'field_name' => 'wds-twitter',
84
+ 'disabled' => $twitter_meta_disabled,
85
+ 'current_title' => $twitter['title'],
86
+ 'title_placeholder' => $twitter_printer->get_title_content(),
87
+ 'current_description' => $twitter['description'],
88
+ 'description_placeholder' => $twitter_printer->get_description_content(),
89
+ 'images' => $twitter['images'],
90
+ 'single_image' => true,
91
+ ) );
92
+ ?>
93
+ <?php endif; ?>
94
+
95
+ <?php
96
+ $resolver->stop_simulation();
97
+ ?>
98
+ </div>
 
includes/admin/templates/native-dismissible-notice-javascript.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="application/javascript">
2
+ jQuery(function ($) {
3
+ $(document).on('click', '.wds-native-dismissible-notice .notice-dismiss', function () {
4
+ var message_key = $(this).closest('.wds-native-dismissible-notice').data('messageKey');
5
+ $.post(
6
+ ajaxurl,
7
+ {
8
+ action: 'wds_dismiss_message',
9
+ message: message_key,
10
+ _wds_nonce: '<?php echo esc_js( wp_create_nonce( 'wds-admin-nonce' ) ); ?>'
11
+ },
12
+ 'json'
13
+ );
14
+ });
15
+ });
16
+ </script>
includes/admin/templates/notice.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
- $message = empty( $message ) ? '' : $message;
3
- $class = empty( $class ) ? 'wds-notice-warning' : $class;
4
- ?>
5
- <div class="wds-notice <?php echo esc_attr( $class ); ?>">
6
- <p><?php echo wp_kses( $message, 'post' ); ?></p>
7
- </div>
1
+ <?php
2
+ $message = empty( $message ) ? '' : $message;
3
+ $class = empty( $class ) ? 'wds-notice-warning' : $class;
4
+ ?>
5
+ <div class="wds-notice <?php echo esc_attr( $class ); ?>">
6
+ <p><?php echo wp_kses_post( $message ); ?></p>
7
+ </div>
includes/admin/templates/onpage/onpage-marketpress-tabs.php DELETED
@@ -1,83 +0,0 @@
1
- <?php if ( class_exists( 'MarketPress_MS' ) && ( is_network_admin() || is_main_site() ) ) { ?>
2
- <section class="tab">
3
- <input type="radio" name="wds-admin-active-tab" id="tab-marketpress" value="tab-marketpress" <?php checked( $active_tab, 'tab-marketpress' ); ?>>
4
- <label for="tab-marketpress"><?php esc_html_e( 'MarketPress', 'wds' ); ?></label>
5
- <div class="content wds-content-tabs">
6
- <h2 class="tab-title"><?php esc_html_e( 'MarketPress', 'wds' ); ?></h2>
7
-
8
- <div class="wds-content-tabs-inner">
9
-
10
- <div class="wds-table-fields-group">
11
- <div class="wds-table-fields">
12
- <div class="label">
13
- <label for="title-mp_marketplace-base" class="wds-label"><?php esc_html_e( 'Marketplace Base Title' , 'wds' ); ?></label>
14
- </div>
15
- <div class="fields wds-allow-macros">
16
- <input id='title-mp_marketplace-base' name='<?php echo esc_attr( $_view['option_name'] ); ?>[title-mp_marketplace-base]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-mp_marketplace-base'] ); ?>'>
17
- </div>
18
- </div>
19
- </div>
20
-
21
- <div class="wds-table-fields-group">
22
- <div class="wds-table-fields">
23
- <div class="label label-long">
24
- <label for="metadesc-mp_marketplace-base" class="wds-label"><?php _e( 'Marketplace Base<br> Meta Description' , 'wds' ); ?></label>
25
- </div>
26
- <div class="fields wds-allow-macros">
27
- <textarea id='metadesc-mp_marketplace-base' name='<?php echo esc_attr( $_view['option_name'] ); ?>[metadesc-mp_marketplace-base]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-mp_marketplace-base'] ); ?></textarea>
28
- </div>
29
- </div>
30
- </div>
31
-
32
- <div class="wds-table-fields-group">
33
- <div class="wds-table-fields">
34
- <div class="label label-long">
35
- <label for="title-mp_marketplace-categories" class="wds-label"><?php _e( 'Marketplace Categories<br> Title' , 'wds' ); ?></label>
36
- </div>
37
- <div class="fields wds-allow-macros">
38
- <input id='title-mp_marketplace-categories' name='<?php echo esc_attr( $_view['option_name'] ); ?>[title-mp_marketplace-categories]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-mp_marketplace-categories'] ); ?>'>
39
- </div>
40
- </div>
41
- </div>
42
-
43
- <div class="wds-table-fields-group">
44
- <div class="wds-table-fields">
45
- <div class="label">
46
- <label for="metadesc-mp_marketplace-categories" class="wds-label"><?php _e( 'Marketplace Categories<br> Meta Description' , 'wds' ); ?></label>
47
- </div>
48
- <div class="fields wds-allow-macros">
49
- <textarea id='metadesc-mp_marketplace-categories' name='<?php echo esc_attr( $_view['option_name'] ); ?>[metadesc-mp_marketplace-categories]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-mp_marketplace-categories'] ); ?></textarea>
50
- </div>
51
- </div>
52
- </div>
53
-
54
- <div class="wds-table-fields-group">
55
- <div class="wds-table-fields">
56
- <div class="label label-long">
57
- <label for="title-mp_marketplace-tags" class="wds-label"><?php _e( 'Marketplace Tags<br> Title' , 'wds' ); ?></label>
58
- </div>
59
- <div class="fields wds-allow-macros">
60
- <input id='title-mp_marketplace-tags' name='<?php echo esc_attr( $_view['option_name'] ); ?>[title-mp_marketplace-tags]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-mp_marketplace-tags'] ); ?>'>
61
- </div>
62
- </div>
63
- </div>
64
-
65
- <div class="wds-table-fields-group">
66
- <div class="wds-table-fields">
67
- <div class="label">
68
- <label for="metadesc-mp_marketplace-tags" class="wds-label"><?php _e( 'Marketplace Tags<br> Meta Description' , 'wds' ); ?></label>
69
- </div>
70
- <div class="fields wds-allow-macros">
71
- <textarea id='metadesc-mp_marketplace-tags' name='<?php echo esc_attr( $_view['option_name'] ); ?>[metadesc-mp_marketplace-tags]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-mp_marketplace-tags'] ); ?></textarea>
72
- </div>
73
- </div>
74
- </div>
75
-
76
- </div><!-- end wds-content-tabs-inner -->
77
- <div class="wds-seamless-footer">
78
- <input name='submit' type='submit' class='button' value='<?php echo esc_attr( __( 'Save Settings' , 'wds' ) ); ?>'>
79
- </div>
80
-
81
- </div>
82
- </section>
83
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/onpage/onpage-meta-robots.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
- $items = empty( $items ) ? array() : $items;
3
-
4
- if ( ! $items ) {
5
- return;
6
- }
7
- ?>
8
-
9
- <?php
10
- $this->_render('toggle-group', array(
11
- 'label' => __( 'Indexing', 'wds' ),
12
- 'description' => __( 'Choose whether you want your website to appear in search results.', 'wds' ),
13
- 'separator' => true,
14
- 'items' => $items,
15
- ));
16
-
1
+ <?php
2
+ $items = empty( $items ) ? array() : $items;
3
+
4
+ if ( ! $items ) {
5
+ return;
6
+ }
7
+ ?>
8
+
9
+ <?php
10
+ $this->_render( 'toggle-group', array(
11
+ 'label' => __( 'Indexing', 'wds' ),
12
+ 'description' => __( 'Choose whether you want your website to appear in search results.', 'wds' ),
13
+ 'separator' => true,
14
+ 'items' => $items,
15
+ ) );
16
+
includes/admin/templates/onpage/onpage-og-disabled.php CHANGED
@@ -1,14 +1,18 @@
1
- <?php
2
- $message = sprintf(
3
- esc_html__('OpenGraph is globally disabled. You can enable it %s.', 'wds'),
4
- sprintf(
5
- '<a href="%s">%s</a>',
6
- Smartcrawl_Settings_Admin::admin_url(Smartcrawl_Settings::TAB_SOCIAL),
7
- esc_html__('here', 'wds')
8
- )
9
- );
10
-
11
- $this->_render('notice', array(
12
- 'class' => 'wds-notice-info',
13
- 'message' => $message,
14
- ));
 
 
 
 
1
+ <?php
2
+ $message = esc_html__( 'OpenGraph is globally disabled.', 'wds' );
3
+ if ( smartcrawl_subsite_setting_page_enabled( 'wds_social' ) ) {
4
+ $message = sprintf(
5
+ esc_html__( '%1$s You can enable it %2$s.', 'wds' ),
6
+ $message,
7
+ sprintf(
8
+ '<a href="%s">%s</a>',
9
+ Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SOCIAL ),
10
+ esc_html__( 'here', 'wds' )
11
+ )
12
+ );
13
+ }
14
+
15
+ $this->_render( 'notice', array(
16
+ 'class' => 'wds-notice-info',
17
+ 'message' => $message,
18
+ ) );
includes/admin/templates/onpage/onpage-og-settings.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- /**
3
- * @var string $for_type
4
- */
5
- $section_enabled_field_id = 'og-active-' . $for_type;
6
- $section_enabled = !empty($_view['options'][$section_enabled_field_id]) ? $_view['options'][$section_enabled_field_id] : false;
7
- $section_title = __('Enable OpenGraph', 'wds');
8
- $section_description = __('OpenGraph support enhances how your content appears when shared on social networks such as Facebook.', 'wds');
9
- $option_name = empty($_view['option_name']) ? '' : $_view['option_name'];
10
- $title_field_id = 'og-title-' . $for_type;
11
- $current_title = !empty($_view['options']["og-title-{$for_type}"])
12
- ? $_view['options']["og-title-{$for_type}"]
13
- : '';
14
-
15
- $description_field_id = 'og-description-' . $for_type;
16
- $current_description = !empty($_view['options']["og-description-{$for_type}"])
17
- ? $_view['options']["og-description-{$for_type}"]
18
- : '';
19
-
20
- $images_field_id = 'og-images-' . $for_type;
21
- $current_images = !empty($_view['options']["og-images-{$for_type}"]) && is_array($_view['options']["og-images-{$for_type}"])
22
- ? $_view['options']["og-images-{$for_type}"]
23
- : array();
24
-
25
- $this->_render('onpage/onpage-social-meta-tags', array(
26
- 'for_type' => $for_type,
27
- 'section_enabled_field_id' => $section_enabled_field_id,
28
- 'section_enabled' => $section_enabled,
29
- 'section_title' => $section_title,
30
- 'section_description' => $section_description,
31
- 'option_name' => $option_name,
32
- 'title_field_id' => $title_field_id,
33
- 'current_title' => $current_title,
34
- 'description_field_id' => $description_field_id,
35
- 'current_description' => $current_description,
36
- 'images_field_id' => $images_field_id,
37
- 'current_images' => $current_images,
38
- ));
1
+ <?php
2
+ /**
3
+ * @var string $for_type
4
+ */
5
+ $section_enabled_field_id = 'og-active-' . $for_type;
6
+ $section_enabled = ! empty( $_view['options'][ $section_enabled_field_id ] ) ? $_view['options'][ $section_enabled_field_id ] : false;
7
+ $section_title = __( 'Enable OpenGraph', 'wds' );
8
+ $section_description = __( 'OpenGraph support enhances how your content appears when shared on social networks such as Facebook.', 'wds' );
9
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
10
+ $title_field_id = 'og-title-' . $for_type;
11
+ $current_title = ! empty( $_view['options']["og-title-{$for_type}"] )
12
+ ? $_view['options']["og-title-{$for_type}"]
13
+ : '';
14
+
15
+ $description_field_id = 'og-description-' . $for_type;
16
+ $current_description = ! empty( $_view['options']["og-description-{$for_type}"] )
17
+ ? $_view['options']["og-description-{$for_type}"]
18
+ : '';
19
+
20
+ $images_field_id = 'og-images-' . $for_type;
21
+ $current_images = ! empty( $_view['options']["og-images-{$for_type}"] ) && is_array( $_view['options']["og-images-{$for_type}"] )
22
+ ? $_view['options']["og-images-{$for_type}"]
23
+ : array();
24
+
25
+ $this->_render( 'onpage/onpage-social-meta-tags', array(
26
+ 'for_type' => $for_type,
27
+ 'section_enabled_field_id' => $section_enabled_field_id,
28
+ 'section_enabled' => $section_enabled,
29
+ 'section_title' => $section_title,
30
+ 'section_description' => $section_description,
31
+ 'option_name' => $option_name,
32
+ 'title_field_id' => $title_field_id,
33
+ 'current_title' => $current_title,
34
+ 'description_field_id' => $description_field_id,
35
+ 'current_description' => $current_description,
36
+ 'images_field_id' => $images_field_id,
37
+ 'current_images' => $current_images,
38
+ ) );
includes/admin/templates/onpage/onpage-og-twitter.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
- /**
3
- * @var string $for_type
4
- */
5
- $social_options = Smartcrawl_Settings::get_component_options(Smartcrawl_Settings::COMP_SOCIAL);
6
- $onpage_options = !empty($_view['options']) ? $_view['options'] : array();
7
-
8
- $og_enabled_field_id = 'og-active-' . esc_attr($for_type);
9
- $og_enabled_globally = smartcrawl_get_array_value($social_options, 'og-enable');
10
- $og_enabled_locally = !empty($onpage_options[$og_enabled_field_id]) ? $onpage_options[$og_enabled_field_id] : false;
11
-
12
- $twitter_enabled_field_id = 'twitter-active-' . esc_attr($for_type);
13
- $twitter_enabled_globally = smartcrawl_get_array_value($social_options, 'twitter-card-enable');
14
- $twitter_enabled_locally = !empty($onpage_options[$twitter_enabled_field_id]) ? $onpage_options[$twitter_enabled_field_id] : false;
15
- ?>
16
- <fieldset class="wds-table-fields-group wds-separator-top">
17
- <div class="wds-table-fields">
18
- <div class="label">
19
- <label class="wds-label">
20
- <?php esc_html_e('Options', 'wds'); ?>
21
- </label>
22
- </div>
23
- <div class="fields">
24
- <div class="wds-toggleable <?php echo $og_enabled_locally ? '' : 'inactive'; ?>">
25
- <?php
26
- if (!$og_enabled_globally) {
27
- $this->_render('onpage/onpage-og-disabled');
28
- } else {
29
- $this->_render('onpage/onpage-og-settings', array(
30
- 'for_type' => $for_type,
31
- ));
32
- }
33
- ?>
34
- </div>
35
- <p></p>
36
-
37
- <div class="wds-toggleable <?php echo $twitter_enabled_locally ? '' : 'inactive'; ?>">
38
- <?php
39
- if (!$twitter_enabled_globally) {
40
- $this->_render('onpage/onpage-twitter-disabled');
41
- } else {
42
- $this->_render('onpage/onpage-twitter-settings', array(
43
- 'for_type' => $for_type,
44
- ));
45
- }
46
- ?>
47
- </div>
48
- </div>
49
- </div>
50
- </fieldset>
1
+ <?php
2
+ /**
3
+ * @var string $for_type
4
+ */
5
+ $social_options = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_SOCIAL );
6
+ $onpage_options = ! empty( $_view['options'] ) ? $_view['options'] : array();
7
+
8
+ $og_enabled_field_id = 'og-active-' . esc_attr( $for_type );
9
+ $og_enabled_globally = smartcrawl_get_array_value( $social_options, 'og-enable' );
10
+ $og_enabled_locally = ! empty( $onpage_options[ $og_enabled_field_id ] ) ? $onpage_options[ $og_enabled_field_id ] : false;
11
+
12
+ $twitter_enabled_field_id = 'twitter-active-' . esc_attr( $for_type );
13
+ $twitter_enabled_globally = smartcrawl_get_array_value( $social_options, 'twitter-card-enable' );
14
+ $twitter_enabled_locally = ! empty( $onpage_options[ $twitter_enabled_field_id ] ) ? $onpage_options[ $twitter_enabled_field_id ] : false;
15
+ ?>
16
+ <fieldset class="wds-table-fields-group wds-separator-top">
17
+ <div class="wds-table-fields">
18
+ <div class="label">
19
+ <label class="wds-label">
20
+ <?php esc_html_e( 'Options', 'wds' ); ?>
21
+ </label>
22
+ </div>
23
+ <div class="fields">
24
+ <div class="wds-toggleable <?php echo $og_enabled_locally ? '' : 'inactive'; ?>">
25
+ <?php
26
+ if ( ! $og_enabled_globally ) {
27
+ $this->_render( 'onpage/onpage-og-disabled' );
28
+ } else {
29
+ $this->_render( 'onpage/onpage-og-settings', array(
30
+ 'for_type' => $for_type,
31
+ ) );
32
+ }
33
+ ?>
34
+ </div>
35
+ <p></p>
36
+
37
+ <div class="wds-toggleable <?php echo $twitter_enabled_locally ? '' : 'inactive'; ?>">
38
+ <?php
39
+ if ( ! $twitter_enabled_globally ) {
40
+ $this->_render( 'onpage/onpage-twitter-disabled' );
41
+ } else {
42
+ $this->_render( 'onpage/onpage-twitter-settings', array(
43
+ 'for_type' => $for_type,
44
+ ) );
45
+ }
46
+ ?>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </fieldset>
includes/admin/templates/onpage/onpage-preview.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
- $smartcrawl_options = Smartcrawl_Settings::get_options();
3
- $link = ! isset( $link ) ? home_url() : $link;
4
- $title = ! isset( $title ) ? smartcrawl_replace_vars( $smartcrawl_options['title-home'] ) : $title;
5
- $description = ! isset( $description ) ? smartcrawl_replace_vars( $smartcrawl_options['metadesc-home'] ) : $description;
6
- ?>
7
- <div class="wds-preview-container">
8
- <div class="wds-preview">
9
- <div class="wds-preview-title">
10
- <h3>
11
- <a href="<?php echo esc_url( $link ); ?>">
12
- <?php echo esc_html( $title ); ?>
13
- </a>
14
- </h3>
15
- </div>
16
- <div class="wds-preview-url">
17
- <a href="<?php echo esc_url( $link ); ?>">
18
- <?php echo esc_url( $link ); ?>
19
- </a>
20
- </div>
21
- <div class="wds-preview-meta">
22
- <?php echo esc_html( $description ); ?>
23
- </div>
24
- </div>
25
- <p class="wds-preview-description"><?php _e( 'A preview of how your title and meta will appear in Google Search.', 'wds' ); ?></p>
26
- </div>
1
+ <?php
2
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
3
+ $link = ! isset( $link ) ? home_url() : $link;
4
+ $title = ! isset( $title ) ? smartcrawl_replace_vars( $smartcrawl_options['title-home'] ) : $title;
5
+ $description = ! isset( $description ) ? smartcrawl_replace_vars( $smartcrawl_options['metadesc-home'] ) : $description;
6
+ ?>
7
+ <div class="wds-preview-container">
8
+ <div class="wds-preview">
9
+ <div class="wds-preview-title">
10
+ <h3>
11
+ <a href="<?php echo esc_url( $link ); ?>">
12
+ <?php echo esc_html( $title ); ?>
13
+ </a>
14
+ </h3>
15
+ </div>
16
+ <div class="wds-preview-url">
17
+ <a href="<?php echo esc_url( $link ); ?>">
18
+ <?php echo esc_url( $link ); ?>
19
+ </a>
20
+ </div>
21
+ <div class="wds-preview-meta">
22
+ <?php echo esc_html( $description ); ?>
23
+ </div>
24
+ </div>
25
+ <p class="wds-preview-description"><?php esc_html_e( 'A preview of how your title and meta will appear in Google Search.', 'wds' ); ?></p>
26
+ </div>
includes/admin/templates/onpage/onpage-section-404.php CHANGED
@@ -1,25 +1,27 @@
1
- <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
-
3
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
-
5
- <div class="wds-table-fields-group">
6
- <div class="wds-table-fields">
7
- <div class="label">
8
- <label for="title-404" class="wds-label"><?php esc_html_e( '404 Page Title' , 'wds' ); ?></label>
9
- </div>
10
- <div class="fields wds-allow-macros">
11
- <input id='title-404' name='<?php echo esc_attr( $option_name ); ?>[title-404]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-404'] ); ?>'>
12
- </div>
13
- </div>
14
- </div>
15
-
16
- <div class="wds-table-fields-group">
17
- <div class="wds-table-fields">
18
- <div class="label">
19
- <label for="metadesc-404" class="wds-label"><?php esc_html_e( '404 Page Description' , 'wds' ); ?></label>
20
- </div>
21
- <div class="fields wds-allow-macros">
22
- <textarea id='metadesc-404' name='<?php echo esc_attr( $option_name ); ?>[metadesc-404]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-404'] ); ?></textarea>
23
- </div>
24
- </div>
25
- </div>
 
 
1
+ <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
+
3
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
+
5
+ <div class="wds-table-fields-group">
6
+ <div class="wds-table-fields">
7
+ <div class="label">
8
+ <label for="title-404" class="wds-label"><?php esc_html_e( '404 Page Title', 'wds' ); ?></label>
9
+ </div>
10
+ <div class="fields wds-allow-macros">
11
+ <input id='title-404' name='<?php echo esc_attr( $option_name ); ?>[title-404]' type='text'
12
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['title-404'] ); ?>'>
13
+ </div>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="wds-table-fields-group">
18
+ <div class="wds-table-fields">
19
+ <div class="label">
20
+ <label for="metadesc-404" class="wds-label"><?php esc_html_e( '404 Page Description', 'wds' ); ?></label>
21
+ </div>
22
+ <div class="fields wds-allow-macros">
23
+ <textarea id='metadesc-404' name='<?php echo esc_attr( $option_name ); ?>[metadesc-404]' type='text'
24
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-404'] ); ?></textarea>
25
+ </div>
26
+ </div>
27
+ </div>
includes/admin/templates/onpage/onpage-section-author-archive.php CHANGED
@@ -1,40 +1,43 @@
1
- <?php
2
- $option_name = empty( $option_name ) ? '' : $option_name;
3
- $meta_robots_author = empty( $meta_robots_author ) ? '' : $meta_robots_author;
4
- ?>
5
-
6
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
-
8
- <div class="wds-table-fields-group">
9
- <div class="wds-table-fields">
10
- <div class="label">
11
- <label for="title-author" class="wds-label"><?php esc_html_e( 'Author Archive Title' , 'wds' ); ?></label>
12
- </div>
13
- <div class="fields wds-allow-macros">
14
- <input id='title-author' name='<?php echo esc_attr( $option_name ); ?>[title-author]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-author'] ); ?>'>
15
- </div>
16
- </div>
17
- </div>
18
-
19
- <div class="wds-table-fields-group">
20
- <div class="wds-table-fields">
21
- <div class="label">
22
- <label for="metadesc-author" class="wds-label"><?php _e( 'Author Archive Meta Description' , 'wds' ); ?></label>
23
- </div>
24
- <div class="fields wds-allow-macros">
25
- <textarea id='metadesc-author' name='<?php echo esc_attr( $option_name ); ?>[metadesc-author]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-author'] ); ?></textarea>
26
- </div>
27
- </div>
28
- </div>
29
-
30
- <?php
31
- $this->_render('onpage/onpage-og-twitter', array(
32
- 'for_type' => 'author',
33
- ));
34
- ?>
35
-
36
- <?php
37
- $this->_render('onpage/onpage-meta-robots', array(
38
- 'items' => $meta_robots_author,
39
- ));
40
- ?>
 
 
 
1
+ <?php
2
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
+ $meta_robots_author = empty( $meta_robots_author ) ? '' : $meta_robots_author;
4
+ ?>
5
+
6
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
+
8
+ <div class="wds-table-fields-group">
9
+ <div class="wds-table-fields">
10
+ <div class="label">
11
+ <label for="title-author" class="wds-label"><?php esc_html_e( 'Author Archive Title', 'wds' ); ?></label>
12
+ </div>
13
+ <div class="fields wds-allow-macros">
14
+ <input id='title-author' name='<?php echo esc_attr( $option_name ); ?>[title-author]' type='text'
15
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['title-author'] ); ?>'>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="wds-table-fields-group">
21
+ <div class="wds-table-fields">
22
+ <div class="label">
23
+ <label for="metadesc-author"
24
+ class="wds-label"><?php esc_html_e( 'Author Archive Meta Description', 'wds' ); ?></label>
25
+ </div>
26
+ <div class="fields wds-allow-macros">
27
+ <textarea id='metadesc-author' name='<?php echo esc_attr( $option_name ); ?>[metadesc-author]' type='text'
28
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-author'] ); ?></textarea>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <?php
34
+ $this->_render( 'onpage/onpage-og-twitter', array(
35
+ 'for_type' => 'author',
36
+ ) );
37
+ ?>
38
+
39
+ <?php
40
+ $this->_render( 'onpage/onpage-meta-robots', array(
41
+ 'items' => $meta_robots_author,
42
+ ) );
43
+ ?>
includes/admin/templates/onpage/onpage-section-buddypress-groups.php CHANGED
@@ -1,25 +1,31 @@
1
- <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
-
3
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
-
5
- <div class="wds-table-fields-group">
6
- <div class="wds-table-fields">
7
- <div class="label">
8
- <label for="title-bp_groups" class="wds-label"><?php esc_html_e( 'BuddyPress Group Title' , 'wds' ); ?></label>
9
- </div>
10
- <div class="fields wds-allow-macros">
11
- <input id='title-bp_groups' name='<?php echo esc_attr( $option_name ); ?>[title-bp_groups]' size='' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-bp_groups'] ); ?>'>
12
- </div>
13
- </div>
14
- </div>
15
-
16
- <div class="wds-table-fields-group">
17
- <div class="wds-table-fields">
18
- <div class="label">
19
- <label for="metadesc-bp_groups" class="wds-label"><?php esc_html_e( 'BuddyPress Group Meta Description' , 'wds' ); ?></label>
20
- </div>
21
- <div class="fields wds-allow-macros">
22
- <textarea id='metadesc-bp_groups' name='<?php echo esc_attr( $option_name ); ?>[metadesc-bp_groups]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-bp_groups'] ); ?></textarea>
23
- </div>
24
- </div>
25
- </div>
 
 
 
 
 
 
1
+ <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
+
3
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
+
5
+ <div class="wds-table-fields-group">
6
+ <div class="wds-table-fields">
7
+ <div class="label">
8
+ <label for="title-bp_groups"
9
+ class="wds-label"><?php esc_html_e( 'BuddyPress Group Title', 'wds' ); ?></label>
10
+ </div>
11
+ <div class="fields wds-allow-macros">
12
+ <input id='title-bp_groups' name='<?php echo esc_attr( $option_name ); ?>[title-bp_groups]' size=''
13
+ type='text' class='wds-field'
14
+ value='<?php echo esc_attr( $_view['options']['title-bp_groups'] ); ?>'>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="wds-table-fields-group">
20
+ <div class="wds-table-fields">
21
+ <div class="label">
22
+ <label for="metadesc-bp_groups"
23
+ class="wds-label"><?php esc_html_e( 'BuddyPress Group Meta Description', 'wds' ); ?></label>
24
+ </div>
25
+ <div class="fields wds-allow-macros">
26
+ <textarea id='metadesc-bp_groups' name='<?php echo esc_attr( $option_name ); ?>[metadesc-bp_groups]'
27
+ type='text'
28
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-bp_groups'] ); ?></textarea>
29
+ </div>
30
+ </div>
31
+ </div>
includes/admin/templates/onpage/onpage-section-buddypress-profile.php CHANGED
@@ -1,25 +1,31 @@
1
- <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
-
3
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
-
5
- <div class="wds-table-fields-group">
6
- <div class="wds-table-fields">
7
- <div class="label">
8
- <label for="title-bp_profile" class="wds-label"><?php esc_html_e( 'BuddyPress Profile Title' , 'wds' ); ?></label>
9
- </div>
10
- <div class="fields wds-allow-macros">
11
- <input id='title-bp_profile' name='<?php echo esc_attr( $option_name ); ?>[title-bp_profile]' size='' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-bp_profile'] ); ?>'>
12
- </div>
13
- </div>
14
- </div>
15
-
16
- <div class="wds-table-fields-group">
17
- <div class="wds-table-fields">
18
- <div class="label">
19
- <label for="metadesc-bp_profile" class="wds-label"><?php _e( 'BuddyPress Profile<br> Meta Description' , 'wds' ); ?></label>
20
- </div>
21
- <div class="fields wds-allow-macros">
22
- <textarea id='metadesc-bp_profile' name='<?php echo esc_attr( $option_name ); ?>[metadesc-bp_profile]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-bp_profile'] ); ?></textarea>
23
- </div>
24
- </div>
25
- </div>
 
 
 
 
 
 
1
+ <?php $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name']; ?>
2
+
3
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
4
+
5
+ <div class="wds-table-fields-group">
6
+ <div class="wds-table-fields">
7
+ <div class="label">
8
+ <label for="title-bp_profile"
9
+ class="wds-label"><?php esc_html_e( 'BuddyPress Profile Title', 'wds' ); ?></label>
10
+ </div>
11
+ <div class="fields wds-allow-macros">
12
+ <input id='title-bp_profile' name='<?php echo esc_attr( $option_name ); ?>[title-bp_profile]' size=''
13
+ type='text' class='wds-field'
14
+ value='<?php echo esc_attr( $_view['options']['title-bp_profile'] ); ?>'>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="wds-table-fields-group">
20
+ <div class="wds-table-fields">
21
+ <div class="label">
22
+ <label for="metadesc-bp_profile"
23
+ class="wds-label"><?php esc_html_e( 'BuddyPress Profile Meta Description', 'wds' ); ?></label>
24
+ </div>
25
+ <div class="fields wds-allow-macros">
26
+ <textarea id='metadesc-bp_profile' name='<?php echo esc_attr( $option_name ); ?>[metadesc-bp_profile]'
27
+ type='text'
28
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-bp_profile'] ); ?></textarea>
29
+ </div>
30
+ </div>
31
+ </div>
includes/admin/templates/onpage/onpage-section-date-archive.php CHANGED
@@ -1,40 +1,43 @@
1
- <?php
2
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
- $meta_robots_date = empty( $meta_robots_date ) ? array() : $meta_robots_date;
4
- ?>
5
-
6
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
-
8
- <div class="wds-table-fields-group">
9
- <div class="wds-table-fields">
10
- <div class="label">
11
- <label for="title-date" class="wds-label"><?php esc_html_e( 'Date Archives Title' , 'wds' ); ?></label>
12
- </div>
13
- <div class="fields wds-allow-macros">
14
- <input id='title-date' name='<?php echo esc_attr( $option_name ); ?>[title-date]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-date'] ); ?>'>
15
- </div>
16
- </div>
17
- </div>
18
-
19
- <div class="wds-table-fields-group">
20
- <div class="wds-table-fields">
21
- <div class="label">
22
- <label for="metadesc-date" class="wds-label"><?php _e( 'Date Archives Meta Description' , 'wds' ); ?></label>
23
- </div>
24
- <div class="fields wds-allow-macros">
25
- <textarea id='metadesc-date' name='<?php echo esc_attr( $option_name ); ?>[metadesc-date]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-date'] ); ?></textarea>
26
- </div>
27
- </div>
28
- </div>
29
-
30
- <?php
31
- $this->_render('onpage/onpage-og-twitter', array(
32
- 'for_type' => 'date',
33
- ));
34
- ?>
35
-
36
- <?php
37
- $this->_render('onpage/onpage-meta-robots', array(
38
- 'items' => $meta_robots_date,
39
- ));
40
- ?>
 
 
 
1
+ <?php
2
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
+ $meta_robots_date = empty( $meta_robots_date ) ? array() : $meta_robots_date;
4
+ ?>
5
+
6
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
+
8
+ <div class="wds-table-fields-group">
9
+ <div class="wds-table-fields">
10
+ <div class="label">
11
+ <label for="title-date" class="wds-label"><?php esc_html_e( 'Date Archives Title', 'wds' ); ?></label>
12
+ </div>
13
+ <div class="fields wds-allow-macros">
14
+ <input id='title-date' name='<?php echo esc_attr( $option_name ); ?>[title-date]' type='text'
15
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['title-date'] ); ?>'>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="wds-table-fields-group">
21
+ <div class="wds-table-fields">
22
+ <div class="label">
23
+ <label for="metadesc-date"
24
+ class="wds-label"><?php esc_html_e( 'Date Archives Meta Description', 'wds' ); ?></label>
25
+ </div>
26
+ <div class="fields wds-allow-macros">
27
+ <textarea id='metadesc-date' name='<?php echo esc_attr( $option_name ); ?>[metadesc-date]' type='text'
28
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-date'] ); ?></textarea>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <?php
34
+ $this->_render( 'onpage/onpage-og-twitter', array(
35
+ 'for_type' => 'date',
36
+ ) );
37
+ ?>
38
+
39
+ <?php
40
+ $this->_render( 'onpage/onpage-meta-robots', array(
41
+ 'items' => $meta_robots_date,
42
+ ) );
43
+ ?>
includes/admin/templates/onpage/onpage-section-homepage.php CHANGED
@@ -1,91 +1,99 @@
1
- <?php
2
- $homepage_title = empty( $homepage_title ) ? '' : $homepage_title;
3
- $homepage_description = empty( $homepage_description ) ? '' : $homepage_description;
4
- $show_homepage_options = empty( $show_homepage_options ) ? '' : $show_homepage_options;
5
- $meta_robots_main_blog_archive = empty( $meta_robots_main_blog_archive ) ? '' : $meta_robots_main_blog_archive;
6
- $option_name = empty( $_view['option_name'] ) ? '' : '';
7
- ?>
8
-
9
- <?php
10
- $this->_render(
11
- 'onpage/onpage-preview',
12
- array(
13
- 'link' => home_url(),
14
- 'title' => smartcrawl_replace_vars( $homepage_title, array() ),
15
- 'description' => smartcrawl_replace_vars( $homepage_description, array() ),
16
- )
17
- );
18
- ?>
19
-
20
- <?php if ( $show_homepage_options ) : ?>
21
-
22
- <div class="wds-table-fields-group">
23
- <div class="wds-table-fields">
24
- <div class="label">
25
- <label for="title-homepage" class="wds-label"><?php esc_html_e( 'Page Title' , 'wds' ); ?></label>
26
- </div>
27
- <div class="fields wds-allow-macros">
28
- <input id='title-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[title-home]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-home'] ); ?>'>
29
- </div>
30
- </div>
31
- </div>
32
-
33
- <div class="wds-table-fields-group">
34
- <div class="wds-table-fields">
35
- <div class="label">
36
- <label for="metadesc-homepage" class="wds-label"><?php esc_html_e( 'Page Description' , 'wds' ); ?></label>
37
- </div>
38
- <div class="fields wds-allow-macros">
39
- <textarea id='metadesc-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[metadesc-home]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-home'] ); ?></textarea>
40
- </div>
41
- </div>
42
- </div>
43
-
44
- <div class="wds-table-fields-group">
45
- <div class="wds-table-fields">
46
- <div class="label">
47
- <label for="metakeywords-homepage" class="wds-label"><?php esc_html_e( 'Page Keywords' , 'wds' ); ?></label>
48
- </div>
49
- <div class="fields fields-with-legend">
50
- <input id='metakeywords-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[keywords-home]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['keywords-home'] ); ?>'>
51
- <span class="wds-field-legend"><?php echo sprintf( '%s <pre class="wds-pre wds-pre-inline">%s</pre>' , __( 'Comma-separated keywords, e.g.', 'wds' ), __( 'word1, word2', 'wds' ) ); ?></span>
52
- </div>
53
- </div>
54
- </div>
55
-
56
- <?php
57
- $this->_render('onpage/onpage-og-twitter', array(
58
- 'for_type' => 'home',
59
- ));
60
- ?>
61
-
62
- <?php
63
- $this->_render('onpage/onpage-meta-robots', array(
64
- 'items' => $meta_robots_main_blog_archive,
65
- ));
66
- ?>
67
-
68
- <?php else : ?>
69
-
70
- <?php
71
- $front_page = (int) get_option( 'page_on_front' );
72
- $edit_link = sprintf(
73
- '<a href="' . get_edit_post_link( $front_page ) . '">%s</a>',
74
- __( 'here', 'wds' )
75
- );
76
- ?>
77
- <div class="wds-notice wds-notice-info">
78
- <p>
79
- <?php
80
- if ( $front_page ) {
81
- printf(
82
- __( 'Your homepage is set to a static page. Configure your homepage SEO via the page itself %s.', 'wds' ),
83
- $edit_link
84
- );
85
- } else {
86
- esc_html_e( 'Your homepage is set to a static page. Configure your homepage SEO via the page itself.', 'wds' );
87
- }
88
- ?>
89
- </p>
90
- </div>
91
- <?php endif; ?>
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $homepage_title = empty( $homepage_title ) ? '' : $homepage_title;
3
+ $homepage_description = empty( $homepage_description ) ? '' : $homepage_description;
4
+ $show_homepage_options = empty( $show_homepage_options ) ? '' : $show_homepage_options;
5
+ $meta_robots_main_blog_archive = empty( $meta_robots_main_blog_archive ) ? '' : $meta_robots_main_blog_archive;
6
+ $option_name = empty( $_view['option_name'] ) ? '' : '';
7
+ ?>
8
+
9
+ <?php
10
+ $this->_render(
11
+ 'onpage/onpage-preview',
12
+ array(
13
+ 'link' => home_url(),
14
+ 'title' => smartcrawl_replace_vars( $homepage_title, array() ),
15
+ 'description' => smartcrawl_replace_vars( $homepage_description, array() ),
16
+ )
17
+ );
18
+ ?>
19
+
20
+ <?php if ( $show_homepage_options ) : ?>
21
+
22
+ <div class="wds-table-fields-group">
23
+ <div class="wds-table-fields">
24
+ <div class="label">
25
+ <label for="title-homepage" class="wds-label"><?php esc_html_e( 'Page Title', 'wds' ); ?></label>
26
+ </div>
27
+ <div class="fields wds-allow-macros">
28
+ <input id='title-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[title-home]'
29
+ type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-home'] ); ?>'>
30
+ </div>
31
+ </div>
32
+ </div>
33
+
34
+ <div class="wds-table-fields-group">
35
+ <div class="wds-table-fields">
36
+ <div class="label">
37
+ <label for="metadesc-homepage"
38
+ class="wds-label"><?php esc_html_e( 'Page Description', 'wds' ); ?></label>
39
+ </div>
40
+ <div class="fields wds-allow-macros">
41
+ <textarea id='metadesc-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[metadesc-home]'
42
+ type='text'
43
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-home'] ); ?></textarea>
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="wds-table-fields-group">
49
+ <div class="wds-table-fields">
50
+ <div class="label">
51
+ <label for="metakeywords-homepage"
52
+ class="wds-label"><?php esc_html_e( 'Page Keywords', 'wds' ); ?></label>
53
+ </div>
54
+ <div class="fields fields-with-legend">
55
+ <input id='metakeywords-homepage' name='<?php echo esc_attr( $_view['option_name'] ); ?>[keywords-home]'
56
+ type='text' class='wds-field'
57
+ value='<?php echo esc_attr( $_view['options']['keywords-home'] ); ?>'>
58
+ <span
59
+ class="wds-field-legend"><?php echo sprintf( '%s <pre class="wds-pre wds-pre-inline">%s</pre>', esc_html__( 'Comma-separated keywords, e.g.', 'wds' ), esc_html__( 'word1, word2', 'wds' ) ); ?></span>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <?php
65
+ $this->_render( 'onpage/onpage-og-twitter', array(
66
+ 'for_type' => 'home',
67
+ ) );
68
+ ?>
69
+
70
+ <?php
71
+ $this->_render( 'onpage/onpage-meta-robots', array(
72
+ 'items' => $meta_robots_main_blog_archive,
73
+ ) );
74
+ ?>
75
+
76
+ <?php else : ?>
77
+
78
+ <?php
79
+ $front_page = (int) get_option( 'page_on_front' );
80
+ $edit_link = sprintf(
81
+ '<a href="' . get_edit_post_link( $front_page ) . '">%s</a>',
82
+ __( 'here', 'wds' )
83
+ );
84
+ ?>
85
+ <div class="wds-notice wds-notice-info">
86
+ <p>
87
+ <?php
88
+ if ( $front_page ) {
89
+ printf(
90
+ esc_html__( 'Your homepage is set to a static page. Configure your homepage SEO via the page itself %s.', 'wds' ),
91
+ wp_kses_post( $edit_link )
92
+ );
93
+ } else {
94
+ esc_html_e( 'Your homepage is set to a static page. Configure your homepage SEO via the page itself.', 'wds' );
95
+ }
96
+ ?>
97
+ </p>
98
+ </div>
99
+ <?php endif; ?>
includes/admin/templates/onpage/onpage-section-post-type-archive.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
+ $archive_post_type = empty( $archive_post_type ) ? '' : $archive_post_type;
4
+ $archive_post_type_label = empty( $archive_post_type_label ) ? '' : $archive_post_type_label;
5
+ $archive_post_type_robots = empty( $archive_post_type_robots ) ? '' : $archive_post_type_robots;
6
+
7
+ $title_key = 'title-' . $archive_post_type;
8
+ $title_value = smartcrawl_get_array_value( $_view['options'], $title_key );
9
+
10
+ $metadesc_key = 'metadesc-' . $archive_post_type;
11
+ $metadesc_value = smartcrawl_get_array_value( $_view['options'], $metadesc_key );
12
+ ?>
13
+
14
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
15
+
16
+ <div class="wds-table-fields-group">
17
+ <div class="wds-table-fields">
18
+ <div class="label">
19
+ <label for="<?php echo esc_attr( $title_key ); ?>" class="wds-label">
20
+ <?php echo esc_html( $archive_post_type_label ) . esc_html__( ' Archive Title', 'wds' ); ?>
21
+ </label>
22
+ </div>
23
+ <div class="fields wds-allow-macros">
24
+ <input id='<?php echo esc_attr( $title_key ); ?>'
25
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $title_key ); ?>]'
26
+ type='text' class='wds-field'
27
+ value='<?php echo esc_attr( $title_value ); ?>'>
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="wds-table-fields-group">
33
+ <div class="wds-table-fields">
34
+ <div class="label">
35
+ <label for="<?php echo esc_attr( $metadesc_key ); ?>" class="wds-label">
36
+ <?php echo esc_html( $archive_post_type_label ) . esc_html__( ' Archive Meta Description', 'wds' ); ?>
37
+ </label>
38
+ </div>
39
+ <div class="fields wds-allow-macros">
40
+ <textarea id='<?php echo esc_attr( $metadesc_key ); ?>'
41
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $metadesc_key ); ?>]'
42
+ type='text' class='wds-field'><?php echo esc_textarea( $metadesc_value ); ?></textarea>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <?php
48
+ $this->_render( 'onpage/onpage-og-twitter', array(
49
+ 'for_type' => $archive_post_type,
50
+ ) );
51
+ ?>
52
+
53
+ <?php
54
+ $this->_render( 'onpage/onpage-meta-robots', array(
55
+ 'items' => $archive_post_type_robots,
56
+ ) );
57
+ ?>
includes/admin/templates/onpage/onpage-section-post-type.php CHANGED
@@ -1,41 +1,50 @@
1
- <?php
2
- $post_type = empty( $post_type ) ? '' : $post_type;
3
- $post_type_object = empty( $post_type_object ) ? '' : $post_type_object;
4
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
5
- ?>
6
-
7
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
8
-
9
- <div class="wds-table-fields-group">
10
- <div class="wds-table-fields">
11
- <div class="label">
12
- <label for="title-<?php echo $post_type; ?>" class="wds-label"><?php printf( esc_html( __( '%s Title' , 'wds' ) ), esc_html( $post_type_object->labels->singular_name ) ); ?></label>
13
- </div>
14
- <div class="fields wds-allow-macros">
15
- <input id='title-<?php echo $post_type; ?>' name='<?php echo esc_attr( $option_name ); ?>[title-<?php echo $post_type; ?>]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options'][ 'title-' . $post_type ] ); ?>'>
16
- </div>
17
- </div>
18
- </div>
19
-
20
- <div class="wds-table-fields-group">
21
- <div class="wds-table-fields">
22
- <div class="label">
23
- <label for="metadesc-<?php echo $post_type; ?>" class="wds-label"><?php printf( esc_html( __( '%s Meta Description' , 'wds' ) ), esc_html( $post_type_object->labels->singular_name ) ); ?></label>
24
- </div>
25
- <div class="fields wds-allow-macros">
26
- <textarea id='metadesc-<?php echo $post_type; ?>' name='<?php echo esc_attr( $option_name ); ?>[metadesc-<?php echo $post_type; ?>]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options'][ 'metadesc-' . $post_type ] ); ?></textarea>
27
- </div>
28
- </div>
29
-
30
- <?php
31
- $this->_render('onpage/onpage-meta-robots', array(
32
- 'items' => $post_type_robots,
33
- ));
34
- ?>
35
-
36
- <?php
37
- $this->_render('onpage/onpage-og-twitter', array(
38
- 'for_type' => $post_type,
39
- ));
40
- ?>
41
- </div>
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $post_type = empty( $post_type ) ? '' : $post_type;
3
+ $post_type_object = empty( $post_type_object ) ? '' : $post_type_object;
4
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
5
+ ?>
6
+
7
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
8
+
9
+ <div class="wds-table-fields-group">
10
+ <div class="wds-table-fields">
11
+ <div class="label">
12
+ <label for="title-<?php echo esc_attr( $post_type ); ?>"
13
+ class="wds-label"><?php printf( esc_html( __( '%s Title', 'wds' ) ), esc_html( $post_type_object->labels->singular_name ) ); ?></label>
14
+ </div>
15
+ <div class="fields wds-allow-macros">
16
+ <input id='title-<?php echo esc_attr( $post_type ); ?>'
17
+ name='<?php echo esc_attr( $option_name ); ?>[title-<?php echo esc_attr( $post_type ); ?>]'
18
+ type='text'
19
+ class='wds-field'
20
+ value='<?php echo esc_attr( $_view['options'][ 'title-' . $post_type ] ); ?>'>
21
+ </div>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="wds-table-fields-group">
26
+ <div class="wds-table-fields">
27
+ <div class="label">
28
+ <label for="metadesc-<?php echo esc_attr( $post_type ); ?>"
29
+ class="wds-label"><?php printf( esc_html( __( '%s Meta Description', 'wds' ) ), esc_html( $post_type_object->labels->singular_name ) ); ?></label>
30
+ </div>
31
+ <div class="fields wds-allow-macros">
32
+ <textarea id='metadesc-<?php echo esc_attr( $post_type ); ?>'
33
+ name='<?php echo esc_attr( $option_name ); ?>[metadesc-<?php echo esc_attr( $post_type ); ?>]'
34
+ type='text'
35
+ class='wds-field'><?php echo esc_textarea( $_view['options'][ 'metadesc-' . $post_type ] ); ?></textarea>
36
+ </div>
37
+ </div>
38
+
39
+ <?php
40
+ $this->_render( 'onpage/onpage-og-twitter', array(
41
+ 'for_type' => $post_type,
42
+ ) );
43
+ ?>
44
+
45
+ <?php
46
+ $this->_render( 'onpage/onpage-meta-robots', array(
47
+ 'items' => $post_type_robots,
48
+ ) );
49
+ ?>
50
+ </div>
includes/admin/templates/onpage/onpage-section-search.php CHANGED
@@ -1,40 +1,43 @@
1
- <?php
2
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
- $meta_robots_search = empty( $meta_robots_search ) ? array() : $meta_robots_search;
4
- ?>
5
-
6
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
-
8
- <div class="wds-table-fields-group">
9
- <div class="wds-table-fields">
10
- <div class="label">
11
- <label for="title-search" class="wds-label"><?php esc_html_e( 'Search Page Title' , 'wds' ); ?></label>
12
- </div>
13
- <div class="fields wds-allow-macros">
14
- <input id='title-search' name='<?php echo esc_attr( $option_name ); ?>[title-search]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options']['title-search'] ); ?>'>
15
- </div>
16
- </div>
17
- </div>
18
-
19
- <div class="wds-table-fields-group">
20
- <div class="wds-table-fields">
21
- <div class="label">
22
- <label for="metadesc-search" class="wds-label"><?php esc_html_e( 'Search Page Meta Description' , 'wds' ); ?></label>
23
- </div>
24
- <div class="fields wds-allow-macros">
25
- <textarea id='metadesc-search' name='<?php echo esc_attr( $option_name ); ?>[metadesc-search]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-search'] ); ?></textarea>
26
- </div>
27
- </div>
28
- </div>
29
-
30
- <?php
31
- $this->_render('onpage/onpage-og-twitter', array(
32
- 'for_type' => 'search',
33
- ));
34
- ?>
35
-
36
- <?php
37
- $this->_render('onpage/onpage-meta-robots', array(
38
- 'items' => $meta_robots_search,
39
- ));
40
- ?>
 
 
 
1
+ <?php
2
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
3
+ $meta_robots_search = empty( $meta_robots_search ) ? array() : $meta_robots_search;
4
+ ?>
5
+
6
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
7
+
8
+ <div class="wds-table-fields-group">
9
+ <div class="wds-table-fields">
10
+ <div class="label">
11
+ <label for="title-search" class="wds-label"><?php esc_html_e( 'Search Page Title', 'wds' ); ?></label>
12
+ </div>
13
+ <div class="fields wds-allow-macros">
14
+ <input id='title-search' name='<?php echo esc_attr( $option_name ); ?>[title-search]' type='text'
15
+ class='wds-field' value='<?php echo esc_attr( $_view['options']['title-search'] ); ?>'>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="wds-table-fields-group">
21
+ <div class="wds-table-fields">
22
+ <div class="label">
23
+ <label for="metadesc-search"
24
+ class="wds-label"><?php esc_html_e( 'Search Page Meta Description', 'wds' ); ?></label>
25
+ </div>
26
+ <div class="fields wds-allow-macros">
27
+ <textarea id='metadesc-search' name='<?php echo esc_attr( $option_name ); ?>[metadesc-search]' type='text'
28
+ class='wds-field'><?php echo esc_textarea( $_view['options']['metadesc-search'] ); ?></textarea>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <?php
34
+ $this->_render( 'onpage/onpage-og-twitter', array(
35
+ 'for_type' => 'search',
36
+ ) );
37
+ ?>
38
+
39
+ <?php
40
+ $this->_render( 'onpage/onpage-meta-robots', array(
41
+ 'items' => $meta_robots_search,
42
+ ) );
43
+ ?>
includes/admin/templates/onpage/onpage-section-settings.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php $separators = empty( $separators ) ? array() : $separators; ?>
2
- <div class="wds-table-fields-group">
3
- <div class="wds-table-fields">
4
- <div class="label">
5
- <label for="separator" class="wds-label"><?php esc_html_e( 'Separator' , 'wds' ); ?></label>
6
- <p class="wds-label-description">
7
- <?php _e( 'The separator refers to the break between variables which you can use by referencing the %1$%sep%1$% tag. You can choose a preset one or bake your own.', 'wds' ); ?>
8
- </p>
9
- </div>
10
- <div class="fields">
11
- <div class="wds-preset-separators">
12
- <?php foreach ( $separators as $key => $separator ) : ?>
13
- <input
14
- type="radio"
15
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[preset-separator]"
16
- id="separator-<?php echo esc_attr( $key ); ?>"
17
- value="<?php echo esc_attr( $key ); ?>"
18
- autocomplete="off"
19
- <?php echo $_view['options']['preset-separator'] == $key ? 'checked="checked"' : ''; ?> />
20
- <label class="separator-selector" for="separator-<?php echo esc_attr( $key ); ?>">
21
- <?php echo esc_html( $separator ); ?>
22
- </label>
23
- <?php endforeach; ?>
24
- </div>
25
- <p class="wds-custom-separator-message"><?php _e( 'Or, choose your own custom separator.', 'wds' ) ?></p>
26
- <input
27
- id='separator'
28
- placeholder="<?php _e( 'Enter custom separator', 'wds' ); ?>"
29
- name='<?php echo esc_attr( $_view['option_name'] ); ?>[separator]'
30
- type='text'
31
- class='wds-field'
32
- value='<?php echo esc_attr( $_view['options']['separator'] ); ?>' />
33
- </div>
34
- </div>
35
- </div>
1
+ <?php $separators = empty( $separators ) ? array() : $separators; ?>
2
+ <div class="wds-table-fields-group">
3
+ <div class="wds-table-fields">
4
+ <div class="label">
5
+ <label for="separator" class="wds-label"><?php esc_html_e( 'Separator', 'wds' ); ?></label>
6
+ <p class="wds-label-description">
7
+ <?php esc_html_e( 'The separator refers to the break between variables which you can use by referencing the %%sep%% tag. You can choose a preset one or bake your own.', 'wds' ); ?>
8
+ </p>
9
+ </div>
10
+ <div class="fields">
11
+ <div class="wds-preset-separators">
12
+ <?php foreach ( $separators as $key => $separator ) : ?>
13
+ <input
14
+ type="radio"
15
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[preset-separator]"
16
+ id="separator-<?php echo esc_attr( $key ); ?>"
17
+ value="<?php echo esc_attr( $key ); ?>"
18
+ autocomplete="off"
19
+ <?php echo $_view['options']['preset-separator'] === $key ? 'checked="checked"' : ''; ?> />
20
+ <label class="separator-selector" for="separator-<?php echo esc_attr( $key ); ?>">
21
+ <?php echo esc_html( $separator ); ?>
22
+ </label>
23
+ <?php endforeach; ?>
24
+ </div>
25
+ <p class="wds-custom-separator-message"><?php esc_html_e( 'Or, choose your own custom separator.', 'wds' ); ?></p>
26
+ <input
27
+ id='separator'
28
+ placeholder="<?php esc_attr_e( 'Enter custom separator', 'wds' ); ?>"
29
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[separator]'
30
+ type='text'
31
+ class='wds-field'
32
+ value='<?php echo esc_attr( $_view['options']['separator'] ); ?>'/>
33
+ </div>
34
+ </div>
35
+ </div>
includes/admin/templates/onpage/onpage-section-taxonomy.php CHANGED
@@ -1,41 +1,49 @@
1
- <?php
2
- $taxonomy = empty( $taxonomy ) ? new stdClass() : $taxonomy;
3
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
4
- $meta_robots = empty( $meta_robots ) ? array() : $meta_robots;
5
- ?>
6
-
7
- <?php $this->_render( 'onpage/onpage-preview' ); ?>
8
-
9
- <div class="wds-table-fields-group">
10
- <div class="wds-table-fields">
11
- <div class="label">
12
- <label for="title-<?php echo $taxonomy->name; ?>" class="wds-label"><?php printf( esc_html( __( '%s Title' , 'wds' ) ), esc_html( ucfirst( $taxonomy->label ) ) ); ?></label>
13
- </div>
14
- <div class="fields wds-allow-macros">
15
- <input id='title-<?php echo $taxonomy->name; ?>' name='<?php echo esc_attr( $option_name ); ?>[title-<?php echo $taxonomy->name; ?>]' type='text' class='wds-field' value='<?php echo esc_attr( $_view['options'][ 'title-' . $taxonomy->name ] ); ?>'>
16
- </div>
17
- </div>
18
- </div>
19
-
20
- <div class="wds-table-fields-group">
21
- <div class="wds-table-fields">
22
- <div class="label">
23
- <label for="metadesc-<?php echo $taxonomy->name; ?>" class="wds-label"><?php printf( esc_html( __( '%s Meta Description' , 'wds' ) ), esc_html( ucfirst( $taxonomy->label ) ) ); ?></label>
24
- </div>
25
- <div class="fields wds-allow-macros">
26
- <textarea id='metadesc-<?php echo $taxonomy->name; ?>' name='<?php echo esc_attr( $option_name ); ?>[metadesc-<?php echo $taxonomy->name; ?>]' type='text' class='wds-field'><?php echo esc_textarea( $_view['options'][ 'metadesc-' . $taxonomy->name ] ); ?></textarea>
27
- </div>
28
- </div>
29
- </div>
30
-
31
- <?php
32
- $this->_render('onpage/onpage-og-twitter', array(
33
- 'for_type' => $taxonomy->name,
34
- ));
35
- ?>
36
-
37
- <?php
38
- $this->_render('onpage/onpage-meta-robots', array(
39
- 'items' => $meta_robots,
40
- ));
41
- ?>
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $taxonomy = empty( $taxonomy ) ? new stdClass() : $taxonomy;
3
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
4
+ $meta_robots = empty( $meta_robots ) ? array() : $meta_robots;
5
+ ?>
6
+
7
+ <?php $this->_render( 'onpage/onpage-preview' ); ?>
8
+
9
+ <div class="wds-table-fields-group">
10
+ <div class="wds-table-fields">
11
+ <div class="label">
12
+ <label for="title-<?php echo esc_attr( $taxonomy->name ); ?>"
13
+ class="wds-label"><?php printf( esc_html( __( '%s Title', 'wds' ) ), esc_html( ucfirst( $taxonomy->label ) ) ); ?></label>
14
+ </div>
15
+ <div class="fields wds-allow-macros">
16
+ <input id='title-<?php echo esc_attr( $taxonomy->name ); ?>'
17
+ name='<?php echo esc_attr( $option_name ); ?>[title-<?php echo esc_attr( $taxonomy->name ); ?>]'
18
+ type='text'
19
+ class='wds-field' value='<?php echo esc_attr( $_view['options'][ 'title-' . $taxonomy->name ] ); ?>'>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="wds-table-fields-group">
25
+ <div class="wds-table-fields">
26
+ <div class="label">
27
+ <label for="metadesc-<?php echo esc_attr( $taxonomy->name ); ?>"
28
+ class="wds-label"><?php printf( esc_html( __( '%s Meta Description', 'wds' ) ), esc_html( ucfirst( $taxonomy->label ) ) ); ?></label>
29
+ </div>
30
+ <div class="fields wds-allow-macros">
31
+ <textarea id='metadesc-<?php echo esc_attr( $taxonomy->name ); ?>'
32
+ name='<?php echo esc_attr( $option_name ); ?>[metadesc-<?php echo esc_attr( $taxonomy->name ); ?>]'
33
+ type='text'
34
+ class='wds-field'><?php echo esc_textarea( $_view['options'][ 'metadesc-' . $taxonomy->name ] ); ?></textarea>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <?php
40
+ $this->_render( 'onpage/onpage-og-twitter', array(
41
+ 'for_type' => $taxonomy->name,
42
+ ) );
43
+ ?>
44
+
45
+ <?php
46
+ $this->_render( 'onpage/onpage-meta-robots', array(
47
+ 'items' => $meta_robots,
48
+ ) );
49
+ ?>
includes/admin/templates/onpage/onpage-settings.php CHANGED
@@ -1,257 +1,263 @@
1
- <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
- <section id="header">
3
- <?php $this->_render( 'settings-message-top' ); ?>
4
- <div class="actions">
5
- <a href="#show-supported-macros-modal" rel="dialog" class="button button-small button-light actions-button"><?php esc_html_e( 'Browse Macros', 'wds' ); ?></a>
6
- </div>
7
- <h1><?php esc_html_e( 'Title & Meta' , 'wds' ); ?></h1>
8
- </section><!-- end header -->
9
-
10
- <dialog class="wds-modal" id="show-supported-macros-modal" title="<?php esc_html_e( 'Supported Macros', 'wds' ); ?>">
11
- <div id="wds-show-supported-macros">
12
- <table class="wds-data-table wds-data-table-inverse-large">
13
- <thead>
14
- <tr>
15
- <th class="label"><?php esc_html_e( 'Title' , 'wds' ); ?></th>
16
- <th class="result"><?php esc_html_e( 'Gets Replaced By' , 'wds' ); ?></th>
17
- </tr>
18
- </thead>
19
- <tfoot>
20
- <tr>
21
- <th class="label"><?php esc_html_e( 'Title' , 'wds' ); ?></th>
22
- <th class="result"><?php esc_html_e( 'Gets Replaced By' , 'wds' ); ?></th>
23
- </tr>
24
- </tfoot>
25
- <tbody>
26
-
27
- <?php foreach ( $macros as $macro => $label ) { ?>
28
- <tr>
29
- <td class="data data-small"><?php echo esc_html( $macro ); ?></td>
30
- <td class="data data-small"><?php echo esc_html( $label ); ?></td>
31
- </tr>
32
- <?php } ?>
33
-
34
- </tbody>
35
- </table>
36
- </div>
37
- </dialog><!-- end run-seo-analysis-modal -->
38
-
39
- <?php
40
- $smartcrawl_options = Smartcrawl_Settings::get_options();
41
- if ( ! smartcrawl_is_allowed_tab( $_view['slug'] ) ) {
42
- printf( __( "Your network admin prevented access to '%s', please move onto next step.", 'wds' ), __( 'Title & Meta' , 'wds' ) );
43
- } elseif ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
44
-
45
- ?>
46
- <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
47
- <?php settings_fields( $_view['option_name'] ); ?>
48
-
49
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1">
50
-
51
- <div class="vertical-tabs" id="page-title-meta-tabs">
52
- <?php
53
- /*
54
- * Homepage tab
55
- */
56
- $this->_render('vertical-tab', array(
57
- 'tab_id' => 'tab_homepage',
58
- 'tab_name' => __( 'Homepage', 'wds' ),
59
- 'is_active' => $active_tab == 'tab_homepage',
60
- 'tab_sections' => array(
61
- array(
62
- 'section_description' => __( 'Customize your homepage title, description and meta.', 'wds' ),
63
- 'section_type' => 'homepage',
64
- 'section_template' => 'onpage/onpage-section-homepage',
65
- 'section_args' => array(
66
- 'homepage_title' => $homepage_title,
67
- 'homepage_description' => $homepage_description,
68
- 'show_homepage_options' => $show_homepage_options,
69
- 'meta_robots_main_blog_archive' => $meta_robots_main_blog_archive,
70
- ),
71
- ),
72
- ),
73
- ));
74
-
75
- /*
76
- * Post types tab
77
- */
78
- $post_type_sections = array();
79
- foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
80
- if ( in_array( $post_type, array( 'revision', 'nav_menu_item' ) ) ) {
81
- continue;
82
- }
83
-
84
- $post_type_object = get_post_type_object( $post_type );
85
-
86
- $post_type_sections[] = array(
87
- 'section_title' => $post_type_object->labels->name,
88
- 'section_description' => __( sprintf( 'Customize your %s title, description and meta.', $post_type_object->labels->singular_name ), 'wds' ),
89
- 'section_type' => $post_type,
90
- 'section_template' => 'onpage/onpage-section-post-type',
91
- 'section_args' => array(
92
- 'post_type' => $post_type,
93
- 'post_type_object' => $post_type_object,
94
- 'post_type_robots' => ( ! empty( $post_robots[ $post_type ] ) ? $post_robots[ $post_type ] : array()),
95
- ),
96
- );
97
- }
98
-
99
- $this->_render('vertical-tab', array(
100
- 'tab_id' => 'tab_post_types',
101
- 'tab_name' => __( 'Post Types', 'wds' ),
102
- 'is_active' => $active_tab == 'tab_post_types',
103
- 'tab_sections' => $post_type_sections,
104
- ));
105
-
106
- /*
107
- * Other taxonomies
108
- */
109
- $taxonomy_sections = array();
110
- $taxonomies = array_merge(
111
- array( 'post_tag', 'category' ),
112
- get_taxonomies( array( '_builtin' => false ) )
113
- );
114
- foreach ( $taxonomies as $taxonomy_name ) {
115
- $taxonomy = get_taxonomy( $taxonomy_name );
116
- $meta_robots_taxonomy_name = 'meta_robots_' . str_replace( '-', '_', $taxonomy->name );
117
- $taxonomy_sections[] = array(
118
- 'section_title' => $taxonomy->label,
119
- 'section_description' => sprintf( __( 'Customize the title, description and meta of %s.', 'wds' ), $taxonomy->label ),
120
- 'section_type' => $taxonomy->name,
121
- 'section_template' => 'onpage/onpage-section-taxonomy',
122
- 'section_args' => array(
123
- 'taxonomy' => $taxonomy,
124
- 'meta_robots' => $$meta_robots_taxonomy_name,
125
- ),
126
- );
127
- }
128
-
129
- $this->_render('vertical-tab', array(
130
- 'tab_id' => 'tab_taxonomies',
131
- 'tab_name' => __( 'Taxonomies', 'wds' ),
132
- 'is_active' => $active_tab == 'tab_taxonomies',
133
- 'tab_sections' => $taxonomy_sections,
134
- ));
135
-
136
- /*
137
- * Archives
138
- */
139
- $this->_render('vertical-tab', array(
140
- 'tab_id' => 'tab_archives',
141
- 'tab_name' => __( 'Archives', 'wds' ),
142
- 'is_active' => $active_tab == 'tab_archives',
143
- 'tab_sections' => array(
144
- // Author archive
145
- array(
146
- 'section_title' => __( 'Author Archive', 'wds' ),
147
- 'section_description' => __( 'If you are the only author of your website content Google may see your author archives as duplicate content to your Blog Homepage. If this is the case we recommend disabling author archives.', 'wds' ),
148
- 'section_type' => 'author-archive',
149
- 'section_template' => 'onpage/onpage-section-author-archive',
150
- 'section_enabled_option' => 'enable-author-archive',
151
- 'section_args' => array(
152
- 'meta_robots_author' => $meta_robots_author,
153
- ),
154
- ),
155
- // Date archive
156
- array(
157
- 'section_title' => __( 'Date Archive', 'wds' ),
158
- 'section_description' => __( 'Google may see your date archives as duplicate content to your Blog Homepage. For this reason we recommend disabling date archives.', 'wds' ),
159
- 'section_type' => 'date-archive',
160
- 'section_template' => 'onpage/onpage-section-date-archive',
161
- 'section_enabled_option' => 'enable-date-archive',
162
- 'section_args' => array(
163
- 'meta_robots_date' => $meta_robots_date,
164
- ),
165
- ),
166
- // Search page
167
- array(
168
- 'section_title' => __( 'Search Page', 'wds' ),
169
- 'section_description' => __( 'Customize your search page title, description and meta.', 'wds' ),
170
- 'section_type' => 'search-page',
171
- 'section_template' => 'onpage/onpage-section-search',
172
- 'section_args' => array(
173
- 'meta_robots_search' => $meta_robots_search,
174
- ),
175
- ),
176
- // 404 page
177
- array(
178
- 'section_title' => __( '404 Page', 'wds' ),
179
- 'section_description' => __( 'Customize your 404 page title, description and meta.', 'wds' ),
180
- 'section_type' => '404-page',
181
- 'section_template' => 'onpage/onpage-section-404',
182
- 'section_args' => array(),
183
- ),
184
- ),
185
- ));
186
-
187
- $buddypress_sections = array();
188
-
189
- if ( function_exists( 'groups_get_groups' ) && (is_network_admin() || is_main_site()) ) {
190
- $buddypress_sections[] = array(
191
- 'section_title' => __( 'BuddyPress Groups', 'wds' ),
192
- 'section_description' => __( 'Customize your BuddyPress group title, description and meta options.', 'wds' ),
193
- 'section_type' => 'bp-group',
194
- 'section_template' => 'onpage/onpage-section-buddypress-groups',
195
- 'section_args' => array(),
196
- );
197
- }
198
-
199
- if ( defined( 'BP_VERSION' ) && (is_network_admin() || is_main_site()) ) {
200
- $buddypress_sections[] = array(
201
- 'section_title' => __( 'BuddyPress Profile', 'wds' ),
202
- 'section_description' => __( 'Customize your BuddyPress profile title, description and meta options.', 'wds' ),
203
- 'section_type' => 'bp-profile',
204
- 'section_template' => 'onpage/onpage-section-buddypress-profile',
205
- 'section_args' => array(),
206
- );
207
- }
208
-
209
- if ( $buddypress_sections ) {
210
- $this->_render('vertical-tab', array(
211
- 'tab_id' => 'tab_buddypress',
212
- 'tab_name' => __( 'BuddyPress', 'wds' ),
213
- 'is_active' => $active_tab == 'tab_buddypress',
214
- 'tab_sections' => $buddypress_sections,
215
- ));
216
- }
217
- ?>
218
-
219
- <?php
220
- $this->_render('onpage/onpage-marketpress-tabs', array(
221
- 'active_tab' => $active_tab,
222
- 'wds_options' => $smartcrawl_options,
223
- ));
224
- ?>
225
-
226
- <?php
227
- $this->_render('vertical-tab', array(
228
- 'tab_id' => 'tab_settings',
229
- 'tab_name' => __( 'Settings', 'wds' ),
230
- 'is_active' => $active_tab == 'tab_settings',
231
- 'tab_sections' => array(
232
- array(
233
- 'section_type' => '',
234
- 'section_template' => 'onpage/onpage-section-settings',
235
- 'section_args' => array(
236
- 'separators' => $separators,
237
- ),
238
- ),
239
- ),
240
- ));
241
- ?>
242
-
243
- </div><!-- end page-title-meta-tabs -->
244
-
245
- </form>
246
-
247
- <?php // echo $additional; ?>
248
-
249
- <?php
250
-
251
- } else {
252
- printf( __( "You've chosen not to set up '%s', please move onto next step.", 'wds' ), __( 'Title & Meta' , 'wds' ) );
253
- }
254
-
255
- ?>
256
-
257
- </div><!-- end wds-page-onpage -->
 
 
 
 
 
 
1
+ <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
+ <section id="header">
3
+ <?php $this->_render( 'settings-message-top' ); ?>
4
+ <div class="actions">
5
+ <a href="#show-supported-macros-modal" rel="dialog"
6
+ class="button button-small button-light actions-button"><?php esc_html_e( 'Browse Macros', 'wds' ); ?></a>
7
+ <a target="_blank" class="button button-small button-light actions-button"
8
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-2">
9
+ <i class="wds-icon-academy"></i>
10
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
11
+ </a>
12
+ </div>
13
+ <h1><?php esc_html_e( 'Title & Meta', 'wds' ); ?></h1>
14
+ </section><!-- end header -->
15
+
16
+ <dialog class="wds-modal" id="show-supported-macros-modal"
17
+ title="<?php esc_html_e( 'Supported Macros', 'wds' ); ?>">
18
+ <div id="wds-show-supported-macros">
19
+ <table class="wds-data-table wds-data-table-inverse-large">
20
+ <thead>
21
+ <tr>
22
+ <th class="label"><?php esc_html_e( 'Title', 'wds' ); ?></th>
23
+ <th class="result"><?php esc_html_e( 'Gets Replaced By', 'wds' ); ?></th>
24
+ </tr>
25
+ </thead>
26
+ <tfoot>
27
+ <tr>
28
+ <th class="label"><?php esc_html_e( 'Title', 'wds' ); ?></th>
29
+ <th class="result"><?php esc_html_e( 'Gets Replaced By', 'wds' ); ?></th>
30
+ </tr>
31
+ </tfoot>
32
+ <tbody>
33
+
34
+ <?php foreach ( $macros as $macro => $label ) { ?>
35
+ <tr>
36
+ <td class="data data-small"><?php echo esc_html( $macro ); ?></td>
37
+ <td class="data data-small"><?php echo esc_html( $label ); ?></td>
38
+ </tr>
39
+ <?php } ?>
40
+
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+ </dialog>
45
+ <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
46
+ <?php settings_fields( $_view['option_name'] ); ?>
47
+
48
+ <input type="hidden"
49
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
50
+ value="1">
51
+
52
+ <div class="vertical-tabs" id="page-title-meta-tabs">
53
+ <?php
54
+ /*
55
+ * Homepage tab
56
+ */
57
+ $this->_render( 'vertical-tab', array(
58
+ 'tab_id' => 'tab_homepage',
59
+ 'tab_name' => __( 'Homepage', 'wds' ),
60
+ 'is_active' => 'tab_homepage' === $active_tab,
61
+ 'tab_sections' => array(
62
+ array(
63
+ 'section_description' => __( 'Customize your homepage title, description and meta.', 'wds' ),
64
+ 'section_type' => 'homepage',
65
+ 'section_template' => 'onpage/onpage-section-homepage',
66
+ 'section_args' => array(
67
+ 'homepage_title' => $homepage_title,
68
+ 'homepage_description' => $homepage_description,
69
+ 'show_homepage_options' => $show_homepage_options,
70
+ 'meta_robots_main_blog_archive' => $meta_robots_main_blog_archive,
71
+ ),
72
+ ),
73
+ ),
74
+ ) );
75
+
76
+ /*
77
+ * Post types tab
78
+ */
79
+ $post_type_sections = array();
80
+ foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) {
81
+ if ( in_array( $post_type, array( 'revision', 'nav_menu_item' ), true ) ) {
82
+ continue;
83
+ }
84
+
85
+ $post_type_object = get_post_type_object( $post_type );
86
+
87
+ $post_type_sections[] = array(
88
+ 'section_title' => $post_type_object->labels->name,
89
+ 'section_description' => sprintf( esc_html__( 'Customize your %s title, description and meta.', 'wds' ), $post_type_object->labels->singular_name ),
90
+ 'section_type' => $post_type,
91
+ 'section_template' => 'onpage/onpage-section-post-type',
92
+ 'section_args' => array(
93
+ 'post_type' => $post_type,
94
+ 'post_type_object' => $post_type_object,
95
+ 'post_type_robots' => ( ! empty( $post_robots[ $post_type ] ) ? $post_robots[ $post_type ] : array() ),
96
+ ),
97
+ );
98
+ }
99
+
100
+ $this->_render( 'vertical-tab', array(
101
+ 'tab_id' => 'tab_post_types',
102
+ 'tab_name' => __( 'Post Types', 'wds' ),
103
+ 'is_active' => 'tab_post_types' === $active_tab,
104
+ 'tab_sections' => $post_type_sections,
105
+ ) );
106
+
107
+ /*
108
+ * Other taxonomies
109
+ */
110
+ $taxonomy_sections = array();
111
+ $taxonomies = array_merge(
112
+ array( 'post_tag', 'category' ),
113
+ get_taxonomies( array( '_builtin' => false ) )
114
+ );
115
+ foreach ( $taxonomies as $taxonomy_name ) {
116
+ $taxonomy = get_taxonomy( $taxonomy_name );
117
+ $meta_robots_taxonomy_name = 'meta_robots_' . str_replace( '-', '_', $taxonomy->name );
118
+ $taxonomy_sections[] = array(
119
+ 'section_title' => $taxonomy->label,
120
+ 'section_description' => sprintf( __( 'Customize the title, description and meta of %s.', 'wds' ), $taxonomy->label ),
121
+ 'section_type' => $taxonomy->name,
122
+ 'section_template' => 'onpage/onpage-section-taxonomy',
123
+ 'section_args' => array(
124
+ 'taxonomy' => $taxonomy,
125
+ 'meta_robots' => $$meta_robots_taxonomy_name,
126
+ ),
127
+ );
128
+ }
129
+
130
+ $this->_render( 'vertical-tab', array(
131
+ 'tab_id' => 'tab_taxonomies',
132
+ 'tab_name' => __( 'Taxonomies', 'wds' ),
133
+ 'is_active' => 'tab_taxonomies' === $active_tab,
134
+ 'tab_sections' => $taxonomy_sections,
135
+ ) );
136
+
137
+ $archive_sections = array(
138
+ // Author archive
139
+ array(
140
+ 'section_title' => __( 'Author Archive', 'wds' ),
141
+ 'section_description' => __( 'If you are the only author of your website content Google may see your author archives as duplicate content to your Blog Homepage. If this is the case we recommend disabling author archives.', 'wds' ),
142
+ 'section_type' => 'author-archive',
143
+ 'section_template' => 'onpage/onpage-section-author-archive',
144
+ 'section_enabled_option' => 'enable-author-archive',
145
+ 'section_args' => array(
146
+ 'meta_robots_author' => $meta_robots_author,
147
+ ),
148
+ ),
149
+ // Date archive
150
+ array(
151
+ 'section_title' => __( 'Date Archive', 'wds' ),
152
+ 'section_description' => __( 'Google may see your date archives as duplicate content to your Blog Homepage. For this reason we recommend disabling date archives.', 'wds' ),
153
+ 'section_type' => 'date-archive',
154
+ 'section_template' => 'onpage/onpage-section-date-archive',
155
+ 'section_enabled_option' => 'enable-date-archive',
156
+ 'section_args' => array(
157
+ 'meta_robots_date' => $meta_robots_date,
158
+ ),
159
+ ),
160
+ // Search page
161
+ array(
162
+ 'section_title' => __( 'Search Page', 'wds' ),
163
+ 'section_description' => __( 'Customize your search page title, description and meta.', 'wds' ),
164
+ 'section_type' => 'search-page',
165
+ 'section_template' => 'onpage/onpage-section-search',
166
+ 'section_args' => array(
167
+ 'meta_robots_search' => $meta_robots_search,
168
+ ),
169
+ ),
170
+ // 404 page
171
+ array(
172
+ 'section_title' => __( '404 Page', 'wds' ),
173
+ 'section_description' => __( 'Customize your 404 page title, description and meta.', 'wds' ),
174
+ 'section_type' => '404-page',
175
+ 'section_template' => 'onpage/onpage-section-404',
176
+ 'section_args' => array(),
177
+ ),
178
+ );
179
+
180
+ /**
181
+ * @var $archive_post_types array
182
+ */
183
+ foreach ( $archive_post_types as $archive_post_type => $archive_post_type_label ) {
184
+
185
+ $archive_sections[] = array(
186
+ 'section_title' => $archive_post_type_label . esc_html__( ' Archive Title', 'wds' ),
187
+ 'section_description' => sprintf(
188
+ esc_html__( 'Customize title, description and meta for the archive page of custom post type %s.', 'wds' ),
189
+ $archive_post_type_label
190
+ ),
191
+ 'section_type' => $archive_post_type,
192
+ 'section_template' => 'onpage/onpage-section-post-type-archive',
193
+ 'section_args' => array(
194
+ 'archive_post_type' => $archive_post_type,
195
+ 'archive_post_type_label' => $archive_post_type_label,
196
+ 'archive_post_type_robots' => ( ! empty( $archive_post_type_robots[ $archive_post_type ] ) ? $archive_post_type_robots[ $archive_post_type ] : array() ),
197
+ ),
198
+ );
199
+ }
200
+
201
+ /*
202
+ * Archives
203
+ */
204
+ $this->_render( 'vertical-tab', array(
205
+ 'tab_id' => 'tab_archives',
206
+ 'tab_name' => __( 'Archives', 'wds' ),
207
+ 'is_active' => 'tab_archives' === $active_tab,
208
+ 'tab_sections' => $archive_sections,
209
+ ) );
210
+
211
+ $buddypress_sections = array();
212
+
213
+ if ( function_exists( 'groups_get_groups' ) && ( is_network_admin() || is_main_site() ) ) {
214
+ $buddypress_sections[] = array(
215
+ 'section_title' => __( 'BuddyPress Groups', 'wds' ),
216
+ 'section_description' => __( 'Customize your BuddyPress group title, description and meta options.', 'wds' ),
217
+ 'section_type' => 'bp-group',
218
+ 'section_template' => 'onpage/onpage-section-buddypress-groups',
219
+ 'section_args' => array(),
220
+ );
221
+ }
222
+
223
+ if ( defined( 'BP_VERSION' ) && ( is_network_admin() || is_main_site() ) ) {
224
+ $buddypress_sections[] = array(
225
+ 'section_title' => __( 'BuddyPress Profile', 'wds' ),
226
+ 'section_description' => __( 'Customize your BuddyPress profile title, description and meta options.', 'wds' ),
227
+ 'section_type' => 'bp-profile',
228
+ 'section_template' => 'onpage/onpage-section-buddypress-profile',
229
+ 'section_args' => array(),
230
+ );
231
+ }
232
+
233
+ if ( $buddypress_sections ) {
234
+ $this->_render( 'vertical-tab', array(
235
+ 'tab_id' => 'tab_buddypress',
236
+ 'tab_name' => __( 'BuddyPress', 'wds' ),
237
+ 'is_active' => 'tab_buddypress' === $active_tab,
238
+ 'tab_sections' => $buddypress_sections,
239
+ ) );
240
+ }
241
+ ?>
242
+
243
+ <?php
244
+ $this->_render( 'vertical-tab', array(
245
+ 'tab_id' => 'tab_settings',
246
+ 'tab_name' => __( 'Settings', 'wds' ),
247
+ 'is_active' => 'tab_settings' === $active_tab,
248
+ 'tab_sections' => array(
249
+ array(
250
+ 'section_type' => '',
251
+ 'section_template' => 'onpage/onpage-section-settings',
252
+ 'section_args' => array(
253
+ 'separators' => $separators,
254
+ ),
255
+ ),
256
+ ),
257
+ ) );
258
+ ?>
259
+
260
+ </div><!-- end page-title-meta-tabs -->
261
+
262
+ </form>
263
+ </div><!-- end wds-page-onpage -->
includes/admin/templates/onpage/onpage-social-meta-tags.php CHANGED
@@ -1,115 +1,116 @@
1
- <?php
2
- /**
3
- * @var string $for_type
4
- */
5
- $section_enabled_field_id = empty($section_enabled_field_id) ? '' : $section_enabled_field_id;
6
- $section_enabled = empty($section_enabled) ? '' : $section_enabled;
7
- $section_title = empty($section_title) ? '' : $section_title;
8
- $section_description = empty($section_description) ? '' : $section_description;
9
- $option_name = empty($option_name) ? '' : $option_name;
10
- $title_field_id = empty($title_field_id) ? '' : $title_field_id;
11
- $current_title = empty($current_title) ? '' : $current_title;
12
-
13
- $description_field_id = empty($description_field_id) ? '' : $description_field_id;
14
- $current_description = empty($current_description) ? '' : $current_description;
15
-
16
- $images_field_id = empty($images_field_id) ? '' : $images_field_id;
17
- $current_images = empty($current_images) ? array() : $current_images;
18
- $images_available = !empty($current_images) && is_array($current_images);
19
- $single_image = empty($single_image) ? false : true;
20
-
21
- $title_placeholder = (!empty($_view['options']["title-{$for_type}"]) ? $_view['options']["title-{$for_type}"] : '');
22
- $description_placeholder = (!empty($_view['options']["metadesc-{$for_type}"]) ? $_view['options']["metadesc-{$for_type}"] : '');
23
- ?>
24
- <div class="wds-toggle-table">
25
- <span class="toggle wds-toggle">
26
- <input
27
- class="toggle-checkbox"
28
- value='1' <?php checked($section_enabled, true); ?> id='<?php echo esc_attr($section_enabled_field_id); ?>'
29
- name='<?php echo esc_attr($option_name); ?>[<?php echo esc_attr($section_enabled_field_id); ?>]'
30
- type='checkbox' autocomplete="off"/>
31
- <label class="toggle-label" for="<?php echo esc_attr($section_enabled_field_id); ?>"></label>
32
- </span>
33
-
34
- <div class="wds-toggle-description">
35
- <label class="wds-label" for="<?php echo esc_attr($section_enabled_field_id); ?>">
36
- <?php echo esc_attr($section_title); ?>
37
- </label>
38
- <p class="wds-label-description">
39
- <?php echo esc_attr($section_description); ?>
40
- </p>
41
-
42
- <div class="wds-table-fields-group wds-toggleable-inside-box">
43
-
44
- <div class="wds-table-fields wds-table-fields-stacked">
45
- <div class="label">
46
- <label for="<?php echo esc_attr( $title_field_id ); ?>" class="wds-label">
47
- <?php esc_html_e( 'Title' , 'wds' ); ?>
48
- </label>
49
- </div>
50
- <div class="fields wds-allow-macros">
51
- <input
52
- id='<?php echo esc_attr( $title_field_id ); ?>'
53
- name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $title_field_id ); ?>]'
54
- size='' type='text' class='wds-field'
55
- placeholder="<?php echo esc_html($title_placeholder); ?>"
56
- value='<?php echo esc_attr( $current_title ); ?>' />
57
- </div>
58
- </div>
59
-
60
- <div class="wds-table-fields wds-table-fields-stacked">
61
- <div class="label">
62
- <label for="<?php echo esc_attr( $description_field_id ); ?>" class="wds-label">
63
- <?php esc_html_e( 'Description' , 'wds' ); ?>
64
- </label>
65
- </div>
66
- <div class="fields wds-allow-macros">
67
- <textarea
68
- id='<?php echo esc_attr( $description_field_id ); ?>'
69
- name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $description_field_id ); ?>]'
70
- placeholder="<?php echo esc_html($description_placeholder); ?>"
71
- type='text' class='wds-field'><?php echo esc_textarea( $current_description ); ?></textarea>
72
- </div>
73
- </div>
74
-
75
- <div class="wds-table-fields wds-table-fields-stacked">
76
- <div class="label">
77
- <label for="<?php echo esc_attr( $images_field_id ); ?>" class="wds-label">
78
- <?php if ($single_image): ?>
79
- <?php esc_html_e('Default Featured Image', 'wds'); ?>
80
- <?php else: ?>
81
- <?php esc_html_e('Default Featured Images', 'wds'); ?>
82
- <?php endif; ?>
83
- </label>
84
- </div>
85
- <div
86
- class="fields og-images <?php echo esc_attr( $images_field_id ); ?>"
87
- data-singular="<?php echo $single_image ? 'true' : 'false'; ?>"
88
- data-name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $images_field_id ); ?>]'>
89
-
90
- <div class="wds-has-tooltip add-action-wrapper item"
91
- data-content="<?php _e( 'Add featured image', 'wds' ); ?>"
92
- style="<?php echo $single_image && $images_available ? 'display:none;' : ''; ?>">
93
- <a href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>"><i class="wds-icon-plus"></i></a>
94
- </div>
95
- <?php foreach ( $current_images as $image ): ?>
96
- <input
97
- name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $images_field_id ); ?>][]'
98
- type='text'
99
- value='<?php echo esc_attr( $image ); ?>' />
100
- <?php endforeach; ?>
101
- </div>
102
- </div>
103
- <p class="wds-label-description">
104
- <?php if($single_image): ?>
105
- <?php esc_html_e( "This image will be available to use if the post or page being shared doesn't contain an image.", 'wds' ); ?>
106
- <?php else: ?>
107
- <?php esc_html_e( "These images will be available to use if the post or page being shared doesn't contain any images.", 'wds' ); ?>
108
- <?php endif; ?>
109
- </p>
110
-
111
- <?php wp_enqueue_media(); ?>
112
- <?php wp_enqueue_style( 'wds-admin-opengraph' ); ?>
113
- </div>
114
- </div>
115
- </div>
 
1
+ <?php
2
+ /**
3
+ * @var string $for_type
4
+ */
5
+ $section_enabled_field_id = empty( $section_enabled_field_id ) ? '' : $section_enabled_field_id;
6
+ $section_enabled = empty( $section_enabled ) ? '' : $section_enabled;
7
+ $section_title = empty( $section_title ) ? '' : $section_title;
8
+ $section_description = empty( $section_description ) ? '' : $section_description;
9
+ $option_name = empty( $option_name ) ? '' : $option_name;
10
+ $title_field_id = empty( $title_field_id ) ? '' : $title_field_id;
11
+ $current_title = empty( $current_title ) ? '' : $current_title;
12
+
13
+ $description_field_id = empty( $description_field_id ) ? '' : $description_field_id;
14
+ $current_description = empty( $current_description ) ? '' : $current_description;
15
+
16
+ $images_field_id = empty( $images_field_id ) ? '' : $images_field_id;
17
+ $current_images = empty( $current_images ) ? array() : $current_images;
18
+ $images_available = ! empty( $current_images ) && is_array( $current_images );
19
+ $single_image = empty( $single_image ) ? false : true;
20
+
21
+ $title_placeholder = ( ! empty( $_view['options']["title-{$for_type}"] ) ? $_view['options']["title-{$for_type}"] : '' );
22
+ $description_placeholder = ( ! empty( $_view['options']["metadesc-{$for_type}"] ) ? $_view['options']["metadesc-{$for_type}"] : '' );
23
+ ?>
24
+ <div class="wds-toggle-table">
25
+ <span class="toggle wds-toggle">
26
+ <input
27
+ class="toggle-checkbox"
28
+ value='1' <?php checked( $section_enabled, true ); ?>
29
+ id='<?php echo esc_attr( $section_enabled_field_id ); ?>'
30
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $section_enabled_field_id ); ?>]'
31
+ type='checkbox' autocomplete="off"/>
32
+ <label class="toggle-label" for="<?php echo esc_attr( $section_enabled_field_id ); ?>"></label>
33
+ </span>
34
+
35
+ <div class="wds-toggle-description">
36
+ <label class="wds-label" for="<?php echo esc_attr( $section_enabled_field_id ); ?>">
37
+ <?php echo esc_html( $section_title ); ?>
38
+ </label>
39
+ <p class="wds-label-description">
40
+ <?php echo esc_html( $section_description ); ?>
41
+ </p>
42
+
43
+ <div class="wds-table-fields-group wds-toggleable-inside-box">
44
+
45
+ <div class="wds-table-fields wds-table-fields-stacked">
46
+ <div class="label">
47
+ <label for="<?php echo esc_attr( $title_field_id ); ?>" class="wds-label">
48
+ <?php esc_html_e( 'Title', 'wds' ); ?>
49
+ </label>
50
+ </div>
51
+ <div class="fields wds-allow-macros">
52
+ <input
53
+ id='<?php echo esc_attr( $title_field_id ); ?>'
54
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $title_field_id ); ?>]'
55
+ size='' type='text' class='wds-field'
56
+ placeholder="<?php echo esc_attr( $title_placeholder ); ?>"
57
+ value='<?php echo esc_attr( $current_title ); ?>'/>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="wds-table-fields wds-table-fields-stacked">
62
+ <div class="label">
63
+ <label for="<?php echo esc_attr( $description_field_id ); ?>" class="wds-label">
64
+ <?php esc_html_e( 'Description', 'wds' ); ?>
65
+ </label>
66
+ </div>
67
+ <div class="fields wds-allow-macros">
68
+ <textarea
69
+ id='<?php echo esc_attr( $description_field_id ); ?>'
70
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $description_field_id ); ?>]'
71
+ placeholder="<?php echo esc_attr( $description_placeholder ); ?>"
72
+ type='text' class='wds-field'><?php echo esc_textarea( $current_description ); ?></textarea>
73
+ </div>
74
+ </div>
75
+
76
+ <div class="wds-table-fields wds-table-fields-stacked">
77
+ <div class="label">
78
+ <label for="<?php echo esc_attr( $images_field_id ); ?>" class="wds-label">
79
+ <?php if ( $single_image ): ?>
80
+ <?php esc_html_e( 'Default Featured Image', 'wds' ); ?>
81
+ <?php else: ?>
82
+ <?php esc_html_e( 'Default Featured Images', 'wds' ); ?>
83
+ <?php endif; ?>
84
+ </label>
85
+ </div>
86
+ <div
87
+ class="fields og-images <?php echo esc_attr( $images_field_id ); ?>"
88
+ data-singular="<?php echo $single_image ? 'true' : 'false'; ?>"
89
+ data-name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $images_field_id ); ?>]'>
90
+
91
+ <div class="wds-has-tooltip add-action-wrapper item"
92
+ data-content="<?php esc_attr_e( 'Add featured image', 'wds' ); ?>"
93
+ style="<?php echo $single_image && $images_available ? 'display:none;' : ''; ?>">
94
+ <a href="#add" id="<?php echo esc_attr( $images_field_id ); ?>" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>"><i class="wds-icon-plus"></i></a>
95
+ </div>
96
+ <?php foreach ( $current_images as $image ): ?>
97
+ <input
98
+ name='<?php echo esc_attr( $option_name ); ?>[<?php echo esc_attr( $images_field_id ); ?>][]'
99
+ type='text'
100
+ value='<?php echo esc_attr( $image ); ?>'/>
101
+ <?php endforeach; ?>
102
+ </div>
103
+ </div>
104
+ <p class="wds-label-description">
105
+ <?php if ( $single_image ): ?>
106
+ <?php esc_html_e( "This image will be available to use if the post or page being shared doesn't contain an image.", 'wds' ); ?>
107
+ <?php else: ?>
108
+ <?php esc_html_e( "These images will be available to use if the post or page being shared doesn't contain any images.", 'wds' ); ?>
109
+ <?php endif; ?>
110
+ </p>
111
+
112
+ <?php wp_enqueue_media(); ?>
113
+ <?php wp_enqueue_style( 'wds-admin-opengraph' ); ?>
114
+ </div>
115
+ </div>
116
+ </div>
includes/admin/templates/onpage/onpage-twitter-disabled.php CHANGED
@@ -1,14 +1,18 @@
1
- <?php
2
- $message = sprintf(
3
- esc_html__('Twitter Cards are globally disabled. You can enable them %s.', 'wds'),
4
- sprintf(
5
- '<a href="%s">%s</a>',
6
- Smartcrawl_Settings_Admin::admin_url(Smartcrawl_Settings::TAB_SOCIAL),
7
- esc_html__('here', 'wds')
8
- )
9
- );
10
-
11
- $this->_render('notice', array(
12
- 'class' => 'wds-notice-info',
13
- 'message' => $message,
14
- ));
 
 
 
 
1
+ <?php
2
+ $message = esc_html__( 'Twitter Cards are globally disabled.', 'wds' );
3
+ if ( smartcrawl_subsite_setting_page_enabled( 'wds_social' ) ) {
4
+ $message = sprintf(
5
+ esc_html__( '%1$s You can enable them %2$s.', 'wds' ),
6
+ $message,
7
+ sprintf(
8
+ '<a href="%s">%s</a>',
9
+ Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_SOCIAL ),
10
+ esc_html__( 'here', 'wds' )
11
+ )
12
+ );
13
+ }
14
+
15
+ $this->_render( 'notice', array(
16
+ 'class' => 'wds-notice-info',
17
+ 'message' => $message,
18
+ ) );
includes/admin/templates/onpage/onpage-twitter-settings.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
- /**
3
- * @var string $for_type
4
- */
5
- $section_enabled_field_id = 'twitter-active-' . $for_type;
6
- $section_enabled = !empty($_view['options'][$section_enabled_field_id]) ? $_view['options'][$section_enabled_field_id] : false;
7
- $section_title = __('Enable Twitter Cards', 'wds');
8
- $section_description = __('Twitter Cards support enhances how your content appears when shared on Twitter.', 'wds');
9
- $option_name = empty($_view['option_name']) ? '' : $_view['option_name'];
10
- $title_field_id = 'twitter-title-' . $for_type;
11
- $current_title = !empty($_view['options']["twitter-title-{$for_type}"])
12
- ? $_view['options']["twitter-title-{$for_type}"]
13
- : '';
14
-
15
- $description_field_id = 'twitter-description-' . $for_type;
16
- $current_description = !empty($_view['options']["twitter-description-{$for_type}"])
17
- ? $_view['options']["twitter-description-{$for_type}"]
18
- : '';
19
-
20
- $images_field_id = 'twitter-images-' . $for_type;
21
- $current_images = !empty($_view['options']["twitter-images-{$for_type}"]) && is_array($_view['options']["twitter-images-{$for_type}"])
22
- ? $_view['options']["twitter-images-{$for_type}"]
23
- : array();
24
-
25
- $this->_render('onpage/onpage-social-meta-tags', array(
26
- 'for_type' => $for_type,
27
- 'section_enabled_field_id' => $section_enabled_field_id,
28
- 'section_enabled' => $section_enabled,
29
- 'section_title' => $section_title,
30
- 'section_description' => $section_description,
31
- 'option_name' => $option_name,
32
- 'title_field_id' => $title_field_id,
33
- 'current_title' => $current_title,
34
- 'description_field_id' => $description_field_id,
35
- 'current_description' => $current_description,
36
- 'images_field_id' => $images_field_id,
37
- 'current_images' => $current_images,
38
- 'single_image' => true,
39
- ));
1
+ <?php
2
+ /**
3
+ * @var string $for_type
4
+ */
5
+ $section_enabled_field_id = 'twitter-active-' . $for_type;
6
+ $section_enabled = ! empty( $_view['options'][ $section_enabled_field_id ] ) ? $_view['options'][ $section_enabled_field_id ] : false;
7
+ $section_title = __( 'Enable Twitter Cards', 'wds' );
8
+ $section_description = __( 'Twitter Cards support enhances how your content appears when shared on Twitter.', 'wds' );
9
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
10
+ $title_field_id = 'twitter-title-' . $for_type;
11
+ $current_title = ! empty( $_view['options']["twitter-title-{$for_type}"] )
12
+ ? $_view['options']["twitter-title-{$for_type}"]
13
+ : '';
14
+
15
+ $description_field_id = 'twitter-description-' . $for_type;
16
+ $current_description = ! empty( $_view['options']["twitter-description-{$for_type}"] )
17
+ ? $_view['options']["twitter-description-{$for_type}"]
18
+ : '';
19
+
20
+ $images_field_id = 'twitter-images-' . $for_type;
21
+ $current_images = ! empty( $_view['options']["twitter-images-{$for_type}"] ) && is_array( $_view['options']["twitter-images-{$for_type}"] )
22
+ ? $_view['options']["twitter-images-{$for_type}"]
23
+ : array();
24
+
25
+ $this->_render( 'onpage/onpage-social-meta-tags', array(
26
+ 'for_type' => $for_type,
27
+ 'section_enabled_field_id' => $section_enabled_field_id,
28
+ 'section_enabled' => $section_enabled,
29
+ 'section_title' => $section_title,
30
+ 'section_description' => $section_description,
31
+ 'option_name' => $option_name,
32
+ 'title_field_id' => $title_field_id,
33
+ 'current_title' => $current_title,
34
+ 'description_field_id' => $description_field_id,
35
+ 'current_description' => $current_description,
36
+ 'images_field_id' => $images_field_id,
37
+ 'current_images' => $current_images,
38
+ 'single_image' => true,
39
+ ) );
includes/admin/templates/{underscore-macros-list.php → onpage/underscore-macros-list.php} RENAMED
@@ -1,12 +1,13 @@
1
- <div class="insert-macro">
2
- <button class="button-fields-trigger" data-content="{{- Wds.l10n('macros', 'Insert dynamic macro') }}" id="toogle-macro-list-"><i class="wds-icon-plus"></i></button>
3
- <div class="macro-list" style="display: none">
4
- <ul>
5
- {{ _.each(macros, function (desc, macro) { }}
6
- <li data-macro="{{- macro }}">
7
- {{- desc }}
8
- </li>
9
- {{ }); }}
10
- </ul>
11
- </div>
12
- </div>
 
1
+ <?php // phpcs:ignoreFile -- underscore template ?>
2
+ <div class="insert-macro">
3
+ <button class="button-fields-trigger" data-content="{{- Wds.l10n('macros', 'Insert dynamic macro') }}" id="toogle-macro-list-"><i class="wds-icon-plus"></i></button>
4
+ <div class="macro-list" style="display: none">
5
+ <ul>
6
+ {{ _.each(macros, function (desc, macro) { }}
7
+ <li data-macro="{{- macro }}">
8
+ {{- desc }}
9
+ </li>
10
+ {{ }); }}
11
+ </ul>
12
+ </div>
13
+ </div>
includes/admin/templates/post-list/post-seo-analysis-errors.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $errors = empty( $errors ) ? array() : $errors;
3
+ $status_class = empty( $status_class ) ? 'wds-status-warning' : $status_class;
4
+ $percentage = ! empty( $percentage )
5
+ ? intval( $percentage ) . '%'
6
+ : esc_html__( 'Errors:', 'wds' );
7
+ ?>
8
+
9
+ <div class="wds-analysis <?php echo esc_attr( $status_class ); ?>" title="<?php esc_attr( $percentage ); ?>">
10
+ <span><?php echo esc_html( $percentage ); ?></span>
11
+ </div>
12
+ <div class="wds-analysis-details">
13
+ <?php foreach ( $errors as $key => $error ): ?>
14
+ <div class="wds-error <?php echo esc_attr( $key ); ?>">
15
+ <?php echo esc_html( $error ); ?>
16
+ </div>
17
+ <?php endforeach; ?>
18
+ </div>
includes/admin/templates/post-list/post-seo-analysis-good.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <div class="wds-analysis wds-status-success">
2
+ <span><?php esc_html( __( 'Good', 'wds' ) ); ?></span>
3
+ </div>
includes/admin/templates/progress-bar.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
- $progress = empty( $progress ) ? 0 : $progress;
3
- ?>
4
-
5
- <div class="wds-progress">
6
- <span class="wds-progress-bar-current-percent"><?php echo (int) $progress; ?>%</span>
7
- <div class="wds-progress-bar">
8
- <div class="wds-progress-bar-inside" style="width:<?php echo (int) $progress; ?>%;"></div>
9
- </div>
10
- </div>
1
+ <?php
2
+ $progress = empty( $progress ) ? 0 : $progress;
3
+ ?>
4
+
5
+ <div class="wds-progress">
6
+ <span class="wds-progress-bar-current-percent"><?php echo (int) $progress; ?>%</span>
7
+ <div class="wds-progress-bar">
8
+ <div class="wds-progress-bar-inside" style="width:<?php echo (int) $progress; ?>%;"></div>
9
+ </div>
10
+ </div>
includes/admin/templates/progress-notice.php CHANGED
@@ -1,26 +1,28 @@
1
- <?php
2
- $admin_email = false;
3
- $dash_email = false;
4
- if ( class_exists( 'WPMUDEV_Dashboard' ) && ! empty( WPMUDEV_Dashboard::$site ) ) {
5
- if ( is_callable( array( WPMUDEV_Dashboard::$site, 'get_option' ) ) ) {
6
- $dash_email = WPMUDEV_Dashboard::$site->get_option( 'auth_user' );
7
- if ( false !== strpos( $dash_email, '@' ) ) { $admin_email = $dash_email; }
8
- }
9
- }
10
- $scan_msg = __( "A full scan can take quite a while, especially if you have a large site! Feel free to close this page; we'll send an e-mail to %s once the results are in.", 'wds' );
11
- ?>
12
- <p class="wds-small-text">
13
- <?php if ( ! empty( $dash_email ) && ! empty( $admin_email ) ) { ?>
14
- <?php $admin_email = sprintf( '<a href="mailto: %1$s">%1$s</a>', $admin_email ); ?>
15
- <?php } else { ?>
16
- <?php $admin_email = __( 'your DEV account email', 'wds' ); ?>
17
- <?php } ?>
18
- <?php
19
- printf(
20
- $scan_msg,
21
- $admin_email
22
- );
23
- ?>
24
- <?php esc_html_e( 'You can change that e-mail address if you want, on your DEV account page', 'wds' ); ?>
25
- <a href="https://premium.wpmudev.org/hub/account" target="_blank"><?php esc_html_e( 'here', 'wds' ); ?></a>
26
- </p>
 
 
1
+ <?php
2
+ $admin_email = false;
3
+ $dash_email = false;
4
+ if ( class_exists( 'WPMUDEV_Dashboard' ) && ! empty( WPMUDEV_Dashboard::$site ) ) {
5
+ if ( is_callable( array( WPMUDEV_Dashboard::$site, 'get_option' ) ) ) {
6
+ $dash_email = WPMUDEV_Dashboard::$site->get_option( 'auth_user' );
7
+ if ( false !== strpos( $dash_email, '@' ) ) {
8
+ $admin_email = $dash_email;
9
+ }
10
+ }
11
+ }
12
+ $scan_msg = __( "A full scan can take quite a while, especially if you have a large site! Feel free to close this page; we'll send an e-mail to %s once the results are in.", 'wds' );
13
+ ?>
14
+ <p class="wds-small-text">
15
+ <?php if ( ! empty( $dash_email ) && ! empty( $admin_email ) ) { ?>
16
+ <?php $admin_email = sprintf( '<a href="mailto: %1$s">%1$s</a>', $admin_email ); ?>
17
+ <?php } else { ?>
18
+ <?php $admin_email = __( 'your DEV account email', 'wds' ); ?>
19
+ <?php } ?>
20
+ <?php
21
+ printf(
22
+ esc_html( $scan_msg ),
23
+ wp_kses_post( $admin_email )
24
+ );
25
+ ?>
26
+ <?php esc_html_e( 'You can change that e-mail address if you want, on your DEV account page', 'wds' ); ?>
27
+ <a href="https://premium.wpmudev.org/hub/account" target="_blank"><?php esc_html_e( 'here', 'wds' ); ?></a>
28
+ </p>
includes/admin/templates/quick-edit-javascript.php CHANGED
@@ -1,41 +1,45 @@
1
- <script type="text/javascript">
2
- (function ($) {
3
-
4
- $("td.column-title").on('click', 'a.editinline', function () {
5
- var id = inlineEditPost.getId(this),
6
- loading = "<?php echo esc_js( 'Loading, please hold on...', 'wds' ); ?>"
7
- ;
8
- setTimeout(function () {
9
- $(".smartcrawl_title:visible").attr("placeholder", loading);
10
- $(".smartcrawl_metadesc:visible").attr("placeholder", loading);
11
- $(".smartcrawl_focus:visible").attr("placeholder", loading);
12
- $(".smartcrawl_keywords:visible").attr("placeholder", loading);
13
- }); // Just move off stack
14
- $.post(ajaxurl, {"action": "wds_get_meta_fields", "id": id}, function (data) {
15
- $(".smartcrawl_title:visible, .smartcrawl_metadesc:visible, .smartcrawl_focus:visible, .smartcrawl_keywords:visible").attr("placeholder", "");
16
- if (!data) return false;
17
- if ("title" in data && data.title) {
18
- $(".smartcrawl_title:visible")
19
- .val(data.title)
20
- ;
21
- }
22
- if ("description" in data && data.description) {
23
- $(".smartcrawl_metadesc:visible")
24
- .val(data.description)
25
- ;
26
- }
27
- if ("keywords" in data && data.keywords) {
28
- $(".smartcrawl_keywords:visible")
29
- .val(data.keywords)
30
- ;
31
- }
32
- if ("focus" in data && data.focus) {
33
- $(".smartcrawl_focus:visible")
34
- .val(data.focus)
35
- ;
36
- }
37
- }, "json");
38
- });
39
-
40
- })(jQuery);
41
- </script>
 
 
 
 
1
+ <script type="text/javascript">
2
+ (function ($) {
3
+
4
+ $('body').on('click', 'td.column-title', '.editinline', function () {
5
+ var id = inlineEditPost.getId(this),
6
+ loading = "<?php echo esc_js( __( 'Loading, please hold on...', 'wds' ) ); ?>"
7
+ ;
8
+ setTimeout(function () {
9
+ $(".smartcrawl_title:visible").attr("placeholder", loading);
10
+ $(".smartcrawl_metadesc:visible").attr("placeholder", loading);
11
+ $(".smartcrawl_focus:visible").attr("placeholder", loading);
12
+ $(".smartcrawl_keywords:visible").attr("placeholder", loading);
13
+ }); // Just move off stack
14
+ $.post(ajaxurl, {
15
+ "action": "wds_get_meta_fields",
16
+ "id": id,
17
+ "_wds_nonce": '<?php echo esc_js(wp_create_nonce( 'wds-metabox-nonce' )); ?>'
18
+ }, function (data) {
19
+ $(".smartcrawl_title:visible, .smartcrawl_metadesc:visible, .smartcrawl_focus:visible, .smartcrawl_keywords:visible").attr("placeholder", "");
20
+ if (!data) return false;
21
+ if ("title" in data && data.title) {
22
+ $(".smartcrawl_title:visible")
23
+ .val(data.title)
24
+ ;
25
+ }
26
+ if ("description" in data && data.description) {
27
+ $(".smartcrawl_metadesc:visible")
28
+ .val(data.description)
29
+ ;
30
+ }
31
+ if ("keywords" in data && data.keywords) {
32
+ $(".smartcrawl_keywords:visible")
33
+ .val(data.keywords)
34
+ ;
35
+ }
36
+ if ("focus" in data && data.focus) {
37
+ $(".smartcrawl_focus:visible")
38
+ .val(data.focus)
39
+ ;
40
+ }
41
+ }, "json");
42
+ });
43
+
44
+ })(jQuery);
45
+ </script>
includes/admin/templates/quick-edit-robots.php CHANGED
@@ -1,38 +1,39 @@
1
-
2
- <fieldset class="inline-edit-col-left">
3
- <div class="inline-edit-col">
4
- <label>
5
- <span class="title metadesc"><?php _e( 'Meta Description', 'wds' ); ?></span>
6
- <textarea class="ptitle smartcrawl_metadesc" name="wds_metadesc"></textarea>
7
- </label>
8
- </div>
9
- <div class="inline-edit-col long-label">
10
- <label>
11
- <span class="title"><?php _e( 'Focus keywords', 'wds' ); ?></span>
12
- <span class="input-text-wrap">
13
- <input class="ptitle smartcrawl_focus" type="text" value="" name="wds_focus" />
14
- </span>
15
- </label>
16
- </div>
17
- <div class="inline-edit-col long-label">
18
- <label>
19
- <span class="title"><?php _e( 'Other Keywords', 'wds' ); ?></span>
20
- <span class="input-text-wrap">
21
- <input class="ptitle smartcrawl_keywords" type="text" value="" name="wds_keywords" />
22
- </span>
23
- </label>
24
- </div>
25
- </fieldset>
26
- <style>
27
- .inline-edit-col .title.metadesc {
28
- display: block;
29
- margin-top: 20px;
30
- width: 100%;
31
- }
32
- .inline-edit-col.long-label .title {
33
- width: 10em;
34
- }
35
- .inline-edit-col.long-label .input-text-wrap {
36
- margin-left: 10em;
37
- }
38
- </style>
 
1
+ <fieldset class="inline-edit-col-left">
2
+ <div class="inline-edit-col">
3
+ <label>
4
+ <span class="title metadesc"><?php esc_html_e( 'Meta Description', 'wds' ); ?></span>
5
+ <textarea class="ptitle smartcrawl_metadesc" name="wds_metadesc"></textarea>
6
+ </label>
7
+ </div>
8
+ <div class="inline-edit-col long-label">
9
+ <label>
10
+ <span class="title"><?php esc_html_e( 'Focus keywords', 'wds' ); ?></span>
11
+ <span class="input-text-wrap">
12
+ <input class="ptitle smartcrawl_focus" type="text" value="" name="wds_focus"/>
13
+ </span>
14
+ </label>
15
+ </div>
16
+ <div class="inline-edit-col long-label">
17
+ <label>
18
+ <span class="title"><?php esc_html_e( 'Other Keywords', 'wds' ); ?></span>
19
+ <span class="input-text-wrap">
20
+ <input class="ptitle smartcrawl_keywords" type="text" value="" name="wds_keywords"/>
21
+ </span>
22
+ </label>
23
+ </div>
24
+ </fieldset>
25
+ <style>
26
+ .inline-edit-col .title.metadesc {
27
+ display: block;
28
+ margin-top: 20px;
29
+ width: 100%;
30
+ }
31
+
32
+ .inline-edit-col.long-label .title {
33
+ width: 10em;
34
+ }
35
+
36
+ .inline-edit-col.long-label .input-text-wrap {
37
+ margin-left: 10em;
38
+ }
39
+ </style>
includes/admin/templates/quick-edit-title.php CHANGED
@@ -1,12 +1,14 @@
1
-
2
- <fieldset class="inline-edit-col-left" style="clear:left">
3
- <div class="inline-edit-col">
4
- <h4><?php _e( 'SmartCrawl', 'wds' ); ?></h4>
5
- <label>
6
- <span class="title"><?php _e( 'Title Tag', 'wds' ); ?></span>
7
- <span class="input-text-wrap">
8
- <input class="ptitle smartcrawl_title" type="text" value="" name="wds_title" />
9
- </span>
10
- </label>
11
- </div>
12
- </fieldset>
 
 
1
+ <fieldset class="inline-edit-col-left" style="clear:left">
2
+ <div class="inline-edit-col">
3
+ <h4><?php esc_html_e( 'SmartCrawl', 'wds' ); ?></h4>
4
+ <label>
5
+ <span class="title"><?php esc_html_e( 'Title Tag', 'wds' ); ?></span>
6
+ <span class="input-text-wrap">
7
+ <input class="ptitle smartcrawl_title" type="text" value="" name="wds_title"/>
8
+ <input type="hidden"
9
+ value="<?php echo esc_attr( wp_create_nonce( 'wds-metabox-nonce' ) ); ?>"
10
+ name="_wds_nonce"/>
11
+ </span>
12
+ </label>
13
+ </div>
14
+ </fieldset>
includes/admin/templates/redirections-settings.php DELETED
@@ -1,123 +0,0 @@
1
- <div id="container" class="wrap wrap-wds wds-page wds-redirections-settings">
2
-
3
- <dialog class="dev-overlay wds-modal wds-redirect" id="wds-new-redirect" title="<?php echo esc_attr( __( 'Add new redirection', 'wds' ) ); ?>">
4
- <div class="box-content modal">
5
- <p class="group wds-group">
6
- <label for="" class="wds-label"><?php esc_html_e( 'Enter old URL', 'wds' ); ?></label>
7
- <input type="url" name="source" value="" class="wds-field">
8
- </p>
9
- <p class="group wds-group">
10
- <label for="" class="wds-label"><?php esc_html_e( 'Enter re-direct URL', 'wds' ); ?></label>
11
- <input type="url" name="redirect" value="" class="wds-field">
12
- </p>
13
- </div>
14
-
15
- <div class="box-footer buttons modal">
16
- <?php wp_nonce_field( 'wds-redirect', 'wds-redirect' ); ?>
17
- <button type="button" class="button button-cta-alt wds-submit-redirect"><?php echo esc_html_e( 'Save', 'wds' ); ?></button>
18
- </div>
19
-
20
- </dialog>
21
-
22
- <section id="header">
23
- <?php $this->_render( 'settings-message-top' ); ?>
24
- <h1><?php esc_html_e( 'Redirections' , 'wds' ); ?></h1>
25
- </section><!-- end header -->
26
-
27
- <div class="row sub-header">
28
- <div class="wds-block-section">
29
- <p class="wds-page-desc"><?php esc_html_e( 'Here you will find a list of active redirections on your site.' , 'wds' ); ?></p>
30
- </div>
31
- </div><!-- end sub-header -->
32
-
33
- <form action='<?php echo esc_url( $_view['action_url'] ); ?>' method='post' class="wds-form">
34
- <?php settings_fields( $_view['option_name'] ); ?>
35
-
36
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1">
37
-
38
- <div class="row">
39
-
40
- <div class="wds-redirections-list">
41
- <section class="box-settings-redirections-list dev-box">
42
- <div class="box-title">
43
- <h3><?php esc_html_e( 'Active Redirections', 'wds' ); ?></h3>
44
- <div class="buttons left">
45
- <button type="button" class="button button-light wds-add_new">
46
- <?php esc_html_e( 'Add new', 'wds' ); ?>
47
- </button>
48
- </div>
49
- </div>
50
- <div class="box-content no-padding">
51
- <?php if ( $redirections ) { ?>
52
- <div class="wds-redirections">
53
- <table class="wds-table wds-redirections-table">
54
- <thead>
55
- <tr>
56
- <th class="selector"><input type="checkbox" class="wds-checkbox"></th>
57
- <th class="source"><?php esc_html_e( 'Old URL', 'wds' ); ?></th>
58
- <th class="destination"><?php esc_html_e( 'Redirect URL', 'wds' ); ?></th>
59
- <th class="type"><?php esc_html_e( 'Type', 'wds' ); ?></th>
60
- </tr>
61
- </thead>
62
- <tbody>
63
- <?php foreach ( $redirections as $source => $redirection ) { ?>
64
- <tr>
65
- <td>
66
- <input type="checkbox" class="wds-checkbox" name="<?php echo esc_attr( $_view['option_name'] ); ?>[bulk][]" value="<?php echo esc_attr( $source ); ?>">
67
- </td>
68
-
69
- <td>
70
- <div class="wds-redirection_item-source">
71
- <a href="<?php echo esc_url( $source ); ?>" class="wds-label link"><?php echo esc_html( $source ); ?></a>
72
- </div>
73
- <div class="wds-redirection_item-separator"><i class="wdv-icon wdv-icon-fw wdv-icon-arrow-right"></i></div>
74
- </td>
75
-
76
- <td>
77
- <div class="wds-redirection_item-destination">
78
- <input id="<?php echo esc_attr( $_view['option_name'] ); ?>" name="<?php echo esc_attr( $_view['option_name'] ); ?>[urls][<?php echo esc_attr( $source ); ?>]" type="text" class="wds-field" value="<?php echo esc_attr( $redirection ); ?>">
79
- </div>
80
- </td>
81
-
82
- <td>
83
- <div class="wds-redirection_item-type">
84
- <select name="<?php echo esc_attr( $_view['option_name'] ); ?>[types][<?php echo esc_attr( $source ); ?>]">
85
- <option <?php if ( ! empty( $types[ $source ] ) && 301 == $types[ $source ] ) { echo 'selected'; } ?> value="301"><?php esc_html_e( 'Permanent (301)', 'wds' ); ?></option>
86
- <option <?php if ( ! empty( $types[ $source ] ) && 302 == $types[ $source ] ) { echo 'selected'; } ?> value="302"><?php esc_html_e( 'Temporary (302)', 'wds' ); ?></option>
87
- </select>
88
- </div>
89
- </td>
90
- </tr>
91
- <?php } ?>
92
- </tbody>
93
- </table>
94
- </div>
95
- <?php } else { ?>
96
- <p><?php esc_html_e( 'No active redirections', 'wds' ); ?></p>
97
- <?php } ?>
98
- <div class="box-footer buttons">
99
- <div class="select-wrapper">
100
- <label><?php esc_html_e( 'Action:', 'wds' ); ?></label>
101
- <div class="wds-redirections-actions">
102
- <select name="<?php echo esc_attr( $_view['option_name'] ); ?>[bulk_action]">
103
- <option><?php esc_html_e( 'No action selected', 'wds' ); ?></option>
104
- <option value="delete"><?php esc_html_e( 'Delete', 'wds' ); ?></option>
105
- <option value="redirect_301"><?php esc_html_e( 'Change to 301', 'wds' ); ?></option>
106
- <option value="redirect_302"><?php esc_html_e( 'Change to 302', 'wds' ); ?></option>
107
- </select>
108
- </div>
109
- </div>
110
- <input name='submit' type='submit' class='button button-cta-alt' value='<?php echo esc_attr( __( 'Apply Action' , 'wds' ) ); ?>'>
111
- </div>
112
- </div>
113
- </section><!-- end box-sitemaps-xml-sitemap-settings -->
114
- </div>
115
- </div>
116
-
117
- <div class="block-section-footer buttons">
118
- <input name='submit' type='submit' class='button button-cta-alt' value='<?php echo esc_attr( __( 'Save Settings' , 'wds' ) ); ?>'>
119
- </div>
120
-
121
- </form>
122
-
123
- </div><!-- end wds-sitemap-settings -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/report-vertical-tab.php CHANGED
@@ -1,81 +1,84 @@
1
- <section class="tab wds-report-vertical-tab">
2
- <?php
3
- // Required
4
- $tab_id = empty( $tab_id ) ? '' : $tab_id;
5
- $tab_name = empty( $tab_name ) ? '' : $tab_name;
6
- $is_active = empty( $is_active ) ? false : $is_active;
7
- $tab_sections = ! empty( $tab_sections ) && is_array( $tab_sections ) ? $tab_sections : array();
8
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
9
-
10
- // Optional
11
- $button_text = isset( $button_text ) ? $button_text : __( 'Save Settings', 'wds' );
12
- $before_output = isset( $before_output ) ? $before_output : null;
13
- $after_output = isset( $after_output ) ? $after_output : null;
14
- $title_button = isset( $title_button ) ? $title_button : 'ignore';
15
-
16
- // Variables
17
- $is_singular = count( $tab_sections ) == 1;
18
- $smartcrawl_options = Smartcrawl_Settings::get_options();
19
- ?>
20
- <input
21
- type="radio"
22
- name="wds-admin-active-tab"
23
- id="<?php echo esc_attr( $tab_id ); ?>"
24
- value="<?php echo esc_attr( $tab_id ); ?>"
25
- <?php checked( $is_active ); ?> />
26
-
27
- <label for="<?php echo esc_attr( $tab_id ); ?>">
28
- <?php echo esc_html( $tab_name ); ?>
29
- <span class="wds-issues wds-issues-warning"><span></span></span>
30
- </label>
31
-
32
- <div class="content wds-content-tabs <?php echo $tab_id; ?> <?php echo $is_singular ? '' : 'wds-accordion'; ?>">
33
- <h2 class="tab-title">
34
- <span class="wds-tab-title-part">
35
- <?php echo esc_html( $tab_name ); ?>
36
- </span>
37
- <span class="wds-tab-title-part">
38
- <span class="wds-issues wds-issues-warning"><span></span></span>
39
- </span>
40
- <span class="wds-tab-title-part">
41
- <?php if ( $title_button == 'ignore' ) : ?>
42
- <button class="wds-ignore-all wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
43
- <?php endif; ?>
44
-
45
- <?php if ( $title_button == 'upgrade' ) : ?>
46
- <button class="wds-upgrade-button button-green"><?php esc_html_e( 'Upgrade to Pro', 'wds' ); ?></button>
47
- <?php endif; ?>
48
- </span>
49
- </h2>
50
-
51
- <?php if ( $before_output ) : ?>
52
- <?php echo($before_output); ?>
53
- <input
54
- type="hidden"
55
- name="wds-admin-active-tab"
56
- id="<?php echo esc_attr( $tab_id ); ?>"
57
- value="<?php echo esc_attr( $tab_id ); ?>"/>
58
- <?php endif; ?>
59
-
60
- <?php foreach ( $tab_sections as $section ) : ?>
61
- <?php
62
- $this->_render('vertical-tab-section', array_merge(
63
- $section,
64
- array(
65
- 'show_accordion' => ! $is_singular,
66
- )
67
- ));
68
- ?>
69
- <?php endforeach; ?>
70
-
71
- <?php if ( $button_text ) : ?>
72
- <div class="wds-seamless-footer"></div>
73
- <?php endif; ?>
74
-
75
- <?php
76
- if ( $after_output ) {
77
- echo($after_output);
78
- }
79
- ?>
80
- </div>
81
- </section>
 
 
 
1
+ <section class="tab wds-report-vertical-tab">
2
+ <?php
3
+ // Required
4
+ $tab_id = empty( $tab_id ) ? '' : $tab_id;
5
+ $tab_name = empty( $tab_name ) ? '' : $tab_name;
6
+ $is_active = empty( $is_active ) ? false : $is_active;
7
+ $tab_sections = ! empty( $tab_sections ) && is_array( $tab_sections ) ? $tab_sections : array();
8
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
9
+
10
+ // Optional
11
+ $button_text = isset( $button_text ) ? $button_text : __( 'Save Settings', 'wds' );
12
+ $before_output = isset( $before_output ) ? $before_output : null;
13
+ $after_output = isset( $after_output ) ? $after_output : null;
14
+ $title_button = isset( $title_button ) ? $title_button : 'ignore';
15
+
16
+ // Variables
17
+ $is_singular = count( $tab_sections ) === 1;
18
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
19
+ ?>
20
+ <input
21
+ type="radio"
22
+ name="wds-admin-active-tab"
23
+ id="<?php echo esc_attr( $tab_id ); ?>"
24
+ value="<?php echo esc_attr( $tab_id ); ?>"
25
+ <?php checked( $is_active ); ?> />
26
+
27
+ <label for="<?php echo esc_attr( $tab_id ); ?>">
28
+ <?php echo esc_html( $tab_name ); ?>
29
+ <span class="wds-issues wds-issues-warning"><span></span></span>
30
+ </label>
31
+
32
+ <div
33
+ class="content wds-content-tabs <?php echo esc_attr( $tab_id ); ?> <?php echo $is_singular ? '' : 'wds-accordion'; ?>">
34
+ <h2 class="tab-title">
35
+ <span class="wds-tab-title-part">
36
+ <?php echo esc_html( $tab_name ); ?>
37
+ </span>
38
+ <span class="wds-tab-title-part">
39
+ <span class="wds-issues wds-issues-warning"><span></span></span>
40
+ </span>
41
+ <span class="wds-tab-title-part">
42
+ <?php if ( 'ignore' === $title_button ) : ?>
43
+ <button
44
+ class="wds-ignore-all wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
45
+ <?php endif; ?>
46
+
47
+ <?php if ( 'upgrade' === $title_button ) : ?>
48
+ <button
49
+ class="wds-upgrade-button button-green"><?php esc_html_e( 'Upgrade to Pro', 'wds' ); ?></button>
50
+ <?php endif; ?>
51
+ </span>
52
+ </h2>
53
+
54
+ <?php if ( $before_output ) : ?>
55
+ <?php echo wp_kses( $before_output, smartcrawl_get_allowed_html_for_forms() ); ?>
56
+ <input
57
+ type="hidden"
58
+ name="wds-admin-active-tab"
59
+ id="<?php echo esc_attr( $tab_id ); ?>"
60
+ value="<?php echo esc_attr( $tab_id ); ?>"/>
61
+ <?php endif; ?>
62
+
63
+ <?php foreach ( $tab_sections as $section ) : ?>
64
+ <?php
65
+ $this->_render( 'vertical-tab-section', array_merge(
66
+ $section,
67
+ array(
68
+ 'show_accordion' => ! $is_singular,
69
+ )
70
+ ) );
71
+ ?>
72
+ <?php endforeach; ?>
73
+
74
+ <?php if ( $button_text ) : ?>
75
+ <div class="wds-seamless-footer"></div>
76
+ <?php endif; ?>
77
+
78
+ <?php
79
+ if ( $after_output ) {
80
+ echo wp_kses( $after_output, smartcrawl_get_allowed_html_for_forms() );
81
+ }
82
+ ?>
83
+ </div>
84
+ </section>
includes/admin/templates/seomoz-dashboard-widget.php CHANGED
@@ -1,71 +1,88 @@
1
- <table class="wds-list-table wds-moz-table">
2
- <thead>
3
- <tr>
4
- <th class="label"><?php _e( 'Metric' , 'wds' ); ?></th>
5
- <th class="result"><?php _e( 'Value' , 'wds' ); ?></th>
6
- </tr>
7
- </thead>
8
- <tbody>
9
- <tr>
10
- <td>
11
- <strong><?php _e( 'Domain mozRank' , 'wds' ); ?></strong><br>
12
- <?php printf( __( 'Measure of the mozRank %s of the domain in the Linkscape index' , 'wds' ), '<a href="https://moz.com/learn/seo/mozrank" target="_blank">(?)</a>' ); ?>
13
- </td>
14
- <td>
15
- <?php _e( '10-point score:' , 'wds' ); ?>&nbsp;
16
- <a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->fmrp ) ? esc_html( $urlmetrics->fmrp ) : ''); ?></a>
17
- <br>
18
- <?php _e( 'Raw score:' , 'wds' ); ?>&nbsp;
19
- <a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->fmrr ) ? esc_html( $urlmetrics->fmrr ) : ''); ?></a>
20
- </td>
21
- </tr>
22
- <tr>
23
- <td>
24
- <strong><?php _e( 'Domain Authority' , 'wds' ); ?></strong>
25
- <a href="https://moz.com/learn/seo/domain-authority" target="_blank">(?)</a>
26
- </td>
27
- <td><a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->pda ) ? esc_html( $urlmetrics->pda ) : ''); ?></a></td>
28
- </tr>
29
- <tr>
30
- <td>
31
- <strong><?php _e( 'External Links to Homepage' , 'wds' ); ?></strong><br>
32
- <?php printf( __( 'The number of external (from other subdomains), juice passing links %s to the target URL in the Linkscape index' , 'wds' ), '<a href="https://moz.com/learn/seo/external-link" target="_blank">(?)</a>' ); ?>
33
- </td>
34
- <td><a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->ueid ) ? esc_html( $urlmetrics->ueid ) : ''); ?></a></td>
35
- </tr>
36
- <tr>
37
- <td>
38
- <strong><?php _e( 'Links to Homepage' , 'wds' ); ?></strong><br>
39
- <?php printf( __( 'The number of internal and external, juice and non-juice passing links %s to the target URL in the Linkscape index' , 'wds' ), '<a href="https://moz.com/learn/seo/internal-link" target="_blank">(?)</a>' ); ?>
40
- </td>
41
- <td><a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->uid ) ? esc_html( $urlmetrics->uid ) : ''); ?></a></td>
42
- </tr>
43
- <tr>
44
- <td>
45
- <strong><?php _e( 'Homepage mozRank' , 'wds' ); ?></strong><br>
46
- <?php printf( __( 'Measure of the mozRank %s of the homepage URL in the Linkscape index' , 'wds' ), '<a href="https://moz.com/learn/seo/mozrank" target="_blank">(?)</a>' ); ?>
47
- </td>
48
- <td>
49
- <?php _e( '10-point score:' , 'wds' ); ?>&nbsp;
50
- <a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->umrp ) ? esc_html( $urlmetrics->umrp ) : ''); ?></a>
51
- <br>
52
- <?php _e( 'Raw score:' , 'wds' ); ?>&nbsp;
53
- <a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->umrr ) ? esc_html( $urlmetrics->umrr ) : ''); ?></a>
54
- </td>
55
- </tr>
56
- <tr>
57
- <td>
58
- <strong><?php _e( 'Homepage Authority' , 'wds' ); ?></strong>
59
- <a href="https://moz.com/learn/seo/page-authority" target="_blank">(?)</a>
60
- </td>
61
- <td><a href="<?php echo esc_attr( $attribution ); ?>" target="_blank"><?php echo ( ! empty( $urlmetrics->upa ) ? esc_html( $urlmetrics->upa ) : ''); ?></a></td>
62
- </tr>
63
- </tbody>
64
- <tfoot>
65
- <tr>
66
- <th class="label"><?php _e( 'Metric' , 'wds' ); ?></th>
67
- <th class="result"><?php _e( 'Value' , 'wds' ); ?></th>
68
- </tr>
69
- </tfoot>
70
- </table>
71
- <p class="copy-moz"><?php _e( 'For posts / pages specific metrics refer to the Moz URL metrics module on the Edit Post / Page screen' , 'wds' ); ?> <a class="linkscape" href="http://moz.com/" target="_blank"><img class="linkscape-image" src="<?php echo SMARTCRAWL_PLUGIN_URL; ?>images/linkscape-logo.png" title="Moz Linkscape API" /></a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wpmud">
2
+ <table class="wds-list-table wds-moz-table">
3
+ <thead>
4
+ <tr>
5
+ <th class="label"><?php esc_html_e( 'Metric', 'wds' ); ?></th>
6
+ <th class="result"><?php esc_html_e( 'Value', 'wds' ); ?></th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <tr>
11
+ <td>
12
+ <strong><?php esc_html_e( 'Domain mozRank', 'wds' ); ?></strong><br>
13
+ <?php printf( esc_html__( 'Measure of the mozRank %s of the domain in the Linkscape index', 'wds' ), '<a href="https://moz.com/learn/seo/mozrank" target="_blank">(?)</a>' ); ?>
14
+ </td>
15
+ <td>
16
+ <?php esc_html_e( '10-point score:', 'wds' ); ?>&nbsp;
17
+ <a href="<?php echo esc_attr( $attribution ); ?>"
18
+ target="_blank"><?php echo( ! empty( $urlmetrics->fmrp ) ? esc_html( $urlmetrics->fmrp ) : '' ); ?></a>
19
+ <br>
20
+ <?php esc_html_e( 'Raw score:', 'wds' ); ?>&nbsp;
21
+ <a href="<?php echo esc_attr( $attribution ); ?>"
22
+ target="_blank"><?php echo( ! empty( $urlmetrics->fmrr ) ? esc_html( $urlmetrics->fmrr ) : '' ); ?></a>
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <td>
27
+ <strong><?php esc_html_e( 'Domain Authority', 'wds' ); ?></strong>
28
+ <a href="https://moz.com/learn/seo/domain-authority" target="_blank">(?)</a>
29
+ </td>
30
+ <td>
31
+ <a href="<?php echo esc_attr( $attribution ); ?>"
32
+ target="_blank"><?php echo( ! empty( $urlmetrics->pda ) ? esc_html( $urlmetrics->pda ) : '' ); ?></a>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td>
37
+ <strong><?php esc_html_e( 'External Links to Homepage', 'wds' ); ?></strong><br>
38
+ <?php printf( esc_html__( 'The number of external (from other subdomains), juice passing links %s to the target URL in the Linkscape index', 'wds' ), '<a href="https://moz.com/learn/seo/external-link" target="_blank">(?)</a>' ); ?>
39
+ </td>
40
+ <td>
41
+ <a href="<?php echo esc_attr( $attribution ); ?>"
42
+ target="_blank"><?php echo( ! empty( $urlmetrics->ueid ) ? esc_html( $urlmetrics->ueid ) : '' ); ?></a>
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td>
47
+ <strong><?php esc_html_e( 'Links to Homepage', 'wds' ); ?></strong><br>
48
+ <?php printf( esc_html__( 'The number of internal and external, juice and non-juice passing links %s to the target URL in the Linkscape index', 'wds' ), '<a href="https://moz.com/learn/seo/internal-link" target="_blank">(?)</a>' ); ?>
49
+ </td>
50
+ <td>
51
+ <a href="<?php echo esc_attr( $attribution ); ?>"
52
+ target="_blank"><?php echo( ! empty( $urlmetrics->uid ) ? esc_html( $urlmetrics->uid ) : '' ); ?></a>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td>
57
+ <strong><?php esc_html_e( 'Homepage mozRank', 'wds' ); ?></strong><br>
58
+ <?php printf( esc_html__( 'Measure of the mozRank %s of the homepage URL in the Linkscape index', 'wds' ), '<a href="https://moz.com/learn/seo/mozrank" target="_blank">(?)</a>' ); ?>
59
+ </td>
60
+ <td>
61
+ <?php esc_html_e( '10-point score:', 'wds' ); ?>&nbsp;
62
+ <a href="<?php echo esc_attr( $attribution ); ?>"
63
+ target="_blank"><?php echo( ! empty( $urlmetrics->umrp ) ? esc_html( $urlmetrics->umrp ) : '' ); ?></a>
64
+ <br>
65
+ <?php esc_html_e( 'Raw score:', 'wds' ); ?>&nbsp;
66
+ <a href="<?php echo esc_attr( $attribution ); ?>"
67
+ target="_blank"><?php echo( ! empty( $urlmetrics->umrr ) ? esc_html( $urlmetrics->umrr ) : '' ); ?></a>
68
+ </td>
69
+ </tr>
70
+ <tr>
71
+ <td>
72
+ <strong><?php esc_html_e( 'Homepage Authority', 'wds' ); ?></strong>
73
+ <a href="https://moz.com/learn/seo/page-authority" target="_blank">(?)</a>
74
+ </td>
75
+ <td>
76
+ <a href="<?php echo esc_attr( $attribution ); ?>"
77
+ target="_blank"><?php echo( ! empty( $urlmetrics->upa ) ? esc_html( $urlmetrics->upa ) : '' ); ?></a>
78
+ </td>
79
+ </tr>
80
+ </tbody>
81
+ <tfoot>
82
+ <tr>
83
+ <th class="label"><?php esc_html_e( 'Metric', 'wds' ); ?></th>
84
+ <th class="result"><?php esc_html_e( 'Value', 'wds' ); ?></th>
85
+ </tr>
86
+ </tfoot>
87
+ </table>
88
+ </div>
includes/admin/templates/seomoz-settings.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Moz settings template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- ?>
9
- <div class='wrap'>
10
-
11
- <?php $this->_render( 'settings-message-top' ); ?>
12
-
13
- <h1><?php esc_html_e( 'SmartCrawl Wizard: Moz' , 'wds' ); ?></h1>
14
-
15
- <?php
16
- $smartcrawl_options = Smartcrawl_Settings::get_options();
17
- if ( ! smartcrawl_is_allowed_tab( $_view['slug'] ) ) {
18
- printf( __( "Your network admin prevented access to '%s', please move onto next step.", 'wds' ), __( 'Moz' , 'wds' ) );
19
- } elseif ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
20
-
21
- echo $additional;
22
-
23
- } else {
24
- printf( __( "You've chosen not to set up '%s', please move onto next step.", 'wds' ), __( 'Moz' , 'wds' ) );
25
- }
26
-
27
- ?>
28
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/templates/settings-message-top.php CHANGED
@@ -1,49 +1,55 @@
1
- <?php
2
- /**
3
- * Messages handling template for settings pages
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $errors = ! empty( $_view['errors'] ) && is_array( $_view['errors'] )
9
- ? $_view['errors']
10
- : array()
11
- ;
12
- $type = ! empty( $errors )
13
- ? 'warning'
14
- : 'success'
15
- ;
16
- ?>
17
- <?php if ( ! empty( $_view['msg'] ) ) { ?>
18
- <div class="wds-notice-floating wds-notice wds-notice-<?php echo esc_attr( $type ); ?>">
19
- <p><?php echo $_view['msg']; ?></p>
20
- </div>
21
- <?php } ?>
22
-
23
- <?php if ( ! empty( $errors ) ) { foreach ( $errors as $error ) { ?>
24
- <?php
25
- $msg = ! empty( $error['message'] ) ? $error['message'] : false;
26
- if ( empty( $msg ) ) { continue; }
27
- ?>
28
- <div class="wds-notice-floating wds-notice wds-notice-error can-close">
29
- <p><?php echo $msg; ?></p>
30
- </div>
31
- <?php }
32
- } ?>
33
-
34
- <?php
35
- /**
36
- * Import/Export error messages display
37
- */
38
- ?>
39
- <?php $io_errors = Smartcrawl_Controller_IO::get()->get_errors(); ?>
40
- <?php if ( ! empty( $io_errors ) ) { foreach ( $io_errors as $io_type => $io_error ) { ?>
41
- <div class="wds-notice-floating wds-notice wds-notice-error <?php esc_attr( $io_type ); ?>">
42
- <p><?php echo wp_kses( $io_error, array( 'br' => array() ) ); ?></p>
43
- </div>
44
- <?php }
45
- } elseif ( ! empty( $_GET['import'] ) && 'success' === $_GET['import'] ) { ?>
46
- <div class="wds-notice-floating wds-notice wds-notice-success">
47
- <p><?php esc_html_e( 'Settings successfully imported', 'wds' ); ?></p>
48
- </div>
49
- <?php } ?>
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Messages handling template for settings pages
4
+ *
5
+ * @package wpmu-dev-seo
6
+ *
7
+ * phpcs:ignoreFile -- We need to use $_GET without nonces
8
+ */
9
+
10
+ $errors = ! empty( $_view['errors'] ) && is_array( $_view['errors'] )
11
+ ? $_view['errors']
12
+ : array();
13
+ $type = ! empty( $errors )
14
+ ? 'warning'
15
+ : 'success';
16
+ ?>
17
+ <?php if ( ! empty( $_view['msg'] ) ): ?>
18
+ <div class="wds-notice-floating wds-notice wds-notice-<?php echo esc_attr( $type ); ?>">
19
+ <p><?php echo wp_kses_post( $_view['msg'] ); ?></p>
20
+ </div>
21
+ <?php endif; ?>
22
+
23
+ <?php if ( ! empty( $errors ) ): ?>
24
+ <?php foreach ( $errors as $error ): ?>
25
+ <?php
26
+ $msg = ! empty( $error['message'] ) ? $error['message'] : false;
27
+ if ( empty( $msg ) ) {
28
+ continue;
29
+ }
30
+ ?>
31
+ <div class="wds-notice-floating wds-notice wds-notice-error">
32
+ <p><?php echo wp_kses_post( $msg ); ?></p>
33
+ </div>
34
+ <?php endforeach; ?>
35
+ <?php endif; ?>
36
+
37
+ <?php
38
+ /**
39
+ * Import/Export error messages display
40
+ */
41
+ $io_errors = Smartcrawl_Controller_IO::get()->get_errors();
42
+ ?>
43
+
44
+ <?php if ( ! empty( $io_errors ) ): ?>
45
+ <?php foreach ( $io_errors as $io_type => $io_error ): ?>
46
+ <div class="wds-notice-floating wds-notice wds-notice-error <?php esc_attr( $io_type ); ?>">
47
+ <p><?php echo wp_kses( $io_error, array( 'br' => array() ) ); ?></p>
48
+ </div>
49
+ <?php endforeach; ?>
50
+ <?php elseif ( ! empty( $_GET['import'] ) && 'success' === $_GET['import'] ): ?>
51
+ <div class="wds-notice-floating wds-notice wds-notice-success">
52
+ <p><?php esc_html_e( 'Settings successfully imported', 'wds' ); ?></p>
53
+ </div>
54
+ <?php endif; ?>
55
+
includes/admin/templates/settings/settings-custom-meta-tag.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php $value = empty( $value ) ? '' : $value; ?>
2
- <div class="wds-custom-meta-tag">
3
- <input type="text"
4
- value="<?php echo esc_attr( $value ); ?>"
5
- placeholder="<?php esc_html_e( 'Paste your meta tag here', 'wds' ); ?>"
6
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[additional-metas][]"/>
7
- </div>
1
+ <?php $value = empty( $value ) ? '' : $value; ?>
2
+ <div class="wds-custom-meta-tag">
3
+ <input type="text"
4
+ value="<?php echo esc_attr( $value ); ?>"
5
+ placeholder="<?php esc_html_e( 'Paste your meta tag here', 'wds' ); ?>"
6
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[additional-metas][]"/>
7
+ </div>
includes/admin/templates/settings/settings-section-general.php CHANGED
@@ -1,203 +1,202 @@
1
- <?php
2
- /**
3
- * Settings general section template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $sitemap_option_name = empty( $sitemap_option_name ) ? '' : $sitemap_option_name;
9
- $verification_pages = empty( $verification_pages ) ? array() : $verification_pages;
10
- $smartcrawl_options = Smartcrawl_Settings::get_options();
11
- ?>
12
-
13
- <?php
14
- $this->_render('toggle-group', array(
15
- 'label' => __( 'Plugin Modules', 'wds' ),
16
- 'description' => __( 'Choose which modules you would like to activate.', 'wds' ),
17
- 'items' => array(
18
- 'autolinks' => __( 'Autolinks', 'wds' ),
19
- 'onpage' => __( 'Title & Meta Optimization', 'wds' ),
20
- 'social' => __( 'Social', 'wds' ),
21
- 'sitemap' => __( 'XML Sitemap', 'wds' ),
22
- 'checkup' => __( 'SEO Checkup', 'wds' ),
23
- ),
24
- ));
25
-
26
- $this->_render('toggle-group', array(
27
- 'label' => esc_html__( 'Builtin modules', 'wds' ),
28
- 'description' => esc_html__( 'Choose which modules you would like to activate.', 'wds' ),
29
- 'separator' => true,
30
- 'items' => array(
31
- 'analysis-seo' => array(
32
- 'label' => esc_html__( 'Page Analysis', 'wds' ),
33
- 'description' => esc_html__( 'Analyses your content against recommend SEO practice and gives recommendations for improvement to make sure content is as optimized as possible.', 'wds' ),
34
- ),
35
- 'analysis-readability' => array(
36
- 'label' => esc_html__( 'Readability analysis', 'wds' ),
37
- 'description' => esc_html__( 'Benchmarks the readability of your content for the average visitor and gives recommendations for improvement.', 'wds' ),
38
- ),
39
- 'extras-admin_bar' => array(
40
- 'label' => esc_html__( 'Admin Bar', 'wds' ),
41
- 'description' => esc_html__( 'Adds a shortcut to SmartCrawl in the WP Admin bar at the top of your screen.', 'wds' ),
42
- ),
43
- ),
44
- ));
45
- ?>
46
-
47
- <?php if ( is_multisite() && is_network_admin() ) : ?>
48
- <div class="wds-table-fields wds-separator-top">
49
- <div class="label">
50
- <label class="wds-label"><?php esc_html_e( 'Site Owner Permissions', 'wds' ); ?></label>
51
- <p class="wds-label-description">
52
- <?php esc_html_e( 'Use this section to choose what sections of this plugin will be accessible to Site Admins on your Network.', 'wds' ); ?>
53
- </p>
54
- </div>
55
-
56
- <div class="fields">
57
- <div class="wds-toggle-table">
58
- <span class="toggle wds-toggle">
59
- <input type="checkbox"
60
- class="toggle-checkbox"
61
- value="yes"
62
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[wds_sitewide_mode]"
63
- id="wds_sitewide_mode"
64
- <?php isset( $wds_sitewide_mode )
65
- ? checked( $wds_sitewide_mode, true )
66
- : ''; ?>
67
- />
68
- <label class="toggle-label" for="wds_sitewide_mode"></label>
69
- </span>
70
-
71
- <div class="wds-toggle-description">
72
- <label
73
- class="wds-label"
74
- for="wds_sitewide_mode"><?php esc_html_e( 'Sitewide mode (network level changes only)', 'wds' ); ?>
75
- </label>
76
- </div>
77
- </div>
78
- <?php
79
- foreach ( $slugs as $item => $label ) {
80
- $checked = ( ! empty( $blog_tabs[ $item ] )) ? "checked='checked' " : '';
81
- $presence_slug = preg_replace( '/^wds_/', '', $item );
82
- $disabled = 'settings' !== $presence_slug && empty( $_view['options'][ $presence_slug ] )
83
- ? 'disabled="disabled"'
84
- : '';
85
- ?>
86
- <div class="wds-toggle-table <?php if ( ! empty( $disabled ) ) { echo sanitize_html_class( 'disabled' ); } ?>">
87
- <span class="toggle wds-toggle">
88
- <input type="checkbox"
89
- class="toggle-checkbox"
90
- value="yes"
91
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[wds_blog_tabs][<?php echo esc_attr( $item ); ?>]"
92
- id="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"
93
- <?php echo $checked; ?>
94
- <?php echo $disabled; ?>
95
- />
96
- <label class="toggle-label" for="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"></label>
97
- </span>
98
- <div class="wds-toggle-description">
99
- <label class="wds-label" for="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"><?php echo esc_html( $label ); ?></label>
100
- </div>
101
- </div>
102
- <?php
103
- }
104
- ?>
105
- </div>
106
- </div>
107
- <?php endif; ?>
108
-
109
- <?php
110
- $this->_render('toggle-group', array(
111
- 'label' => __( 'Meta Tags', 'wds' ),
112
- 'description' => __( 'Choose what SmartCrawl modules you want available to use.', 'wds' ),
113
- 'separator' => true,
114
- 'items' => array(
115
- 'general-suppress-generator' => array(
116
- 'label' => __( 'Hide generator meta tag', 'wds' ),
117
- 'description' => __( 'It can be considered a security risk to have your WordPress version visible to the public, so we recommend you hide it.', 'wds' ),
118
- ),
119
- 'general-suppress-redundant_canonical' => array(
120
- 'label' => __( 'Hide redundant canonical link tags', 'wds' ),
121
- 'description' => __( 'WordPress automatically generates a canonical tag for your website, but in many cases this isn’t needed so you can turn it off to avoid any potential SEO ‘duplicate content’ backlash from search engines.', 'wds' ),
122
- ),
123
- 'metabox-lax_enforcement' => array(
124
- 'label' => __( 'Enforce meta tag character limits', 'wds' ),
125
- 'description' => __( 'Each meta tag type has recommended maximum characters lengths to follow. Turning this off will remove the enforcement preventing you from adding too many characters.', 'wds' ),
126
- ),
127
- ),
128
- ));
129
- ?>
130
-
131
- <div class="wds-table-fields wds-separator-top">
132
- <div class="label">
133
- <label class="wds-label"><?php esc_html_e( 'Search engines', 'wds' ); ?></label>
134
- <p class="wds-label-description"><?php esc_html_e( 'This tool will add the meta tags required by search engines to verify your site with their SEO management tools to your websites <head> tag.', 'wds' ); ?></p>
135
- </div>
136
- <div class="fields">
137
- <?php
138
- // Normalize legacy content value vs new full meta format.
139
- $value = ! empty( $smartcrawl_options['verification-google'] )
140
- ? '<meta name="google-site-verification" content="' . esc_attr( $smartcrawl_options['verification-google'] ) . '" />'
141
- : (isset( $smartcrawl_options['verification-google-meta'] ) ? $smartcrawl_options['verification-google-meta'] : '');
142
- ?>
143
- <label for="verification-google" class="wds-label"><?php esc_html_e( 'Google Verification', 'wds' ); ?></label>
144
- <p class="wds-label-description"><?php esc_html_e( 'Paste the full meta tag from Google.', 'wds' ); ?></p>
145
- <input
146
- id='verification-google'
147
- name='<?php echo esc_attr( $_view['option_name'] ); ?>[verification-google-meta]'
148
- type='text'
149
- class='wds-field'
150
- value='<?php echo esc_attr( $value ); ?>'>
151
-
152
- <?php
153
- // Normalize legacy content value vs new full meta format.
154
- $value = ! empty( $smartcrawl_options['verification-bing'] )
155
- ? '<meta name="msvalidate.01" content="' . esc_attr( $smartcrawl_options['verification-bing'] ) . '" />'
156
- : (isset( $smartcrawl_options['verification-bing-meta'] ) ? $smartcrawl_options['verification-bing-meta'] : '');
157
- ?>
158
- <label for="verification-bing" class="wds-label"><?php esc_html_e( 'Bing Verification', 'wds' ); ?></label>
159
- <p class="wds-label-description"><?php esc_html_e( 'Paste the full meta tag from Bing.', 'wds' ); ?></p>
160
- <input
161
- id='verification-bing'
162
- name='<?php echo esc_attr( $_view['option_name'] ); ?>[verification-bing-meta]'
163
- type='text'
164
- class='wds-field'
165
- value='<?php echo esc_attr( $value ); ?>'>
166
-
167
- <label for="verification-pages" class="wds-label"><?php esc_html_e( 'Add verification code to', 'wds' ); ?></label>
168
- <select id="verification-pages"
169
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[verification-pages]"
170
- class="select-container"
171
- style="width: 100%;">
172
- <?php foreach ( $verification_pages as $item => $label ) : ?>
173
- <?php
174
- $selected = isset( $smartcrawl_options['verification-pages'] ) && $smartcrawl_options['verification-pages'] == $item ? " selected='selected'" : '';
175
- ?>
176
- <option
177
- value="<?php echo esc_attr( $item ); ?>"
178
- <?php echo $selected; ?>>
179
- <?php echo esc_html( $label ); ?>
180
- </option>
181
- <?php endforeach; ?>
182
- </select>
183
-
184
- <div class="wds-custom-meta-tags">
185
- <label for="verification-google" class="wds-label"><?php esc_html_e( 'Custom meta tags', 'wds' ); ?></label>
186
- <p class="wds-label-description"><?php esc_html_e( 'Have more meta tags you want to add? Add as many as you like.', 'wds' ); ?></p>
187
-
188
- <?php if ( ! empty( $smartcrawl_options['additional-metas'] ) && is_array( $smartcrawl_options['additional-metas'] ) ) : ?>
189
- <?php
190
- foreach ( $smartcrawl_options['additional-metas'] as $custom_value ) {
191
- $this->_render('settings/settings-custom-meta-tag', array(
192
- 'value' => $custom_value,
193
- ));
194
- }
195
- ?>
196
- <?php endif; ?>
197
-
198
- <?php $this->_render( 'settings/settings-custom-meta-tag' ); ?>
199
-
200
- <button type="button" class="button button-dark button-dark-o"><?php esc_html_e( 'Add Another', 'wds' ); ?></button>
201
- </div>
202
- </div>
203
- </div>
1
+ <?php
2
+ /**
3
+ * Settings general section template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $sitemap_option_name = empty( $sitemap_option_name ) ? '' : $sitemap_option_name;
9
+ $verification_pages = empty( $verification_pages ) ? array() : $verification_pages;
10
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
11
+ $sitemap_options = Smartcrawl_Settings::get_component_options( Smartcrawl_Settings::COMP_SITEMAP );
12
+ $plugin_modules = empty( $plugin_modules ) ? array() : $plugin_modules;
13
+ ?>
14
+
15
+ <?php
16
+ $this->_render( 'toggle-group', array(
17
+ 'label' => __( 'Plugin Modules', 'wds' ),
18
+ 'description' => __( 'Choose which modules you would like to activate.', 'wds' ),
19
+ 'items' => $plugin_modules,
20
+ ) );
21
+ ?>
22
+
23
+ <?php if ( is_multisite() && is_network_admin() ) : ?>
24
+ <input type="hidden" name="<?php echo esc_attr( $_view['option_name'] ); ?>[save_blog_tabs]" value="1"/>
25
+ <div class="wds-table-fields wds-separator-top">
26
+ <div class="label">
27
+ <label class="wds-label"><?php esc_html_e( 'Site Owner Permissions', 'wds' ); ?></label>
28
+ <p class="wds-label-description">
29
+ <?php esc_html_e( 'Use this section to choose what sections of this plugin will be accessible to Site Admins on your Network.', 'wds' ); ?>
30
+ </p>
31
+ </div>
32
+
33
+ <div class="fields">
34
+ <div class="wds-toggle-table">
35
+ <span class="toggle wds-toggle">
36
+ <input type="checkbox"
37
+ class="toggle-checkbox"
38
+ value="yes"
39
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[wds_sitewide_mode]"
40
+ id="wds_sitewide_mode"
41
+ <?php echo isset( $wds_sitewide_mode ) ? checked( $wds_sitewide_mode, true, false ) : ''; ?>
42
+ />
43
+ <label class="toggle-label" for="wds_sitewide_mode"></label>
44
+ </span>
45
+
46
+ <div class="wds-toggle-description">
47
+ <label
48
+ class="wds-label"
49
+ for="wds_sitewide_mode"><?php esc_html_e( 'Sitewide mode (network level changes only)', 'wds' ); ?>
50
+ </label>
51
+ </div>
52
+ </div>
53
+ <?php
54
+ foreach ( $slugs as $item => $label ) {
55
+ $checked = ( ! empty( $blog_tabs[ $item ] ) ) ? 'checked' : '';
56
+ $presence_slug = preg_replace( '/^wds_/', '', $item );
57
+ ?>
58
+ <div class="wds-toggle-table">
59
+ <span class="toggle wds-toggle">
60
+ <input type="checkbox"
61
+ class="toggle-checkbox"
62
+ value="yes"
63
+ data-prereq="<?php echo esc_attr( $presence_slug ); ?>"
64
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[wds_blog_tabs][<?php echo esc_attr( $item ); ?>]"
65
+ id="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"
66
+ <?php echo esc_attr( $checked ); ?>
67
+ />
68
+ <label class="toggle-label" for="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"></label>
69
+ </span>
70
+ <div class="wds-toggle-description">
71
+ <label class="wds-label"
72
+ for="wds_blog_tabs-<?php echo esc_attr( $item ); ?>"><?php echo esc_html( $label ); ?></label>
73
+ </div>
74
+ </div>
75
+ <?php
76
+ }
77
+ ?>
78
+ </div>
79
+ </div>
80
+ <?php endif; ?>
81
+
82
+ <?php
83
+ $this->_render( 'toggle-group', array(
84
+ 'label' => esc_html__( 'Builtin modules', 'wds' ),
85
+ 'description' => esc_html__( 'Choose which modules you would like to activate.', 'wds' ),
86
+ 'separator' => true,
87
+ 'items' => array(
88
+ 'analysis-seo' => array(
89
+ 'label' => esc_html__( 'Page Analysis', 'wds' ),
90
+ 'description' => esc_html__( 'Analyses your content against recommend SEO practice and gives recommendations for improvement to make sure content is as optimized as possible.', 'wds' ),
91
+ ),
92
+ 'analysis-readability' => array(
93
+ 'label' => esc_html__( 'Readability analysis', 'wds' ),
94
+ 'description' => esc_html__( 'Benchmarks the readability of your content for the average visitor and gives recommendations for improvement.', 'wds' ),
95
+ ),
96
+ 'extras-admin_bar' => array(
97
+ 'label' => esc_html__( 'Admin Bar', 'wds' ),
98
+ 'description' => esc_html__( 'Adds a shortcut to SmartCrawl in the WP Admin bar at the top of your screen.', 'wds' ),
99
+ ),
100
+ ),
101
+ ) );
102
+ ?>
103
+
104
+ <?php
105
+ $this->_render( 'toggle-group', array(
106
+ 'label' => __( 'Meta Tags', 'wds' ),
107
+ 'description' => __( 'Choose what SmartCrawl modules you want available to use.', 'wds' ),
108
+ 'separator' => true,
109
+ 'items' => array(
110
+ 'general-suppress-generator' => array(
111
+ 'label' => __( 'Hide generator meta tag', 'wds' ),
112
+ 'description' => __( 'It can be considered a security risk to have your WordPress version visible to the public, so we recommend you hide it.', 'wds' ),
113
+ ),
114
+ 'general-suppress-redundant_canonical' => array(
115
+ 'label' => __( 'Hide redundant canonical link tags', 'wds' ),
116
+ 'description' => __( 'WordPress automatically generates a canonical tag for your website, but in many cases this isn’t needed so you can turn it off to avoid any potential SEO ‘duplicate content’ backlash from search engines.', 'wds' ),
117
+ ),
118
+ 'metabox-lax_enforcement' => array(
119
+ 'label' => __( 'Enforce meta tag character limits', 'wds' ),
120
+ 'description' => __( 'Each meta tag type has recommended maximum characters lengths to follow. Turning this off will remove the enforcement preventing you from adding too many characters.', 'wds' ),
121
+ ),
122
+ ),
123
+ ) );
124
+ ?>
125
+
126
+ <div class="wds-table-fields wds-separator-top">
127
+ <div class="label">
128
+ <label class="wds-label"><?php esc_html_e( 'Search engines', 'wds' ); ?></label>
129
+ <p class="wds-label-description"><?php esc_html_e( 'This tool will add the meta tags required by search engines to verify your site with their SEO management tools to your websites <head> tag.', 'wds' ); ?></p>
130
+ </div>
131
+ <div class="fields">
132
+ <?php
133
+ $value = isset( $sitemap_options['verification-google-meta'] ) ? $sitemap_options['verification-google-meta'] : '';
134
+ ?>
135
+ <label for="verification-google" class="wds-label"><?php esc_html_e( 'Google Verification', 'wds' ); ?></label>
136
+ <div class="wds-label-description">
137
+ <?php esc_html_e( 'Paste the full meta tag from Google. The value looks like this:', 'wds' ); ?>
138
+ <pre
139
+ class="wds-meta-tags-example"><?php echo esc_html( '<meta name="google-site-verification" content="+nxGUDJ4QpAZ5l9Bsjdi102tLVC21AIh5d1Nl23908vVuFHs34=" />' ); ?></pre>
140
+ </div>
141
+ <input
142
+ id='verification-google'
143
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[verification-google-meta]'
144
+ type='text'
145
+ class='wds-field'
146
+ value='<?php echo esc_attr( $value ); ?>'>
147
+
148
+ <?php
149
+ $value = isset( $sitemap_options['verification-bing-meta'] ) ? $sitemap_options['verification-bing-meta'] : '';
150
+ ?>
151
+ <label for="verification-bing" class="wds-label"><?php esc_html_e( 'Bing Verification', 'wds' ); ?></label>
152
+ <div class="wds-label-description">
153
+ <?php esc_html_e( 'Paste the full meta tag from Bing. The value looks like this:', 'wds' ); ?>
154
+ <pre
155
+ class="wds-meta-tags-example"><?php echo esc_html( '<meta name="msvalidate.01" content="J3P85HC9105H840J1U8117603269HA13" />' ); ?></pre>
156
+ </div>
157
+ <input
158
+ id='verification-bing'
159
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[verification-bing-meta]'
160
+ type='text'
161
+ class='wds-field'
162
+ value='<?php echo esc_attr( $value ); ?>'>
163
+
164
+ <label for="verification-pages"
165
+ class="wds-label"><?php esc_html_e( 'Add verification code to', 'wds' ); ?></label>
166
+ <select id="verification-pages"
167
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[verification-pages]"
168
+ class="select-container"
169
+ style="width: 100%;">
170
+ <?php foreach ( $verification_pages as $item => $label ) : ?>
171
+ <?php
172
+ $selected = isset( $sitemap_options['verification-pages'] ) && $sitemap_options['verification-pages'] === $item ? 'selected' : '';
173
+ ?>
174
+ <option
175
+ value="<?php echo esc_attr( $item ); ?>"
176
+ <?php echo esc_attr( $selected ); ?>>
177
+ <?php echo esc_html( $label ); ?>
178
+ </option>
179
+ <?php endforeach; ?>
180
+ </select>
181
+
182
+ <div class="wds-custom-meta-tags">
183
+ <label for="verification-google" class="wds-label"><?php esc_html_e( 'Custom meta tags', 'wds' ); ?></label>
184
+ <p class="wds-label-description"><?php esc_html_e( 'Have more meta tags you want to add? Add as many as you like.', 'wds' ); ?></p>
185
+
186
+ <?php if ( ! empty( $sitemap_options['additional-metas'] ) && is_array( $sitemap_options['additional-metas'] ) ) : ?>
187
+ <?php
188
+ foreach ( $sitemap_options['additional-metas'] as $custom_value ) {
189
+ $this->_render( 'settings/settings-custom-meta-tag', array(
190
+ 'value' => $custom_value,
191
+ ) );
192
+ }
193
+ ?>
194
+ <?php endif; ?>
195
+
196
+ <?php $this->_render( 'settings/settings-custom-meta-tag' ); ?>
197
+
198
+ <button type="button"
199
+ class="button button-dark button-dark-o"><?php esc_html_e( 'Add Another', 'wds' ); ?></button>
200
+ </div>
201
+ </div>
202
+ </div>
 
includes/admin/templates/settings/settings-section-import-export.php CHANGED
@@ -1,61 +1,66 @@
1
- <div class="wds-io">
2
- <div class="wds-table-fields">
3
- <div class="label">
4
- <label class="wds-label"><?php esc_html_e( 'Export', 'wds' ); ?></label>
5
- <p class="wds-label-description"><?php esc_html_e( 'Export your full SmartCrawl configuration to use on another site.', 'wds' ); ?></p>
6
- </div>
7
- <div class="fields wds-io wds-export">
8
- <?php wp_nonce_field( 'wds-export', 'wds-settings-action-export' ); ?>
9
- <button name="io-action" value="export" class="button button-dark-o"><?php esc_html_e( 'Export', 'wds' ); ?></button>
10
- </div>
11
- </div>
12
-
13
- <div class="wds-table-fields wds-separator-top">
14
- <div class="label">
15
- <label class="wds-label"><?php esc_html_e( 'Import', 'wds' ); ?></label>
16
- <p class="wds-label-description"><?php esc_html_e( 'Use this tool to import your SmartCrawl settings from another site.', 'wds' ); ?></p>
17
- </div>
18
- <div class="fields wds-io wds-import">
19
- <div>
20
- <label class="wds-label"><?php esc_html_e('SmartCrawl', 'wds') ?></label>
21
- <p class="wds-label-description">
22
- <?php esc_html_e('Import your exported SmartCrawl XML settings file.', 'wds'); ?>
23
- </p>
24
-
25
- <?php wp_nonce_field('wds-import', 'wds-settings-action-import'); ?>
26
- <div class="wds-styleable-file-input">
27
- <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo wp_max_upload_size(); ?>"/>
28
- <input id="wds_import_json" type="file" name="wds_import_json"/>
29
- <input type="text" readonly/>
30
- <label for="wds_import_json" class="button button-dark-o"><?php esc_html_e('Select File', 'wds'); ?></label>
31
- </div>
32
- <button name="io-action" value="import" class="button button-dark"><?php esc_html_e('Import', 'wds'); ?></button>
33
- </div>
34
- <?php if(is_main_site()): ?>
35
- <div class="wds-separator-top">
36
- <label class="wds-label"><?php esc_html_e('Third Party', 'wds') ?></label>
37
- <p class="wds-label-description">
38
- <?php esc_html_e('Automatically import your SEO configuration from other SEO plugins.', 'wds'); ?>
39
- </p>
40
- <div class="wds-third-party-plugins">
41
- <div class="wds-yoast wds-third-party-plugin">
42
- <div class="wds-third-party-plugin-name"><?php esc_html_e('Yoast SEO', 'wds'); ?></div>
43
- <div class="wds-third-party-plugin-button">
44
- <button class="button button-dark button-small"><?php esc_html_e('Import', 'wds'); ?></button>
45
- </div>
46
- </div>
47
- <div class="wds-aioseop wds-third-party-plugin">
48
- <div class="wds-third-party-plugin-name"><?php esc_html_e('All In One SEO', 'wds'); ?></div>
49
- <div class="wds-third-party-plugin-button">
50
- <button class="button button-dark button-small"><?php esc_html_e('Import', 'wds'); ?></button>
51
- </div>
52
- </div>
53
- </div>
54
- <p class="wds-label-description">
55
- <?php esc_html_e('Automatically import your SEO configuration from other SEO plugins. Note: This will override all of your current settings. We recommend exporting your current settings first, just in case.', 'wds'); ?>
56
- </p>
57
- </div>
58
- <?php endif; ?>
59
- </div>
60
- </div>
61
- </div>
 
 
 
 
 
1
+ <?php wp_nonce_field( 'wds-io-nonce', '_wds_nonce' ); ?>
2
+ <div class="wds-io">
3
+ <div class="wds-table-fields">
4
+ <div class="label">
5
+ <label class="wds-label"><?php esc_html_e( 'Export', 'wds' ); ?></label>
6
+ <p class="wds-label-description"><?php esc_html_e( 'Export your full SmartCrawl configuration to use on another site.', 'wds' ); ?></p>
7
+ </div>
8
+ <div class="fields wds-io wds-export">
9
+ <button name="io-action" value="export"
10
+ class="button button-dark-o"><?php esc_html_e( 'Export', 'wds' ); ?></button>
11
+ </div>
12
+ </div>
13
+
14
+ <div class="wds-table-fields wds-separator-top">
15
+ <div class="label">
16
+ <label class="wds-label"><?php esc_html_e( 'Import', 'wds' ); ?></label>
17
+ <p class="wds-label-description"><?php esc_html_e( 'Use this tool to import your SmartCrawl settings from another site.', 'wds' ); ?></p>
18
+ </div>
19
+ <div class="fields wds-io wds-import">
20
+ <div>
21
+ <label class="wds-label"><?php esc_html_e( 'SmartCrawl', 'wds' ); ?></label>
22
+ <p class="wds-label-description">
23
+ <?php esc_html_e( 'Import your exported SmartCrawl XML settings file.', 'wds' ); ?>
24
+ </p>
25
+
26
+ <div class="wds-styleable-file-input">
27
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo esc_attr( wp_max_upload_size() ); ?>"/>
28
+ <input id="wds_import_json" type="file" name="wds_import_json"/>
29
+ <input type="text" readonly/>
30
+ <label for="wds_import_json"
31
+ class="button button-dark-o"><?php esc_html_e( 'Select File', 'wds' ); ?></label>
32
+ </div>
33
+ <button name="io-action" value="import"
34
+ class="button button-dark"><?php esc_html_e( 'Import', 'wds' ); ?></button>
35
+ </div>
36
+ <?php if ( is_main_site() ): ?>
37
+ <div class="wds-separator-top">
38
+ <label class="wds-label"><?php esc_html_e( 'Third Party', 'wds' ); ?></label>
39
+ <p class="wds-label-description">
40
+ <?php esc_html_e( 'Automatically import your SEO configuration from other SEO plugins.', 'wds' ); ?>
41
+ </p>
42
+ <div class="wds-third-party-plugins">
43
+ <div class="wds-yoast wds-third-party-plugin">
44
+ <div class="wds-third-party-plugin-name"><?php esc_html_e( 'Yoast SEO', 'wds' ); ?></div>
45
+ <div class="wds-third-party-plugin-button">
46
+ <button
47
+ class="button button-dark button-small"><?php esc_html_e( 'Import', 'wds' ); ?></button>
48
+ </div>
49
+ </div>
50
+ <div class="wds-aioseop wds-third-party-plugin">
51
+ <div
52
+ class="wds-third-party-plugin-name"><?php esc_html_e( 'All In One SEO', 'wds' ); ?></div>
53
+ <div class="wds-third-party-plugin-button">
54
+ <button
55
+ class="button button-dark button-small"><?php esc_html_e( 'Import', 'wds' ); ?></button>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ <p class="wds-label-description">
60
+ <?php esc_html_e( 'Automatically import your SEO configuration from other SEO plugins. Note: This will override all of your current settings. We recommend exporting your current settings first, just in case.', 'wds' ); ?>
61
+ </p>
62
+ </div>
63
+ <?php endif; ?>
64
+ </div>
65
+ </div>
66
+ </div>
includes/admin/templates/settings/settings-section-user-roles.php CHANGED
@@ -1,82 +1,85 @@
1
- <?php
2
- $seo_metabox_permission_level = empty( $seo_metabox_permission_level ) ? array() : $seo_metabox_permission_level;
3
- $seo_metabox_301_permission_level = empty( $seo_metabox_301_permission_level ) ? array() : $seo_metabox_301_permission_level;
4
- $urlmetrics_metabox_permission_level = empty( $urlmetrics_metabox_permission_level ) ? array() : $urlmetrics_metabox_permission_level;
5
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
6
- ?>
7
- <input type="hidden" name="<?php echo esc_attr( $option_name ); ?>[saving_user_roles]" value="1" />
8
- <div class="wds-table-fields">
9
- <div class="label">
10
- <label class="wds-label"><?php esc_html_e( 'Access', 'wds' ); ?></label>
11
- </div>
12
- <div class="fields">
13
- <div>
14
- <label for="seo_metabox_permission_level" class="wds-label"><?php esc_html_e( 'In page SEO meta box', 'wds' ); ?></label>
15
- <p class="wds-label-description"><?php esc_html_e( 'Choose what user level you want to be able to edit individual post and page meta tags.', 'wds' ); ?></p>
16
-
17
- <select id="seo_metabox_permission_level"
18
- name="<?php echo esc_attr( $option_name ); ?>[seo_metabox_permission_level][]"
19
- class="select-container"
20
- style="width: 100%;">
21
- <?php foreach ( $seo_metabox_permission_level as $item => $label ) : ?>
22
- <?php
23
- $selected = ! empty( $_view['options']['seo_metabox_permission_level'] ) && is_array( $_view['options']['seo_metabox_permission_level'] )
24
- ? (in_array( $item, $_view['options']['seo_metabox_permission_level'] ) ? " selected='selected'" : '') // New
25
- : ($_view['options']['seo_metabox_permission_level'] === $item ? " selected='selected'" : '');
26
- ?>
27
- <option
28
- <?php echo $selected; ?>
29
- value="<?php echo esc_attr( $item ); ?>">
30
- <?php echo esc_html( $label ); ?>
31
- </option>
32
- <?php endforeach; ?>
33
- </select>
34
- </div>
35
-
36
- <div class="wds-separator-top">
37
- <label for="seo_metabox_301_permission_level" class="wds-label"><?php esc_html_e( '301 Redirections', 'wds' ); ?></label>
38
- <p class="wds-label-description"><?php esc_html_e( 'Choose what user level has the ability to add 301 redirects to individual posts and pages.', 'wds' ); ?></p>
39
-
40
- <select id="seo_metabox_301_permission_level"
41
- name="<?php echo esc_attr( $option_name ); ?>[seo_metabox_301_permission_level][]"
42
- class="select-container"
43
- style="width: 100%;">
44
- <?php foreach ( $seo_metabox_301_permission_level as $item => $label ) { ?>
45
- <?php
46
- $selected = ! empty( $_view['options']['seo_metabox_301_permission_level'] ) && is_array( $_view['options']['seo_metabox_301_permission_level'] )
47
- ? (in_array( $item, $_view['options']['seo_metabox_301_permission_level'] ) ? " selected='selected'" : '') // New
48
- : ($_view['options']['seo_metabox_301_permission_level'] === $item ? " selected='selected'" : '');
49
- ?>
50
- <option
51
- <?php echo $selected; ?>
52
- value="<?php echo esc_attr( $item ); ?>">
53
- <?php echo esc_html( $label ); ?>
54
- </option>
55
- <?php } ?>
56
- </select>
57
- </div>
58
-
59
- <div class="wds-separator-top">
60
- <label for="urlmetrics_metabox_permission_level" class="wds-label"><?php esc_html_e( 'Show Moz data to roles', 'wds' ); ?></label>
61
- <p class="wds-label-description"><?php esc_html_e( 'Choose what user level gets to view the Moz data.', 'wds' ); ?></p>
62
-
63
- <select id="urlmetrics_metabox_permission_level"
64
- name="<?php echo esc_attr( $option_name ); ?>[urlmetrics_metabox_permission_level][]"
65
- class="select-container"
66
- style="width: 100%;">
67
- <?php foreach ( $urlmetrics_metabox_permission_level as $item => $label ) : ?>
68
- <?php
69
- $selected = ! empty( $_view['options']['urlmetrics_metabox_permission_level'] ) && is_array( $_view['options']['urlmetrics_metabox_permission_level'] )
70
- ? (in_array( $item, $_view['options']['urlmetrics_metabox_permission_level'] ) ? " selected='selected'" : '') // New
71
- : ($_view['options']['urlmetrics_metabox_permission_level'] === $item ? " selected='selected'" : '');
72
- ?>
73
- <option
74
- <?php echo $selected; ?>
75
- value="<?php echo esc_attr( $item ); ?>">
76
- <?php echo esc_html( $label ); ?>
77
- </option>
78
- <?php endforeach; ?>
79
- </select>
80
- </div>
81
- </div>
82
- </div>
 
 
 
1
+ <?php
2
+ $seo_metabox_permission_level = empty( $seo_metabox_permission_level ) ? array() : $seo_metabox_permission_level;
3
+ $seo_metabox_301_permission_level = empty( $seo_metabox_301_permission_level ) ? array() : $seo_metabox_301_permission_level;
4
+ $urlmetrics_metabox_permission_level = empty( $urlmetrics_metabox_permission_level ) ? array() : $urlmetrics_metabox_permission_level;
5
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
6
+ ?>
7
+ <input type="hidden" name="<?php echo esc_attr( $option_name ); ?>[saving_user_roles]" value="1"/>
8
+ <div class="wds-table-fields">
9
+ <div class="label">
10
+ <label class="wds-label"><?php esc_html_e( 'Access', 'wds' ); ?></label>
11
+ </div>
12
+ <div class="fields">
13
+ <div>
14
+ <label for="seo_metabox_permission_level"
15
+ class="wds-label"><?php esc_html_e( 'In page SEO meta box', 'wds' ); ?></label>
16
+ <p class="wds-label-description"><?php esc_html_e( 'Choose what user level you want to be able to edit individual post and page meta tags.', 'wds' ); ?></p>
17
+
18
+ <select id="seo_metabox_permission_level"
19
+ name="<?php echo esc_attr( $option_name ); ?>[seo_metabox_permission_level][]"
20
+ class="select-container"
21
+ style="width: 100%;">
22
+ <?php foreach ( $seo_metabox_permission_level as $item => $label ) : ?>
23
+ <?php
24
+ $selected = ! empty( $_view['options']['seo_metabox_permission_level'] ) && is_array( $_view['options']['seo_metabox_permission_level'] )
25
+ ? ( in_array( $item, $_view['options']['seo_metabox_permission_level'], true ) ? "selected" : '' ) // New
26
+ : ( $_view['options']['seo_metabox_permission_level'] === $item ? "selected" : '' );
27
+ ?>
28
+ <option
29
+ <?php echo esc_attr( $selected ); ?>
30
+ value="<?php echo esc_attr( $item ); ?>">
31
+ <?php echo esc_html( $label ); ?>
32
+ </option>
33
+ <?php endforeach; ?>
34
+ </select>
35
+ </div>
36
+
37
+ <div class="wds-separator-top">
38
+ <label for="seo_metabox_301_permission_level"
39
+ class="wds-label"><?php esc_html_e( '301 Redirections', 'wds' ); ?></label>
40
+ <p class="wds-label-description"><?php esc_html_e( 'Choose what user level has the ability to add 301 redirects to individual posts and pages.', 'wds' ); ?></p>
41
+
42
+ <select id="seo_metabox_301_permission_level"
43
+ name="<?php echo esc_attr( $option_name ); ?>[seo_metabox_301_permission_level][]"
44
+ class="select-container"
45
+ style="width: 100%;">
46
+ <?php foreach ( $seo_metabox_301_permission_level as $item => $label ) { ?>
47
+ <?php
48
+ $selected = ! empty( $_view['options']['seo_metabox_301_permission_level'] ) && is_array( $_view['options']['seo_metabox_301_permission_level'] )
49
+ ? ( in_array( $item, $_view['options']['seo_metabox_301_permission_level'], true ) ? "selected" : '' ) // New
50
+ : ( $_view['options']['seo_metabox_301_permission_level'] === $item ? "selected" : '' );
51
+ ?>
52
+ <option
53
+ <?php echo esc_attr( $selected ); ?>
54
+ value="<?php echo esc_attr( $item ); ?>">
55
+ <?php echo esc_html( $label ); ?>
56
+ </option>
57
+ <?php } ?>
58
+ </select>
59
+ </div>
60
+
61
+ <div class="wds-separator-top">
62
+ <label for="urlmetrics_metabox_permission_level"
63
+ class="wds-label"><?php esc_html_e( 'Show Moz data to roles', 'wds' ); ?></label>
64
+ <p class="wds-label-description"><?php esc_html_e( 'Choose what user level gets to view the Moz data.', 'wds' ); ?></p>
65
+
66
+ <select id="urlmetrics_metabox_permission_level"
67
+ name="<?php echo esc_attr( $option_name ); ?>[urlmetrics_metabox_permission_level][]"
68
+ class="select-container"
69
+ style="width: 100%;">
70
+ <?php foreach ( $urlmetrics_metabox_permission_level as $item => $label ) : ?>
71
+ <?php
72
+ $selected = ! empty( $_view['options']['urlmetrics_metabox_permission_level'] ) && is_array( $_view['options']['urlmetrics_metabox_permission_level'] )
73
+ ? ( in_array( $item, $_view['options']['urlmetrics_metabox_permission_level'], true ) ? "selected" : '' ) // New
74
+ : ( $_view['options']['urlmetrics_metabox_permission_level'] === $item ? "selected" : '' );
75
+ ?>
76
+ <option
77
+ <?php echo esc_attr( $selected ); ?>
78
+ value="<?php echo esc_attr( $item ); ?>">
79
+ <?php echo esc_html( $label ); ?>
80
+ </option>
81
+ <?php endforeach; ?>
82
+ </select>
83
+ </div>
84
+ </div>
85
+ </div>
includes/admin/templates/settings/settings.php CHANGED
@@ -1,81 +1,75 @@
1
- <div id="container" class="wrap wrap-wds wds-page wds-page-settings">
2
-
3
- <section id="header">
4
- <?php $this->_render( 'settings-message-top' ); ?>
5
- <h1><?php esc_html_e( 'SmartCrawl Settings' , 'wds' ); ?></h1>
6
- </section><!-- end header -->
7
-
8
- <?php
9
- $smartcrawl_options = Smartcrawl_Settings::get_options();
10
- if ( ! is_network_admin() && ! smartcrawl_is_allowed_tab( $_view['slug'] ) ) {
11
- printf( __( "Your network admin prevented access to '%s', please move onto next step.", 'wds' ), __( 'Settings' , 'wds' ) );
12
- } elseif ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
13
- ?>
14
-
15
- <div class="vertical-tabs">
16
- <?php
17
- $this->_render('vertical-tab', array(
18
- 'tab_id' => 'tab_general_settings',
19
- 'tab_name' => __( 'General Settings', 'wds' ),
20
- 'is_active' => $active_tab == 'tab_general_settings',
21
- 'before_output' => $this->_load( '_forms/settings' ),
22
- 'after_output' => '</form>',
23
- 'tab_sections' => array(
24
- array(
25
- 'section_template' => 'settings/settings-section-general',
26
- 'section_args' => array(
27
- 'verification_pages' => $verification_pages,
28
- 'sitemap_option_name' => $sitemap_option_name,
29
- 'slugs' => $slugs,
30
- 'wds_sitewide_mode' => $wds_sitewide_mode,
31
- 'blog_tabs' => $blog_tabs,
32
- ),
33
- ),
34
- ),
35
- ));
36
- ?>
37
-
38
- <?php
39
- $this->_render('vertical-tab', array(
40
- 'tab_id' => 'tab_user_roles',
41
- 'tab_name' => __( 'User Roles', 'wds' ),
42
- 'is_active' => $active_tab == 'tab_user_roles',
43
- 'before_output' => $this->_load( '_forms/settings' ),
44
- 'after_output' => '</form>',
45
- 'tab_sections' => array(
46
- array(
47
- 'section_template' => 'settings/settings-section-user-roles',
48
- 'section_args' => array(
49
- 'seo_metabox_permission_level' => $seo_metabox_permission_level,
50
- 'seo_metabox_301_permission_level' => $seo_metabox_301_permission_level,
51
- 'urlmetrics_metabox_permission_level' => $urlmetrics_metabox_permission_level,
52
- ),
53
- ),
54
- ),
55
- ));
56
- ?>
57
-
58
- <?php
59
- $this->_render('vertical-tab', array(
60
- 'tab_id' => 'tab_import_export',
61
- 'tab_name' => __( 'Import / Export', 'wds' ),
62
- 'is_active' => $active_tab == 'tab_import_export',
63
- 'button_text' => false,
64
- 'before_output' => $this->_load( '_forms/import-export' ),
65
- 'after_output' => '</form>',
66
- 'tab_sections' => array(
67
- array(
68
- 'section_template' => 'settings/settings-section-import-export',
69
- ),
70
- ),
71
- ));
72
- ?>
73
- </div>
74
-
75
- <?php
76
-
77
- } else {
78
- printf( __( "You've chosen not to set up '%s', please move onto next step.", 'wds' ), __( 'Settings' , 'wds' ) );
79
- }
80
-
81
- ?>
1
+ <div id="container" class="wrap wrap-wds wds-page wds-page-settings">
2
+
3
+ <section id="header">
4
+ <div class="actions">
5
+ <a target="_blank" class="button button-small button-light actions-button"
6
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-6">
7
+ <i class="wds-icon-academy"></i>
8
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
9
+ </a>
10
+ </div>
11
+
12
+ <?php $this->_render( 'settings-message-top' ); ?>
13
+ <h1><?php esc_html_e( 'SmartCrawl Settings', 'wds' ); ?></h1>
14
+ </section><!-- end header -->
15
+ <div class="vertical-tabs">
16
+ <?php
17
+ $this->_render( 'vertical-tab', array(
18
+ 'tab_id' => 'tab_general_settings',
19
+ 'tab_name' => __( 'General Settings', 'wds' ),
20
+ 'is_active' => 'tab_general_settings' === $active_tab,
21
+ 'before_output' => $this->_load( '_forms/settings' ),
22
+ 'after_output' => '</form>',
23
+ 'tab_sections' => array(
24
+ array(
25
+ 'section_template' => 'settings/settings-section-general',
26
+ 'section_args' => array(
27
+ 'verification_pages' => $verification_pages,
28
+ 'sitemap_option_name' => $sitemap_option_name,
29
+ 'slugs' => $slugs,
30
+ 'wds_sitewide_mode' => $wds_sitewide_mode,
31
+ 'blog_tabs' => $blog_tabs,
32
+ 'plugin_modules' => $plugin_modules,
33
+ ),
34
+ ),
35
+ ),
36
+ ) );
37
+ ?>
38
+
39
+ <?php
40
+ $this->_render( 'vertical-tab', array(
41
+ 'tab_id' => 'tab_user_roles',
42
+ 'tab_name' => __( 'User Roles', 'wds' ),
43
+ 'is_active' => 'tab_user_roles' === $active_tab,
44
+ 'before_output' => $this->_load( '_forms/settings' ),
45
+ 'after_output' => '</form>',
46
+ 'tab_sections' => array(
47
+ array(
48
+ 'section_template' => 'settings/settings-section-user-roles',
49
+ 'section_args' => array(
50
+ 'seo_metabox_permission_level' => $seo_metabox_permission_level,
51
+ 'seo_metabox_301_permission_level' => $seo_metabox_301_permission_level,
52
+ 'urlmetrics_metabox_permission_level' => $urlmetrics_metabox_permission_level,
53
+ ),
54
+ ),
55
+ ),
56
+ ) );
57
+ ?>
58
+
59
+ <?php
60
+ $this->_render( 'vertical-tab', array(
61
+ 'tab_id' => 'tab_import_export',
62
+ 'tab_name' => __( 'Import / Export', 'wds' ),
63
+ 'is_active' => 'tab_import_export' === $active_tab,
64
+ 'button_text' => false,
65
+ 'before_output' => $this->_load( '_forms/import-export' ),
66
+ 'after_output' => '</form>',
67
+ 'tab_sections' => array(
68
+ array(
69
+ 'section_template' => 'settings/settings-section-import-export',
70
+ ),
71
+ ),
72
+ ) );
73
+ ?>
74
+ </div>
75
+ </div>
 
 
 
 
 
 
includes/admin/templates/sitemap/sitemap-buddypress-settings.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php $groups_enabled = ! empty( $_view['options']['sitemap-buddypress-groups'] ); ?>
2
- <div class="wds-sitemap-section wds-toggleable <?php echo $groups_enabled ? '' : 'inactive'; ?>">
3
- <?php
4
- $this->_render('sitemap/sitemap-part', array(
5
- 'item' => 'sitemap-buddypress-groups',
6
- 'item_name' => '',
7
- 'item_label' => __( 'BuddyPress Groups', 'wds' ),
8
- 'option_name' => $_view['option_name'] . '[sitemap-buddypress-groups]',
9
- ));
10
- ?>
11
-
12
- <div class="wds-sitemap-sub-section wds-toggleable-inside-box">
13
- <?php if ( ! empty( $exclude_groups ) ) : ?>
14
- <?php foreach ( $exclude_groups as $exclude_bp_role => $exclude_bp_role_label ) : ?>
15
- <?php
16
- $this->_render('sitemap/sitemap-part', array(
17
- 'item' => 'sitemap-buddypress-' . $exclude_bp_role,
18
- 'item_name' => '',
19
- 'item_label' => $exclude_bp_role_label,
20
- 'option_name' => $_view['option_name'] . '[exclude_bp_groups][]',
21
- ));
22
- ?>
23
- <?php endforeach; ?>
24
- <?php endif; ?>
25
- </div>
26
- </div>
27
-
28
- <?php $profiles_enabled = ! empty( $_view['options']['sitemap-buddypress-profiles'] ); ?>
29
- <div class="wds-sitemap-section wds-toggleable <?php echo $profiles_enabled ? '' : 'inactive'; ?>">
30
- <?php
31
- $this->_render('sitemap/sitemap-part', array(
32
- 'item' => 'sitemap-buddypress-profiles',
33
- 'item_name' => '',
34
- 'item_label' => __( 'BuddyPress Profiles', 'wds' ),
35
- 'option_name' => $_view['option_name'] . '[sitemap-buddypress-profiles]',
36
- ));
37
- ?>
38
-
39
- <div class="wds-sitemap-sub-section wds-toggleable-inside-box">
40
- <?php if ( ! empty( $exclude_roles ) ) : ?>
41
- <?php foreach ( $exclude_roles as $exclude_bp_role => $exclude_bp_role_label ) : ?>
42
- <?php
43
- $this->_render('sitemap/sitemap-part', array(
44
- 'item' => 'sitemap-buddypress-roles-' . $exclude_bp_role,
45
- 'item_name' => '',
46
- 'item_label' => $exclude_bp_role_label,
47
- 'option_name' => $_view['option_name'] . '[exclude_bp_roles][]',
48
- ));
49
- ?>
50
- <?php endforeach; ?>
51
- <?php endif; ?>
52
- </div>
53
- </div>
1
+ <?php $groups_enabled = ! empty( $_view['options']['sitemap-buddypress-groups'] ); ?>
2
+ <div class="wds-sitemap-section wds-toggleable <?php echo $groups_enabled ? '' : 'inactive'; ?>">
3
+ <?php
4
+ $this->_render( 'sitemap/sitemap-part', array(
5
+ 'item' => 'sitemap-buddypress-groups',
6
+ 'item_name' => '',
7
+ 'item_label' => __( 'BuddyPress Groups', 'wds' ),
8
+ 'option_name' => $_view['option_name'] . '[sitemap-buddypress-groups]',
9
+ ) );
10
+ ?>
11
+
12
+ <div class="wds-sitemap-sub-section wds-toggleable-inside-box">
13
+ <?php if ( ! empty( $exclude_groups ) ) : ?>
14
+ <?php foreach ( $exclude_groups as $exclude_bp_role => $exclude_bp_role_label ) : ?>
15
+ <?php
16
+ $this->_render( 'sitemap/sitemap-part', array(
17
+ 'item' => 'sitemap-buddypress-' . $exclude_bp_role,
18
+ 'item_name' => '',
19
+ 'item_label' => $exclude_bp_role_label,
20
+ 'option_name' => $_view['option_name'] . '[exclude_bp_groups][]',
21
+ ) );
22
+ ?>
23
+ <?php endforeach; ?>
24
+ <?php endif; ?>
25
+ </div>
26
+ </div>
27
+
28
+ <?php $profiles_enabled = ! empty( $_view['options']['sitemap-buddypress-profiles'] ); ?>
29
+ <div class="wds-sitemap-section wds-toggleable <?php echo $profiles_enabled ? '' : 'inactive'; ?>">
30
+ <?php
31
+ $this->_render( 'sitemap/sitemap-part', array(
32
+ 'item' => 'sitemap-buddypress-profiles',
33
+ 'item_name' => '',
34
+ 'item_label' => __( 'BuddyPress Profiles', 'wds' ),
35
+ 'option_name' => $_view['option_name'] . '[sitemap-buddypress-profiles]',
36
+ ) );
37
+ ?>
38
+
39
+ <div class="wds-sitemap-sub-section wds-toggleable-inside-box">
40
+ <?php if ( ! empty( $exclude_roles ) ) : ?>
41
+ <?php foreach ( $exclude_roles as $exclude_bp_role => $exclude_bp_role_label ) : ?>
42
+ <?php
43
+ $this->_render( 'sitemap/sitemap-part', array(
44
+ 'item' => 'sitemap-buddypress-roles-' . $exclude_bp_role,
45
+ 'item_name' => '',
46
+ 'item_label' => $exclude_bp_role_label,
47
+ 'option_name' => $_view['option_name'] . '[exclude_bp_roles][]',
48
+ ) );
49
+ ?>
50
+ <?php endforeach; ?>
51
+ <?php endif; ?>
52
+ </div>
53
+ </div>
includes/admin/templates/sitemap/sitemap-crawl-content.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- /**
3
- * @var Smartcrawl_Seo_Service $service
4
- */
5
- $open_type = empty( $open_type ) ? null : $open_type;
6
- $this->_render('url-crawl-master', array(
7
- 'ready_template' => 'sitemap/sitemap-crawl-results',
8
- 'ready_args' => array(
9
- 'open_type' => $open_type,
10
- ),
11
- 'no_data_template' => 'sitemap/sitemap-no-crawler-data',
12
- 'no_data_args' => array(),
13
- 'progress_template' => 'sitemap/sitemap-progress-bar',
14
- ));
1
+ <?php
2
+ /**
3
+ * @var Smartcrawl_Seo_Service $service
4
+ */
5
+ $open_type = empty( $open_type ) ? null : $open_type;
6
+ $this->_render( 'url-crawl-master', array(
7
+ 'ready_template' => 'sitemap/sitemap-crawl-results',
8
+ 'ready_args' => array(
9
+ 'open_type' => $open_type,
10
+ ),
11
+ 'no_data_template' => 'sitemap/sitemap-no-crawler-data',
12
+ 'no_data_args' => array(),
13
+ 'progress_template' => 'sitemap/sitemap-progress-bar',
14
+ ) );
includes/admin/templates/sitemap/sitemap-crawl-issue-generic.php CHANGED
@@ -1,57 +1,58 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $issue_id = empty( $issue_id ) ? null : $issue_id;
5
-
6
- if ( ! $report || ! $type || ! $issue_id ) {
7
- return;
8
- }
9
-
10
- $issue = $report->get_issue( $issue_id );
11
- $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
12
- $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
13
- ?>
14
-
15
- <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
16
- <td>
17
- <a href="<?php echo esc_attr( $url ); ?>">
18
- <?php echo esc_html( $path ); ?>
19
- </a>
20
- </td>
21
- <td>
22
- <?php
23
- if ( isset( $issue['response'] ) && $issue['response'] ) {
24
- echo $issue['response'];
25
- }
26
- ?>
27
- </td>
28
- <td>
29
- <span class="wds-issues wds-issues-warning">
30
- <span><?php echo count( $issue['origin'] ); ?></span>
31
- </span>
32
- </td>
33
- <td>
34
- <?php
35
- $this->_render('links-dropdown', array(
36
- 'label' => esc_html__( 'Options', 'wds' ),
37
- 'links' => array(
38
- '#ignore' => esc_html__( 'Ignore', 'wds' ),
39
- '#occurences' => esc_html__( 'List Occurrences', 'wds' ),
40
- '#redirect' => esc_html__( 'Redirect', 'wds' ),
41
- ),
42
- ));
43
- ?>
44
- <?php
45
- $this->_render('sitemap/sitemap-occurrences-overlay', array(
46
- 'issue_id' => $issue_id,
47
- 'issue' => $issue,
48
- ));
49
- ?>
50
- <?php
51
- $this->_render('sitemap/sitemap-redirect-overlay', array(
52
- 'issue_id' => $issue_id,
53
- 'issue' => $issue,
54
- ));
55
- ?>
56
- </td>
57
- </tr>
 
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $issue_id = empty( $issue_id ) ? null : $issue_id;
5
+
6
+ if ( ! $report || ! $type || ! $issue_id ) {
7
+ return;
8
+ }
9
+
10
+ $issue = $report->get_issue( $issue_id );
11
+ $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
12
+ $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
13
+ $path = empty( $path ) ? $url : $path;
14
+ ?>
15
+
16
+ <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
17
+ <td>
18
+ <a href="<?php echo esc_attr( $url ); ?>">
19
+ <?php echo esc_html( $path ); ?>
20
+ </a>
21
+ </td>
22
+ <td>
23
+ <?php
24
+ if ( isset( $issue['response'] ) && $issue['response'] ) {
25
+ echo esc_html( $issue['response'] );
26
+ }
27
+ ?>
28
+ </td>
29
+ <td>
30
+ <span class="wds-issues wds-issues-warning">
31
+ <span><?php echo count( $issue['origin'] ); ?></span>
32
+ </span>
33
+ </td>
34
+ <td>
35
+ <?php
36
+ $this->_render( 'links-dropdown', array(
37
+ 'label' => esc_html__( 'Options', 'wds' ),
38
+ 'links' => array(
39
+ '#ignore' => esc_html__( 'Ignore', 'wds' ),
40
+ '#occurrences' => esc_html__( 'List Occurrences', 'wds' ),
41
+ '#redirect' => esc_html__( 'Redirect', 'wds' ),
42
+ ),
43
+ ) );
44
+ ?>
45
+ <?php
46
+ $this->_render( 'sitemap/sitemap-occurrences-overlay', array(
47
+ 'issue_id' => $issue_id,
48
+ 'issue' => $issue,
49
+ ) );
50
+ ?>
51
+ <?php
52
+ $this->_render( 'sitemap/sitemap-redirect-overlay', array(
53
+ 'issue_id' => $issue_id,
54
+ 'issue' => $issue,
55
+ ) );
56
+ ?>
57
+ </td>
58
+ </tr>
includes/admin/templates/sitemap/sitemap-crawl-issue-ignored.php CHANGED
@@ -1,24 +1,26 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $issue_id = empty( $issue_id ) ? null : $issue_id;
5
-
6
- if ( ! $report || ! $type || ! $issue_id ) {
7
- return;
8
- }
9
-
10
- $issue = $report->get_issue( $issue_id );
11
- $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
12
- $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
13
- ?>
14
-
15
- <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
16
- <td>
17
- <a href="<?php echo esc_attr( $url ); ?>">
18
- <?php echo esc_html( $path ); ?>
19
- </a>
20
- </td>
21
- <td>
22
- <button class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Restore', 'wds' ); ?></button>
23
- </td>
24
- </tr>
 
 
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $issue_id = empty( $issue_id ) ? null : $issue_id;
5
+
6
+ if ( ! $report || ! $type || ! $issue_id ) {
7
+ return;
8
+ }
9
+
10
+ $issue = $report->get_issue( $issue_id );
11
+ $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
12
+ $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
13
+ $path = empty( $path ) ? $url : $path;
14
+ ?>
15
+
16
+ <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
17
+ <td>
18
+ <a href="<?php echo esc_attr( $url ); ?>">
19
+ <?php echo esc_html( $path ); ?>
20
+ </a>
21
+ </td>
22
+ <td>
23
+ <button
24
+ class="wds-unignore wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Restore', 'wds' ); ?></button>
25
+ </td>
26
+ </tr>
includes/admin/templates/sitemap/sitemap-crawl-issue-sitemap.php CHANGED
@@ -1,33 +1,34 @@
1
- <?php
2
-
3
- $type = empty( $type ) ? '' : $type;
4
- $report = empty( $report ) ? null : $report;
5
- $issue_id = empty( $issue_id ) ? null : $issue_id;
6
-
7
- if ( ! $report || ! $type || ! $issue_id ) {
8
- return;
9
- }
10
-
11
- $issue = $report->get_issue( $issue_id );
12
- $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
13
- $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
14
- ?>
15
-
16
- <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>" data-path="<?php echo esc_url( $url ); ?>">
17
- <td>
18
- <a href="<?php echo esc_attr( $url ); ?>">
19
- <?php echo esc_html( $path ); ?>
20
- </a>
21
- </td>
22
- <td>
23
- <?php
24
- $this->_render('links-dropdown', array(
25
- 'label' => esc_html__( 'Options', 'wds' ),
26
- 'links' => array(
27
- '#add-to-sitemap' => esc_html__( 'Add to Sitemap', 'wds' ),
28
- '#ignore' => esc_html__( 'Ignore', 'wds' ),
29
- ),
30
- ));
31
- ?>
32
- </td>
33
- </tr>
 
1
+ <?php
2
+
3
+ $type = empty( $type ) ? '' : $type;
4
+ $report = empty( $report ) ? null : $report;
5
+ $issue_id = empty( $issue_id ) ? null : $issue_id;
6
+
7
+ if ( ! $report || ! $type || ! $issue_id ) {
8
+ return;
9
+ }
10
+
11
+ $issue = $report->get_issue( $issue_id );
12
+ $url = ! empty( $issue['path'] ) ? $issue['path'] : '';
13
+ $path = preg_replace( '/' . preg_quote( home_url(), '/' ) . '/', '', $url );
14
+ $path = empty( $path ) ? $url : $path;
15
+ ?>
16
+
17
+ <tr data-issue-id="<?php echo esc_attr( $issue_id ); ?>" data-path="<?php echo esc_url( $url ); ?>">
18
+ <td>
19
+ <a href="<?php echo esc_attr( $url ); ?>">
20
+ <?php echo esc_html( $path ); ?>
21
+ </a>
22
+ </td>
23
+ <td>
24
+ <?php
25
+ $this->_render( 'links-dropdown', array(
26
+ 'label' => esc_html__( 'Options', 'wds' ),
27
+ 'links' => array(
28
+ '#add-to-sitemap' => esc_html__( 'Add to Sitemap', 'wds' ),
29
+ '#ignore' => esc_html__( 'Ignore', 'wds' ),
30
+ ),
31
+ ) );
32
+ ?>
33
+ </td>
34
+ </tr>
includes/admin/templates/sitemap/sitemap-crawl-issues-3xx.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $open = empty( $open ) ? false : $open;
5
-
6
- $this->_render('sitemap/sitemap-crawl-issues-group', array(
7
- 'type' => $type,
8
- 'report' => $report,
9
- 'open' => $open,
10
- 'title' => esc_html__( '%s URLs have multiple redirections', 'wds' ),
11
- 'description' => esc_html__( 'Some of your URLs have multiple redirections. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
- 'header_items' => array(
13
- sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
- sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
- sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
- ),
17
- ));
18
-
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $open = empty( $open ) ? false : $open;
5
+
6
+ $this->_render( 'sitemap/sitemap-crawl-issues-group', array(
7
+ 'type' => $type,
8
+ 'report' => $report,
9
+ 'open' => $open,
10
+ 'title' => esc_html__( '%s URLs have multiple redirections', 'wds' ),
11
+ 'description' => esc_html__( 'Some of your URLs have multiple redirections. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
+ 'header_items' => array(
13
+ sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
+ sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
+ sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
+ ),
17
+ ) );
18
+
includes/admin/templates/sitemap/sitemap-crawl-issues-4xx.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $open = empty( $open ) ? false : $open;
5
-
6
- $this->_render('sitemap/sitemap-crawl-issues-group', array(
7
- 'type' => $type,
8
- 'report' => $report,
9
- 'open' => $open,
10
- 'title' => esc_html__( '%s URLs are resulting in 4xx errors', 'wds' ),
11
- 'description' => esc_html__( 'Some of your URLs are resulting in 4xx errors. Either the page no longer exists or the URL has changed. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
- 'header_items' => array(
13
- sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
- sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
- sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
- ),
17
- ));
18
-
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $open = empty( $open ) ? false : $open;
5
+
6
+ $this->_render( 'sitemap/sitemap-crawl-issues-group', array(
7
+ 'type' => $type,
8
+ 'report' => $report,
9
+ 'open' => $open,
10
+ 'title' => esc_html__( '%s URLs are resulting in 4xx errors', 'wds' ),
11
+ 'description' => esc_html__( 'Some of your URLs are resulting in 4xx errors. Either the page no longer exists or the URL has changed. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
+ 'header_items' => array(
13
+ sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
+ sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
+ sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
+ ),
17
+ ) );
18
+
includes/admin/templates/sitemap/sitemap-crawl-issues-5xx.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $open = empty( $open ) ? false : $open;
5
-
6
- $this->_render('sitemap/sitemap-crawl-issues-group', array(
7
- 'type' => $type,
8
- 'report' => $report,
9
- 'open' => $open,
10
- 'title' => esc_html__( '%s URLs are resulting in 5xx server errors', 'wds' ),
11
- 'description' => esc_html__( 'Some of your URLs are resulting in 5xx server errors. These errors are indicative of errors in your server-side code. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
- 'header_items' => array(
13
- sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
- sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
- sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
- ),
17
- ));
18
-
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $open = empty( $open ) ? false : $open;
5
+
6
+ $this->_render( 'sitemap/sitemap-crawl-issues-group', array(
7
+ 'type' => $type,
8
+ 'report' => $report,
9
+ 'open' => $open,
10
+ 'title' => esc_html__( '%s URLs are resulting in 5xx server errors', 'wds' ),
11
+ 'description' => esc_html__( 'Some of your URLs are resulting in 5xx server errors. These errors are indicative of errors in your server-side code. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
+ 'header_items' => array(
13
+ sprintf( '<th>%s</th>', esc_html__( 'URLs resulting in errors', 'wds' ) ),
14
+ sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
+ sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
+ ),
17
+ ) );
18
+
includes/admin/templates/sitemap/sitemap-crawl-issues-generic-controls.php CHANGED
@@ -1,5 +1,6 @@
1
- <tr class="wds-controls-row">
2
- <td colspan="4">
3
- <button class="wds-ignore-all wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
4
- </td>
5
- </tr>
 
1
+ <tr class="wds-controls-row">
2
+ <td colspan="4">
3
+ <button
4
+ class="wds-ignore-all wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
5
+ </td>
6
+ </tr>
includes/admin/templates/sitemap/sitemap-crawl-issues-group.php CHANGED
@@ -1,95 +1,96 @@
1
- <?php
2
- // Required
3
- $type = empty( $type ) ? '' : $type;
4
- /**
5
- * @var $report Smartcrawl_SeoReport
6
- */
7
- $report = empty( $report ) ? null : $report;
8
- // Optional
9
- $title = empty( $title ) ? '' : $title;
10
- $description = empty( $description ) ? '' : $description;
11
- $header_items = empty( $header_items ) ? array() : $header_items;
12
- $controls_template = empty( $controls_template ) ? 'sitemap/sitemap-crawl-issues-generic-controls' : $controls_template;
13
- $issue_template = empty( $issue_template ) ? 'sitemap/sitemap-crawl-issue-generic' : $issue_template;
14
- $success_class = empty( $success_class ) ? 'wds-check-success' : $success_class;
15
- $warning_class = empty( $warning_class ) ? 'wds-check-warning' : $warning_class;
16
- $open = empty( $open ) ? false : $open;
17
-
18
- if ( ! $report || ! $type ) {
19
- return;
20
- }
21
- $all_issues = $report->get_issues_by_type( $type, true );
22
- $ignored_issues = array();
23
- $active_issues = array();
24
-
25
- foreach ( $all_issues as $issue_id ) {
26
- if ( $report->is_ignored_issue( $issue_id ) ) {
27
- $ignored_issues[] = $issue_id;
28
- } else {
29
- $active_issues[] = $issue_id;
30
- }
31
- }
32
-
33
- $issue_count = count( $active_issues );
34
- $class = $issue_count > 0 ? $warning_class : $success_class;
35
- ?>
36
- <div class="wds-issues-type-<?php echo esc_attr( $type ); ?> wds-accordion-section <?php echo esc_attr( $class ); ?> <?php echo $open ? 'open' : ''; ?> <?php echo $all_issues ? '' : 'disabled'; ?>"
37
- data-type="<?php echo esc_attr( $type ); ?>">
38
-
39
- <div class="wds-accordion-handle">
40
- <?php printf( $title, $issue_count > 0 ? $issue_count : esc_html__( 'No', 'wds' ) ); ?>
41
- </div>
42
- <?php if ( $all_issues ) : ?>
43
- <div class="wds-accordion-content">
44
- <div class="wds-small-text"><strong><?php esc_html_e( 'Overview', 'wds' ); ?></strong></div>
45
- <p>
46
- <?php echo esc_html( $description ); ?>
47
- </p>
48
- <?php if ( $active_issues ) : ?>
49
- <table class="wds-list-table wds-crawl-issues-table">
50
- <thead>
51
- <tr>
52
- <?php foreach ( $header_items as $header_item ) : ?>
53
- <?php echo $header_item; ?>
54
- <?php endforeach; ?>
55
- </tr>
56
- </thead>
57
- <tbody>
58
- <?php
59
- foreach ( $active_issues as $active_issue_id ) {
60
- $this->_render($issue_template, array(
61
- 'type' => $type,
62
- 'report' => $report,
63
- 'issue_id' => $active_issue_id,
64
- ));
65
- }
66
-
67
- $this->_render( $controls_template );
68
- ?>
69
- </tbody>
70
- </table>
71
- <?php endif; ?>
72
-
73
- <?php if ( $ignored_issues ) : ?>
74
- <table class="wds-list-table wds-ignored-items-table">
75
- <thead>
76
- <tr>
77
- <th colspan="2"><?php esc_html_e( 'Ignored', 'wds' ); ?></th>
78
- </tr>
79
- </thead>
80
- <tbody>
81
- <?php
82
- foreach ( $ignored_issues as $ignored_issue_id ) {
83
- $this->_render('sitemap/sitemap-crawl-issue-ignored', array(
84
- 'type' => $type,
85
- 'report' => $report,
86
- 'issue_id' => $ignored_issue_id,
87
- ));
88
- }
89
- ?>
90
- </tbody>
91
- </table>
92
- <?php endif; ?>
93
- </div>
94
- <?php endif; ?>
95
- </div>
 
1
+ <?php
2
+ // Required
3
+ $type = empty( $type ) ? '' : $type;
4
+ /**
5
+ * @var $report Smartcrawl_SeoReport
6
+ */
7
+ $report = empty( $report ) ? null : $report;
8
+ // Optional
9
+ $title = empty( $title ) ? '' : $title;
10
+ $description = empty( $description ) ? '' : $description;
11
+ $header_items = empty( $header_items ) ? array() : $header_items;
12
+ $controls_template = empty( $controls_template ) ? 'sitemap/sitemap-crawl-issues-generic-controls' : $controls_template;
13
+ $issue_template = empty( $issue_template ) ? 'sitemap/sitemap-crawl-issue-generic' : $issue_template;
14
+ $success_class = empty( $success_class ) ? 'wds-check-success' : $success_class;
15
+ $warning_class = empty( $warning_class ) ? 'wds-check-warning' : $warning_class;
16
+ $open = empty( $open ) ? false : $open;
17
+
18
+ if ( ! $report || ! $type ) {
19
+ return;
20
+ }
21
+ $all_issues = $report->get_issues_by_type( $type, true );
22
+ $ignored_issues = array();
23
+ $active_issues = array();
24
+
25
+ foreach ( $all_issues as $issue_id ) {
26
+ if ( $report->is_ignored_issue( $issue_id ) ) {
27
+ $ignored_issues[] = $issue_id;
28
+ } else {
29
+ $active_issues[] = $issue_id;
30
+ }
31
+ }
32
+
33
+ $issue_count = count( $active_issues );
34
+ $class = $issue_count > 0 ? $warning_class : $success_class;
35
+ ?>
36
+ <div
37
+ class="wds-issues-type-<?php echo esc_attr( $type ); ?> wds-accordion-section <?php echo esc_attr( $class ); ?> <?php echo $open ? 'open' : ''; ?> <?php echo $all_issues ? '' : 'disabled'; ?>"
38
+ data-type="<?php echo esc_attr( $type ); ?>">
39
+
40
+ <div class="wds-accordion-handle">
41
+ <?php printf( esc_html( $title ), $issue_count > 0 ? intval( $issue_count ) : esc_html__( 'No', 'wds' ) ); ?>
42
+ </div>
43
+ <?php if ( $all_issues ) : ?>
44
+ <div class="wds-accordion-content">
45
+ <div class="wds-small-text"><strong><?php esc_html_e( 'Overview', 'wds' ); ?></strong></div>
46
+ <p>
47
+ <?php echo esc_html( $description ); ?>
48
+ </p>
49
+ <?php if ( $active_issues ) : ?>
50
+ <table class="wds-list-table wds-crawl-issues-table">
51
+ <thead>
52
+ <tr>
53
+ <?php foreach ( $header_items as $header_item ) : ?>
54
+ <?php echo wp_kses_post( $header_item ); ?>
55
+ <?php endforeach; ?>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <?php
60
+ foreach ( $active_issues as $active_issue_id ) {
61
+ $this->_render( $issue_template, array(
62
+ 'type' => $type,
63
+ 'report' => $report,
64
+ 'issue_id' => $active_issue_id,
65
+ ) );
66
+ }
67
+
68
+ $this->_render( $controls_template );
69
+ ?>
70
+ </tbody>
71
+ </table>
72
+ <?php endif; ?>
73
+
74
+ <?php if ( $ignored_issues ) : ?>
75
+ <table class="wds-list-table wds-ignored-items-table">
76
+ <thead>
77
+ <tr>
78
+ <th colspan="2"><?php esc_html_e( 'Ignored', 'wds' ); ?></th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <?php
83
+ foreach ( $ignored_issues as $ignored_issue_id ) {
84
+ $this->_render( 'sitemap/sitemap-crawl-issue-ignored', array(
85
+ 'type' => $type,
86
+ 'report' => $report,
87
+ 'issue_id' => $ignored_issue_id,
88
+ ) );
89
+ }
90
+ ?>
91
+ </tbody>
92
+ </table>
93
+ <?php endif; ?>
94
+ </div>
95
+ <?php endif; ?>
96
+ </div>
includes/admin/templates/sitemap/sitemap-crawl-issues-inaccessible.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $open = empty( $open ) ? false : $open;
5
-
6
- $this->_render('sitemap/sitemap-crawl-issues-group', array(
7
- 'type' => $type,
8
- 'report' => $report,
9
- 'open' => $open,
10
- 'title' => esc_html__( '%s URLs could not be processed', 'wds' ),
11
- 'description' => esc_html__( 'Some of your URLs could not be processed by our crawlers. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
- 'header_items' => array(
13
- sprintf( '<th>%s</th>', esc_html__( "URLs that couldn't be processed", 'wds' ) ),
14
- sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
- sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
- ),
17
- ));
18
-
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $open = empty( $open ) ? false : $open;
5
+
6
+ $this->_render( 'sitemap/sitemap-crawl-issues-group', array(
7
+ 'type' => $type,
8
+ 'report' => $report,
9
+ 'open' => $open,
10
+ 'title' => esc_html__( '%s URLs could not be processed', 'wds' ),
11
+ 'description' => esc_html__( 'Some of your URLs could not be processed by our crawlers. In the options menu you can List occurrences to see where these links can be found, and also set up and 301 redirects to a newer version of these pages.', 'wds' ),
12
+ 'header_items' => array(
13
+ sprintf( '<th>%s</th>', esc_html__( "URLs that couldn't be processed", 'wds' ) ),
14
+ sprintf( '<th>%s</th>', esc_html__( 'Error Code', 'wds' ) ),
15
+ sprintf( '<th colspan="2">%s</th>', esc_html__( 'Occurrences', 'wds' ) ),
16
+ ),
17
+ ) );
18
+
includes/admin/templates/sitemap/sitemap-crawl-issues-sitemap-controls.php CHANGED
@@ -1,8 +1,10 @@
1
- <tr class="wds-controls-row">
2
- <td>
3
- <button class="wds-ignore-all wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
4
- </td>
5
- <td>
6
- <button class="wds-add-all-to-sitemap button wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button-small"><?php esc_html_e( 'Add All to Sitemap', 'wds' ); ?></button>
7
- </td>
8
- </tr>
 
 
1
+ <tr class="wds-controls-row">
2
+ <td>
3
+ <button
4
+ class="wds-ignore-all wds-button-with-loader wds-button-with-right-loader wds-disabled-during-request button button-small button-dark button-dark-o"><?php esc_html_e( 'Ignore All', 'wds' ); ?></button>
5
+ </td>
6
+ <td>
7
+ <button
8
+ class="wds-add-all-to-sitemap button wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request button-small"><?php esc_html_e( 'Add All to Sitemap', 'wds' ); ?></button>
9
+ </td>
10
+ </tr>
includes/admin/templates/sitemap/sitemap-crawl-issues-sitemap.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
- $type = empty( $type ) ? '' : $type;
3
- $report = empty( $report ) ? null : $report;
4
- $open = empty( $open ) ? false : $open;
5
-
6
- $this->_render('sitemap/sitemap-crawl-issues-group', array(
7
- 'type' => $type,
8
- 'report' => $report,
9
- 'open' => $open,
10
- 'title' => esc_html__( '%s URLs are missing from the sitemap', 'wds' ),
11
- 'description' => esc_html__( 'SmartCrawl couldn’t find these URLs in your Sitemap. You can choose to add them to your Sitemap, or ignore the warning if you don’t want them included.', 'wds' ),
12
- 'header_items' => array(
13
- sprintf( '<th colspan="2">%s</th>', esc_html__( 'Missing URLs', 'wds' ) ),
14
- ),
15
- 'issue_template' => 'sitemap/sitemap-crawl-issue-sitemap',
16
- 'controls_template' => 'sitemap/sitemap-crawl-issues-sitemap-controls',
17
- 'warning_class' => 'wds-check-invalid',
18
- ));
19
-
1
+ <?php
2
+ $type = empty( $type ) ? '' : $type;
3
+ $report = empty( $report ) ? null : $report;
4
+ $open = empty( $open ) ? false : $open;
5
+
6
+ $this->_render( 'sitemap/sitemap-crawl-issues-group', array(
7
+ 'type' => $type,
8
+ 'report' => $report,
9
+ 'open' => $open,
10
+ 'title' => esc_html__( '%s URLs are missing from the sitemap', 'wds' ),
11
+ 'description' => esc_html__( 'SmartCrawl couldn’t find these URLs in your Sitemap. You can choose to add them to your Sitemap, or ignore the warning if you don’t want them included.', 'wds' ),
12
+ 'header_items' => array(
13
+ sprintf( '<th colspan="2">%s</th>', esc_html__( 'Missing URLs', 'wds' ) ),
14
+ ),
15
+ 'issue_template' => 'sitemap/sitemap-crawl-issue-sitemap',
16
+ 'controls_template' => 'sitemap/sitemap-crawl-issues-sitemap-controls',
17
+ 'warning_class' => 'wds-check-invalid',
18
+ ) );
19
+
includes/admin/templates/sitemap/sitemap-crawl-results.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
- /**
3
- * SEO Audit crawl results dispatching template
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $report = empty( $report ) ? null : $report;
9
-
10
- if ( null == $report ) {
11
- return;
12
- }
13
-
14
- $active_issues = $report->get_issues_count();
15
- $ignored_issues = $report->get_ignored_issues_count();
16
- $open_type = empty( $open_type ) ? null : $open_type;
17
- $default_issue_types = array( '3xx', '4xx', '5xx', 'inaccessible', 'sitemap' );
18
- ?>
19
- <div class="wds-crawl-results-report wds-report"
20
- data-active-issues="<?php echo esc_attr( $active_issues ); ?>"
21
- data-ignored-issues="<?php echo esc_attr( $ignored_issues ); ?>">
22
-
23
- <?php
24
- if ( $report->has_state_messages() ) {
25
- foreach ( $report->get_state_messages() as $state_message ) {
26
- $this->_render('notice', array(
27
- 'message' => $state_message,
28
- 'class' => 'wds-notice-error',
29
- ));
30
- }
31
- }
32
- ?>
33
-
34
- <?php
35
- $this->_render('sitemap/sitemap-crawl-stats', array(
36
- 'active_issues' => $active_issues,
37
- 'report' => $report,
38
- ));
39
- ?>
40
-
41
- <p><?php esc_html_e( 'Here are potential issues SmartCrawl has picked up. We recommend fixing them up to ensure you aren’t penalized by search engines - you can however ignore any of these warnings.', 'wds' ); ?></p>
42
-
43
- <?php if ( ! Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member() ) { ?>
44
- <div class="wds-obfuscate-section"></div>
45
- <?php } ?>
46
-
47
- <div class="wds-accordion">
48
- <?php
49
- $issue_types = array_unique( array_replace_recursive( $default_issue_types, $report->get_issue_types() ) );
50
-
51
- foreach ( $issue_types as $type ) {
52
- $this->_render('sitemap/sitemap-crawl-issues-' . $type, array(
53
- 'type' => $type,
54
- 'report' => $report,
55
- 'open' => $open_type == $type,
56
- ));
57
- }
58
- ?>
59
- </div>
60
- </div>
1
+ <?php
2
+ /**
3
+ * SEO Audit crawl results dispatching template
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $report = empty( $report ) ? null : $report;
9
+
10
+ if ( ! $report ) {
11
+ return;
12
+ }
13
+
14
+ $active_issues = $report->get_issues_count();
15
+ $ignored_issues = $report->get_ignored_issues_count();
16
+ $open_type = empty( $open_type ) ? null : $open_type;
17
+ $default_issue_types = array( '3xx', '4xx', '5xx', 'inaccessible', 'sitemap' );
18
+ ?>
19
+ <div class="wds-crawl-results-report wds-report"
20
+ data-active-issues="<?php echo intval( $active_issues ); ?>"
21
+ data-ignored-issues="<?php echo intval( $ignored_issues ); ?>">
22
+
23
+ <?php
24
+ if ( $report->has_state_messages() ) {
25
+ foreach ( $report->get_state_messages() as $state_message ) {
26
+ $this->_render( 'notice', array(
27
+ 'message' => $state_message,
28
+ 'class' => 'wds-notice-error',
29
+ ) );
30
+ }
31
+ }
32
+ ?>
33
+
34
+ <?php
35
+ $this->_render( 'sitemap/sitemap-crawl-stats', array(
36
+ 'active_issues' => $active_issues,
37
+ 'report' => $report,
38
+ ) );
39
+ ?>
40
+
41
+ <p><?php esc_html_e( 'Here are potential issues SmartCrawl has picked up. We recommend fixing them up to ensure you aren’t penalized by search engines - you can however ignore any of these warnings.', 'wds' ); ?></p>
42
+
43
+ <?php if ( ! Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SITE )->is_member() ) { ?>
44
+ <div class="wds-obfuscate-section"></div>
45
+ <?php } ?>
46
+
47
+ <div class="wds-accordion">
48
+ <?php
49
+ $issue_types = array_unique( array_replace_recursive( $default_issue_types, $report->get_issue_types() ) );
50
+
51
+ foreach ( $issue_types as $type ) {
52
+ $this->_render( 'sitemap/sitemap-crawl-issues-' . $type, array(
53
+ 'type' => $type,
54
+ 'report' => $report,
55
+ 'open' => $open_type === $type,
56
+ ) );
57
+ }
58
+ ?>
59
+ </div>
60
+ </div>
includes/admin/templates/sitemap/sitemap-crawl-stats.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
- $active_issues = empty( $active_issues ) ? 0 : $active_issues;
3
- $report = empty( $report ) ? null : $report;
4
-
5
- if ( ! $report ) {
6
- return;
7
- }
8
- ?>
9
-
10
- <div class="wds-url-crawler-stats wds-report-stats">
11
- <div class="wds-report-score">
12
- <span class="wds-score <?php echo $active_issues > 0 ? 'wds-score-warning' : 'wds-score-success'; ?>">
13
- <?php echo $active_issues; ?>
14
- <span class="wds-total"></span>
15
- </span>
16
- <span class="wds-small-text"><?php esc_html_e( 'Sitemap Issues', 'wds' ); ?></span>
17
- </div>
18
-
19
- <div>
20
- <div class="wds-stacked-stats">
21
- <div>
22
- <div class="wds-stat-name"><?php esc_html_e( 'Total URLs Discovered', 'wds' ); ?></div>
23
- <div class="wds-stat-value"><?php echo $report->get_meta( 'total' ); ?></div>
24
- </div>
25
- <div>
26
- <div class="wds-stat-name"><?php esc_html_e( 'Invisible URLs', 'wds' ); ?></div>
27
- <div class="wds-stat-value"><?php echo $report->get_issues_count( 'sitemap' ); ?></div>
28
- </div>
29
- </div>
30
- </div>
31
- </div>
1
+ <?php
2
+ $active_issues = empty( $active_issues ) ? 0 : $active_issues;
3
+ $report = empty( $report ) ? null : $report;
4
+
5
+ if ( ! $report ) {
6
+ return;
7
+ }
8
+ ?>
9
+
10
+ <div class="wds-url-crawler-stats wds-report-stats">
11
+ <div class="wds-report-score">
12
+ <span class="wds-score <?php echo $active_issues > 0 ? 'wds-score-warning' : 'wds-score-success'; ?>">
13
+ <?php echo intval( $active_issues ); ?>
14
+ <span class="wds-total"></span>
15
+ </span>
16
+ <span class="wds-small-text"><?php esc_html_e( 'Sitemap Issues', 'wds' ); ?></span>
17
+ </div>
18
+
19
+ <div>
20
+ <div class="wds-stacked-stats">
21
+ <div>
22
+ <div class="wds-stat-name"><?php esc_html_e( 'Total URLs Discovered', 'wds' ); ?></div>
23
+ <div class="wds-stat-value"><?php echo intval( $report->get_meta( 'total' ) ); ?></div>
24
+ </div>
25
+ <div>
26
+ <div class="wds-stat-name"><?php esc_html_e( 'Invisible URLs', 'wds' ); ?></div>
27
+ <div class="wds-stat-value"><?php echo intval( $report->get_issues_count( 'sitemap' ) ); ?></div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
includes/admin/templates/sitemap/sitemap-no-crawler-data.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
- $action_url = esc_url( add_query_arg( 'run-checkup', 'yes' ) ) . '#tab_url_crawler';
3
-
4
- $this->_render('disabled-component-inner', array(
5
- 'content' => sprintf(
6
- '%s<br/>%s',
7
- __( 'Have SmartCrawl check for broken URLs, 404s, multiple redirections and other harmful', 'wds' ),
8
- __( 'issues that can reduce your ability to rank in search engines.', 'wds' )
9
- ),
10
- 'image' => 'url-crawler-disabled.png',
11
- 'button_text' => __( 'Begin Crawl', 'wds' ),
12
- 'button_url' => $action_url,
13
- 'premium_feature' => true,
14
- ));
15
-
1
+ <?php
2
+ $action_url = Smartcrawl_Sitemap_Settings::crawl_url();
3
+
4
+ $this->_render( 'disabled-component-inner', array(
5
+ 'content' => sprintf(
6
+ '%s<br/>%s',
7
+ __( 'Have SmartCrawl check for broken URLs, 404s, multiple redirections and other harmful', 'wds' ),
8
+ __( 'issues that can reduce your ability to rank in search engines.', 'wds' )
9
+ ),
10
+ 'image' => 'url-crawler-disabled.png',
11
+ 'button_text' => __( 'Begin Crawl', 'wds' ),
12
+ 'button_url' => $action_url,
13
+ 'premium_feature' => true,
14
+ ) );
15
+
includes/admin/templates/sitemap/sitemap-occurrences-overlay.php CHANGED
@@ -1,41 +1,42 @@
1
- <?php
2
- $issue_id = empty( $issue_id ) ? null : $issue_id;
3
- $issue = empty( $issue ) ? null : $issue;
4
-
5
- if ( ! $issue_id || ! $issue ) {
6
- return;
7
- }
8
- ?>
9
- <dialog class="dev-overlay wds-modal wds-occurences"
10
- id="wds-issue-occurences-<?php echo esc_attr( $issue_id ); ?>"
11
- title="<?php esc_attr_e( 'List Occurrences', 'wds' ); ?>">
12
-
13
- <div class="box-content">
14
- <div class="wds-issue-occurences-list">
15
- <p>
16
- <?php
17
- printf(
18
- esc_html__( 'We found links to %s in these locations, you might want to remove these links or direct them somewhere else.', 'wds' ),
19
- '<strong>' . $issue['path'] . '</strong>'
20
- );
21
- ?>
22
- </p>
23
- <ul class="wds-listing wds-path-occurrences">
24
- <?php if ( ! empty( $issue['origin'] ) ) : ?>
25
- <?php foreach ( $issue['origin'] as $origin ) : ?>
26
- <li>
27
- <?php $origin = is_array( $origin ) && ! empty( $origin[0] ) ? $origin[0] : $origin; ?>
28
-
29
- <a href="<?php echo is_string( $origin ) ? esc_url( $origin ) : esc_url( $origin[0] ); ?>">
30
- <?php echo is_string( $origin ) ? esc_html( $origin ) : esc_html( $origin[0] ); ?>
31
- </a>
32
- </li>
33
- <?php endforeach; ?>
34
- <?php endif; ?>
35
- </ul>
36
- </div>
37
- <div class="wds-box-footer">
38
- <button type="button" class="wds-cancel-button button button-dark-o"><?php esc_attr_e( 'Cancel', 'wds' ); ?></button>
39
- </div>
40
- </div>
41
- </dialog>
 
1
+ <?php
2
+ $issue_id = empty( $issue_id ) ? null : $issue_id;
3
+ $issue = empty( $issue ) ? null : $issue;
4
+
5
+ if ( ! $issue_id || ! $issue ) {
6
+ return;
7
+ }
8
+ ?>
9
+ <dialog class="dev-overlay wds-modal wds-occurrences"
10
+ id="wds-issue-occurrences-<?php echo esc_attr( $issue_id ); ?>"
11
+ title="<?php esc_attr_e( 'List Occurrences', 'wds' ); ?>">
12
+
13
+ <div class="box-content">
14
+ <div class="wds-issue-occurrences-list">
15
+ <p>
16
+ <?php
17
+ printf(
18
+ esc_html__( 'We found links to %s in these locations, you might want to remove these links or direct them somewhere else.', 'wds' ),
19
+ '<strong>' . esc_html( $issue['path'] ) . '</strong>'
20
+ );
21
+ ?>
22
+ </p>
23
+ <ul class="wds-listing wds-path-occurrences">
24
+ <?php if ( ! empty( $issue['origin'] ) ) : ?>
25
+ <?php foreach ( $issue['origin'] as $origin ) : ?>
26
+ <li>
27
+ <?php $origin = is_array( $origin ) && ! empty( $origin[0] ) ? $origin[0] : $origin; ?>
28
+
29
+ <a href="<?php echo is_string( $origin ) ? esc_url( $origin ) : esc_url( $origin[0] ); ?>">
30
+ <?php echo is_string( $origin ) ? esc_html( $origin ) : esc_html( $origin[0] ); ?>
31
+ </a>
32
+ </li>
33
+ <?php endforeach; ?>
34
+ <?php endif; ?>
35
+ </ul>
36
+ </div>
37
+ <div class="wds-box-footer">
38
+ <button type="button"
39
+ class="wds-cancel-button button button-dark-o"><?php esc_attr_e( 'Cancel', 'wds' ); ?></button>
40
+ </div>
41
+ </div>
42
+ </dialog>
includes/admin/templates/sitemap/sitemap-part.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
- $part_excluded = ! empty( $_view['options'][ $item ] );
3
- $part_checked = $part_excluded ? 'checked="checked"' : '';
4
- $inverted = empty( $inverted ) ? false : $inverted;
5
- ?>
6
- <div class="wds-sitemap-part">
7
- <span class="wds-sitemap-part-label">
8
- <label
9
- class="wds-label wds-label-inline"
10
- for="<?php echo esc_attr( $item ); ?>">
11
- <?php echo $item_label; ?>
12
- </label>
13
- </span>
14
- <?php if ( ! empty( $item_name ) ) : ?>
15
- <span class="wds-sitemap-part-name">
16
- <?php echo $item_name; ?>
17
- </span>
18
- <?php endif; ?>
19
- <span class="wds-sitemap-part-toggle">
20
- <span class="toggle wds-toggle <?php echo $inverted ? 'wds-inverted-toggle' : ''; ?>">
21
- <input
22
- class="toggle-checkbox"
23
- value='<?php echo esc_attr( $item ); ?>'
24
- <?php echo $part_checked; ?>
25
- id='<?php echo esc_attr( $item ); ?>'
26
- name="<?php echo esc_attr( $option_name ); ?>"
27
- type='checkbox'/>
28
-
29
- <label class="toggle-label" for="<?php echo $item; ?>"></label>
30
- </span>
31
- </span>
32
- </div>
1
+ <?php
2
+ $part_excluded = ! empty( $_view['options'][ $item ] );
3
+ $part_checked = $part_excluded ? 'checked' : '';
4
+ $inverted = empty( $inverted ) ? false : $inverted;
5
+ ?>
6
+ <div class="wds-sitemap-part">
7
+ <span class="wds-sitemap-part-label">
8
+ <label
9
+ class="wds-label wds-label-inline"
10
+ for="<?php echo esc_attr( $item ); ?>">
11
+ <?php echo esc_html( $item_label ); ?>
12
+ </label>
13
+ </span>
14
+ <?php if ( ! empty( $item_name ) ) : ?>
15
+ <span class="wds-sitemap-part-name">
16
+ <?php echo esc_html( $item_name ); ?>
17
+ </span>
18
+ <?php endif; ?>
19
+ <span class="wds-sitemap-part-toggle">
20
+ <span class="toggle wds-toggle <?php echo $inverted ? 'wds-inverted-toggle' : ''; ?>">
21
+ <input
22
+ class="toggle-checkbox"
23
+ value='<?php echo esc_attr( $item ); ?>'
24
+ <?php echo esc_attr( $part_checked ); ?>
25
+ id='<?php echo esc_attr( $item ); ?>'
26
+ name="<?php echo esc_attr( $option_name ); ?>"
27
+ type='checkbox'/>
28
+
29
+ <label class="toggle-label" for="<?php echo esc_attr( $item ); ?>"></label>
30
+ </span>
31
+ </span>
32
+ </div>
includes/admin/templates/sitemap/sitemap-progress-bar.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php $progress = empty( $progress ) ? 0 : $progress; ?>
2
-
3
- <div class="wds-crawl-results-report wds-report">
4
- <div class="wds-url-crawler-progress">
5
- <?php
6
- $this->_render('progress-bar', array(
7
- 'progress' => $progress,
8
- ));
9
- ?>
10
- <?php $this->_render( 'progress-notice' ); ?>
11
- </div>
12
- </div>
1
+ <?php $progress = empty( $progress ) ? 0 : $progress; ?>
2
+
3
+ <div class="wds-crawl-results-report wds-report">
4
+ <div class="wds-url-crawler-progress">
5
+ <?php
6
+ $this->_render( 'progress-bar', array(
7
+ 'progress' => $progress,
8
+ ) );
9
+ ?>
10
+ <?php $this->_render( 'progress-notice' ); ?>
11
+ </div>
12
+ </div>
includes/admin/templates/sitemap/sitemap-redirect-overlay.php CHANGED
@@ -1,61 +1,64 @@
1
- <?php
2
- $issue_id = empty( $issue_id ) ? null : $issue_id;
3
- $issue = empty( $issue ) ? null : $issue;
4
- $issue_path = smartcrawl_get_array_value( $issue, 'path' );
5
-
6
- if ( ! $issue_id || ! $issue || ! $issue_path ) {
7
- return;
8
- }
9
-
10
- $rmodel = new Smartcrawl_Model_Redirection;
11
- $redirections = $rmodel->get_all_redirections();
12
- $redirection_target = ! empty( $redirections[ $issue_path ] ) ? esc_url( $redirections[ $issue_path ] ) : '';
13
- ?>
14
- <dialog class="dev-overlay wds-modal wds-redirect wds-report"
15
- id="wds-issue-redirect-<?php echo esc_attr( $issue_id ); ?>"
16
- title="<?php esc_attr_e( 'Redirect URL', 'wds' ); ?>">
17
-
18
- <div class="box-content modal wds-form"
19
- data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
20
-
21
- <p>
22
- <?php
23
- printf(
24
- esc_html__( 'Choose where to redirect %s', 'wds' ),
25
- '<strong>' . $issue_path . '</strong>'
26
- );
27
- ?>
28
- </p>
29
- <div class="wds-table-fields wds-table-fields-stacked">
30
- <div class="label">
31
- <label for="wds-redirect-target-<?php echo $issue_id; ?>" class="wds-label"><?php esc_html_e( 'New URL', 'wds' ); ?></label>
32
- </div>
33
- <div class="fields">
34
- <input id="wds-redirect-target-<?php echo $issue_id; ?>"
35
- type="url"
36
- name="redirect"
37
- value="<?php echo esc_attr( $redirection_target ); ?>"
38
- class="wds-field"
39
- placeholder="<?php esc_attr_e( 'Enter new URL', 'wds' ); ?>"/>
40
- <p class="wds-field-legend">
41
- <?php
42
- $advanced_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
43
- printf(
44
- esc_html__( 'Formats include relative (E.g. %1$s) or absolute URLs (E.g. %1$s or %1$s). This will set up a 301 (permanent) redirect from one URL to another, you can view all your redirections under %1$s.', 'wds' ),
45
- sprintf( '<strong>%s</strong>', esc_html__( '/cats', 'wds' ) ),
46
- sprintf( '<strong>%s</strong>', esc_html__( 'www.website.com/cats', 'wds' ) ),
47
- sprintf( '<strong>%s</strong>', esc_html__( 'https://website.com/cats', 'wds' ) ),
48
- sprintf( '<strong><a href="%s">%s</a></strong>', $advanced_url, esc_html__( 'Advanced Tools', 'wds' ) )
49
- );
50
- ?>
51
- </p>
52
- </div>
53
- </div>
54
- <div class="wds-box-footer">
55
- <input type="hidden" name="source" value="<?php echo esc_url( $issue_path ); ?>"/>
56
- <?php wp_nonce_field( 'wds-redirect', 'wds-redirect' ); ?>
57
- <button type="button" class="button button-dark-o wds-cancel-button wds-disabled-during-request"><?php esc_html_e( 'Cancel', 'wds' ); ?></button>
58
- <button type="button" class="button wds-action-button wds-submit-redirect wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request"><?php esc_html_e( 'Add Redirect', 'wds' ); ?></button>
59
- </div>
60
- </div>
61
- </dialog>
 
 
 
1
+ <?php
2
+ $issue_id = empty( $issue_id ) ? null : $issue_id;
3
+ $issue = empty( $issue ) ? null : $issue;
4
+ $issue_path = smartcrawl_get_array_value( $issue, 'path' );
5
+
6
+ if ( ! $issue_id || ! $issue || ! $issue_path ) {
7
+ return;
8
+ }
9
+
10
+ $rmodel = new Smartcrawl_Model_Redirection();
11
+ $redirections = $rmodel->get_all_redirections();
12
+ $redirection_target = ! empty( $redirections[ $issue_path ] ) ? esc_url( $redirections[ $issue_path ] ) : '';
13
+ ?>
14
+ <dialog class="dev-overlay wds-modal wds-redirect wds-report"
15
+ id="wds-issue-redirect-<?php echo esc_attr( $issue_id ); ?>"
16
+ title="<?php esc_attr_e( 'Redirect URL', 'wds' ); ?>">
17
+
18
+ <div class="box-content modal wds-form"
19
+ data-issue-id="<?php echo esc_attr( $issue_id ); ?>">
20
+
21
+ <p>
22
+ <?php
23
+ printf(
24
+ esc_html__( 'Choose where to redirect %s', 'wds' ),
25
+ '<strong>' . esc_html( $issue_path ) . '</strong>'
26
+ );
27
+ ?>
28
+ </p>
29
+ <div class="wds-table-fields wds-table-fields-stacked">
30
+ <div class="label">
31
+ <label for="wds-redirect-target-<?php echo esc_attr( $issue_id ); ?>"
32
+ class="wds-label"><?php esc_html_e( 'New URL', 'wds' ); ?></label>
33
+ </div>
34
+ <div class="fields">
35
+ <input id="wds-redirect-target-<?php echo esc_attr( $issue_id ); ?>"
36
+ type="url"
37
+ name="redirect"
38
+ value="<?php echo esc_attr( $redirection_target ); ?>"
39
+ class="wds-field"
40
+ placeholder="<?php esc_attr_e( 'Enter new URL', 'wds' ); ?>"/>
41
+ <p class="wds-field-legend">
42
+ <?php
43
+ $advanced_url = Smartcrawl_Settings_Admin::admin_url( Smartcrawl_Settings::TAB_AUTOLINKS );
44
+ printf(
45
+ esc_html__( 'Formats include relative (E.g. %1$s) or absolute URLs (E.g. %2$s or %3$s). This will set up a 301 (permanent) redirect from one URL to another, you can view all your redirections under %4$s.', 'wds' ),
46
+ sprintf( '<strong>%s</strong>', esc_html__( '/cats', 'wds' ) ),
47
+ sprintf( '<strong>%s</strong>', esc_html__( 'www.website.com/cats', 'wds' ) ),
48
+ sprintf( '<strong>%s</strong>', esc_html__( 'https://website.com/cats', 'wds' ) ),
49
+ sprintf( '<strong><a href="%s">%s</a></strong>', esc_url( $advanced_url ), esc_html__( 'Advanced Tools', 'wds' ) )
50
+ );
51
+ ?>
52
+ </p>
53
+ </div>
54
+ </div>
55
+ <div class="wds-box-footer">
56
+ <input type="hidden" name="source" value="<?php echo esc_url( $issue_path ); ?>"/>
57
+ <?php wp_nonce_field( 'wds-redirect', 'wds-redirect' ); ?>
58
+ <button type="button"
59
+ class="button button-dark-o wds-cancel-button wds-disabled-during-request"><?php esc_html_e( 'Cancel', 'wds' ); ?></button>
60
+ <button type="button"
61
+ class="button wds-action-button wds-submit-redirect wds-button-with-loader wds-button-with-left-loader wds-disabled-during-request"><?php esc_html_e( 'Add Redirect', 'wds' ); ?></button>
62
+ </div>
63
+ </div>
64
+ </dialog>
includes/admin/templates/sitemap/sitemap-section-advanced.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
- $engines = empty( $engines ) ? array() : $engines;
3
- ?>
4
-
5
- <?php
6
- $this->_render('toggle-group', array(
7
- 'label' => __( 'Include images', 'wds' ),
8
- 'description' => __( 'If your posts contain imagery you would like others to be able to search, this setting will help Google Images index them correctly.', 'wds' ),
9
- 'items' => array(
10
- 'sitemap-images' => array(
11
- 'label' => __( 'Include image items with the sitemap', 'wds' ),
12
- 'description' => __( 'Note: When uploading attachments to posts, be sure to add titles and captions that clearly describe your images.', 'wds' ),
13
- 'value' => '1',
14
- ),
15
- ),
16
- ));
17
-
18
- $this->_render('toggle-group', array(
19
- 'label' => __( 'Auto-notify search engines', 'wds' ),
20
- 'description' => __( 'Instead of waiting for search engines to crawl your website you can automatically submit your sitemap whenever it changes.', 'wds' ),
21
- 'separator' => true,
22
- 'items' => $engines,
23
- ));
24
-
25
- $this->_render('toggle-group', array(
26
- 'label' => __( 'Style sitemap', 'wds' ),
27
- 'description' => __( 'Adds some nice styling to your sitemap.', 'wds' ),
28
- 'separator' => true,
29
- 'items' => array(
30
- 'sitemap-stylesheet' => array(
31
- 'label' => __( 'Include stylesheet with sitemap', 'wds' ),
32
- 'description' => __( 'Note: This doesn’t affect your SEO and is purely visual.', 'wds' ),
33
- 'value' => '1',
34
- ),
35
- ),
36
- ));
37
- ?>
38
-
39
- <?php $automatic_updates_disabled = ! empty( $_view['options']['sitemap-disable-automatic-regeneration'] ); ?>
40
- <div class="wds-toggleable wds-disable-updates <?php echo $automatic_updates_disabled ? '' : 'inactive'; ?>">
41
- <?php
42
- $this->_render('toggle-group', array(
43
- 'label' => __( 'Automatic sitemap updates', 'wds' ),
44
- 'description' => __( 'Choose whether or not you want SmartCrawl to update your Sitemap automatically when you publish new pages, posts, post types or taxonomies.', 'wds' ),
45
- 'separator' => true,
46
- 'items' => array(
47
- 'sitemap-disable-automatic-regeneration' => array(
48
- 'label' => __( 'Automatically update my sitemap', 'wds' ),
49
- 'inverted' => true,
50
- 'html_description' => sprintf(
51
- '<div class="wds-toggleable-inside wds-notice wds-notice-warning"><p>%s</p></div>',
52
- __( 'Your sitemap isn’t being updated automatically. Click Save Settings below to regenerate your sitemap.', 'wds' )
53
- ),
54
- ),
55
- ),
56
- ));
57
- ?>
58
- </div>
1
+ <?php
2
+ $engines = empty( $engines ) ? array() : $engines;
3
+ ?>
4
+
5
+ <?php
6
+ $this->_render( 'toggle-group', array(
7
+ 'label' => __( 'Include images', 'wds' ),
8
+ 'description' => __( 'If your posts contain imagery you would like others to be able to search, this setting will help Google Images index them correctly.', 'wds' ),
9
+ 'items' => array(
10
+ 'sitemap-images' => array(
11
+ 'label' => __( 'Include image items with the sitemap', 'wds' ),
12
+ 'description' => __( 'Note: When uploading attachments to posts, be sure to add titles and captions that clearly describe your images.', 'wds' ),
13
+ 'value' => '1',
14
+ ),
15
+ ),
16
+ ) );
17
+
18
+ $this->_render( 'toggle-group', array(
19
+ 'label' => __( 'Auto-notify search engines', 'wds' ),
20
+ 'description' => __( 'Instead of waiting for search engines to crawl your website you can automatically submit your sitemap whenever it changes.', 'wds' ),
21
+ 'separator' => true,
22
+ 'items' => $engines,
23
+ ) );
24
+
25
+ $this->_render( 'toggle-group', array(
26
+ 'label' => __( 'Style sitemap', 'wds' ),
27
+ 'description' => __( 'Adds some nice styling to your sitemap.', 'wds' ),
28
+ 'separator' => true,
29
+ 'items' => array(
30
+ 'sitemap-stylesheet' => array(
31
+ 'label' => __( 'Include stylesheet with sitemap', 'wds' ),
32
+ 'description' => __( 'Note: This doesn’t affect your SEO and is purely visual.', 'wds' ),
33
+ 'value' => '1',
34
+ ),
35
+ ),
36
+ ) );
37
+ ?>
38
+
39
+ <?php $automatic_updates_disabled = ! empty( $_view['options']['sitemap-disable-automatic-regeneration'] ); ?>
40
+ <div class="wds-toggleable wds-disable-updates <?php echo $automatic_updates_disabled ? '' : 'inactive'; ?>">
41
+ <?php
42
+ $this->_render( 'toggle-group', array(
43
+ 'label' => __( 'Automatic sitemap updates', 'wds' ),
44
+ 'description' => __( 'Choose whether or not you want SmartCrawl to update your Sitemap automatically when you publish new pages, posts, post types or taxonomies.', 'wds' ),
45
+ 'separator' => true,
46
+ 'items' => array(
47
+ 'sitemap-disable-automatic-regeneration' => array(
48
+ 'label' => __( 'Automatically update my sitemap', 'wds' ),
49
+ 'inverted' => true,
50
+ 'html_description' => sprintf(
51
+ '<div class="wds-toggleable-inside wds-notice wds-notice-warning"><p>%s</p></div>',
52
+ __( 'Your sitemap isn’t being updated automatically. Click Save Settings below to regenerate your sitemap.', 'wds' )
53
+ ),
54
+ ),
55
+ ),
56
+ ) );
57
+ ?>
58
+ </div>
includes/admin/templates/sitemap/sitemap-section-reporting.php CHANGED
@@ -1,100 +1,103 @@
1
- <?php
2
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
3
- $cron = Smartcrawl_Controller_Cron::get();
4
- $option_name = $_view['option_name'];
5
-
6
- // This does the actual rescheduling
7
- $cron->set_up_schedule();
8
- $crawler_cron_enabled = $_view['options']['crawler-cron-enable'];
9
- $toggle_field_name = $option_name . '[crawler-cron-enable]';
10
- ?>
11
-
12
- <?php if ( ! $service->is_member() ) : ?>
13
- <div class="wds-obfuscate-section"></div>
14
- <?php endif; ?>
15
-
16
- <div class="wds-table-fields wds-toggleable">
17
- <div class="label">
18
- <label class="wds-label"
19
- for="<?php echo esc_attr( $toggle_field_name ); ?>">
20
-
21
- <?php esc_html_e( 'Schedule Crawl', 'wds' ); ?>
22
- </label>
23
- </div>
24
- <div class="fields wds-toggleable <?php echo $crawler_cron_enabled ? '' : 'inactive'; ?>">
25
- <?php
26
- $this->_render('toggle-item', array(
27
- 'field_name' => $toggle_field_name,
28
- 'field_id' => $toggle_field_name,
29
- 'checked' => checked( $crawler_cron_enabled, true, false ),
30
- 'item_label' => esc_html__( 'Run regular URL crawls', 'wds' ),
31
- ));
32
- ?>
33
- <div class="wds-toggleable-inside wds-toggleable-inside-box">
34
- <div class="wds-table-fields wds-table-fields-stacked">
35
- <div class="label">
36
- <label for="wds-crawler-frequency" class="wds-label"><?php esc_html_e( 'Frequency', 'wds' ); ?></label>
37
- </div>
38
- <div class="fields">
39
- <select class="select-container wds-conditional-parent"
40
- id="wds-crawler-frequency"
41
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-frequency]"
42
- style="width: 100%">
43
-
44
- <?php foreach ( $cron->get_frequencies() as $key => $label ) : ?>
45
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $_view['options']['crawler-frequency'] ); ?>>
46
- <?php echo esc_html( $label ); ?>
47
- </option>
48
- <?php endforeach; ?>
49
- </select>
50
- </div>
51
- </div>
52
-
53
- <div class="wds-table-fields wds-table-fields-stacked wds-conditional-child"
54
- data-parent="wds-crawler-frequency"
55
- data-parent-val="weekly,monthly">
56
-
57
- <div class="label">
58
- <label for="wds-crawler-dow" class="wds-label"><?php esc_html_e( 'Day of the week', 'wds' ); ?></label>
59
- </div>
60
- <div class="fields">
61
- <select class="select-container"
62
- id="wds-crawler-dow"
63
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-dow]"
64
- style="width: 100%">
65
-
66
- <?php $monday = strtotime( 'this Monday' ); ?>
67
- <?php foreach ( range( 0, 6 ) as $dow ) : ?>
68
- <option value="<?php echo esc_attr( $dow ); ?>"
69
- <?php selected( $dow, $_view['options']['crawler-dow'] ); ?>>
70
- <?php echo esc_html( date_i18n( 'l', $monday + ($dow * DAY_IN_SECONDS) ) ); ?>
71
- </option>
72
- <?php endforeach; ?>
73
- </select>
74
- </div>
75
- </div>
76
-
77
- <div class="wds-table-fields wds-table-fields-stacked">
78
- <div class="label">
79
- <label for="wds-crawler-tod" class="wds-label"><?php esc_html_e( 'Time of day', 'wds' ); ?></label>
80
- </div>
81
- <div class="fields">
82
- <select class="select-container"
83
- id="wds-crawler-tod"
84
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-tod]"
85
- style="width: 100%">
86
-
87
- <?php $midnight = strtotime( 'today' ); ?>
88
- <?php foreach ( range( 0, 23 ) as $tod ) : ?>
89
- <option value="<?php echo esc_attr( $tod ); ?>"
90
- <?php selected( $tod, $_view['options']['crawler-tod'] ); ?>>
91
- <?php echo esc_html( date_i18n( get_option( 'time_format' ), $midnight + ($tod * HOUR_IN_SECONDS) ) ); ?>
92
- </option>
93
- <?php endforeach; ?>
94
- </select>
95
- </div>
96
- </div>
97
- </div>
98
- </div>
99
-
100
- </div>
 
 
 
1
+ <?php
2
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
3
+ $cron = Smartcrawl_Controller_Cron::get();
4
+ $option_name = $_view['option_name'];
5
+
6
+ // This does the actual rescheduling
7
+ $cron->set_up_schedule();
8
+ $crawler_cron_enabled = $_view['options']['crawler-cron-enable'];
9
+ $toggle_field_name = $option_name . '[crawler-cron-enable]';
10
+ ?>
11
+
12
+ <?php if ( ! $service->is_member() ) : ?>
13
+ <div class="wds-obfuscate-section"></div>
14
+ <?php endif; ?>
15
+
16
+ <div class="wds-table-fields wds-toggleable">
17
+ <div class="label">
18
+ <label class="wds-label"
19
+ for="<?php echo esc_attr( $toggle_field_name ); ?>">
20
+
21
+ <?php esc_html_e( 'Schedule Crawl', 'wds' ); ?>
22
+ </label>
23
+ </div>
24
+ <div class="fields wds-toggleable <?php echo $crawler_cron_enabled ? '' : 'inactive'; ?>">
25
+ <?php
26
+ $this->_render( 'toggle-item', array(
27
+ 'field_name' => $toggle_field_name,
28
+ 'field_id' => $toggle_field_name,
29
+ 'checked' => checked( $crawler_cron_enabled, true, false ),
30
+ 'item_label' => esc_html__( 'Run regular URL crawls', 'wds' ),
31
+ ) );
32
+ ?>
33
+ <div class="wds-toggleable-inside wds-toggleable-inside-box">
34
+ <div class="wds-table-fields wds-table-fields-stacked">
35
+ <div class="label">
36
+ <label for="wds-crawler-frequency"
37
+ class="wds-label"><?php esc_html_e( 'Frequency', 'wds' ); ?></label>
38
+ </div>
39
+ <div class="fields">
40
+ <select class="select-container wds-conditional-parent"
41
+ id="wds-crawler-frequency"
42
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-frequency]"
43
+ style="width: 100%">
44
+
45
+ <?php foreach ( $cron->get_frequencies() as $key => $label ) : ?>
46
+ <option
47
+ value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $_view['options']['crawler-frequency'] ); ?>>
48
+ <?php echo esc_html( $label ); ?>
49
+ </option>
50
+ <?php endforeach; ?>
51
+ </select>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="wds-table-fields wds-table-fields-stacked wds-conditional-child"
56
+ data-parent="wds-crawler-frequency"
57
+ data-parent-val="weekly,monthly">
58
+
59
+ <div class="label">
60
+ <label for="wds-crawler-dow"
61
+ class="wds-label"><?php esc_html_e( 'Day of the week', 'wds' ); ?></label>
62
+ </div>
63
+ <div class="fields">
64
+ <select class="select-container"
65
+ id="wds-crawler-dow"
66
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-dow]"
67
+ style="width: 100%">
68
+
69
+ <?php $monday = strtotime( 'this Monday' ); ?>
70
+ <?php foreach ( range( 0, 6 ) as $dow ) : ?>
71
+ <option value="<?php echo esc_attr( $dow ); ?>"
72
+ <?php selected( $dow, $_view['options']['crawler-dow'] ); ?>>
73
+ <?php echo esc_html( date_i18n( 'l', $monday + ( $dow * DAY_IN_SECONDS ) ) ); ?>
74
+ </option>
75
+ <?php endforeach; ?>
76
+ </select>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="wds-table-fields wds-table-fields-stacked">
81
+ <div class="label">
82
+ <label for="wds-crawler-tod" class="wds-label"><?php esc_html_e( 'Time of day', 'wds' ); ?></label>
83
+ </div>
84
+ <div class="fields">
85
+ <select class="select-container"
86
+ id="wds-crawler-tod"
87
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[crawler-tod]"
88
+ style="width: 100%">
89
+
90
+ <?php $midnight = strtotime( 'today' ); ?>
91
+ <?php foreach ( range( 0, 23 ) as $tod ) : ?>
92
+ <option value="<?php echo esc_attr( $tod ); ?>"
93
+ <?php selected( $tod, $_view['options']['crawler-tod'] ); ?>>
94
+ <?php echo esc_html( date_i18n( get_option( 'time_format' ), $midnight + ( $tod * HOUR_IN_SECONDS ) ) ); ?>
95
+ </option>
96
+ <?php endforeach; ?>
97
+ </select>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
103
+ </div>
includes/admin/templates/sitemap/sitemap-section-settings.php CHANGED
@@ -1,139 +1,144 @@
1
- <?php
2
- /**
3
- * Sitemaps admin page, Sitemap vertical tab
4
- *
5
- * @package wpmu-dev-seo
6
- */
7
-
8
- $post_types = empty( $post_types ) ? array() : $post_types;
9
- $taxonomies = empty( $taxonomies ) ? array() : $taxonomies;
10
- $smartcrawl_buddypress = empty( $smartcrawl_buddypress ) ? array() : $smartcrawl_buddypress;
11
- $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
12
- $extra_urls = empty( $extra_urls ) ? '' : $extra_urls;
13
- $ignore_urls = empty( $ignore_urls ) ? '' : $ignore_urls;
14
- $ignore_post_ids = empty( $ignore_post_ids ) ? '' : $ignore_post_ids;
15
- ?>
16
-
17
- <?php if ( Smartcrawl_Xml_Sitemap::is_sitemap_path_writable() ) { ?>
18
- <div class="wds-notice wds-notice-success">
19
- <p>
20
- <?php
21
- printf(
22
- __( 'Your sitemap is available at %s', 'wds' ),
23
- sprintf( '<a target="_blank" href="%s">/sitemap.xml</a>', esc_attr( smartcrawl_get_sitemap_url() ) )
24
- );
25
- ?>
26
- </p>
27
- </div>
28
- <?php } else { ?>
29
- <div class="wds-notice wds-notice-error">
30
- <p>
31
- <?php
32
- printf(
33
- __( 'Unable to write to sitemap file: <code>%s</code>', 'wds' ),
34
- esc_html( smartcrawl_get_sitemap_path() )
35
- );
36
- ?>
37
- </p>
38
- </div>
39
- <?php } ?>
40
-
41
- <div class="wds-table-fields-group">
42
- <div class="wds-table-fields wds-separator-top">
43
- <div class="label">
44
- <label class="wds-label"><?php _e( 'Include' , 'wds' ); ?></label>
45
- <span class="wds-label-description">
46
- <?php _e( 'Choose which post types, archives and taxonomies you wish to include in your sitemap.', 'wds' ); ?>
47
- </span>
48
- </div>
49
- <div class="fields">
50
- <div class="wds-sitemap-parts">
51
- <?php foreach ( $post_types as $item => $post_type ) : ?>
52
- <?php
53
- $this->_render('sitemap/sitemap-part', array(
54
- 'item' => $item,
55
- 'item_name' => $post_type->name,
56
- 'item_label' => $post_type->label,
57
- 'inverted' => true,
58
- 'option_name' => $option_name . '[exclude_post_types][]',
59
- ));
60
- ?>
61
- <?php endforeach; ?>
62
-
63
- <?php foreach ( $taxonomies as $item => $taxonomy ) : ?>
64
- <?php
65
- $this->_render('sitemap/sitemap-part', array(
66
- 'item' => $item,
67
- 'item_name' => $taxonomy->name,
68
- 'item_label' => $taxonomy->label,
69
- 'inverted' => true,
70
- 'option_name' => $option_name . '[exclude_taxonomies][]',
71
- ));
72
- ?>
73
- <?php endforeach; ?>
74
-
75
- <?php
76
- if ( $smartcrawl_buddypress ) {
77
- $this->_render( 'sitemap/sitemap-buddypress-settings', $smartcrawl_buddypress );
78
- }
79
- ?>
80
-
81
- </div>
82
- </div>
83
- </div>
84
-
85
- <div class="wds-table-fields wds-separator-top">
86
- <div class="label">
87
- <label for="<?php echo $option_name; ?>[extra_sitemap_urls]" class="wds-label"><?php _e( 'Extra URLs', 'wds' ); ?></label>
88
- <span class="wds-label-description">
89
- <?php esc_html_e( "Enter any additional URLs that aren't part of your default pages, posts or custom post types.", 'wds' ); ?>
90
- </span>
91
- </div>
92
-
93
- <div class="fields">
94
- <textarea id="<?php echo $option_name; ?>[extra_sitemap_urls]"
95
- name="<?php echo $option_name; ?>[extra_sitemap_urls]"><?php echo esc_textarea( $extra_urls ); ?></textarea>
96
- <span class="wds-field-legend">
97
- <?php esc_html_e( 'Enter one URL per line', 'wds' ); ?>
98
- </span>
99
- </div>
100
- </div>
101
-
102
- <div class="wds-table-fields wds-separator-top">
103
- <div class="label">
104
- <label for="<?php echo $option_name; ?>[sitemap_ignore_urls]" class="wds-label"><?php _e( 'Exclusions', 'wds' ); ?></label>
105
- <span class="wds-label-description">
106
- <?php esc_html_e( 'If you have custom URLs you want explicitly excluded from your Sitemap you can do this here.', 'wds' ); ?>
107
- </span>
108
- </div>
109
-
110
- <div class="fields">
111
- <div>
112
- <label for="<?php echo $option_name; ?>[sitemap_ignore_post_ids]" class="wds-label"><?php _e( 'Posts', 'wds' ); ?></label>
113
- <span class="wds-field-legend">
114
- <?php esc_html_e( 'Enter any particular post IDs you wish to exclude from your sitemap. Note, you can also exclude posts and pages from the post editor page.', 'wds' ); ?>
115
- </span>
116
- <input type="text" id="<?php echo $option_name; ?>[sitemap_ignore_post_ids]"
117
- placeholder="<?php echo esc_attr( __( 'e.g. 1,5,6,99', 'wds' ) ); ?>"
118
- name="<?php echo $option_name; ?>[sitemap_ignore_post_ids]" value="<?php echo esc_attr( $ignore_post_ids ); ?>" />
119
- <span class="wds-field-legend">
120
- <?php esc_html_e( 'Enter post IDs separated by commas.', 'wds' ); ?>
121
- </span>
122
- </div>
123
-
124
- <div class="wds-separator-top">
125
- <label for="<?php echo $option_name; ?>[sitemap_ignore_urls]" class="wds-label"><?php _e( 'Custom URLs', 'wds' ); ?></label>
126
- <span class="wds-field-legend">
127
- <?php esc_html_e( 'Enter any custom URLs you want excluded permanently from the sitemap.', 'wds' ); ?>
128
- </span>
129
- <textarea id="<?php echo $option_name; ?>[sitemap_ignore_urls]"
130
- placeholder="<?php echo esc_attr( __( 'e.g. /excluded-url', 'wds' ) ); ?>"
131
- name="<?php echo $option_name; ?>[sitemap_ignore_urls]"><?php echo esc_textarea( $ignore_urls ); ?></textarea>
132
- <span class="wds-field-legend">
133
- <?php esc_html_e( 'Enter one URL per line', 'wds' ); ?>
134
- </span>
135
- </div>
136
- </div>
137
- </div>
138
-
139
- </div>
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitemaps admin page, Sitemap vertical tab
4
+ *
5
+ * @package wpmu-dev-seo
6
+ */
7
+
8
+ $post_types = empty( $post_types ) ? array() : $post_types;
9
+ $taxonomies = empty( $taxonomies ) ? array() : $taxonomies;
10
+ $smartcrawl_buddypress = empty( $smartcrawl_buddypress ) ? array() : $smartcrawl_buddypress;
11
+ $option_name = empty( $_view['option_name'] ) ? '' : $_view['option_name'];
12
+ $extra_urls = empty( $extra_urls ) ? '' : $extra_urls;
13
+ $ignore_urls = empty( $ignore_urls ) ? '' : $ignore_urls;
14
+ $ignore_post_ids = empty( $ignore_post_ids ) ? '' : $ignore_post_ids;
15
+ ?>
16
+
17
+ <?php if ( Smartcrawl_Xml_Sitemap::is_sitemap_path_writable() ) { ?>
18
+ <div class="wds-notice wds-notice-success">
19
+ <p>
20
+ <?php
21
+ printf(
22
+ esc_html__( 'Your sitemap is available at %s', 'wds' ),
23
+ sprintf( '<a target="_blank" href="%s">/sitemap.xml</a>', esc_attr( smartcrawl_get_sitemap_url() ) )
24
+ );
25
+ ?>
26
+ </p>
27
+ </div>
28
+ <?php } else { ?>
29
+ <div class="wds-notice wds-notice-error">
30
+ <p>
31
+ <?php
32
+ printf(
33
+ esc_html__( 'Unable to write to sitemap file: <code>%s</code>', 'wds' ),
34
+ esc_html( smartcrawl_get_sitemap_path() )
35
+ );
36
+ ?>
37
+ </p>
38
+ </div>
39
+ <?php } ?>
40
+
41
+ <div class="wds-table-fields-group">
42
+ <div class="wds-table-fields wds-separator-top">
43
+ <div class="label">
44
+ <label class="wds-label"><?php esc_html_e( 'Include', 'wds' ); ?></label>
45
+ <span class="wds-label-description">
46
+ <?php esc_html_e( 'Choose which post types, archives and taxonomies you wish to include in your sitemap.', 'wds' ); ?>
47
+ </span>
48
+ </div>
49
+ <div class="fields">
50
+ <div class="wds-sitemap-parts">
51
+ <?php foreach ( $post_types as $item => $post_type ) : ?>
52
+ <?php
53
+ $this->_render( 'sitemap/sitemap-part', array(
54
+ 'item' => $item,
55
+ 'item_name' => $post_type->name,
56
+ 'item_label' => $post_type->label,
57
+ 'inverted' => true,
58
+ 'option_name' => $option_name . '[exclude_post_types][]',
59
+ ) );
60
+ ?>
61
+ <?php endforeach; ?>
62
+
63
+ <?php foreach ( $taxonomies as $item => $taxonomy ) : ?>
64
+ <?php
65
+ $this->_render( 'sitemap/sitemap-part', array(
66
+ 'item' => $item,
67
+ 'item_name' => $taxonomy->name,
68
+ 'item_label' => $taxonomy->label,
69
+ 'inverted' => true,
70
+ 'option_name' => $option_name . '[exclude_taxonomies][]',
71
+ ) );
72
+ ?>
73
+ <?php endforeach; ?>
74
+
75
+ <?php
76
+ if ( $smartcrawl_buddypress ) {
77
+ $this->_render( 'sitemap/sitemap-buddypress-settings', $smartcrawl_buddypress );
78
+ }
79
+ ?>
80
+
81
+ </div>
82
+ </div>
83
+ </div>
84
+
85
+ <div class="wds-table-fields wds-separator-top">
86
+ <div class="label">
87
+ <label for="extra-sitemap-urls"
88
+ class="wds-label"><?php esc_html_e( 'Extra URLs', 'wds' ); ?></label>
89
+ <span class="wds-label-description">
90
+ <?php esc_html_e( "Enter any additional URLs that aren't part of your default pages, posts or custom post types.", 'wds' ); ?>
91
+ </span>
92
+ </div>
93
+
94
+ <div class="fields">
95
+ <textarea id="extra-sitemap-urls"
96
+ name="<?php echo esc_attr( $option_name ); ?>[extra_sitemap_urls]"><?php echo esc_textarea( $extra_urls ); ?></textarea>
97
+ <span class="wds-field-legend">
98
+ <?php esc_html_e( 'Enter one URL per line', 'wds' ); ?>
99
+ </span>
100
+ </div>
101
+ </div>
102
+
103
+ <div class="wds-table-fields wds-separator-top">
104
+ <div class="label">
105
+ <label for="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_urls]"
106
+ class="wds-label"><?php esc_html_e( 'Exclusions', 'wds' ); ?></label>
107
+ <span class="wds-label-description">
108
+ <?php esc_html_e( 'If you have custom URLs you want explicitly excluded from your Sitemap you can do this here.', 'wds' ); ?>
109
+ </span>
110
+ </div>
111
+
112
+ <div class="fields">
113
+ <div>
114
+ <label for="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_post_ids]"
115
+ class="wds-label"><?php esc_html_e( 'Posts', 'wds' ); ?></label>
116
+ <span class="wds-field-legend">
117
+ <?php esc_html_e( 'Enter any particular post IDs you wish to exclude from your sitemap. Note, you can also exclude posts and pages from the post editor page.', 'wds' ); ?>
118
+ </span>
119
+ <input type="text" id="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_post_ids]"
120
+ placeholder="<?php echo esc_attr__( 'e.g. 1,5,6,99', 'wds' ); ?>"
121
+ name="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_post_ids]"
122
+ value="<?php echo esc_attr( $ignore_post_ids ); ?>"/>
123
+ <span class="wds-field-legend">
124
+ <?php esc_html_e( 'Enter post IDs separated by commas.', 'wds' ); ?>
125
+ </span>
126
+ </div>
127
+
128
+ <div class="wds-separator-top">
129
+ <label for="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_urls]"
130
+ class="wds-label"><?php esc_html_e( 'Custom URLs', 'wds' ); ?></label>
131
+ <span class="wds-field-legend">
132
+ <?php esc_html_e( 'Enter any custom URLs you want excluded permanently from the sitemap.', 'wds' ); ?>
133
+ </span>
134
+ <textarea id="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_urls]"
135
+ placeholder="<?php echo esc_attr__( 'e.g. /excluded-url', 'wds' ); ?>"
136
+ name="<?php echo esc_attr( $option_name ); ?>[sitemap_ignore_urls]"><?php echo esc_textarea( $ignore_urls ); ?></textarea>
137
+ <span class="wds-field-legend">
138
+ <?php esc_html_e( 'Enter one URL per line', 'wds' ); ?>
139
+ </span>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ </div>
includes/admin/templates/sitemap/sitemap-settings.php CHANGED
@@ -1,195 +1,203 @@
1
- <?php
2
- $sitemap_tab_id = 'tab_sitemap';
3
- $sitemap_tab_name = __( 'Sitemap', 'wds' );
4
- $url_crawler_tab_id = 'tab_url_crawler';
5
- $url_crawler_tab_name = __( 'URL Crawler', 'wds' );
6
- ?>
7
-
8
- <div id="container" class="wrap wrap-wds wds-page wds-sitemap-settings">
9
-
10
- <section id="header">
11
- <?php $this->_render( 'settings-message-top' ); ?>
12
- <?php if ( Smartcrawl_Settings::get_setting( 'sitemap' ) ) { ?>
13
- <div class="actions">
14
- <?php
15
- $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
16
- $end = $service->get_last_run_timestamp();
17
- $end = ! empty( $end ) && is_numeric( $end )
18
- ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $end )
19
- : __( 'Never', 'wds' );
20
-
21
- printf(
22
- __( 'Last crawl: %s', 'wds' ),
23
- $end
24
- );
25
- ?>
26
- <?php if ( ! $service->in_progress() ) { ?>
27
- <a href="<?php echo esc_url( add_query_arg( 'run-crawl', 'yes' ) ); ?>" class="button button-small">
28
- <?php esc_html_e( 'New crawl', 'wds' ); ?>
29
- </a>
30
- <?php } ?>
31
- </div>
32
- <?php } ?>
33
- <h1>
34
- <?php esc_html_e( 'Sitemaps', 'wds' ); ?>
35
- <span class="toggle wds-toggle wds-has-tooltip"
36
- data-content="<?php echo Smartcrawl_Settings::get_setting( 'sitemap' ) ? __( 'Turn off automated sitemap' ) : __( 'Turn on automated sitemap' ); ?>"
37
- data-position='{"my":"left center","at":"right center"}'>
38
- <input class="toggle-checkbox sitemap-status-toggle"
39
- value="1"
40
- id="sitemap-status-toggle"
41
- autocomplete="off"
42
- type="checkbox" <?php checked( Smartcrawl_Settings::get_setting( 'sitemap' ) ); ?>>
43
- <label class="toggle-label" for="sitemap-status-toggle"></label>
44
- </span>
45
- </h1>
46
- </section><!-- end header -->
47
-
48
- <div class="wds-url-crawler-stats-container"></div>
49
-
50
- <?php
51
- $smartcrawl_options = Smartcrawl_Settings::get_options();
52
- if ( ! smartcrawl_is_allowed_tab( $_view['slug'] ) ) {
53
- printf( __( "Your network admin prevented access to '%s', please move onto next step.", 'wds' ), __( 'Sitemaps' , 'wds' ) );
54
- } elseif ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
55
-
56
- ?>
57
- <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
58
- <?php settings_fields( $_view['option_name'] ); ?>
59
-
60
- <input type="hidden" name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]' value="1">
61
-
62
- <div class="vertical-tabs" id="sitemap-settings-tabs">
63
- <?php
64
- $this->_render('vertical-tab', array(
65
- 'tab_id' => $sitemap_tab_id,
66
- 'tab_name' => $sitemap_tab_name,
67
- 'is_active' => $active_tab == $sitemap_tab_id,
68
- 'tab_sections' => array(
69
- array(
70
- 'section_description' => __( 'Automatically generate a sitemap and regularly send updates to Google.', 'wds' ),
71
- 'section_template' => 'sitemap/sitemap-section-settings',
72
- 'section_args' => array(
73
- 'post_types' => $post_types,
74
- 'taxonomies' => $taxonomies,
75
- 'wds_buddypress' => $wds_buddypress,
76
- 'extra_urls' => ! empty( $extra_urls ) ? $extra_urls : '',
77
- 'ignore_urls' => ! empty( $ignore_urls ) ? $ignore_urls : '',
78
- 'ignore_post_ids' => ! empty( $ignore_post_ids ) ? $ignore_post_ids : '',
79
- ),
80
- ),
81
- ),
82
- ));
83
- ?>
84
-
85
- <?php
86
-
87
- $is_member = $service->is_member();
88
- ?>
89
-
90
- <?php
91
- $this->_render(
92
- $is_member ? 'vertical-tab' : 'report-vertical-tab',
93
- array(
94
- 'tab_id' => $url_crawler_tab_id,
95
- 'tab_name' => $url_crawler_tab_name,
96
- 'is_active' => $active_tab == $url_crawler_tab_id,
97
- 'title_button' => 'upgrade',
98
- 'tab_sections' => array(
99
- array(
100
- 'section_template' => 'sitemap/sitemap-section-url-crawler',
101
- ),
102
- ),
103
- ));
104
- ?>
105
-
106
- <?php
107
- $this->_render(
108
- $is_member ? 'vertical-tab' : 'report-vertical-tab',
109
- array(
110
- 'tab_id' => 'tab_url_crawler_reporting',
111
- 'tab_name' => __( 'Reporting', 'wds' ),
112
- 'is_active' => $active_tab == 'tab_url_crawler_reporting',
113
- 'title_button' => 'upgrade',
114
- 'tab_sections' => array(
115
- array(
116
- 'section_description' => esc_html__( 'Set up SmartCrawl to automatically crawl your URLs daily, weekly or monthly and send an email report to as many recipients as you like.', 'wds' ),
117
- 'section_template' => 'sitemap/sitemap-section-reporting',
118
- ),
119
- ),
120
- )
121
- );
122
- ?>
123
-
124
- <?php
125
- $this->_render('vertical-tab', array(
126
- 'tab_id' => 'tab_advanced',
127
- 'tab_name' => __( 'Advanced', 'wds' ),
128
- 'is_active' => $active_tab == 'tab_advanced',
129
- 'tab_sections' => array(
130
- array(
131
- 'section_template' => 'sitemap/sitemap-section-advanced',
132
- 'section_args' => array(
133
- 'engines' => $engines,
134
- ),
135
- ),
136
- ),
137
- ));
138
- ?>
139
- </div>
140
- </form>
141
- <?php } else { ?>
142
- <form method="post" class="wds-form">
143
- <div class="vertical-tabs" id="sitemap-settings-tabs">
144
- <?php
145
- $this->_render('vertical-tab', array(
146
- 'tab_id' => $sitemap_tab_id,
147
- 'tab_name' => $sitemap_tab_name,
148
- 'is_active' => $active_tab == $sitemap_tab_id,
149
- 'button_text' => false,
150
- 'tab_sections' => array(
151
- array(
152
- 'section_template' => 'disabled-component-inner',
153
- 'section_args' => array(
154
- 'content' => sprintf(
155
- '%s<br/>%s',
156
- __( 'Automatically generate a full sitemap, regularly send updates to search engines and set up', 'wds' ),
157
- __( 'SmartCrawl to automatically check URLs are discoverable by search engines.', 'wds' )
158
- ),
159
- 'image' => 'sitemap-disabled.png',
160
- 'component' => 'sitemap',
161
- 'button_text' => __( 'Activate Sitemap', 'wds' ),
162
- ),
163
- ),
164
- ),
165
- ));
166
-
167
- $this->_render('vertical-tab', array(
168
- 'tab_id' => $url_crawler_tab_id,
169
- 'tab_name' => $url_crawler_tab_name,
170
- 'is_active' => $active_tab == $url_crawler_tab_id,
171
- 'button_text' => false,
172
- 'tab_sections' => array(
173
- array(
174
- 'section_template' => 'disabled-component-inner',
175
- 'section_args' => array(
176
- 'content' => sprintf(
177
- '%s<br/>%s',
178
- __( 'Have SmartCrawl check for broken URLs, 404s, multiple redirections and other harmful', 'wds' ),
179
- __( 'issues that can reduce your ability to rank in search engines.', 'wds' )
180
- ),
181
- 'image' => 'url-crawler-disabled.png',
182
- 'component' => 'sitemap',
183
- 'button_text' => __( 'Activate Sitemap', 'wds' ),
184
- 'notice' => esc_html__( 'You must activate the Sitemap feature to use the URL crawler.', 'wds' ),
185
- ),
186
- ),
187
- ),
188
- ));
189
- ?>
190
- </div>
191
- </form>
192
- <?php } ?>
193
- <?php $this->_render( 'upsell-modal' ); ?>
194
-
195
- </div><!-- end wds-sitemap-settings -->
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $sitemap_tab_id = 'tab_sitemap';
3
+ $sitemap_tab_name = __( 'Sitemap', 'wds' );
4
+ $url_crawler_tab_id = 'tab_url_crawler';
5
+ $url_crawler_tab_name = __( 'URL Crawler', 'wds' );
6
+ $crawl_url = Smartcrawl_Sitemap_Settings::crawl_url();
7
+ ?>
8
+
9
+ <div id="container" class="wrap wrap-wds wds-page wds-sitemap-settings">
10
+
11
+ <section id="header">
12
+ <?php $this->_render( 'settings-message-top' ); ?>
13
+ <div class="actions">
14
+ <?php if ( Smartcrawl_Settings::get_setting( 'sitemap' ) ) { ?>
15
+ <?php
16
+ $service = Smartcrawl_Service::get( Smartcrawl_Service::SERVICE_SEO );
17
+ $end = $service->get_last_run_timestamp();
18
+ $end = ! empty( $end ) && is_numeric( $end )
19
+ ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $end )
20
+ : __( 'Never', 'wds' );
21
+
22
+ printf(
23
+ esc_html__( 'Last crawl: %s', 'wds' ),
24
+ esc_html( $end )
25
+ );
26
+ ?>
27
+ <?php if ( ! $service->in_progress() ) { ?>
28
+ <a href="<?php echo esc_attr( $crawl_url ); ?>" class="button button-small">
29
+ <?php esc_html_e( 'New crawl', 'wds' ); ?>
30
+ </a>
31
+ <?php } ?>
32
+ <?php } ?>
33
+ <a target="_blank" class="button button-small button-light actions-button"
34
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-4">
35
+ <i class="wds-icon-academy"></i>
36
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
37
+ </a>
38
+ </div>
39
+ <h1>
40
+ <?php esc_html_e( 'Sitemaps', 'wds' ); ?>
41
+ <span class="toggle wds-toggle wds-has-tooltip"
42
+ data-content="<?php echo Smartcrawl_Settings::get_setting( 'sitemap' ) ? esc_html__( 'Turn off automated sitemap' ) : esc_html__( 'Turn on automated sitemap' ); ?>"
43
+ data-position='{"my":"left center","at":"right center"}'>
44
+ <input class="toggle-checkbox sitemap-status-toggle"
45
+ value="1"
46
+ id="sitemap-status-toggle"
47
+ autocomplete="off"
48
+ type="checkbox" <?php checked( Smartcrawl_Settings::get_setting( 'sitemap' ) ); ?>>
49
+ <label class="toggle-label" for="sitemap-status-toggle"></label>
50
+ </span>
51
+ </h1>
52
+ </section><!-- end header -->
53
+
54
+ <div class="wds-url-crawler-stats-container"></div>
55
+
56
+ <?php
57
+ $smartcrawl_options = Smartcrawl_Settings::get_options();
58
+ if ( 'settings' === $_view['name'] || ( ! empty( $smartcrawl_options[ $_view['name'] ] ) ) ) {
59
+
60
+ ?>
61
+ <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
62
+ <?php settings_fields( $_view['option_name'] ); ?>
63
+
64
+ <input type="hidden"
65
+ name='<?php echo esc_attr( $_view['option_name'] ); ?>[<?php echo esc_attr( $_view['slug'] ); ?>-setup]'
66
+ value="1">
67
+
68
+ <div class="vertical-tabs" id="sitemap-settings-tabs">
69
+ <?php
70
+ $this->_render( 'vertical-tab', array(
71
+ 'tab_id' => $sitemap_tab_id,
72
+ 'tab_name' => $sitemap_tab_name,
73
+ 'is_active' => $sitemap_tab_id === $active_tab,
74
+ 'tab_sections' => array(
75
+ array(
76
+ 'section_description' => __( 'Automatically generate a sitemap and regularly send updates to Google.', 'wds' ),
77
+ 'section_template' => 'sitemap/sitemap-section-settings',
78
+ 'section_args' => array(
79
+ 'post_types' => $post_types,
80
+ 'taxonomies' => $taxonomies,
81
+ 'wds_buddypress' => $wds_buddypress,
82
+ 'extra_urls' => ! empty( $extra_urls ) ? $extra_urls : '',
83
+ 'ignore_urls' => ! empty( $ignore_urls ) ? $ignore_urls : '',
84
+ 'ignore_post_ids' => ! empty( $ignore_post_ids ) ? $ignore_post_ids : '',
85
+ ),
86
+ ),
87
+ ),
88
+ ) );
89
+ ?>
90
+
91
+ <?php
92
+
93
+ $is_member = $service->is_member();
94
+ ?>
95
+
96
+ <?php
97
+ $this->_render(
98
+ $is_member ? 'vertical-tab' : 'report-vertical-tab',
99
+ array(
100
+ 'tab_id' => $url_crawler_tab_id,
101
+ 'tab_name' => $url_crawler_tab_name,
102
+ 'is_active' => $url_crawler_tab_id === $active_tab,
103
+ 'button_text' => false,
104
+ 'title_button' => 'upgrade',
105
+ 'tab_sections' => array(
106
+ array(
107
+ 'section_template' => 'sitemap/sitemap-section-url-crawler',
108
+ ),
109
+ ),
110
+ )
111
+ );
112
+ ?>
113
+
114
+ <?php
115
+ $this->_render(
116
+ $is_member ? 'vertical-tab' : 'report-vertical-tab',
117
+ array(
118
+ 'tab_id' => 'tab_url_crawler_reporting',
119
+ 'tab_name' => __( 'Reporting', 'wds' ),
120
+ 'is_active' => 'tab_url_crawler_reporting' === $active_tab,
121
+ 'title_button' => 'upgrade',
122
+ 'tab_sections' => array(
123
+ array(
124
+ 'section_description' => esc_html__( 'Set up SmartCrawl to automatically crawl your URLs daily, weekly or monthly and send an email report to as many recipients as you like.', 'wds' ),
125
+ 'section_template' => 'sitemap/sitemap-section-reporting',
126
+ ),
127
+ ),
128
+ )
129
+ );
130
+ ?>
131
+
132
+ <?php
133
+ $this->_render( 'vertical-tab', array(
134
+ 'tab_id' => 'tab_advanced',
135
+ 'tab_name' => __( 'Advanced', 'wds' ),
136
+ 'is_active' => 'tab_advanced' === $active_tab,
137
+ 'tab_sections' => array(
138
+ array(
139
+ 'section_template' => 'sitemap/sitemap-section-advanced',
140
+ 'section_args' => array(
141
+ 'engines' => $engines,
142
+ ),
143
+ ),
144
+ ),
145
+ ) );
146
+ ?>
147
+ </div>
148
+ </form>
149
+ <?php } else { ?>
150
+ <form method="post" class="wds-form">
151
+ <div class="vertical-tabs" id="sitemap-settings-tabs">
152
+ <?php
153
+ $this->_render( 'vertical-tab', array(
154
+ 'tab_id' => $sitemap_tab_id,
155
+ 'tab_name' => $sitemap_tab_name,
156
+ 'is_active' => $active_tab === $sitemap_tab_id,
157
+ 'button_text' => false,
158
+ 'tab_sections' => array(
159
+ array(
160
+ 'section_template' => 'disabled-component-inner',
161
+ 'section_args' => array(
162
+ 'content' => sprintf(
163
+ '%s<br/>%s',
164
+ __( 'Automatically generate a full sitemap, regularly send updates to search engines and set up', 'wds' ),
165
+ __( 'SmartCrawl to automatically check URLs are discoverable by search engines.', 'wds' )
166
+ ),
167
+ 'image' => 'sitemap-disabled.png',
168
+ 'component' => 'sitemap',
169
+ 'button_text' => __( 'Activate Sitemap', 'wds' ),
170
+ ),
171
+ ),
172
+ ),
173
+ ) );
174
+
175
+ $this->_render( 'vertical-tab', array(
176
+ 'tab_id' => $url_crawler_tab_id,
177
+ 'tab_name' => $url_crawler_tab_name,
178
+ 'is_active' => $active_tab === $url_crawler_tab_id,
179
+ 'button_text' => false,
180
+ 'tab_sections' => array(
181
+ array(
182
+ 'section_template' => 'disabled-component-inner',
183
+ 'section_args' => array(
184
+ 'content' => sprintf(
185
+ '%s<br/>%s',
186
+ __( 'Have SmartCrawl check for broken URLs, 404s, multiple redirections and other harmful', 'wds' ),
187
+ __( 'issues that can reduce your ability to rank in search engines.', 'wds' )
188
+ ),
189
+ 'image' => 'url-crawler-disabled.png',
190
+ 'component' => 'sitemap',
191
+ 'button_text' => __( 'Activate Sitemap', 'wds' ),
192
+ 'notice' => esc_html__( 'You must activate the Sitemap feature to use the URL crawler.', 'wds' ),
193
+ ),
194
+ ),
195
+ ),
196
+ ) );
197
+ ?>
198
+ </div>
199
+ </form>
200
+ <?php } ?>
201
+ <?php $this->_render( 'upsell-modal' ); ?>
202
+
203
+ </div><!-- end wds-sitemap-settings -->
includes/admin/templates/sitemaps-dashboard-widget.php CHANGED
@@ -1,59 +1,71 @@
1
-
2
- <div style='width:45%;float:left'>
3
- <div><?php printf( __( 'Your sitemap contains <a href="%1$s" target="_blank"><b>%2$d</b> items</a>.', 'wds' ), $sitemap_url, (int) @$opts['items'] ); ?></div>
4
- <br /><?php echo esc_html( $datetime ); ?>
5
- <p><a href='#update_sitemap' id='wds_update_now'><?php echo esc_html( $update_sitemap ); ?></a></p>
6
- </div>
7
-
8
- <div style='width:45%;float:right'>
9
- <?php if ( $engines ) { ?>
10
- <ul>
11
- <?php
12
- foreach ( $engines as $key => $engine ) {
13
- $service = ucfirst( $key );
14
- $edate = @$engine['time'] ? date( get_option( 'date_format' ), $engine['time'] ) : false;
15
- $etime = @$engine['time'] ? date( get_option( 'time_format' ), $engine['time'] ) : false;
16
- $edatetime = ($edate && $etime) ? sprintf( __( 'Last notified on %1$s, at %1$s.', 'wds' ), $date, $time ) : __( 'Not notified', 'wds' );
17
- ?>
18
- <li><b><?php echo esc_html( $service ); ?>:</b> <?php echo esc_html( $edatetime ); ?></li>
19
- <?php } ?>
20
-
21
- </ul>
22
-
23
- <?php } else { ?>
24
- <?php _e( "<div>Search engines haven't been recently updated</div>", 'wds' ); ?>
25
- <?php } ?>
26
-
27
- <p><a href='#update_search_engines' id='wds_update_engines'><?php echo esc_html( $update_engines ); ?></a></p>
28
- </div>
29
- <div style='clear:both'></div>
30
-
31
- <script type="text/javascript">
32
- ;(function ($) {
33
- $(function () {
34
- $( "#smartcrawl_update_now" ).click(function () {
35
- var me = $( this );
36
- me.html( "<?php echo esc_js( $working ); ?>" );
37
-
38
- $.post(ajaxurl, { "action": "wds_update_sitemap" }, function () {
39
- me.html( "<?php echo esc_js( $done_msg ); ?>" );
40
- window.location.reload();
41
- });
42
-
43
- return false;
44
- });
45
-
46
- $("#smartcrawl_update_engines").click(function () {
47
- var me = $( this );
48
- me.html( "<?php echo esc_js( $working ); ?>" );
49
-
50
- $.post( ajaxurl, { "action": "wds_update_engines" }, function () {
51
- me.html( "<?php echo esc_js( $done_msg ); ?>" );
52
- window.location.reload();
53
- } );
54
-
55
- return false;
56
- });
57
- });
58
- })(jQuery);
59
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div style='width:45%;float:left'>
2
+ <div>
3
+ <?php
4
+ printf(
5
+ esc_html__( 'Your sitemap contains %s.', 'wds' ),
6
+ sprintf(
7
+ '<a href="%1$s" target="_blank"><b>%2$d</b> %3$s</a>',
8
+ esc_url( $sitemap_url ),
9
+ (int) smartcrawl_get_array_value( $opts, 'items' ),
10
+ esc_html__( 'items' )
11
+ )
12
+ );
13
+ ?>
14
+ </div>
15
+ <br/><?php echo esc_html( $datetime ); ?>
16
+ <p><a href='#update_sitemap' id='wds_update_now'><?php echo esc_html( $update_sitemap ); ?></a></p>
17
+ </div>
18
+
19
+ <div style='width:45%;float:right'>
20
+ <?php if ( $engines ) { ?>
21
+ <ul>
22
+ <?php
23
+ foreach ( $engines as $key => $engine ) {
24
+ $service = ucfirst( $key );
25
+ $edate = ! empty( $engine['time'] ) ? date( get_option( 'date_format' ), $engine['time'] ) : false;
26
+ $etime = ! empty( $engine['time'] ) ? date( get_option( 'time_format' ), $engine['time'] ) : false;
27
+ $edatetime = ( $edate && $etime ) ? sprintf( __( 'Last notified on %1$s, at %2$s.', 'wds' ), $date, $time ) : __( 'Not notified', 'wds' );
28
+ ?>
29
+ <li><b><?php echo esc_html( $service ); ?>:</b> <?php echo esc_html( $edatetime ); ?></li>
30
+ <?php } ?>
31
+
32
+ </ul>
33
+
34
+ <?php } else { ?>
35
+ <div><?php esc_html_e( "Search engines haven't been recently updated.", 'wds' ); ?></div>
36
+ <?php } ?>
37
+
38
+ <p><a href='#update_search_engines' id='wds_update_engines'><?php echo esc_html( $update_engines ); ?></a></p>
39
+ </div>
40
+ <div style='clear:both'></div>
41
+
42
+ <script type="text/javascript">
43
+ ;
44
+ (function ($) {
45
+ $(function () {
46
+ $("#wds_update_now").click(function () {
47
+ var me = $(this);
48
+ me.html("<?php echo esc_js( $working ); ?>");
49
+
50
+ $.post(ajaxurl, {"action": "wds_update_sitemap"}, function () {
51
+ me.html("<?php echo esc_js( $done_msg ); ?>");
52
+ window.location.reload();
53
+ });
54
+
55
+ return false;
56
+ });
57
+
58
+ $("#wds_update_engines").click(function () {
59
+ var me = $(this);
60
+ me.html("<?php echo esc_js( $working ); ?>");
61
+
62
+ $.post(ajaxurl, {"action": "wds_update_engines"}, function () {
63
+ me.html("<?php echo esc_js( $done_msg ); ?>");
64
+ window.location.reload();
65
+ });
66
+
67
+ return false;
68
+ });
69
+ });
70
+ })(jQuery);
71
+ </script>
includes/admin/templates/social/social-section-accounts.php CHANGED
@@ -1,163 +1,168 @@
1
- <?php
2
- $options = empty( $options ) ? $_view['options'] : $options;
3
- ?>
4
-
5
- <div class="wds-table-fields wds-separator-top">
6
- <div class="label">
7
- <label class="wds-label" for="website_name"><?php esc_html_e( 'Website name', 'wds' ); ?></label>
8
- </div>
9
- <div class="fields">
10
- <input type="text" id="website_name" name="<?php echo esc_attr( $_view['option_name'] ); ?>[sitename]"
11
- value="<?php echo esc_attr( $options['sitename'] ); ?>"/>
12
- </div>
13
- </div>
14
-
15
- <div class="wds-table-fields">
16
- <div class="label">
17
- <label class="wds-label" for="schema_type"><?php esc_html_e( 'Type', 'wds' ); ?></label>
18
- </div>
19
- <div class="fields">
20
- <div class="wds-conditional">
21
- <select id="schema_type"
22
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[schema_type]"
23
- class="select-container" style="width: 100%">
24
- <option
25
- <?php selected( $options['schema_type'], Smartcrawl_Schema_Printer::PERSON ); ?>
26
- value="<?php echo esc_attr( Smartcrawl_Schema_Printer::PERSON ); ?>">
27
- <?php esc_html_e( 'Person', 'wds' ); ?>
28
- </option>
29
-
30
- <option
31
- <?php selected( $options['schema_type'], Smartcrawl_Schema_Printer::ORGANIZATION ); ?>
32
- value="<?php echo esc_attr( Smartcrawl_Schema_Printer::ORGANIZATION ); ?>">
33
- <?php esc_html_e( 'Organization', 'wds' ); ?>
34
- </option>
35
- </select>
36
-
37
- <div
38
- data-conditional-val="<?php echo esc_attr( Smartcrawl_Schema_Printer::PERSON ); ?>"
39
- class="wds-table-fields wds-table-fields-stacked wds-conditional-inside wds-conditional-inside-box">
40
-
41
- <div class="label">
42
- <label for="override_name" class="wds-label"><?php esc_html_e( 'Your name', 'wds' ); ?></label>
43
- </div>
44
- <div class="fields">
45
- <input id="override_name" type="text" name="<?php echo esc_attr( $_view['option_name'] ); ?>[override_name]"
46
- value="<?php echo esc_attr( $options['override_name'] ); ?>"/>
47
- </div>
48
- </div>
49
-
50
- <div
51
- data-conditional-val="<?php echo esc_attr( Smartcrawl_Schema_Printer::ORGANIZATION ); ?>"
52
- class="wds-table-fields wds-table-fields-stacked wds-conditional-inside wds-conditional-inside-box">
53
-
54
- <div class="label">
55
- <label for="organization_name" class="wds-label"><?php esc_html_e( 'Organization Name', 'wds' ); ?></label>
56
- </div>
57
- <div class="fields">
58
- <input id="organization_name" type="text" name="<?php echo esc_attr( $_view['option_name'] ); ?>[organization_name]"
59
- value="<?php echo esc_attr( $options['organization_name'] ); ?>"/>
60
- </div>
61
-
62
- <div class="label">
63
- <label for="organization_logo" class="wds-label"><?php esc_html_e( 'Organization Logo', 'wds' ); ?></label>
64
- </div>
65
- <div class="fields">
66
- <?php
67
- $this->_render('media-url-field', array(
68
- 'item' => 'organization_logo',
69
- ));
70
- ?>
71
- </div>
72
- </div>
73
- </div>
74
- </div>
75
- </div>
76
-
77
- <?php
78
- $this->_render('toggle-group', array(
79
- 'label' => __( 'Schema markup', 'wds' ),
80
- 'items' => array(
81
- 'disable-schema' => array(
82
- 'label' => __( 'Enable schema markup output', 'wds' ),
83
- 'inverted' => true,
84
- 'description' => __( 'By default, the plugin will render appropriate schema markup to all your pages. You can disable this kind of output here.', 'wds' ),
85
- ),
86
- ),
87
- 'separator' => true,
88
- ));
89
- ?>
90
-
91
- <div class="wds-table-fields wds-separator-top">
92
- <div class="label">
93
- <label for="twitter_username" class="wds-label"><?php esc_html_e( 'Twitter Username', 'wds' ); ?></label>
94
- </div>
95
- <div class="fields wds-twitter-username">
96
- <input type="text" id="twitter_username" name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter_username]"
97
- value="<?php echo esc_attr( $options['twitter_username'] ); ?>"
98
- placeholder="<?php _e( 'username', 'wds' ); ?>"/>
99
- </div>
100
-
101
- <div class="label">
102
- <label for="fb-app-id" class="wds-label"><?php esc_html_e( 'Facebook App ID', 'wds' ); ?></label>
103
- </div>
104
- <div class="fields wds-fb-app-id">
105
- <input type="text" id="fb-app-id" name="<?php echo esc_attr( $_view['option_name'] ); ?>[fb-app-id]"
106
- value="<?php echo esc_attr( $options['fb-app-id'] ); ?>"
107
- placeholder="<?php _e( 'App ID', 'wds' ); ?>"/>
108
- </div>
109
-
110
- <div class="label">
111
- <label for="facebook_url" class="wds-label"><?php esc_html_e( 'Facebook Page Url', 'wds' ); ?></label>
112
- </div>
113
- <div class="fields">
114
- <input type="text" id="facebook_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[facebook_url]"
115
- value="<?php echo esc_attr( $options['facebook_url'] ); ?>"
116
- placeholder="<?php _e( 'https://facebook.com/pagename', 'wds' ); ?>"/>
117
- </div>
118
-
119
- <div class="label">
120
- <label for="instagram_url" class="wds-label"><?php esc_html_e( 'Instagram URL', 'wds' ); ?></label>
121
- </div>
122
- <div class="fields">
123
- <input type="text" id="instagram_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[instagram_url]"
124
- value="<?php echo esc_attr( $options['instagram_url'] ); ?>"
125
- placeholder="<?php _e( 'https://instagram.com/username', 'wds' ); ?>"/>
126
- </div>
127
-
128
- <div class="label">
129
- <label for="linkedin_url" class="wds-label"><?php esc_html_e( 'Linkedin URL', 'wds' ); ?></label>
130
- </div>
131
- <div class="fields">
132
- <input type="text" id="linkedin_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[linkedin_url]"
133
- value="<?php echo esc_attr( $options['linkedin_url'] ); ?>"
134
- placeholder="<?php _e( 'https://linkedin.com/username', 'wds' ); ?>"/>
135
- </div>
136
-
137
- <div class="label">
138
- <label for="pinterest_url" class="wds-label"><?php esc_html_e( 'Pinterest URL', 'wds' ); ?></label>
139
- </div>
140
- <div class="fields">
141
- <input type="text" id="pinterest_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[pinterest_url]"
142
- value="<?php echo esc_attr( $options['pinterest_url'] ); ?>"
143
- placeholder="<?php _e( 'https://pinterest.com/username', 'wds' ); ?>"/>
144
- </div>
145
-
146
- <div class="label">
147
- <label for="gplus_url" class="wds-label"><?php esc_html_e( 'Google+ URL', 'wds' ); ?></label>
148
- </div>
149
- <div class="fields">
150
- <input type="text" id="gplus_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[gplus_url]"
151
- value="<?php echo esc_attr( $options['gplus_url'] ); ?>"
152
- placeholder="<?php _e( 'https://plus.google.com/u/1/123456789123456789123', 'wds' ); ?>"/>
153
- </div>
154
-
155
- <div class="label">
156
- <label for="youtube_url" class="wds-label"><?php esc_html_e( 'Youtube URL', 'wds' ); ?></label>
157
- </div>
158
- <div class="fields">
159
- <input type="text" id="youtube_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[youtube_url]"
160
- value="<?php echo esc_attr( $options['youtube_url'] ); ?>"
161
- placeholder="<?php _e( 'https://www.youtube.com/user/username', 'wds' ); ?>"/>
162
- </div>
163
- </div>
 
 
 
 
 
1
+ <?php
2
+ $options = empty( $options ) ? $_view['options'] : $options;
3
+ ?>
4
+
5
+ <div class="wds-table-fields wds-separator-top">
6
+ <div class="label">
7
+ <label class="wds-label" for="website_name"><?php esc_html_e( 'Website name', 'wds' ); ?></label>
8
+ </div>
9
+ <div class="fields">
10
+ <input type="text" id="website_name" name="<?php echo esc_attr( $_view['option_name'] ); ?>[sitename]"
11
+ value="<?php echo esc_attr( $options['sitename'] ); ?>"/>
12
+ </div>
13
+ </div>
14
+
15
+ <div class="wds-table-fields">
16
+ <div class="label">
17
+ <label class="wds-label" for="schema_type"><?php esc_html_e( 'Type', 'wds' ); ?></label>
18
+ </div>
19
+ <div class="fields">
20
+ <div class="wds-conditional">
21
+ <select id="schema_type"
22
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[schema_type]"
23
+ class="select-container" style="width: 100%">
24
+ <option
25
+ <?php selected( $options['schema_type'], Smartcrawl_Schema_Printer::PERSON ); ?>
26
+ value="<?php echo esc_attr( Smartcrawl_Schema_Printer::PERSON ); ?>">
27
+ <?php esc_html_e( 'Person', 'wds' ); ?>
28
+ </option>
29
+
30
+ <option
31
+ <?php selected( $options['schema_type'], Smartcrawl_Schema_Printer::ORGANIZATION ); ?>
32
+ value="<?php echo esc_attr( Smartcrawl_Schema_Printer::ORGANIZATION ); ?>">
33
+ <?php esc_html_e( 'Organization', 'wds' ); ?>
34
+ </option>
35
+ </select>
36
+
37
+ <div
38
+ data-conditional-val="<?php echo esc_attr( Smartcrawl_Schema_Printer::PERSON ); ?>"
39
+ class="wds-table-fields wds-table-fields-stacked wds-conditional-inside wds-conditional-inside-box">
40
+
41
+ <div class="label">
42
+ <label for="override_name" class="wds-label"><?php esc_html_e( 'Your name', 'wds' ); ?></label>
43
+ </div>
44
+ <div class="fields">
45
+ <input id="override_name" type="text"
46
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[override_name]"
47
+ value="<?php echo esc_attr( $options['override_name'] ); ?>"/>
48
+ </div>
49
+ </div>
50
+
51
+ <div
52
+ data-conditional-val="<?php echo esc_attr( Smartcrawl_Schema_Printer::ORGANIZATION ); ?>"
53
+ class="wds-table-fields wds-table-fields-stacked wds-conditional-inside wds-conditional-inside-box">
54
+
55
+ <div class="label">
56
+ <label for="organization_name"
57
+ class="wds-label"><?php esc_html_e( 'Organization Name', 'wds' ); ?></label>
58
+ </div>
59
+ <div class="fields">
60
+ <input id="organization_name" type="text"
61
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[organization_name]"
62
+ value="<?php echo esc_attr( $options['organization_name'] ); ?>"/>
63
+ </div>
64
+
65
+ <div class="label">
66
+ <label for="organization_logo"
67
+ class="wds-label"><?php esc_html_e( 'Organization Logo', 'wds' ); ?></label>
68
+ </div>
69
+ <div class="fields">
70
+ <?php
71
+ $this->_render( 'media-url-field', array(
72
+ 'item' => 'organization_logo',
73
+ ) );
74
+ ?>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+
81
+ <?php
82
+ $this->_render( 'toggle-group', array(
83
+ 'label' => __( 'Schema markup', 'wds' ),
84
+ 'items' => array(
85
+ 'disable-schema' => array(
86
+ 'label' => __( 'Enable schema markup output', 'wds' ),
87
+ 'inverted' => true,
88
+ 'description' => __( 'By default, the plugin will render appropriate schema markup to all your pages. You can disable this kind of output here.', 'wds' ),
89
+ ),
90
+ ),
91
+ 'separator' => true,
92
+ ) );
93
+ ?>
94
+
95
+ <div class="wds-table-fields wds-separator-top">
96
+ <div class="label">
97
+ <label for="twitter_username" class="wds-label"><?php esc_html_e( 'Twitter Username', 'wds' ); ?></label>
98
+ </div>
99
+ <div class="fields wds-twitter-username">
100
+ <input type="text" id="twitter_username"
101
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter_username]"
102
+ value="<?php echo esc_attr( $options['twitter_username'] ); ?>"
103
+ placeholder="<?php esc_attr_e( 'username', 'wds' ); ?>"/>
104
+ </div>
105
+
106
+ <div class="label">
107
+ <label for="fb-app-id" class="wds-label"><?php esc_html_e( 'Facebook App ID', 'wds' ); ?></label>
108
+ </div>
109
+ <div class="fields wds-fb-app-id">
110
+ <input type="text" id="fb-app-id" name="<?php echo esc_attr( $_view['option_name'] ); ?>[fb-app-id]"
111
+ value="<?php echo esc_attr( $options['fb-app-id'] ); ?>"
112
+ placeholder="<?php esc_attr_e( 'App ID', 'wds' ); ?>"/>
113
+ </div>
114
+
115
+ <div class="label">
116
+ <label for="facebook_url" class="wds-label"><?php esc_html_e( 'Facebook Page Url', 'wds' ); ?></label>
117
+ </div>
118
+ <div class="fields">
119
+ <input type="text" id="facebook_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[facebook_url]"
120
+ value="<?php echo esc_attr( $options['facebook_url'] ); ?>"
121
+ placeholder="<?php esc_attr_e( 'https://facebook.com/pagename', 'wds' ); ?>"/>
122
+ </div>
123
+
124
+ <div class="label">
125
+ <label for="instagram_url" class="wds-label"><?php esc_html_e( 'Instagram URL', 'wds' ); ?></label>
126
+ </div>
127
+ <div class="fields">
128
+ <input type="text" id="instagram_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[instagram_url]"
129
+ value="<?php echo esc_attr( $options['instagram_url'] ); ?>"
130
+ placeholder="<?php esc_attr_e( 'https://instagram.com/username', 'wds' ); ?>"/>
131
+ </div>
132
+
133
+ <div class="label">
134
+ <label for="linkedin_url" class="wds-label"><?php esc_html_e( 'Linkedin URL', 'wds' ); ?></label>
135
+ </div>
136
+ <div class="fields">
137
+ <input type="text" id="linkedin_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[linkedin_url]"
138
+ value="<?php echo esc_attr( $options['linkedin_url'] ); ?>"
139
+ placeholder="<?php esc_attr_e( 'https://linkedin.com/username', 'wds' ); ?>"/>
140
+ </div>
141
+
142
+ <div class="label">
143
+ <label for="pinterest_url" class="wds-label"><?php esc_html_e( 'Pinterest URL', 'wds' ); ?></label>
144
+ </div>
145
+ <div class="fields">
146
+ <input type="text" id="pinterest_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[pinterest_url]"
147
+ value="<?php echo esc_attr( $options['pinterest_url'] ); ?>"
148
+ placeholder="<?php esc_attr_e( 'https://pinterest.com/username', 'wds' ); ?>"/>
149
+ </div>
150
+
151
+ <div class="label">
152
+ <label for="gplus_url" class="wds-label"><?php esc_html_e( 'Google+ URL', 'wds' ); ?></label>
153
+ </div>
154
+ <div class="fields">
155
+ <input type="text" id="gplus_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[gplus_url]"
156
+ value="<?php echo esc_attr( $options['gplus_url'] ); ?>"
157
+ placeholder="<?php esc_attr_e( 'https://plus.google.com/u/1/123456789123456789123', 'wds' ); ?>"/>
158
+ </div>
159
+
160
+ <div class="label">
161
+ <label for="youtube_url" class="wds-label"><?php esc_html_e( 'Youtube URL', 'wds' ); ?></label>
162
+ </div>
163
+ <div class="fields">
164
+ <input type="text" id="youtube_url" name="<?php echo esc_attr( $_view['option_name'] ); ?>[youtube_url]"
165
+ value="<?php echo esc_attr( $options['youtube_url'] ); ?>"
166
+ placeholder="<?php esc_attr_e( 'https://www.youtube.com/user/username', 'wds' ); ?>"/>
167
+ </div>
168
+ </div>
includes/admin/templates/social/social-section-open-graph.php CHANGED
@@ -1,14 +1,14 @@
1
- <div class="wds-separator-top">
2
- <?php
3
- $this->_render('toggle-group', array(
4
- 'label' => __( 'OpenGraph Support', 'wds' ),
5
- 'description' => __( 'This will add a few extra meta tags to the head section of your pages.', 'wds' ),
6
- 'items' => array(
7
- 'og-enable' => array(
8
- 'label' => __( 'Enable OpenGraph', 'wds' ),
9
- 'description' => __( 'By default OpenGraph will use your default titles, descriptions and feature images. You can override the default on a per post basis inside the post editor, as we as under Titles & Meta for specific post types.', 'wds' ),
10
- ),
11
- ),
12
- ));
13
- ?>
14
- </div>
1
+ <div class="wds-separator-top">
2
+ <?php
3
+ $this->_render( 'toggle-group', array(
4
+ 'label' => __( 'OpenGraph Support', 'wds' ),
5
+ 'description' => __( 'This will add a few extra meta tags to the head section of your pages.', 'wds' ),
6
+ 'items' => array(
7
+ 'og-enable' => array(
8
+ 'label' => __( 'Enable OpenGraph', 'wds' ),
9
+ 'description' => __( 'By default OpenGraph will use your default titles, descriptions and feature images. You can override the default on a per post basis inside the post editor, as well as under Titles & Meta for specific post types.', 'wds' ),
10
+ ),
11
+ ),
12
+ ) );
13
+ ?>
14
+ </div>
includes/admin/templates/social/social-section-pinterest-verification.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
- $options = empty( $options ) ? $_view['options'] : $options;
3
- ?>
4
-
5
- <div class="wds-table-fields">
6
- <?php if ( isset( $options['pinterest-verification-status'] ) ) : ?>
7
- <?php if ( $options['pinterest-verification-status'] === 'fail' ) : ?>
8
- <div class="wds-notice wds-notice-error">
9
- <p><?php esc_html_e( 'Verification failed', 'wds' ); ?></p>
10
- </div>
11
- <?php elseif ( $options['pinterest-verification-status'] === '' ) : ?>
12
- <div class="wds-notice wds-notice-success">
13
- <p><?php esc_html_e( 'Your domain verification tag has been added to the <head> of your website.', 'wds' ); ?></p>
14
- </div>
15
- <?php endif; ?>
16
- <?php endif; ?>
17
- <div class="label">
18
- <label for="pinterest-verify" class="wds-label"><?php esc_html_e( 'Pinterest Meta Tag', 'wds' ); ?></label>
19
- <p class="wds-label-description"><?php _e( 'This setting will add the meta tag to verify your website with Pinterest.', 'wds' ); ?></p>
20
- </div>
21
-
22
- <div class="fields">
23
- <textarea
24
- id="pinterest-verify"
25
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[pinterest-verify]"
26
- placeholder="<?php _e( 'Enter your Pinterest meta tag here', 'wds' ); ?>"><?php echo esc_textarea( $options['pinterest-verify'] ); ?></textarea>
27
- <div class="wds-field-legend">
28
- <?php if ( empty( $options['pinterest-verify'] ) ) : ?>
29
- <?php _e( 'Instructions:', 'wds' ); ?>
30
- <ul>
31
- <li><?php _e( '1. Go to your Account Settings area.', 'wds' ); ?></li>
32
- <li><?php _e( '2. Scroll to the Website field, add your website and click Confirm website.', 'wds' ); ?></li>
33
- <li><?php _e( '3. Copy the meta tag', 'wds' ); ?></li>
34
- </ul>
35
- <?php else : ?>
36
- <?php _e( 'To remove verification simply remove this meta tag.', 'wds' ); ?>
37
- <?php endif; ?>
38
- </div>
39
- </div>
40
- </div>
1
+ <?php
2
+ $options = empty( $options ) ? $_view['options'] : $options;
3
+ ?>
4
+
5
+ <div class="wds-table-fields">
6
+ <?php if ( isset( $options['pinterest-verification-status'] ) ) : ?>
7
+ <?php if ( 'fail' === $options['pinterest-verification-status'] ) : ?>
8
+ <div class="wds-notice wds-notice-error">
9
+ <p><?php esc_html_e( 'Verification failed', 'wds' ); ?></p>
10
+ </div>
11
+ <?php elseif ( '' === $options['pinterest-verification-status'] ) : ?>
12
+ <div class="wds-notice wds-notice-success">
13
+ <p><?php esc_html_e( 'Your domain verification tag has been added to the <head> of your website.', 'wds' ); ?></p>
14
+ </div>
15
+ <?php endif; ?>
16
+ <?php endif; ?>
17
+ <div class="label">
18
+ <label for="pinterest-verify" class="wds-label"><?php esc_html_e( 'Pinterest Meta Tag', 'wds' ); ?></label>
19
+ <p class="wds-label-description"><?php esc_html_e( 'This setting will add the meta tag to verify your website with Pinterest.', 'wds' ); ?></p>
20
+ </div>
21
+
22
+ <div class="fields">
23
+ <textarea
24
+ id="pinterest-verify"
25
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[pinterest-verify]"
26
+ placeholder="<?php esc_attr_e( 'Enter your Pinterest meta tag here', 'wds' ); ?>"><?php echo esc_textarea( $options['pinterest-verify'] ); ?></textarea>
27
+ <div class="wds-field-legend">
28
+ <?php if ( empty( $options['pinterest-verify'] ) ) : ?>
29
+ <?php esc_html_e( 'Instructions:', 'wds' ); ?>
30
+ <ul>
31
+ <li><?php esc_html_e( '1. Go to your Account Settings area.', 'wds' ); ?></li>
32
+ <li><?php esc_html_e( '2. Scroll to the Website field, add your website and click Confirm website.', 'wds' ); ?></li>
33
+ <li><?php esc_html_e( '3. Copy the meta tag', 'wds' ); ?></li>
34
+ </ul>
35
+ <?php else : ?>
36
+ <?php esc_html_e( 'To remove verification simply remove this meta tag.', 'wds' ); ?>
37
+ <?php endif; ?>
38
+ </div>
39
+ </div>
40
+ </div>
includes/admin/templates/social/social-section-twitter-cards.php CHANGED
@@ -1,67 +1,71 @@
1
- <?php
2
- $options = empty( $options ) ? $_view['options'] : $options;
3
- ?>
4
-
5
- <div class="wds-table-fields wds-separator-top">
6
- <div class="label">
7
- <label class="wds-label"><?php _e( 'Twitter Cards', 'wds' ); ?></label>
8
- <p class="wds-label-description"><?php _e( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping to drive traffic to your website.', 'wds' ); ?></p>
9
- </div>
10
-
11
- <?php $twitter_card_enabled = $options['twitter-card-enable']; ?>
12
- <div class="fields wds-toggleable <?php echo $twitter_card_enabled ? '' : 'inactive'; ?>">
13
- <div class="wds-toggle-table">
14
- <span class="toggle wds-toggle">
15
- <input
16
- class="toggle-checkbox"
17
- value="1"
18
- id="twitter-card-enable"
19
- name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter-card-enable]"
20
- autocomplete="off"
21
- type="checkbox"
22
- <?php checked( $twitter_card_enabled ); ?>/>
23
- <label class="toggle-label" for="twitter-card-enable"></label>
24
- </span>
25
-
26
- <div class="wds-toggle-description">
27
- <label for="twitter-card-enable" class="wds-label"><?php esc_html_e( 'Enable Twitter Cards', 'wds' ); ?></label>
28
- </div>
29
- </div>
30
-
31
- <div class="wds-toggleable-inside wds-conditional">
32
- <p></p>
33
- <select name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter-card-type]"
34
- class="select-container" style="width: 100%">
35
- <option
36
- <?php selected( $options['twitter-card-type'], Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>
37
- value="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>">
38
- <?php esc_html_e( 'Summary Card', 'wds' ); ?>
39
- </option>
40
-
41
- <option
42
- <?php selected( $options['twitter-card-type'], Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>
43
- value="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>">
44
- <?php esc_html_e( 'Summary Card with Large Image', 'wds' ); ?>
45
- </option>
46
- </select>
47
-
48
- <div class="wds-conditional-inside" data-conditional-val="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>">
49
- <?php
50
- $this->_render('social/social-twitter-embed', array(
51
- 'tweet_url' => 'https://twitter.com/_HassanAkhtar/status/875530001294270464',
52
- ));
53
- ?>
54
- </div>
55
- <div class="wds-conditional-inside" data-conditional-val="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>">
56
- <?php
57
- $this->_render('social/social-twitter-embed', array(
58
- 'tweet_url' => 'https://twitter.com/Twitter/status/593828669740584960',
59
- 'large' => true,
60
- ));
61
- ?>
62
- </div>
63
- <p class="wds-field-legend"><?php esc_html_e( 'A preview of how your Homepage will appear as a Twitter Card.', 'wds' ); ?></p>
64
- </div>
65
-
66
- </div>
67
- </div>
 
 
 
 
1
+ <?php
2
+ $options = empty( $options ) ? $_view['options'] : $options;
3
+ ?>
4
+
5
+ <div class="wds-table-fields wds-separator-top">
6
+ <div class="label">
7
+ <label class="wds-label"><?php esc_html_e( 'Twitter Cards', 'wds' ); ?></label>
8
+ <p class="wds-label-description"><?php esc_html_e( 'With Twitter Cards, you can attach rich photos, videos and media experiences to Tweets, helping to drive traffic to your website.', 'wds' ); ?></p>
9
+ </div>
10
+
11
+ <?php $twitter_card_enabled = $options['twitter-card-enable']; ?>
12
+ <div class="fields wds-toggleable <?php echo $twitter_card_enabled ? '' : 'inactive'; ?>">
13
+ <div class="wds-toggle-table">
14
+ <span class="toggle wds-toggle">
15
+ <input
16
+ class="toggle-checkbox"
17
+ value="1"
18
+ id="twitter-card-enable"
19
+ name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter-card-enable]"
20
+ autocomplete="off"
21
+ type="checkbox"
22
+ <?php checked( $twitter_card_enabled ); ?>/>
23
+ <label class="toggle-label" for="twitter-card-enable"></label>
24
+ </span>
25
+
26
+ <div class="wds-toggle-description">
27
+ <label for="twitter-card-enable"
28
+ class="wds-label"><?php esc_html_e( 'Enable Twitter Cards', 'wds' ); ?></label>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="wds-toggleable-inside wds-conditional">
33
+ <p></p>
34
+ <select name="<?php echo esc_attr( $_view['option_name'] ); ?>[twitter-card-type]"
35
+ id="twitter-card-type"
36
+ class="select-container" style="width: 100%">
37
+ <option
38
+ <?php selected( $options['twitter-card-type'], Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>
39
+ value="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>">
40
+ <?php esc_html_e( 'Summary Card', 'wds' ); ?>
41
+ </option>
42
+
43
+ <option
44
+ <?php selected( $options['twitter-card-type'], Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>
45
+ value="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>">
46
+ <?php esc_html_e( 'Summary Card with Large Image', 'wds' ); ?>
47
+ </option>
48
+ </select>
49
+
50
+ <div class="wds-conditional-inside"
51
+ data-conditional-val="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_SUMMARY ); ?>">
52
+ <?php
53
+ $this->_render( 'social/social-twitter-embed', array(
54
+ 'tweet_url' => 'https://twitter.com/_HassanAkhtar/status/875530001294270464',
55
+ ) );
56
+ ?>
57
+ </div>
58
+ <div class="wds-conditional-inside"
59
+ data-conditional-val="<?php echo esc_attr( Smartcrawl_Twitter_Printer::CARD_IMAGE ); ?>">
60
+ <?php
61
+ $this->_render( 'social/social-twitter-embed', array(
62
+ 'tweet_url' => 'https://twitter.com/Twitter/status/593828669740584960',
63
+ 'large' => true,
64
+ ) );
65
+ ?>
66
+ </div>
67
+ <p class="wds-field-legend"><?php esc_html_e( 'A preview of how your Homepage will appear as a Twitter Card.', 'wds' ); ?></p>
68
+ </div>
69
+
70
+ </div>
71
+ </div>
includes/admin/templates/social/social-settings.php CHANGED
@@ -1,81 +1,89 @@
1
- <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
-
3
- <section id="header">
4
- <?php $this->_render( 'settings-message-top' ); ?>
5
- <h1><?php esc_html_e( 'Social' , 'wds' ); ?></h1>
6
- </section><!-- end header -->
7
-
8
- <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
9
- <?php settings_fields( $_view['option_name'] ); ?>
10
-
11
- <div class="vertical-tabs">
12
- <?php
13
- $this->_render('vertical-tab', array(
14
- 'tab_id' => 'tab_accounts',
15
- 'tab_name' => __( 'Accounts', 'wds' ),
16
- 'is_active' => $active_tab == 'tab_accounts',
17
- 'tab_sections' => array(
18
- array(
19
- 'section_description' => __( 'Let search engines know whether you’re an organization or a person, then add all your social profiles so search engines know which social profiles to attribute your web content to.', 'wds' ),
20
- 'section_template' => 'social/social-section-accounts',
21
- 'section_args' => array(
22
- 'options' => $options,
23
- ),
24
- ),
25
- ),
26
- ));
27
- ?>
28
-
29
- <?php
30
- $this->_render('vertical-tab', array(
31
- 'tab_id' => 'tab_open_graph',
32
- 'tab_name' => __( 'OpenGraph', 'wds' ),
33
- 'is_active' => $active_tab == 'tab_open_graph',
34
- 'tab_sections' => array(
35
- array(
36
- 'section_description' => __( 'Add meta data to your pages to make them look great when shared platforms such as Facebook and other popular social networks.', 'wds' ),
37
- 'section_template' => 'social/social-section-open-graph',
38
- 'section_args' => array(
39
- 'options' => $options,
40
- ),
41
- ),
42
- ),
43
- ));
44
- ?>
45
-
46
- <?php
47
- $this->_render('vertical-tab', array(
48
- 'tab_id' => 'tab_twitter_cards',
49
- 'tab_name' => __( 'Twitter Cards', 'wds' ),
50
- 'is_active' => $active_tab == 'tab_twitter_cards',
51
- 'tab_sections' => array(
52
- array(
53
- 'section_description' => __( 'Add meta data to your pages to make them look great when shared on Twitter.', 'wds' ),
54
- 'section_template' => 'social/social-section-twitter-cards',
55
- 'section_args' => array(
56
- 'options' => $options,
57
- ),
58
- ),
59
- ),
60
- ));
61
- ?>
62
-
63
- <?php
64
- $this->_render('vertical-tab', array(
65
- 'tab_id' => 'tab_pinterest_verification',
66
- 'tab_name' => __( 'Pinterest Verification', 'wds' ),
67
- 'is_active' => $active_tab == 'tab_pinterest_verification',
68
- 'tab_sections' => array(
69
- array(
70
- 'section_description' => __( 'Verify your website with Pinterest to attribute your website when your website content is pinned to the platform.', 'wds' ),
71
- 'section_template' => 'social/social-section-pinterest-verification',
72
- 'section_args' => array(
73
- 'options' => $options,
74
- ),
75
- ),
76
- ),
77
- ));
78
- ?>
79
- </div>
80
- </form>
81
- </div>
 
 
 
 
 
 
 
 
1
+ <div id="container" class="wrap wrap-wds wds-page wds-page-autolinks">
2
+
3
+ <section id="header">
4
+ <div class="actions">
5
+ <a target="_blank" class="button button-small button-light actions-button"
6
+ href="https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-3">
7
+ <i class="wds-icon-academy"></i>
8
+ <?php esc_html_e( 'View Documentation', 'wds' ); ?>
9
+ </a>
10
+ </div>
11
+
12
+ <?php $this->_render( 'settings-message-top' ); ?>
13
+ <h1><?php esc_html_e( 'Social', 'wds' ); ?></h1>
14
+ </section><!-- end header -->
15
+
16
+ <form action='<?php echo esc_attr( $_view['action_url'] ); ?>' method='post' class="wds-form">
17
+ <?php settings_fields( $_view['option_name'] ); ?>
18
+
19
+ <div class="vertical-tabs">
20
+ <?php
21
+ $this->_render( 'vertical-tab', array(
22
+ 'tab_id' => 'tab_accounts',
23
+ 'tab_name' => __( 'Accounts', 'wds' ),
24
+ 'is_active' => 'tab_accounts' === $active_tab,
25
+ 'tab_sections' => array(
26
+ array(
27
+ 'section_description' => __( 'Let search engines know whether you’re an organization or a person, then add all your social profiles so search engines know which social profiles to attribute your web content to.', 'wds' ),
28
+ 'section_template' => 'social/social-section-accounts',
29
+ 'section_args' => array(
30
+ 'options' => $options,
31
+ ),
32
+ ),
33
+ ),
34
+ ) );
35
+ ?>
36
+
37
+ <?php
38
+ $this->_render( 'vertical-tab', array(
39
+ 'tab_id' => 'tab_open_graph',
40
+ 'tab_name' => __( 'OpenGraph', 'wds' ),
41
+ 'is_active' => 'tab_open_graph' === $active_tab,
42
+ 'tab_sections' => array(
43
+ array(
44
+ 'section_description' => __( 'Add meta data to your pages to make them look great when shared platforms such as Facebook and other popular social networks.', 'wds' ),
45
+ 'section_template' => 'social/social-section-open-graph',
46
+ 'section_args' => array(
47
+ 'options' => $options,
48
+ ),
49
+ ),
50
+ ),
51
+ ) );
52
+ ?>
53
+
54
+ <?php
55
+ $this->_render( 'vertical-tab', array(
56
+ 'tab_id' => 'tab_twitter_cards',
57
+ 'tab_name' => __( 'Twitter Cards', 'wds' ),
58
+ 'is_active' => 'tab_twitter_cards' === $active_tab,
59
+ 'tab_sections' => array(
60
+ array(
61
+ 'section_description' => __( 'Add meta data to your pages to make them look great when shared on Twitter.', 'wds' ),
62
+ 'section_template' => 'social/social-section-twitter-cards',
63
+ 'section_args' => array(
64
+ 'options' => $options,
65
+ ),
66
+ ),
67
+ ),
68
+ ) );
69
+ ?>
70
+
71
+ <?php
72
+ $this->_render( 'vertical-tab', array(
73
+ 'tab_id' => 'tab_pinterest_verification',
74
+ 'tab_name' => __( 'Pinterest Verification', 'wds' ),
75
+ 'is_active' => 'tab_pinterest_verification' === $active_tab,
76
+ 'tab_sections' => array(
77
+ array(
78
+ 'section_description' => __( 'Verify your website with Pinterest to attribute your website when your website content is pinned to the platform.', 'wds' ),
79
+ 'section_template' => 'social/social-section-pinterest-verification',
80
+ 'section_args' => array(
81
+ 'options' => $options,
82
+ ),
83
+ ),
84
+ ),
85
+ ) );
86
+ ?>
87
+ </div>
88
+ </form>
89
+ </div>
includes/admin/templates/social/social-twitter-embed.php CHANGED
@@ -1,23 +1,27 @@
1
- <?php
2
- $tweet_url = empty( $tweet_url ) ? '' : $tweet_url;
3
- $embed_query = new WP_Query( array( 'posts_per_page' => 1, 'post_status' => 'any' ) );
4
- $large = empty( $large ) ? false : $large;
5
-
6
- if ( ! $tweet_url ) {
7
- return;
8
- }
9
- ?>
10
- <?php if ( $embed_query->have_posts() ) : ?>
11
- <div class="wds-twitter-embed <?php echo $large ? 'wds-twitter-embed-large' : ''; ?>">
12
- <?php while ( $embed_query->have_posts() ) : $embed_query->the_post(); ?>
13
- <?php
14
- global $wp_embed;
15
- /**
16
- * @var WP_Embed $wp_embed
17
- */
18
- echo $wp_embed->autoembed( $tweet_url );
19
- ?>
20
- <?php endwhile; ?>
21
- <?php wp_reset_postdata(); ?>
22
- </div>
23
- <?php endif; ?>
 
 
 
 
1
+ <?php
2
+ $tweet_url = empty( $tweet_url ) ? '' : $tweet_url;
3
+ $embed_query = new WP_Query( array(
4
+ 'posts_per_page' => 1,
5
+ 'post_status' => 'any',
6
+ ) );
7
+ $large = empty( $large ) ? false : $large;
8
+
9
+ if ( ! $tweet_url ) {
10
+ return;
11
+ }
12
+ ?>
13
+ <?php if ( $embed_query->have_posts() ) : ?>
14
+ <div class="wds-twitter-embed <?php echo $large ? 'wds-twitter-embed-large' : ''; ?>">
15
+ <?php while ( $embed_query->have_posts() ) : ?>
16
+ <?php
17
+ $embed_query->the_post();
18
+ global $wp_embed;
19
+ /**
20
+ * @var WP_Embed $wp_embed
21
+ */
22
+ echo wp_kses_post( $wp_embed->autoembed( $tweet_url ) );
23
+ ?>
24
+ <?php endwhile; ?>
25
+ <?php wp_reset_postdata(); ?>
26
+ </div>
27
+ <?php endif; ?>
includes/admin/templates/taxonomy-form-row.php CHANGED
@@ -1,24 +1,30 @@
1
-
2
- <tr class="form-field">
3
- <th scope="row" valign="top"><label for="<?php echo $id; ?>"><?php echo $label; ?>:</label></th>
4
- <td>
5
- <?php
6
-
7
- if ( $type === 'text' ) {
8
-
9
- ?>
10
- <input name="<?php echo $id; ?>" id="<?php echo $id; ?>" type="text" value="<?php if ( isset( $val ) ) { echo $val; } ?>" size="40"/>
11
- <p class="description"><?php echo $desc; ?></p>
12
- <?php
13
-
14
- } elseif ( $type === 'checkbox' ) {
15
-
16
- ?>
17
- <input name="<?php echo $id; ?>" id="<?php echo $id; ?>" type="checkbox" <?php checked( $val ); ?> style="width:5%;" />
18
- <?php
19
-
20
- }
21
-
22
- ?>
23
- </td>
24
- </tr>
 
 
 
 
 
 
1
+ <tr class="form-field">
2
+ <th scope="row" valign="top">
3
+ <label for="<?php echo esc_attr( $id ); ?>"><?php echo esc_html( $label ); ?>:</label>
4
+ </th>
5
+ <td>
6
+ <?php
7
+
8
+ if ( 'text' === $type ) {
9
+
10
+ ?>
11
+ <input name="<?php echo esc_attr( $id ); ?>"
12
+ id="<?php echo esc_attr( $id ); ?>" type="text"
13
+ value="<?php echo isset( $val ) ? esc_attr( $val ) : ''; ?>"
14
+ size="40"/>
15
+ <p class="description"><?php echo esc_html( $desc ); ?></p>
16
+ <?php
17
+
18
+ } elseif ( 'checkbox' === $type ) {
19
+
20
+ ?>
21
+ <input name="<?php echo esc_attr( $id ); ?>"
22
+ id="<?php echo esc_attr( $id ); ?>"
23
+ type="checkbox" <?php checked( $val ); ?>
24
+ style="width:5%;"/>
25
+ <?php
26
+ }
27
+
28
+ ?>
29
+ </td>
30
+ </tr>
includes/admin/templates/term-additions-form.php CHANGED
@@ -1,206 +1,222 @@
1
-
2
- <h2><?php _e( 'SmartCrawl Settings ' , 'wds' ); ?></h2>
3
- <table class="form-table">
4
-
5
- <?php
6
-
7
- $this->form_row( 'wds_title', __( 'SEO Title' , 'wds' ), __( 'The SEO title is used on the archive page for this term.' , 'wds' ), $tax_meta );
8
- $this->form_row( 'wds_desc', __( 'SEO Description' , 'wds' ), __( 'The SEO description is used for the meta description on the archive page for this term.' , 'wds' ), $tax_meta );
9
- $this->form_row( 'wds_canonical', __( 'Canonical' , 'wds' ), __( 'The canonical link is shown on the archive page for this term.' , 'wds' ), $tax_meta );
10
-
11
- if ( $global_noindex ) { $this->form_row( 'wds_override_noindex', sprintf( __( 'Index this %s' , 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' ); } else { $this->form_row( 'wds_noindex', sprintf( __( 'Noindex this %s' , 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' ); }
12
-
13
- if ( $global_nofollow ) { $this->form_row( 'wds_override_nofollow', sprintf( __( 'Follow this %s' , 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' ); } else { $this->form_row( 'wds_nofollow', sprintf( __( 'Nofollow this %s' , 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' ); }
14
-
15
- ?>
16
-
17
- <?php
18
- $options = Smartcrawl_Settings::get_options();
19
- ?>
20
-
21
- <?php if ( ! empty( $options['og-enable'] ) ) { ?>
22
- <tr class="form-field">
23
- <th scope="row" valign="top"><label for=""><?php esc_html_e( 'OpenGraph', 'wds' ); ?></label></th>
24
- <td>
25
- <div class="wpmud">
26
- <?php
27
- $og = ! empty( $tax_meta['opengraph'] ) ? $tax_meta['opengraph'] : false;
28
- if ( ! is_array( $og ) ) {
29
- $og = array();
30
- }
31
-
32
- $og = wp_parse_args($og, array(
33
- 'title' => false,
34
- 'description' => false,
35
- 'images' => false,
36
- 'disabled' => false,
37
- ));
38
-
39
- if ( ! class_exists( 'Smartcrawl_OpenGraph_Printer' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/class_wds_opengraph_printer.php' ); }
40
- $ogp = Smartcrawl_OpenGraph_Printer::Get();
41
-
42
- $default_title = $ogp->get_generic_og_tag_value( 'og-title', $taxonomy );
43
- $default_title = ! empty( $default_title ) ? $default_title : $term->name;
44
-
45
- $default_metadesc = $ogp->get_generic_og_tag_value( 'og-description', $taxonomy );
46
- $default_metadesc = ! empty( $default_metadesc ) ? $default_metadesc : $term->name;
47
-
48
- $og_meta_disabled = (bool) smartcrawl_get_array_value( $og, 'disabled' );
49
- ?>
50
- <div class="wds-table-fields">
51
- <div class="fields">
52
- <div class="wds-toggleable inverted <?php echo $og_meta_disabled ? 'inactive' : ''; ?>">
53
- <?php
54
- $this->_render('toggle-item', array(
55
- 'inverted' => true,
56
- 'field_name' => 'wds-opengraph[disabled]',
57
- 'checked' => checked( $og_meta_disabled, true, false ),
58
- 'item_label' => esc_html__( 'Enable OpenGraph for this term', 'wds' ),
59
- ));
60
- ?>
61
- <div class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group wds-opengraph-meta">
62
-
63
- <div class="wds-table-fields wds-table-fields-stacked">
64
- <div class="label">
65
- <label for="og-title" class="wds-label"><?php esc_html_e( 'Title', 'wds' ); ?></label>
66
- </div>
67
- <div class="fields">
68
- <input type="text"
69
- id="og-title"
70
- name="wds-opengraph[title]"
71
- placeholder="<?php echo $og['title'] ? '' : esc_attr( smartcrawl_replace_vars( $default_title, (array) $term ) ); ?>"
72
- value="<?php echo esc_attr( $og['title'] ); ?>"/>
73
- </div>
74
- </div>
75
-
76
- <div class="wds-table-fields wds-table-fields-stacked">
77
- <div class="label">
78
- <label for="og-description" class="wds-label"><?php esc_html_e( 'Description', 'wds' ); ?></label>
79
- </div>
80
- <div class="fields">
81
- <textarea name="wds-opengraph[description]"
82
- placeholder="<?php echo $og['description'] ? '' : esc_attr( smartcrawl_replace_vars( $default_metadesc, (array) $term ) ); ?>"
83
- id="og-description"><?php echo esc_textarea( $og['description'] ); ?></textarea>
84
- </div>
85
- </div>
86
-
87
- <div class="wds-table-fields wds-table-fields-stacked">
88
- <div class="label">
89
- <label for="og-images" class="wds-label"><?php esc_html_e( 'Featured Images', 'wds' ); ?></label>
90
- </div>
91
- <div class="fields og-images"
92
- data-name="wds-opengraph[images]">
93
- <div class="add-action-wrapper item">
94
- <a href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>">
95
- <i class="wds-icon-plus"></i>
96
- </a>
97
- </div>
98
- <?php if ( ! empty( $og['images'] ) && is_array( $og['images'] ) ) : ?>
99
- <?php foreach ( $og['images'] as $img ) : ?>
100
- <input type="text" class="widefat"
101
- name="wds-opengraph[images][]"
102
- value="<?php echo esc_attr( $img ); ?>" />
103
- <?php endforeach; ?>
104
- <?php endif; ?>
105
- </div>
106
- </div>
107
-
108
- <p class="wds-label-description"><?php esc_html_e( 'Each of these images will be available to use as the featured image when the term page is shared.', 'wds' ); ?></p>
109
- </div>
110
- </div>
111
- </div>
112
- </div>
113
- </div>
114
- </div>
115
- </td>
116
- <tr>
117
- <?php } ?>
118
-
119
-
120
- <?php if ( ! empty( $options['twitter-card-enable'] ) ) { ?>
121
- <tr class="form-field">
122
- <th scope="row" valign="top"><label for=""><?php esc_html_e( 'Twitter', 'wds' ); ?></label></th>
123
- <td>
124
- <div class="wpmud">
125
- <?php
126
- $twitter = ! empty( $tax_meta['twitter'] ) ? $tax_meta['twitter'] : false;
127
- if ( ! is_array( $twitter ) ) {
128
- $twitter = array();
129
- }
130
-
131
- $twitter = wp_parse_args($twitter, array(
132
- 'title' => false,
133
- 'description' => false,
134
- 'disabled' => false,
135
- ));
136
-
137
- $twitter_meta_disabled = (bool) smartcrawl_get_array_value( $twitter, 'disabled' );
138
- ?>
139
- <div class="wds-table-fields">
140
- <div class="fields">
141
- <div class="wds-toggleable inverted <?php echo $twitter_meta_disabled ? 'inactive' : ''; ?>">
142
- <?php
143
- $this->_render('toggle-item', array(
144
- 'inverted' => true,
145
- 'field_name' => 'wds-twitter[disabled]',
146
- 'checked' => checked( $twitter_meta_disabled, true, false ),
147
- 'item_label' => esc_html__( 'Enable Twitter Cards for this term', 'wds' ),
148
- ));
149
- ?>
150
- <div class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group wds-twitter-meta">
151
- <div class="wds-table-fields wds-table-fields-stacked">
152
- <div class="label">
153
- <label for="twitter-title" class="wds-label"><?php esc_html_e( 'Title', 'wds' ); ?></label>
154
- </div>
155
- <div class="fields">
156
- <input type="text"
157
- id="twitter-title"
158
- name="wds-twitter[title]"
159
- placeholder="<?php echo $twitter['title'] ? '' : esc_attr( smartcrawl_replace_vars( $term->name ) ); ?>"
160
- value="<?php echo esc_attr( $twitter['title'] ); ?>"/>
161
- </div>
162
- </div>
163
-
164
- <div class="wds-table-fields wds-table-fields-stacked">
165
- <div class="label">
166
- <label for="twitter-description" class="wds-label"><?php esc_html_e( 'Description', 'wds' ); ?></label>
167
- </div>
168
- <div class="fields">
169
- <textarea name="wds-twitter[description]"
170
- placeholder="<?php echo $twitter['description'] ? '' : esc_attr( smartcrawl_replace_vars( $term->name ) ); ?>"
171
- id="twitter-description"><?php echo esc_textarea( $twitter['description'] ); ?></textarea>
172
- </div>
173
- </div>
174
-
175
- <div class="wds-table-fields wds-table-fields-stacked">
176
- <div class="label">
177
- <label for="twitter-images" class="wds-label"><?php esc_html_e( 'Featured Image', 'wds' ); ?></label>
178
- </div>
179
- <div class="fields og-images"
180
- data-singular="true"
181
- data-name="wds-twitter[images]">
182
- <div class="add-action-wrapper item">
183
- <a href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>">
184
- <i class="wds-icon-plus"></i>
185
- </a>
186
- </div>
187
- <?php if (!empty($twitter['images']) && is_array($twitter['images'])) : ?>
188
- <?php foreach ($twitter['images'] as $twitter_image) : ?>
189
- <input type="text" class="widefat"
190
- name="wds-twitter[images][]"
191
- value="<?php echo esc_attr($twitter_image); ?>"/>
192
- <?php endforeach; ?>
193
- <?php endif; ?>
194
- </div>
195
- </div>
196
-
197
- <p class="wds-label-description"><?php esc_html_e( 'This image will be available to use as the featured image when the term page is shared.', 'wds' ); ?></p>
198
- </div>
199
- </div> <!-- fields -->
200
- </div> <!-- wds-table-fields -->
201
- </div>
202
- </td>
203
- </tr>
204
- <?php } ?>
205
-
206
- </table>
1
+ <h2><?php esc_html_e( 'SmartCrawl Settings ', 'wds' ); ?></h2>
2
+ <table class="form-table">
3
+
4
+ <?php
5
+
6
+ $this->form_row( 'wds_title', __( 'SEO Title', 'wds' ), __( 'The SEO title is used on the archive page for this term.', 'wds' ), $tax_meta );
7
+ $this->form_row( 'wds_desc', __( 'SEO Description', 'wds' ), __( 'The SEO description is used for the meta description on the archive page for this term.', 'wds' ), $tax_meta );
8
+ $this->form_row( 'wds_canonical', __( 'Canonical', 'wds' ), __( 'The canonical link is shown on the archive page for this term.', 'wds' ), $tax_meta );
9
+
10
+ if ( $global_noindex ) {
11
+ $this->form_row( 'wds_override_noindex', sprintf( __( 'Index this %s', 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' );
12
+ } else {
13
+ $this->form_row( 'wds_noindex', sprintf( __( 'Noindex this %s', 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' );
14
+ }
15
+
16
+ if ( $global_nofollow ) {
17
+ $this->form_row( 'wds_override_nofollow', sprintf( __( 'Follow this %s', 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' );
18
+ } else {
19
+ $this->form_row( 'wds_nofollow', sprintf( __( 'Nofollow this %s', 'wds' ), strtolower( $taxonomy_labels->singular_name ) ), '', $tax_meta, 'checkbox' );
20
+ }
21
+
22
+ ?>
23
+
24
+ <?php
25
+ $options = Smartcrawl_Settings::get_options();
26
+ ?>
27
+
28
+ <?php if ( ! empty( $options['og-enable'] ) ) { ?>
29
+ <tr class="form-field">
30
+ <th scope="row" valign="top"><label for=""><?php esc_html_e( 'OpenGraph', 'wds' ); ?></label></th>
31
+ <td>
32
+ <div class="wpmud">
33
+ <?php
34
+ $og = ! empty( $tax_meta['opengraph'] ) ? $tax_meta['opengraph'] : false;
35
+ if ( ! is_array( $og ) ) {
36
+ $og = array();
37
+ }
38
+
39
+ $og = wp_parse_args( $og, array(
40
+ 'title' => false,
41
+ 'description' => false,
42
+ 'images' => false,
43
+ 'disabled' => false,
44
+ ) );
45
+
46
+ $ogp = Smartcrawl_OpenGraph_Printer::get();
47
+
48
+ $default_title = $ogp->get_generic_og_tag_value( 'og-title', $taxonomy );
49
+ $default_title = ! empty( $default_title ) ? $default_title : $term->name;
50
+
51
+ $default_metadesc = $ogp->get_generic_og_tag_value( 'og-description', $taxonomy );
52
+ $default_metadesc = ! empty( $default_metadesc ) ? $default_metadesc : $term->name;
53
+
54
+ $og_meta_disabled = (bool) smartcrawl_get_array_value( $og, 'disabled' );
55
+ ?>
56
+ <div class="wds-table-fields">
57
+ <div class="fields">
58
+ <div class="wds-toggleable inverted <?php echo $og_meta_disabled ? 'inactive' : ''; ?>">
59
+ <?php
60
+ $this->_render( 'toggle-item', array(
61
+ 'inverted' => true,
62
+ 'field_name' => 'wds-opengraph[disabled]',
63
+ 'field_id' => 'wds-opengraph-disabled',
64
+ 'checked' => checked( $og_meta_disabled, true, false ),
65
+ 'item_label' => esc_html__( 'Enable OpenGraph for this term', 'wds' ),
66
+ ) );
67
+ ?>
68
+ <div
69
+ class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group wds-opengraph-meta">
70
+
71
+ <div class="wds-table-fields wds-table-fields-stacked">
72
+ <div class="label">
73
+ <label for="og-title"
74
+ class="wds-label"><?php esc_html_e( 'Title', 'wds' ); ?></label>
75
+ </div>
76
+ <div class="fields">
77
+ <input type="text"
78
+ id="og-title"
79
+ name="wds-opengraph[title]"
80
+ placeholder="<?php echo $og['title'] ? '' : esc_attr( smartcrawl_replace_vars( $default_title, (array) $term ) ); ?>"
81
+ value="<?php echo esc_attr( $og['title'] ); ?>"/>
82
+ </div>
83
+ </div>
84
+
85
+ <div class="wds-table-fields wds-table-fields-stacked">
86
+ <div class="label">
87
+ <label for="og-description"
88
+ class="wds-label"><?php esc_html_e( 'Description', 'wds' ); ?></label>
89
+ </div>
90
+ <div class="fields">
91
+ <textarea name="wds-opengraph[description]"
92
+ placeholder="<?php echo $og['description'] ? '' : esc_attr( smartcrawl_replace_vars( $default_metadesc, (array) $term ) ); ?>"
93
+ id="og-description"><?php echo esc_textarea( $og['description'] ); ?></textarea>
94
+ </div>
95
+ </div>
96
+
97
+ <div class="wds-table-fields wds-table-fields-stacked">
98
+ <div class="label">
99
+ <label for="og-images"
100
+ class="wds-label"><?php esc_html_e( 'Featured Images', 'wds' ); ?></label>
101
+ </div>
102
+ <div class="fields og-images"
103
+ data-name="wds-opengraph[images]">
104
+ <div class="add-action-wrapper item">
105
+ <a id="wds-opengraph-images" href="#add" title="<?php esc_attr_e( 'Add image', 'wds' ); ?>">
106
+ <i class="wds-icon-plus"></i>
107
+ </a>
108
+ </div>
109
+ <?php if ( ! empty( $og['images'] ) && is_array( $og['images'] ) ) : ?>
110
+ <?php foreach ( $og['images'] as $img ) : ?>
111
+ <input type="text" class="widefat"
112
+ name="wds-opengraph[images][]"
113
+ value="<?php echo esc_attr( $img ); ?>"/>
114
+ <?php endforeach; ?>
115
+ <?php endif; ?>
116
+ </div>
117
+ </div>
118
+
119
+ <p class="wds-label-description"><?php esc_html_e( 'Each of these images will be available to use as the featured image when the term page is shared.', 'wds' ); ?></p>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </td>
127
+ <tr>
128
+ <?php } ?>
129
+
130
+
131
+ <?php if ( ! empty( $options['twitter-card-enable'] ) ) { ?>
132
+ <tr class="form-field">
133
+ <th scope="row" valign="top"><label for=""><?php esc_html_e( 'Twitter', 'wds' ); ?></label></th>
134
+ <td>
135
+ <div class="wpmud">
136
+ <?php
137
+ $twitter = ! empty( $tax_meta['twitter'] ) ? $tax_meta['twitter'] : false;
138
+ if ( ! is_array( $twitter ) ) {
139
+ $twitter = array();
140
+ }
141
+
142
+ $twitter = wp_parse_args( $twitter, array(
143
+ 'title' => false,
144
+ 'description' => false,
145
+ 'disabled' => false,
146
+ ) );
147
+
148
+ $twitter_meta_disabled = (bool) smartcrawl_get_array_value( $twitter, 'disabled' );
149
+ ?>
150
+ <div class="wds-table-fields">
151
+ <div class="fields">
152
+ <div class="wds-toggleable inverted <?php echo $twitter_meta_disabled ? 'inactive' : ''; ?>">
153
+ <?php
154
+ $this->_render( 'toggle-item', array(
155
+ 'inverted' => true,
156
+ 'field_name' => 'wds-twitter[disabled]',
157
+ 'field_id' => 'wds-twitter-disabled',
158
+ 'checked' => checked( $twitter_meta_disabled, true, false ),
159
+ 'item_label' => esc_html__( 'Enable Twitter Cards for this term', 'wds' ),
160
+ ) );
161
+ ?>
162
+ <div
163
+ class="wds-toggleable-inside wds-toggleable-inside-box wds-table-fields-group wds-twitter-meta">
164
+ <div class="wds-table-fields wds-table-fields-stacked">
165
+ <div class="label">
166
+ <label for="twitter-title"
167
+ class="wds-label"><?php esc_html_e( 'Title', 'wds' ); ?></label>
168
+ </div>
169
+ <div class="fields">
170
+ <input type="text"
171
+ id="twitter-title"
172
+ name="wds-twitter[title]"
173
+ placeholder="<?php echo $twitter['title'] ? '' : esc_attr( smartcrawl_replace_vars( $term->name ) ); ?>"
174
+ value="<?php echo esc_attr( $twitter['title'] ); ?>"/>
175
+ </div>
176
+ </div>
177
+
178
+ <div class="wds-table-fields wds-table-fields-stacked">
179
+ <div class="label">
180
+ <label for="twitter-description"
181
+ class="wds-label"><?php esc_html_e( 'Description', 'wds' ); ?></label>
182
+ </div>
183
+ <div class="fields">
184
+ <textarea name="wds-twitter[descript