| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Remove "Powered by WordPress" |
| 4 |
* Version: 1.6.3 |
| 5 |
* Plugin URI: https://webd.uk/product/support-us/ |
| 6 |
* Description: Removes the WordPress credit on all default WordPress themes and inserts a widget area |
| 7 |
* Author: Webd Ltd |
| 8 |
* Author URI: https://webd.uk |
| 9 |
* License: GPLv2 or later |
| 10 |
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 11 |
* Text Domain: remove-powered-by-wp |
| 12 |
*/ |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
if (!defined('ABSPATH')) { |
| 17 |
exit('This isn\'t the page you\'re looking for. Move along, move along.'); |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
if (!class_exists('remove_powered_by_wp_class')) { |
| 23 |
|
| 24 |
class remove_powered_by_wp_class { |
| 25 |
|
| 26 |
public static $version = '1.6.3'; |
| 27 |
|
| 28 |
public static $rpbw_compatible_themes = array( |
| 29 |
'Inspiro' => 'inspiro', |
| 30 |
'Seedlet' => 'seedlet', |
| 31 |
'Newsup' => 'newsup', |
| 32 |
'Twenty Ten' => 'twentyten', |
| 33 |
'Twenty Eleven' => 'twentyeleven', |
| 34 |
'Twenty Twelve' => 'twentytwelve', |
| 35 |
'Twenty Thirteen' => 'twentythirteen', |
| 36 |
'Twenty Fourteen' => 'twentyfourteen', |
| 37 |
'Twenty Fifteen' => 'twentyfifteen', |
| 38 |
'Twenty Sixteen' => 'twentysixteen', |
| 39 |
'Twenty Seventeen' => 'twentyseventeen', |
| 40 |
'Twenty Nineteen' => 'twentynineteen', |
| 41 |
'Twenty Twenty' => 'twentytwenty', |
| 42 |
'Twenty Twenty One' => 'twentytwentyone', |
| 43 |
'Snaps' => 'snaps', |
| 44 |
'Masonic' => 'masonic', |
| 45 |
'OnePress' => 'onepress', |
| 46 |
'GreenLeaf' => 'greenleaf', |
| 47 |
'Customizr' => 'customizr', |
| 48 |
'Solid Construction' => 'solid-construction', |
| 49 |
'Envo Shopper' => 'envo-shopper', |
| 50 |
'NewsCard' => 'newscard', |
| 51 |
'Travelbee' => 'travelbee', |
| 52 |
'Neve' => 'neve', |
| 53 |
'Tonal' => 'tonal', |
| 54 |
'MinimalistBlogger' => 'minimalistblogger', |
| 55 |
'GeneratePress' => 'generatepress' |
| 56 |
); |
| 57 |
|
| 58 |
function __construct() { |
| 59 |
|
| 60 |
register_activation_hook(__FILE__, array($this, 'rpbw_activation')); |
| 61 |
add_action('customize_register', array($this, 'rpbw_customize_register')); |
| 62 |
add_action('wp_head' , array($this, 'rpbw_header_output')); |
| 63 |
add_action('widgets_init', array($this, 'rpbw_site_info_sidebar_init'), 11); |
| 64 |
|
| 65 |
if (is_admin()) { |
| 66 |
|
| 67 |
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'rpbw_add_plugin_action_links')); |
| 68 |
add_action('admin_notices', 'rpbwCommon::admin_notices'); |
| 69 |
add_action('wp_ajax_dismiss_rpbw_notice_handler', 'rpbwCommon::ajax_notice_handler'); |
| 70 |
add_action('rpbw_admin_notice_donate', array($this, 'rpbw_admin_notice_upsell')); |
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
} |
| 75 |
|
| 76 |
function rpbw_add_plugin_action_links($links) { |
| 77 |
|
| 78 |
$settings_links = rpbwCommon::plugin_action_links(add_query_arg('autofocus[section]', (get_template() == 'twentytwenty' ? 'options' : (get_template() == 'newsup' ? 'footer_options' : 'theme_options')), admin_url('customize.php'))); |
| 79 |
|
| 80 |
return array_merge($settings_links, $links); |
| 81 |
|
| 82 |
} |
| 83 |
|
| 84 |
public static function rpbw_compatible_theme_installed() { |
| 85 |
|
| 86 |
$installed_themes = wp_get_themes(); |
| 87 |
|
| 88 |
foreach (self::$rpbw_compatible_themes as $key => $value) { |
| 89 |
|
| 90 |
if (isset($installed_themes[$value]) && $installed_themes[$value]) { |
| 91 |
|
| 92 |
return true; |
| 93 |
break; |
| 94 |
|
| 95 |
} |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
return false; |
| 100 |
|
| 101 |
} |
| 102 |
|
| 103 |
function rpbw_customize_register($wp_customize) { |
| 104 |
|
| 105 |
foreach (array( |
| 106 |
'Twenty Seventeen' => 'twentyseventeen', |
| 107 |
'Twenty Nineteen' => 'twentynineteen', |
| 108 |
'Twenty Twenty' => 'twentytwenty', |
| 109 |
'Twenty Twenty One' => 'twentytwentyone' |
| 110 |
) as $key => $value) { |
| 111 |
|
| 112 |
if (get_template() == $value && !class_exists('options_for_' . str_replace(' ', '_', strtolower($key)) . '_class')) { |
| 113 |
|
| 114 |
$wp_customize->add_section('more_theme_options', array( |
| 115 |
'title' => __('More Theme Options', 'remove-powered-by-wp'), |
| 116 |
/* translators: theme name */ |
| 117 |
'description' => sprintf(__('Would you like even more options and features for your theme %s?', 'remove-powered-by-wp'), $key), |
| 118 |
'priority' => 0 |
| 119 |
)); |
| 120 |
|
| 121 |
/* translators: theme name */ |
| 122 |
rpbwCommon::add_hidden_control($wp_customize, 'install_' . $value, 'more_theme_options', sprintf(__('Options for %s', 'remove-powered-by-wp'), $key), |
| 123 |
|
| 124 |
/* translators: link to plugin installer, theme name */ |
| 125 |
sprintf(wp_kses(__('<a href="%1$s" class="button">Install Options for %2$s Plugin</a>', 'remove-powered-by-wp'), array('a' => array('href' => array(), 'class' => array()))), esc_url(add_query_arg(array( |
| 126 |
's' => $value . ' please our modification', |
| 127 |
'tab' => 'search', |
| 128 |
'type' => 'term' |
| 129 |
), admin_url('plugin-install.php'))), $key)); |
| 130 |
|
| 131 |
} |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
if (!in_array(get_template(), array('solid-construction', 'newsup', 'twentyseventeen', 'twentytwenty'), true)) { |
| 136 |
|
| 137 |
$wp_customize->add_section('theme_options', array( |
| 138 |
'title' => __('Theme Options', 'remove-powered-by-wp'), |
| 139 |
'priority' => 130 |
| 140 |
)); |
| 141 |
|
| 142 |
} elseif (in_array(get_template(), array('solid-construction'), true)) { |
| 143 |
|
| 144 |
$wp_customize->add_section('theme_options', array( |
| 145 |
'panel' => 'solid_construction_theme_options', |
| 146 |
'title' => __('Footer Options', 'remove-powered-by-wp'), |
| 147 |
'priority' => 0 |
| 148 |
)); |
| 149 |
|
| 150 |
} |
| 151 |
|
| 152 |
$wp_customize->add_setting('remove_powered_by_wordpress', array( |
| 153 |
'default' => false, |
| 154 |
'type' => 'theme_mod', |
| 155 |
'transport' => 'refresh', |
| 156 |
'sanitize_callback' => 'rpbwCommon::sanitize_boolean' |
| 157 |
)); |
| 158 |
|
| 159 |
if (in_array(get_template(), array('newscard', 'newsup', 'seedlet', 'twentynineteen', 'twentytwentyone', 'snaps'), true)) { |
| 160 |
|
| 161 |
$description = __('Removes the "Proudly powered by WordPress" text displayed in the website footer.', 'remove-powered-by-wp'); |
| 162 |
|
| 163 |
} elseif (in_array(get_template(), array('twentytwenty', 'neve', 'minimalistblogger'))) { |
| 164 |
|
| 165 |
$description = __('Removes the "Powered by WordPress" text displayed in the website footer.', 'remove-powered-by-wp'); |
| 166 |
|
| 167 |
} elseif (in_array(get_template(), array('inspiro', 'masonic', 'travelbee', 'tonal'))) { |
| 168 |
|
| 169 |
$description = __('Removes the "Powered by WordPress" text displayed in the website footer and replaces with the content of the "Site Info" widget area.', 'remove-powered-by-wp'); |
| 170 |
|
| 171 |
} elseif (in_array(get_template(), array('customizr'))) { |
| 172 |
|
| 173 |
$description = __('Removes the "Powered by WP" text displayed in the website footer and replaces with the content of the "Site Info" widget area.', 'remove-powered-by-wp'); |
| 174 |
|
| 175 |
} elseif (in_array(get_template(), array('solid-construction'))) { |
| 176 |
|
| 177 |
$description = __('Removes the "SOLID CONSTRUCTION BY" text displayed in the website footer.', 'remove-powered-by-wp'); |
| 178 |
|
| 179 |
} elseif (in_array(get_template(), array('greenleaf'))) { |
| 180 |
|
| 181 |
$description = __('Removes the "Theme by" text displayed in the website footer and replaces with the content of the "Site Info" widget area.', 'remove-powered-by-wp'); |
| 182 |
|
| 183 |
} elseif (in_array(get_template(), array('generatepress'))) { |
| 184 |
|
| 185 |
$description = __('Removes the "Built with" text displayed in the website footer and replaces with the content of the "Site Info" widget area.', 'remove-powered-by-wp'); |
| 186 |
|
| 187 |
} else { |
| 188 |
|
| 189 |
$description = __('Removes the "Proudly powered by WordPress" text displayed in the website footer and replaces with the content of the "Site Info" widget area.', 'remove-powered-by-wp'); |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
$wp_customize->add_control('remove_powered_by_wordpress', array( |
| 194 |
'label' => __('Remove Powered by WordPress', 'remove-powered-by-wp'), |
| 195 |
'description' => $description, |
| 196 |
'section' => (get_template() == 'twentytwenty' ? 'options' : (get_template() == 'newsup' ? 'footer_options' : 'theme_options')), |
| 197 |
'settings' => 'remove_powered_by_wordpress', |
| 198 |
'type' => 'checkbox' |
| 199 |
)); |
| 200 |
|
| 201 |
} |
| 202 |
|
| 203 |
function rpbw_header_output() { |
| 204 |
|
| 205 |
?> |
| 206 |
<!--Customizer CSS--> |
| 207 |
<style type="text/css"> |
| 208 |
<?php |
| 209 |
|
| 210 |
if (get_theme_mod('remove_powered_by_wordpress')) { |
| 211 |
|
| 212 |
switch (get_template()) { |
| 213 |
|
| 214 |
case 'newsup': |
| 215 |
|
| 216 |
if (get_theme_mod('remove_powered_by_wordpress')) { |
| 217 |
|
| 218 |
?> |
| 219 |
.mg-footer-copyright .text-xs:first-child { |
| 220 |
display: none; |
| 221 |
} |
| 222 |
.mg-footer-copyright .col-md-6 { |
| 223 |
flex: 0 0 100%; |
| 224 |
max-width: 100%; |
| 225 |
} |
| 226 |
<?php |
| 227 |
|
| 228 |
} |
| 229 |
|
| 230 |
break; |
| 231 |
|
| 232 |
case 'inspiro': |
| 233 |
|
| 234 |
add_action('wp_footer', array($this, 'rpbw_get_site_info_sidebar')); |
| 235 |
rpbwCommon::generate_css('.site-info .copyright', 'display', 'remove_powered_by_wordpress', '', '', 'none'); |
| 236 |
|
| 237 |
break; |
| 238 |
|
| 239 |
case 'seedlet': |
| 240 |
|
| 241 |
rpbwCommon::generate_css('.imprint', 'display', 'remove_powered_by_wordpress', '', '', 'none'); |
| 242 |
|
| 243 |
break; |
| 244 |
|
| 245 |
case 'twentyten': |
| 246 |
|
| 247 |
add_action('twentyten_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 248 |
rpbwCommon::generate_css('#footer #site-generator>a', 'display', 'remove_powered_by_wordpress', '', '', 'none'); |
| 249 |
|
| 250 |
?> |
| 251 |
#site-generator a { |
| 252 |
background-image: none; |
| 253 |
display: inline; |
| 254 |
padding-left: 0; |
| 255 |
} |
| 256 |
#site-generator p { |
| 257 |
margin: 0; |
| 258 |
} |
| 259 |
<?php |
| 260 |
|
| 261 |
break; |
| 262 |
|
| 263 |
case 'twentyeleven': |
| 264 |
|
| 265 |
add_action('twentyeleven_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 266 |
|
| 267 |
?> |
| 268 |
#site-generator>span { |
| 269 |
display: none; |
| 270 |
} |
| 271 |
#site-generator>a:last-child { |
| 272 |
display: none; |
| 273 |
} |
| 274 |
#site-generator p { |
| 275 |
margin: 0; |
| 276 |
} |
| 277 |
<?php |
| 278 |
|
| 279 |
break; |
| 280 |
|
| 281 |
case 'twentytwelve': |
| 282 |
|
| 283 |
add_action('twentytwelve_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 284 |
|
| 285 |
?> |
| 286 |
.site-info>span { |
| 287 |
display: none; |
| 288 |
} |
| 289 |
.site-info>a:last-child { |
| 290 |
display: none; |
| 291 |
} |
| 292 |
<?php |
| 293 |
|
| 294 |
break; |
| 295 |
|
| 296 |
case 'twentythirteen': |
| 297 |
|
| 298 |
add_action('twentythirteen_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 299 |
|
| 300 |
?> |
| 301 |
.site-info>span { |
| 302 |
display: none; |
| 303 |
} |
| 304 |
.site-info>a:last-child { |
| 305 |
display: none; |
| 306 |
} |
| 307 |
.site-info p { |
| 308 |
margin: 0; |
| 309 |
} |
| 310 |
<?php |
| 311 |
|
| 312 |
break; |
| 313 |
|
| 314 |
case 'twentyfourteen': |
| 315 |
|
| 316 |
add_action('twentyfourteen_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 317 |
|
| 318 |
?> |
| 319 |
.site-info>span { |
| 320 |
display: none; |
| 321 |
} |
| 322 |
.site-info>a:last-child { |
| 323 |
display: none; |
| 324 |
} |
| 325 |
.site-info p { |
| 326 |
margin: 0; |
| 327 |
} |
| 328 |
<?php |
| 329 |
|
| 330 |
break; |
| 331 |
|
| 332 |
case 'twentyfifteen': |
| 333 |
add_action('twentyfifteen_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 334 |
?> |
| 335 |
.site-info>span { |
| 336 |
display: none; |
| 337 |
} |
| 338 |
.site-info>a:last-child { |
| 339 |
display: none; |
| 340 |
} |
| 341 |
<?php |
| 342 |
|
| 343 |
break; |
| 344 |
|
| 345 |
case 'twentysixteen': |
| 346 |
|
| 347 |
add_action('twentysixteen_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 348 |
|
| 349 |
?> |
| 350 |
.site-footer span[role=separator] { |
| 351 |
display: none; |
| 352 |
} |
| 353 |
.site-info>a:last-child { |
| 354 |
display: none; |
| 355 |
} |
| 356 |
.site-footer .site-title:after { |
| 357 |
display: none; |
| 358 |
} |
| 359 |
<?php |
| 360 |
|
| 361 |
break; |
| 362 |
|
| 363 |
case 'twentyseventeen': |
| 364 |
|
| 365 |
add_action('get_template_part_template-parts/footer/site', array($this, 'rpbw_get_site_info_sidebar')); |
| 366 |
|
| 367 |
?> |
| 368 |
.site-info:last-child a:last-child { |
| 369 |
display: none; |
| 370 |
} |
| 371 |
.site-info:last-child span { |
| 372 |
display: none; |
| 373 |
} |
| 374 |
.site-info p { |
| 375 |
margin: 0; |
| 376 |
} |
| 377 |
<?php |
| 378 |
|
| 379 |
break; |
| 380 |
|
| 381 |
case 'twentynineteen': |
| 382 |
|
| 383 |
add_action('wp_footer', array($this, 'rpbw_remove_site_info_comma')); |
| 384 |
|
| 385 |
?> |
| 386 |
.site-info>.imprint { |
| 387 |
display: none; |
| 388 |
} |
| 389 |
.site-name { |
| 390 |
margin-right: 1rem; |
| 391 |
} |
| 392 |
<?php |
| 393 |
|
| 394 |
break; |
| 395 |
|
| 396 |
case 'twentytwenty': |
| 397 |
|
| 398 |
?> |
| 399 |
.powered-by-wordpress { |
| 400 |
display: none; |
| 401 |
} |
| 402 |
<?php |
| 403 |
|
| 404 |
break; |
| 405 |
|
| 406 |
case 'twentytwentyone': |
| 407 |
|
| 408 |
?> |
| 409 |
.powered-by { |
| 410 |
display: none; |
| 411 |
} |
| 412 |
<?php |
| 413 |
|
| 414 |
break; |
| 415 |
|
| 416 |
case 'snaps': |
| 417 |
|
| 418 |
?> |
| 419 |
.site-info { |
| 420 |
display: none; |
| 421 |
} |
| 422 |
<?php |
| 423 |
|
| 424 |
break; |
| 425 |
|
| 426 |
case 'masonic': |
| 427 |
|
| 428 |
add_action('wp_footer', array($this, 'rpbw_replace_masonic_copyright')); |
| 429 |
|
| 430 |
break; |
| 431 |
|
| 432 |
case 'onepress': |
| 433 |
|
| 434 |
remove_action('onepress_footer_site_info', 'onepress_footer_site_info'); |
| 435 |
add_action('onepress_footer_site_info', 'remove_powered_by_wp_class::onepress_footer_site_info'); |
| 436 |
|
| 437 |
break; |
| 438 |
|
| 439 |
case 'customizr': |
| 440 |
|
| 441 |
add_action('wp_footer', array($this, 'rpbw_replace_customizr_copyright')); |
| 442 |
add_filter('tc_wp_powered', '__return_empty_string'); |
| 443 |
|
| 444 |
break; |
| 445 |
|
| 446 |
case 'greenleaf': |
| 447 |
|
| 448 |
add_action('wp_footer', array($this, 'rpbw_replace_greenleaf_theme_by')); |
| 449 |
|
| 450 |
break; |
| 451 |
|
| 452 |
case 'solid-construction': |
| 453 |
|
| 454 |
add_action('wp_footer', array($this, 'rpbw_replace_solid_construction_by')); |
| 455 |
|
| 456 |
break; |
| 457 |
|
| 458 |
case 'envo-shopper': |
| 459 |
|
| 460 |
remove_action('envo_shopper_generate_footer', 'envo_shopper_generate_construct_footer', 20); |
| 461 |
|
| 462 |
add_action('envo_shopper_generate_footer', 'remove_powered_by_wp_class::envo_shopper_generate_footer', 20); |
| 463 |
|
| 464 |
break; |
| 465 |
|
| 466 |
case 'newscard': |
| 467 |
|
| 468 |
?> |
| 469 |
.site-info .copyright .theme-link::after, .site-info .copyright .author-link, .site-info .copyright .wp-link { |
| 470 |
display: none; |
| 471 |
} |
| 472 |
<?php |
| 473 |
|
| 474 |
break; |
| 475 |
|
| 476 |
case 'travelbee': |
| 477 |
|
| 478 |
remove_action('travelbee_footer', 'travelbee_footer_bottom', 40); |
| 479 |
add_action('travelbee_footer', array($this, 'rpbw_travelbee_footer_bottom'), 40); |
| 480 |
|
| 481 |
break; |
| 482 |
|
| 483 |
case 'neve': |
| 484 |
|
| 485 |
global $wp_filter; |
| 486 |
|
| 487 |
if (isset($wp_filter['neve_after_slot_component']->callbacks)) { |
| 488 |
|
| 489 |
foreach ($wp_filter['neve_after_slot_component']->callbacks as $callback_key => $callback_value) { |
| 490 |
|
| 491 |
foreach ($callback_value as $callback_array_key => $callback__array_value) { |
| 492 |
|
| 493 |
if ('add_footer_component' === $callback__array_value['function'][1]) { |
| 494 |
|
| 495 |
unset($wp_filter['neve_after_slot_component']->callbacks[$callback_key]); |
| 496 |
|
| 497 |
} |
| 498 |
|
| 499 |
} |
| 500 |
|
| 501 |
} |
| 502 |
|
| 503 |
if (!$wp_filter['neve_after_slot_component']->callbacks) { |
| 504 |
|
| 505 |
unset($wp_filter['neve_after_slot_component']); |
| 506 |
|
| 507 |
} |
| 508 |
|
| 509 |
} |
| 510 |
|
| 511 |
break; |
| 512 |
|
| 513 |
case 'tonal': |
| 514 |
|
| 515 |
add_action('wp_footer', array($this, 'rpbw_get_site_info_sidebar')); |
| 516 |
|
| 517 |
break; |
| 518 |
|
| 519 |
case 'minimalistblogger': |
| 520 |
|
| 521 |
?> |
| 522 |
.footer-info-right { |
| 523 |
display: none; |
| 524 |
} |
| 525 |
<?php |
| 526 |
|
| 527 |
break; |
| 528 |
|
| 529 |
case 'generatepress': |
| 530 |
|
| 531 |
remove_action('generate_credits', 'generate_add_footer_info'); |
| 532 |
add_action('generate_credits', array($this, 'rpbw_get_site_info_sidebar')); |
| 533 |
|
| 534 |
break; |
| 535 |
|
| 536 |
} |
| 537 |
|
| 538 |
} |
| 539 |
|
| 540 |
?> |
| 541 |
</style> |
| 542 |
<!--/Customizer CSS--> |
| 543 |
<?php |
| 544 |
|
| 545 |
} |
| 546 |
|
| 547 |
function rpbw_site_info_sidebar_init() { |
| 548 |
|
| 549 |
if (!in_array(get_template(), array('twentynineteen', 'twentytwenty', 'twentytwentyone', 'newsup', 'seedlet'), true)) { |
| 550 |
|
| 551 |
register_sidebar( array( |
| 552 |
'name' => __('Site Info', 'remove-powered-by-wp'), |
| 553 |
'id' => 'site-info', |
| 554 |
'description' => __('Add widgets here to appear in your footer site info.', 'remove-powered-by-wp'), |
| 555 |
'before_widget' => '', |
| 556 |
'after_widget' => '', |
| 557 |
'before_title' => '<h2 class="widget-title">', |
| 558 |
'after_title' => '</h2>', |
| 559 |
) ); |
| 560 |
|
| 561 |
} |
| 562 |
|
| 563 |
} |
| 564 |
|
| 565 |
function rpbw_get_site_info_sidebar() { |
| 566 |
|
| 567 |
if (is_active_sidebar('site-info')) { |
| 568 |
|
| 569 |
switch (get_template()) { |
| 570 |
|
| 571 |
case 'twentyten': |
| 572 |
case 'twentyeleven': |
| 573 |
case 'twentytwelve': |
| 574 |
case 'twentythirteen': |
| 575 |
case 'twentyfourteen': |
| 576 |
case 'twentyfifteen': |
| 577 |
case 'twentysixteen': |
| 578 |
dynamic_sidebar('site-info'); |
| 579 |
break; |
| 580 |
|
| 581 |
case 'inspiro': |
| 582 |
echo('<div id="site-info">'); |
| 583 |
dynamic_sidebar('site-info'); |
| 584 |
echo('</div>'); |
| 585 |
|
| 586 |
?> |
| 587 |
<script type="text/javascript"> |
| 588 |
(function() { |
| 589 |
document.getElementsByClassName('copyright')[0].innerHTML = ''; |
| 590 |
while (document.getElementById('site-info').childNodes.length > 0) { |
| 591 |
document.getElementsByClassName('copyright')[0].appendChild(document.getElementById('site-info').childNodes[0]); |
| 592 |
} |
| 593 |
document.getElementsByClassName('copyright')[0].style.display = 'block'; |
| 594 |
document.getElementById('site-info').remove(); |
| 595 |
})(); |
| 596 |
</script> |
| 597 |
<?php |
| 598 |
|
| 599 |
break; |
| 600 |
|
| 601 |
case 'twentyseventeen': |
| 602 |
echo('<div class="site-info">'); |
| 603 |
dynamic_sidebar('site-info'); |
| 604 |
echo('</div>'); |
| 605 |
break; |
| 606 |
|
| 607 |
case 'tonal': |
| 608 |
echo('<div class="site-info" id="site-info">'); |
| 609 |
dynamic_sidebar('site-info'); |
| 610 |
echo('</div>'); |
| 611 |
|
| 612 |
?> |
| 613 |
<script type="text/javascript"> |
| 614 |
(function() { |
| 615 |
document.getElementsByClassName('site-info')[0].remove(); |
| 616 |
document.getElementById('colophon').appendChild(document.getElementById('site-info')); |
| 617 |
})(); |
| 618 |
</script> |
| 619 |
<?php |
| 620 |
|
| 621 |
break; |
| 622 |
|
| 623 |
case 'generatepress': |
| 624 |
echo('<span class="copyright">'); |
| 625 |
dynamic_sidebar('site-info'); |
| 626 |
echo('</span>'); |
| 627 |
break; |
| 628 |
|
| 629 |
} |
| 630 |
|
| 631 |
} else { |
| 632 |
|
| 633 |
switch (get_template()) { |
| 634 |
|
| 635 |
case 'tonal': |
| 636 |
|
| 637 |
?> |
| 638 |
<script type="text/javascript"> |
| 639 |
(function() { |
| 640 |
document.getElementsByClassName('site-info')[0].remove(); |
| 641 |
})(); |
| 642 |
</script> |
| 643 |
<?php |
| 644 |
|
| 645 |
break; |
| 646 |
|
| 647 |
} |
| 648 |
|
| 649 |
} |
| 650 |
|
| 651 |
} |
| 652 |
|
| 653 |
function rpbw_remove_site_info_comma() { |
| 654 |
|
| 655 |
?> |
| 656 |
<script type="text/javascript"> |
| 657 |
(function() { |
| 658 |
document.getElementsByClassName('site-info')[0].innerHTML = document.getElementsByClassName('site-info')[0].innerHTML.split('</a>,\n\t\t\t\t\t\t').join('</a>'); |
| 659 |
})(); |
| 660 |
</script> |
| 661 |
<?php |
| 662 |
|
| 663 |
} |
| 664 |
|
| 665 |
function rpbw_activation() { |
| 666 |
|
| 667 |
set_theme_mod('remove_powered_by_wordpress', true); |
| 668 |
|
| 669 |
} |
| 670 |
|
| 671 |
function rpbw_admin_notice_upsell() { |
| 672 |
|
| 673 |
foreach (array( |
| 674 |
'Twenty Seventeen' => 'twentyseventeen', |
| 675 |
'Twenty Nineteen' => 'twentynineteen', |
| 676 |
'Twenty Twenty' => 'twentytwenty', |
| 677 |
'Twenty Twenty One' => 'twentytwentyone' |
| 678 |
) as $key => $value) { |
| 679 |
|
| 680 |
if ($value === get_template()) { |
| 681 |
|
| 682 |
echo '<p>'; |
| 683 |
printf( |
| 684 |
wp_kses( |
| 685 |
/* translators: theme name, theme name linked to plugin installer */ |
| 686 |
__('You are using %1$s theme so you should try %2$s plugin which has loads more options and features!', 'remove-powered-by-wp'), |
| 687 |
array('a' => array('href' => array(), 'title' => array()), 'strong' => array()) |
| 688 |
), |
| 689 |
'<strong>' . esc_html($key) . '</strong>', |
| 690 |
'<strong><a href="' . esc_url(add_query_arg(array( |
| 691 |
's' => $value . ' please our modification', |
| 692 |
'tab' => 'search', |
| 693 |
'type' => 'term' |
| 694 |
/* translators: theme name */ |
| 695 |
), admin_url('plugin-install.php'))) . '" title="' . sprintf(esc_attr(__('Options for %s', 'remove-powered-by-wp')), esc_attr($key)) . '">' . sprintf(esc_html(__('Options for %s', 'remove-powered-by-wp')), esc_html($key)) . '</a></strong>' |
| 696 |
); |
| 697 |
echo '</p>'; |
| 698 |
|
| 699 |
} |
| 700 |
|
| 701 |
} |
| 702 |
|
| 703 |
} |
| 704 |
|
| 705 |
public function rpbw_replace_masonic_copyright() { |
| 706 |
|
| 707 |
if (is_active_sidebar('site-info')) { |
| 708 |
|
| 709 |
echo('<div class="site-info">'); |
| 710 |
dynamic_sidebar('site-info'); |
| 711 |
echo('</div>'); |
| 712 |
|
| 713 |
} |
| 714 |
|
| 715 |
?> |
| 716 |
<script type="text/javascript"> |
| 717 |
(function() { |
| 718 |
var copyright = document.getElementsByClassName('copyright')[0], |
| 719 |
copyrightHeader = document.getElementsByClassName('copyright-header')[0], |
| 720 |
copyrightYear = document.getElementsByClassName('copyright-year')[0] |
| 721 |
siteInfo = document.getElementsByClassName('site-info'); |
| 722 |
copyright.textContent = ''; |
| 723 |
copyright.append(copyrightHeader); |
| 724 |
copyright.append(copyrightYear); |
| 725 |
if (siteInfo.length) { |
| 726 |
copyright.append(siteInfo[0]); |
| 727 |
} |
| 728 |
})(); |
| 729 |
</script> |
| 730 |
<?php |
| 731 |
|
| 732 |
} |
| 733 |
|
| 734 |
public function rpbw_travelbee_footer_bottom() { |
| 735 |
|
| 736 |
?> |
| 737 |
<div class="footer-b"> |
| 738 |
<div class="container"> |
| 739 |
<div class="footer-bottom-t"> |
| 740 |
<?php |
| 741 |
travelbee_footer_navigation(); |
| 742 |
travelbee_social_links(); ?> |
| 743 |
</div><?php |
| 744 |
|
| 745 |
if (is_active_sidebar('site-info')) { |
| 746 |
|
| 747 |
echo('<div class="site-info">'); |
| 748 |
dynamic_sidebar('site-info'); |
| 749 |
echo('</div>'); |
| 750 |
|
| 751 |
} |
| 752 |
|
| 753 |
?> |
| 754 |
</div> |
| 755 |
</div> |
| 756 |
<?php |
| 757 |
|
| 758 |
} |
| 759 |
|
| 760 |
public function rpbw_replace_customizr_copyright() { |
| 761 |
|
| 762 |
if (is_active_sidebar('site-info')) { |
| 763 |
|
| 764 |
echo('<div class="site-info">'); |
| 765 |
dynamic_sidebar('site-info'); |
| 766 |
echo('</div>'); |
| 767 |
|
| 768 |
} |
| 769 |
|
| 770 |
?> |
| 771 |
<script type="text/javascript"> |
| 772 |
(function() { |
| 773 |
var credits = document.getElementsByClassName('czr-credits')[0], |
| 774 |
siteInfo = document.getElementsByClassName('site-info'); |
| 775 |
credits.textContent = ''; |
| 776 |
if (siteInfo.length) { |
| 777 |
siteInfo[0].classList.add('czr-credits'); |
| 778 |
credits.replaceWith(siteInfo[0]); |
| 779 |
} |
| 780 |
})(); |
| 781 |
</script> |
| 782 |
<?php |
| 783 |
|
| 784 |
} |
| 785 |
|
| 786 |
public function rpbw_replace_greenleaf_theme_by() { |
| 787 |
|
| 788 |
if (is_active_sidebar('site-info')) { |
| 789 |
|
| 790 |
echo('<div class="site-info">'); |
| 791 |
dynamic_sidebar('site-info'); |
| 792 |
echo('</div>'); |
| 793 |
|
| 794 |
} |
| 795 |
|
| 796 |
?> |
| 797 |
<script type="text/javascript"> |
| 798 |
(function() { |
| 799 |
var themeBy = document.getElementsByClassName('fright')[0], |
| 800 |
siteInfo = document.getElementsByClassName('site-info'); |
| 801 |
themeBy.textContent = ''; |
| 802 |
if (siteInfo.length) { |
| 803 |
themeBy.append(siteInfo[0]); |
| 804 |
} |
| 805 |
})(); |
| 806 |
</script> |
| 807 |
<?php |
| 808 |
|
| 809 |
} |
| 810 |
|
| 811 |
public function rpbw_replace_solid_construction_by() { |
| 812 |
|
| 813 |
if (is_active_sidebar('site-info')) { |
| 814 |
|
| 815 |
echo('<div id="site-info">'); |
| 816 |
dynamic_sidebar('site-info'); |
| 817 |
echo('</div>'); |
| 818 |
|
| 819 |
} |
| 820 |
|
| 821 |
?> |
| 822 |
<script type="text/javascript"> |
| 823 |
(function() { |
| 824 |
var solidConstructionBy = document.getElementById('footer-left-content'), |
| 825 |
siteInfo = document.getElementById('site-info'); |
| 826 |
solidConstructionBy.textContent = ''; |
| 827 |
if ('innerHTML' in siteInfo) { |
| 828 |
solidConstructionBy.innerHTML = siteInfo.innerHTML; |
| 829 |
} else { |
| 830 |
solidConstructionBy.remove(); |
| 831 |
} |
| 832 |
})(); |
| 833 |
</script> |
| 834 |
<?php |
| 835 |
|
| 836 |
} |
| 837 |
|
| 838 |
public static function envo_shopper_generate_footer() { |
| 839 |
|
| 840 |
if (is_active_sidebar('site-info')) { |
| 841 |
|
| 842 |
?> |
| 843 |
<footer id="colophon" class="footer-credits container-fluid"> |
| 844 |
<div class="container"> |
| 845 |
<div class="footer-credits-text text-center"> |
| 846 |
<?php |
| 847 |
|
| 848 |
dynamic_sidebar('site-info'); |
| 849 |
|
| 850 |
?> |
| 851 |
</div> |
| 852 |
</div> |
| 853 |
</footer> |
| 854 |
<?php |
| 855 |
|
| 856 |
} |
| 857 |
|
| 858 |
} |
| 859 |
|
| 860 |
public static function onepress_footer_site_info() { |
| 861 |
|
| 862 |
if (is_active_sidebar('site-info')) { |
| 863 |
|
| 864 |
dynamic_sidebar('site-info'); |
| 865 |
|
| 866 |
} |
| 867 |
|
| 868 |
} |
| 869 |
|
| 870 |
} |
| 871 |
|
| 872 |
if (!class_exists('rpbwCommon')) { |
| 873 |
|
| 874 |
require_once(dirname(__FILE__) . '/includes/class-rpbw-common.php'); |
| 875 |
|
| 876 |
} |
| 877 |
|
| 878 |
if (rpbwCommon::is_theme_being_used(remove_powered_by_wp_class::$rpbw_compatible_themes)) { |
| 879 |
|
| 880 |
$remove_powered_by_wp_object = new remove_powered_by_wp_class(); |
| 881 |
|
| 882 |
} else { |
| 883 |
|
| 884 |
if (is_admin() && !remove_powered_by_wp_class::rpbw_compatible_theme_installed()) { |
| 885 |
|
| 886 |
add_action('admin_notices', 'rpbw_wrong_theme_notice'); |
| 887 |
|
| 888 |
} |
| 889 |
|
| 890 |
} |
| 891 |
|
| 892 |
function rpbw_wrong_theme_notice() { |
| 893 |
|
| 894 |
?> |
| 895 |
<div class="notice notice-error"> |
| 896 |
<p><strong><?php esc_html_e('Remove "Powered by WordPress" Plugin Error', 'remove-powered-by-wp'); ?></strong><br /> |
| 897 |
<?php |
| 898 |
|
| 899 |
printf( |
| 900 |
/* translators: theme slug */ |
| 901 |
esc_html(__('This plugin requires one of the compatible themes to be active or live previewed in order to function. Your theme "%s" is not compatible. Please install and activate or live preview one of these themes (or a child theme thereof):', 'remove-powered-by-wp')), |
| 902 |
esc_html(get_template()) |
| 903 |
); |
| 904 |
|
| 905 |
$theme_list = array(); |
| 906 |
|
| 907 |
foreach (remove_powered_by_wp_class::$rpbw_compatible_themes as $key => $value) { |
| 908 |
|
| 909 |
$theme_list[] = '<a href="' . add_query_arg('search', $value, admin_url('theme-install.php')) . '" title="' . esc_attr($key) . '">' . esc_html($key) . '</a>'; |
| 910 |
|
| 911 |
} |
| 912 |
|
| 913 |
echo esc_html(' ' . implode(', ', $theme_list) . '.'); |
| 914 |
|
| 915 |
?></p> |
| 916 |
</div> |
| 917 |
<?php |
| 918 |
|
| 919 |
} |
| 920 |
|
| 921 |
} |
| 922 |
|
| 923 |
?> |
| 924 |
|