| @@ -162,8 +162,82 @@ | ||
| 162 | 162 | return array_merge($defaults, is_array($caps) ? $caps : []); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | + * Capability map for sitewide duplicate snippet detection. | |
| 167 | + * | |
| 168 | + * The check itself is Free: finding out that two of your pages carry one | |
| 169 | + * title is a read, it runs when the user asks for it, and it is exactly the | |
| 170 | + * kind of thing that should work on a first install (#564). What Pro adds | |
| 171 | + * is the unattended half — a recheck that runs on a schedule and tells you | |
| 172 | + * when a new duplicate appears, rather than when you next open the screen. | |
| 173 | + * | |
| 174 | + * Nothing in the free plugin schedules anything, so `scheduled` only ever | |
| 175 | + * reports what Pro has arranged; the report reads it to say whether it is | |
| 176 | + * being watched or only answered on demand. | |
| 177 | + * | |
| 178 | + * Schema: | |
| 179 | + * scheduled bool Duplicates are rechecked without the user asking. | |
| 180 | + * | |
| 181 | + * @since 2.10.0 | |
| 182 | + * | |
| 183 | + * @return array Capability map. | |
| 184 | + */ | |
| 185 | + public static function duplicate_snippets(): array { | |
| 186 | + $defaults = [ | |
| 187 | + 'scheduled' => false, | |
| 188 | + ]; | |
| 189 | + | |
| 190 | + /** | |
| 191 | + * Filter the duplicate snippets capability map. | |
| 192 | + * | |
| 193 | + * @since 2.10.0 | |
| 194 | + * | |
| 195 | + * @param array $defaults Capability map (see schema above). | |
| 196 | + */ | |
| 197 | + $caps = apply_filters('thinkrank_duplicate_snippets_capabilities', $defaults); | |
| 198 | + | |
| 199 | + return array_merge($defaults, is_array($caps) ? $caps : []); | |
| 200 | + } | |
| 201 | + | |
| 202 | + /** | |
| 203 | + * Capability map for the thin content report. | |
| 204 | + * | |
| 205 | + * Finding out which of your pages are thin is a read, it runs when the user | |
| 206 | + * asks for it, and it is exactly what should work on a first install, so | |
| 207 | + * the report is Free (#565). What Pro adds is the unattended half: an alert | |
| 208 | + * when content that was fine becomes thin, or when something thin is | |
| 209 | + * published, which is the decay framing Content Refresh Radar already uses. | |
| 210 | + * | |
| 211 | + * Nothing in the free plugin schedules anything, so `scheduled_alerts` only | |
| 212 | + * ever reports what Pro has arranged; the report reads it to say whether it | |
| 213 | + * is being watched or only answered on demand. | |
| 214 | + * | |
| 215 | + * Schema: | |
| 216 | + * scheduled_alerts bool Newly-thin content is reported without being asked. | |
| 217 | + * | |
| 218 | + * @since 2.10.0 | |
| 219 | + * | |
| 220 | + * @return array Capability map. | |
| 221 | + */ | |
| 222 | + public static function thin_content(): array { | |
| 223 | + $defaults = [ | |
| 224 | + 'scheduled_alerts' => false, | |
| 225 | + ]; | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Filter the thin content capability map. | |
| 229 | + * | |
| 230 | + * @since 2.10.0 | |
| 231 | + * | |
| 232 | + * @param array $defaults Capability map (see schema above). | |
| 233 | + */ | |
| 234 | + $caps = apply_filters('thinkrank_thin_content_capabilities', $defaults); | |
| 235 | + | |
| 236 | + return array_merge($defaults, is_array($caps) ? $caps : []); | |
| 237 | + } | |
| 238 | + | |
| 239 | + /** | |
| 166 | 240 | * Check a single capability for a given feature. |
| 167 | 241 | * |
| 168 | 242 | * Adding a feature means adding a switch case to capabilities_for() that |
| 169 | 243 | * delegates to its own capability builder method. |
| @@ -189,8 +263,12 @@ | ||
| 189 | 263 | case 'seo_analyzer': |
| 190 | 264 | return self::seo_analyzer(); |
| 191 | 265 | case 'focus_pages': |
| 192 | 266 | return self::focus_pages(); |
| 267 | + case 'duplicate_snippets': | |
| 268 | + return self::duplicate_snippets(); | |
| 269 | + case 'thin_content': | |
| 270 | + return self::thin_content(); | |
| 193 | 271 | default: |
| 194 | 272 | return []; |
| 195 | 273 | } |
| 196 | 274 | } |