WP Hide & Security Enhancer - Version 1.1

Version Description

  • Po / Mo localisation files update
  • Update class to process the further structure changes and current components fields name change.
  • New Component : Wp-content folder access block
  • New Component : Block default wp-signup.php file from being accesible.
  • Fix: New admin url save when permalinks disable. keep on default admin url instead redirect.
  • Rewrite Default mod_rewrite code, append slashes to all urls to avoid actual directory reveal
  • Send e-mail notification when admin e-mail change, to prevent url forget / lose
  • New Component Disable Emoji
  • New Component Disable TinyMC Emoji
  • Structure change on the modules, split into chunks called components
  • Code Clean-up
  • Set processing order for component settings to allow mod_rewrite rules placement at certain position related to another line
  • Improved Template dir when child theme is active
  • Allow parent theme / child theme rewrite
  • mod_rewrite change for 404 error, set for WordPress internal 404 error page instead default server
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 WP Hide & Security Enhancer
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.4 to 1.1

include/admin-interface.class.php CHANGED
@@ -64,9 +64,9 @@
64
 
65
  <?php
66
 
67
- $module_id = $this->module->get_module_id();
68
  foreach($this->module_settings as $module_setting)
69
  {
 
70
  if(isset($module_setting['type']) && $module_setting['type'] == 'split')
71
  {
72
  ?>
@@ -75,6 +75,9 @@
75
 
76
  continue;
77
  }
 
 
 
78
 
79
  ?>
80
  <div class="postbox">
@@ -92,7 +95,7 @@
92
  <?php if(!empty($module_setting['value_description'])) { ?><p class="description"><?php echo $module_setting['value_description'] ?></p><?php } ?>
93
  <?php
94
 
95
- $option_name = $this->module->get_module_id() . '_' . $module_setting['id'];
96
  $value = $this->wph->get_setting_value( $option_name, $module_setting['default_value']);
97
 
98
  switch($module_setting['input_type'])
64
 
65
  <?php
66
 
 
67
  foreach($this->module_settings as $module_setting)
68
  {
69
+
70
  if(isset($module_setting['type']) && $module_setting['type'] == 'split')
71
  {
72
  ?>
75
 
76
  continue;
77
  }
78
+
79
+ if($module_setting['visible'] === FALSE)
80
+ continue;
81
 
82
  ?>
83
  <div class="postbox">
95
  <?php if(!empty($module_setting['value_description'])) { ?><p class="description"><?php echo $module_setting['value_description'] ?></p><?php } ?>
96
  <?php
97
 
98
+ $option_name = $module_setting['id'];
99
  $value = $this->wph->get_setting_value( $option_name, $module_setting['default_value']);
100
 
101
  switch($module_setting['input_type'])
include/functions.class.php CHANGED
@@ -15,24 +15,43 @@
15
  {
16
 
17
  }
18
-
19
- function filter_settings($module_settings)
20
  {
21
- if(!is_array($module_settings) || count($module_settings) < 1)
22
- return $module_settings;
23
-
24
  $defaults = array (
25
  'id' => '',
 
26
  'label' => '',
27
  'description' => '',
28
  'value_description' => '',
29
  'input_type' => 'text',
30
  'default_value' => '',
31
- 'sanitize_type' => array('sanitize_title')
32
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  foreach($module_settings as $key => $module_setting)
35
  {
 
 
 
 
 
 
 
 
36
  $module_setting = wp_parse_args( $module_setting, $defaults );
37
 
38
  switch($module_setting['input_type'])
@@ -51,10 +70,12 @@
51
  $module_settings[$key] = $module_setting;
52
  }
53
 
 
 
54
  return $module_settings;
55
 
56
  }
57
-
58
 
59
  function process_interface_save()
60
  {
@@ -71,14 +92,15 @@
71
  return FALSE;
72
 
73
  global $wph;
74
-
75
- $module_id = $module->get_module_id();
76
 
77
  //proces the fields
78
  $module_settings = $this->filter_settings( $module->get_module_settings() );
79
 
80
  foreach($module_settings as $module_setting)
81
  {
 
 
 
82
  $field_name = $module_setting['id'];
83
 
84
  $value = isset($_POST[$field_name]) ? $_POST[$field_name] : '';
@@ -90,7 +112,7 @@
90
  }
91
 
92
  //save the value
93
- $wph->settings['module_settings'][$module_id .'_' . $field_name] = $value;
94
  }
95
 
96
  //update the settings
@@ -101,7 +123,7 @@
101
 
102
  //redirect
103
  $new_admin_url = $this->get_module_item_setting('admin_url' , 'admin');
104
- if(!empty($new_admin_url))
105
  $new_location = trailingslashit( site_url() ) . $new_admin_url . "/admin.php?page=" . $screen_slug;
106
  else
107
  $new_location = trailingslashit( site_url() ) . "wp-admin/admin.php?page=" . $screen_slug;
@@ -184,12 +206,20 @@
184
  }
185
 
186
 
187
- function get_module_item_setting($item_id, $module_id)
 
 
 
 
 
 
188
  {
189
 
190
  $settings = $this->get_settings();
191
 
192
- $value = isset($settings['module_settings'][ $module_id . '_' . $item_id]) ? $settings['module_settings'][ $module_id . '_' . $item_id] : '';
 
 
193
 
194
  return $value;
195
 
@@ -354,11 +384,364 @@
354
 
355
  function is_other_template($template)
356
  {
357
- if($this->wph->templates_data['main']['folder_name'] == $template || $this->wph->templates_data['child']['folder_name'] == $template)
358
- return FALSE;
 
 
 
 
 
 
 
 
 
 
359
 
360
  return TRUE;
361
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
 
363
  }
364
 
15
  {
16
 
17
  }
18
+
19
+ function get_module_default_setting()
20
  {
 
 
 
21
  $defaults = array (
22
  'id' => '',
23
+ 'visible' => TRUE,
24
  'label' => '',
25
  'description' => '',
26
  'value_description' => '',
27
  'input_type' => 'text',
28
  'default_value' => '',
29
+ 'sanitize_type' => array('sanitize_title'),
30
+
31
+ 'callback' => '',
32
+ 'processing_order' => 10,
33
+ );
34
+
35
+ return $defaults;
36
+ }
37
+
38
+ function filter_settings($module_settings, $strip_splits = FALSE)
39
+ {
40
+ if(!is_array($module_settings) || count($module_settings) < 1)
41
+ return $module_settings;
42
+
43
+ $defaults = $this->get_module_default_setting();
44
 
45
  foreach($module_settings as $key => $module_setting)
46
  {
47
+ if(isset($module_setting['type']) && $module_setting['type'] == 'split')
48
+ {
49
+ if($strip_splits === TRUE)
50
+ unset($module_settings[$key]);
51
+
52
+ continue;
53
+ }
54
+
55
  $module_setting = wp_parse_args( $module_setting, $defaults );
56
 
57
  switch($module_setting['input_type'])
70
  $module_settings[$key] = $module_setting;
71
  }
72
 
73
+ $module_settings = array_values($module_settings);
74
+
75
  return $module_settings;
76
 
77
  }
78
+
79
 
80
  function process_interface_save()
81
  {
92
  return FALSE;
93
 
94
  global $wph;
 
 
95
 
96
  //proces the fields
97
  $module_settings = $this->filter_settings( $module->get_module_settings() );
98
 
99
  foreach($module_settings as $module_setting)
100
  {
101
+ if(isset($module_setting['type']) && $module_setting['type'] == 'split')
102
+ continue;
103
+
104
  $field_name = $module_setting['id'];
105
 
106
  $value = isset($_POST[$field_name]) ? $_POST[$field_name] : '';
112
  }
113
 
114
  //save the value
115
+ $wph->settings['module_settings'][ $field_name ] = $value;
116
  }
117
 
118
  //update the settings
123
 
124
  //redirect
125
  $new_admin_url = $this->get_module_item_setting('admin_url' , 'admin');
126
+ if(!empty($new_admin_url) && $this->is_permalink_enabled())
127
  $new_location = trailingslashit( site_url() ) . $new_admin_url . "/admin.php?page=" . $screen_slug;
128
  else
129
  $new_location = trailingslashit( site_url() ) . "wp-admin/admin.php?page=" . $screen_slug;
206
  }
207
 
208
 
209
+
210
+ /**
211
+ * Return a Module Item value setting
212
+ *
213
+ * @param mixed $item_id
214
+ */
215
+ function get_module_item_setting($item_id)
216
  {
217
 
218
  $settings = $this->get_settings();
219
 
220
+ $value = isset($settings['module_settings'][ $item_id ]) ? $settings['module_settings'][ $item_id] : '';
221
+
222
+ $value = apply_filters('wp-hide/get_module_item_setting', $value, $item_id);
223
 
224
  return $value;
225
 
384
 
385
  function is_other_template($template)
386
  {
387
+
388
+ if($this->wph->templates_data['is_child_theme'] === TRUE)
389
+ {
390
+ if($this->wph->templates_data['child']['folder_name'] == $template)
391
+ return FALSE;
392
+ }
393
+ else
394
+ {
395
+ if($this->wph->templates_data['main']['folder_name'] == $template)
396
+ return FALSE;
397
+
398
+ }
399
 
400
  return TRUE;
401
  }
402
+
403
+
404
+ function array_sort_by_processing_order($a, $b)
405
+ {
406
+ return $a['processing_order'] - $b['processing_order'];
407
+ }
408
+
409
+
410
+ /**
411
+ * An early instance of WordPress wp_mail core
412
+ * Unable to load pluggable.php where the function exists, as bein loaded using require
413
+ *
414
+ * @param mixed $to
415
+ * @param mixed $subject
416
+ * @param mixed $message
417
+ * @param mixed $headers
418
+ * @param mixed $attachments
419
+ */
420
+ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )
421
+ {
422
+ // Compact the input, apply the filters, and extract them back out
423
+
424
+ /**
425
+ * Filter the wp_mail() arguments.
426
+ *
427
+ * @since 2.2.0
428
+ *
429
+ * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
430
+ * subject, message, headers, and attachments values.
431
+ */
432
+ $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
433
+
434
+ if ( isset( $atts['to'] ) ) {
435
+ $to = $atts['to'];
436
+ }
437
+
438
+ if ( isset( $atts['subject'] ) ) {
439
+ $subject = $atts['subject'];
440
+ }
441
+
442
+ if ( isset( $atts['message'] ) ) {
443
+ $message = $atts['message'];
444
+ }
445
+
446
+ if ( isset( $atts['headers'] ) ) {
447
+ $headers = $atts['headers'];
448
+ }
449
+
450
+ if ( isset( $atts['attachments'] ) ) {
451
+ $attachments = $atts['attachments'];
452
+ }
453
+
454
+ if ( ! is_array( $attachments ) ) {
455
+ $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
456
+ }
457
+ global $phpmailer;
458
+
459
+ // (Re)create it, if it's gone missing
460
+ if ( ! ( $phpmailer instanceof PHPMailer ) ) {
461
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
462
+ require_once ABSPATH . WPINC . '/class-smtp.php';
463
+ $phpmailer = new PHPMailer( true );
464
+ }
465
+
466
+ // Headers
467
+ if ( empty( $headers ) ) {
468
+ $headers = array();
469
+ } else {
470
+ if ( !is_array( $headers ) ) {
471
+ // Explode the headers out, so this function can take both
472
+ // string headers and an array of headers.
473
+ $tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
474
+ } else {
475
+ $tempheaders = $headers;
476
+ }
477
+ $headers = array();
478
+ $cc = array();
479
+ $bcc = array();
480
+
481
+ // If it's actually got contents
482
+ if ( !empty( $tempheaders ) ) {
483
+ // Iterate through the raw headers
484
+ foreach ( (array) $tempheaders as $header ) {
485
+ if ( strpos($header, ':') === false ) {
486
+ if ( false !== stripos( $header, 'boundary=' ) ) {
487
+ $parts = preg_split('/boundary=/i', trim( $header ) );
488
+ $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
489
+ }
490
+ continue;
491
+ }
492
+ // Explode them out
493
+ list( $name, $content ) = explode( ':', trim( $header ), 2 );
494
+
495
+ // Cleanup crew
496
+ $name = trim( $name );
497
+ $content = trim( $content );
498
+
499
+ switch ( strtolower( $name ) ) {
500
+ // Mainly for legacy -- process a From: header if it's there
501
+ case 'from':
502
+ $bracket_pos = strpos( $content, '<' );
503
+ if ( $bracket_pos !== false ) {
504
+ // Text before the bracketed email is the "From" name.
505
+ if ( $bracket_pos > 0 ) {
506
+ $from_name = substr( $content, 0, $bracket_pos - 1 );
507
+ $from_name = str_replace( '"', '', $from_name );
508
+ $from_name = trim( $from_name );
509
+ }
510
+
511
+ $from_email = substr( $content, $bracket_pos + 1 );
512
+ $from_email = str_replace( '>', '', $from_email );
513
+ $from_email = trim( $from_email );
514
+
515
+ // Avoid setting an empty $from_email.
516
+ } elseif ( '' !== trim( $content ) ) {
517
+ $from_email = trim( $content );
518
+ }
519
+ break;
520
+ case 'content-type':
521
+ if ( strpos( $content, ';' ) !== false ) {
522
+ list( $type, $charset_content ) = explode( ';', $content );
523
+ $content_type = trim( $type );
524
+ if ( false !== stripos( $charset_content, 'charset=' ) ) {
525
+ $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset_content ) );
526
+ } elseif ( false !== stripos( $charset_content, 'boundary=' ) ) {
527
+ $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) );
528
+ $charset = '';
529
+ }
530
+
531
+ // Avoid setting an empty $content_type.
532
+ } elseif ( '' !== trim( $content ) ) {
533
+ $content_type = trim( $content );
534
+ }
535
+ break;
536
+ case 'cc':
537
+ $cc = array_merge( (array) $cc, explode( ',', $content ) );
538
+ break;
539
+ case 'bcc':
540
+ $bcc = array_merge( (array) $bcc, explode( ',', $content ) );
541
+ break;
542
+ default:
543
+ // Add it to our grand headers array
544
+ $headers[trim( $name )] = trim( $content );
545
+ break;
546
+ }
547
+ }
548
+ }
549
+ }
550
+
551
+ // Empty out the values that may be set
552
+ $phpmailer->ClearAllRecipients();
553
+ $phpmailer->ClearAttachments();
554
+ $phpmailer->ClearCustomHeaders();
555
+ $phpmailer->ClearReplyTos();
556
+
557
+ // From email and name
558
+ // If we don't have a name from the input headers
559
+ if ( !isset( $from_name ) )
560
+ $from_name = 'WordPress';
561
+
562
+ /* If we don't have an email from the input headers default to wordpress@$sitename
563
+ * Some hosts will block outgoing mail from this address if it doesn't exist but
564
+ * there's no easy alternative. Defaulting to admin_email might appear to be another
565
+ * option but some hosts may refuse to relay mail from an unknown domain. See
566
+ * https://core.trac.wordpress.org/ticket/5007.
567
+ */
568
+
569
+ if ( !isset( $from_email ) ) {
570
+ // Get the site domain and get rid of www.
571
+ $sitename = strtolower( $_SERVER['SERVER_NAME'] );
572
+ if ( substr( $sitename, 0, 4 ) == 'www.' ) {
573
+ $sitename = substr( $sitename, 4 );
574
+ }
575
+
576
+ $from_email = 'wordpress@' . $sitename;
577
+ }
578
+
579
+ /**
580
+ * Filter the email address to send from.
581
+ *
582
+ * @since 2.2.0
583
+ *
584
+ * @param string $from_email Email address to send from.
585
+ */
586
+ $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
587
+
588
+ /**
589
+ * Filter the name to associate with the "from" email address.
590
+ *
591
+ * @since 2.3.0
592
+ *
593
+ * @param string $from_name Name associated with the "from" email address.
594
+ */
595
+ $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
596
+
597
+ // Set destination addresses
598
+ if ( !is_array( $to ) )
599
+ $to = explode( ',', $to );
600
+
601
+ foreach ( (array) $to as $recipient ) {
602
+ try {
603
+ // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
604
+ $recipient_name = '';
605
+ if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
606
+ if ( count( $matches ) == 3 ) {
607
+ $recipient_name = $matches[1];
608
+ $recipient = $matches[2];
609
+ }
610
+ }
611
+ $phpmailer->AddAddress( $recipient, $recipient_name);
612
+ } catch ( phpmailerException $e ) {
613
+ continue;
614
+ }
615
+ }
616
+
617
+ // Set mail's subject and body
618
+ $phpmailer->Subject = $subject;
619
+ $phpmailer->Body = $message;
620
+
621
+ // Add any CC and BCC recipients
622
+ if ( !empty( $cc ) ) {
623
+ foreach ( (array) $cc as $recipient ) {
624
+ try {
625
+ // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
626
+ $recipient_name = '';
627
+ if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
628
+ if ( count( $matches ) == 3 ) {
629
+ $recipient_name = $matches[1];
630
+ $recipient = $matches[2];
631
+ }
632
+ }
633
+ $phpmailer->AddCc( $recipient, $recipient_name );
634
+ } catch ( phpmailerException $e ) {
635
+ continue;
636
+ }
637
+ }
638
+ }
639
+
640
+ if ( !empty( $bcc ) ) {
641
+ foreach ( (array) $bcc as $recipient) {
642
+ try {
643
+ // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
644
+ $recipient_name = '';
645
+ if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
646
+ if ( count( $matches ) == 3 ) {
647
+ $recipient_name = $matches[1];
648
+ $recipient = $matches[2];
649
+ }
650
+ }
651
+ $phpmailer->AddBcc( $recipient, $recipient_name );
652
+ } catch ( phpmailerException $e ) {
653
+ continue;
654
+ }
655
+ }
656
+ }
657
+
658
+ // Set to use PHP's mail()
659
+ $phpmailer->IsMail();
660
+
661
+ // Set Content-Type and charset
662
+ // If we don't have a content-type from the input headers
663
+ if ( !isset( $content_type ) )
664
+ $content_type = 'text/plain';
665
+
666
+ /**
667
+ * Filter the wp_mail() content type.
668
+ *
669
+ * @since 2.3.0
670
+ *
671
+ * @param string $content_type Default wp_mail() content type.
672
+ */
673
+ $content_type = apply_filters( 'wp_mail_content_type', $content_type );
674
+
675
+ $phpmailer->ContentType = $content_type;
676
+
677
+ // Set whether it's plaintext, depending on $content_type
678
+ if ( 'text/html' == $content_type )
679
+ $phpmailer->IsHTML( true );
680
+
681
+ // If we don't have a charset from the input headers
682
+ if ( !isset( $charset ) )
683
+ $charset = get_bloginfo( 'charset' );
684
+
685
+ // Set the content-type and charset
686
+
687
+ /**
688
+ * Filter the default wp_mail() charset.
689
+ *
690
+ * @since 2.3.0
691
+ *
692
+ * @param string $charset Default email charset.
693
+ */
694
+ $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
695
+
696
+ // Set custom headers
697
+ if ( !empty( $headers ) ) {
698
+ foreach ( (array) $headers as $name => $content ) {
699
+ $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
700
+ }
701
+
702
+ if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
703
+ $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
704
+ }
705
+
706
+ if ( !empty( $attachments ) ) {
707
+ foreach ( $attachments as $attachment ) {
708
+ try {
709
+ $phpmailer->AddAttachment($attachment);
710
+ } catch ( phpmailerException $e ) {
711
+ continue;
712
+ }
713
+ }
714
+ }
715
+
716
+ /**
717
+ * Fires after PHPMailer is initialized.
718
+ *
719
+ * @since 2.2.0
720
+ *
721
+ * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
722
+ */
723
+ do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
724
+
725
+ // Send!
726
+ try {
727
+ return $phpmailer->Send();
728
+ } catch ( phpmailerException $e ) {
729
+
730
+ $mail_error_data = compact( $to, $subject, $message, $headers, $attachments );
731
+
732
+ /**
733
+ * Fires after a phpmailerException is caught.
734
+ *
735
+ * @since 4.4.0
736
+ *
737
+ * @param WP_Error $error A WP_Error object with the phpmailerException code, message, and an array
738
+ * containing the mail recipient, subject, message, headers, and attachments.
739
+ */
740
+ do_action( 'wp_mail_failed', new WP_Error( $e->getCode(), $e->getMessage(), $mail_error_data ) );
741
+
742
+ return false;
743
+ }
744
+ }
745
 
746
  }
747
 
include/module.class.php CHANGED
@@ -3,6 +3,8 @@
3
 
4
  class WPH_module
5
  {
 
 
6
  var $functions;
7
  var $wph;
8
 
@@ -12,6 +14,8 @@
12
 
13
  global $wph;
14
  $this->wph = &$wph;
 
 
15
  }
16
 
17
  function __destruct()
@@ -19,6 +23,50 @@
19
 
20
  }
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  }
24
 
3
 
4
  class WPH_module
5
  {
6
+ var $components = array();
7
+
8
  var $functions;
9
  var $wph;
10
 
14
 
15
  global $wph;
16
  $this->wph = &$wph;
17
+
18
+ $this->load_components();
19
  }
20
 
21
  function __destruct()
23
 
24
  }
25
 
26
+ function load_components()
27
+ {
28
+
29
+ }
30
+
31
+
32
+ /**
33
+ * Return module components settings
34
+ *
35
+ */
36
+ function get_module_settings()
37
+ {
38
+
39
+ $module_settings = array();
40
+
41
+ foreach($this->components as $module_component)
42
+ {
43
+ if(count($module_settings) > 0)
44
+ {
45
+ //add a split for interface
46
+ $module_settings[] = array(
47
+ 'type' => 'split',
48
+ );
49
+ }
50
+
51
+ if(is_array($module_component->module_settings) && count($module_component->module_settings) > 0)
52
+ {
53
+ foreach($module_component->module_settings as $module_setting)
54
+ {
55
+ $module_setting['class_instance'] = $module_component;
56
+ $module_settings[] = $module_setting;
57
+ }
58
+
59
+ }
60
+
61
+
62
+ }
63
+
64
+ $module_settings = apply_filters('wp-hide/module_settings', $module_settings, $this);
65
+
66
+
67
+ return $module_settings;
68
+
69
+ }
70
 
71
  }
72
 
include/module.component.class.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class WPH_module_component
5
+ {
6
+ var $wph;
7
+ var $module_settings;
8
+
9
+ function __construct()
10
+ {
11
+ global $wph;
12
+
13
+ $this->wph = $wph;
14
+
15
+ $this->module_settings = $this->get_module_settings();
16
+ }
17
+
18
+
19
+ function get_module_settings()
20
+ {
21
+
22
+ return array();
23
+ }
24
+
25
+ }
26
+
27
+
28
+ ?>
include/update.class.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class WPH_update
5
+ {
6
+ var $wph;
7
+
8
+ function __construct()
9
+ {
10
+ global $wph;
11
+ $this->wph = &$wph;
12
+
13
+ $this->_run();
14
+ }
15
+
16
+
17
+ private function _run()
18
+ {
19
+ $db_version = isset($this->wph->settings['version']) ? $this->wph->settings['version'] : '1';
20
+
21
+ //structure and settings fields where changed since v1.1
22
+ if( isset($this->wph->settings['module_settings']['rewrite_new_theme_path']) )
23
+ {
24
+ $module_settings = $this->wph->settings['module_settings'];
25
+ $this->wph->settings['module_settings'] = array();
26
+
27
+ foreach($module_settings as $key => $value)
28
+ {
29
+ if(strpos($key, 'rewrite_') !== FALSE && strpos($key, 'rewrite_') == 0)
30
+ $key = substr($key, 8);
31
+
32
+ if(strpos($key, 'general_') !== FALSE && strpos($key, 'general_') == 0)
33
+ $key = substr($key, 8);
34
+
35
+ if(strpos($key, 'admin_') !== FALSE && strpos($key, 'admin_') == 0)
36
+ $key = substr($key, 6);
37
+
38
+ $key = trim($key);
39
+ if(empty($key))
40
+ continue;
41
+
42
+ $this->wph->settings['module_settings'][$key] = $value;
43
+ }
44
+
45
+ //save the data
46
+ $this->wph->functions->update_settings($this->wph->settings);
47
+ }
48
+ }
49
+
50
+
51
+
52
+ }
53
+
54
+
55
+ ?>
include/wph.class.php CHANGED
@@ -49,6 +49,9 @@
49
 
50
  $this->add_default_replacements();
51
 
 
 
 
52
  add_action('plugins_loaded', array($this, 'session_ob_start') , -1);
53
 
54
  //process redirects
@@ -95,7 +98,7 @@
95
  $module_class_name = 'WPH_module_' . $module_name;
96
  $module = new $module_class_name;
97
 
98
- //action available for MU
99
  do_action('wp-hide/loaded_module', $module);
100
 
101
  $interface_menu_data = $module->get_interface_menu_data();
@@ -104,28 +107,30 @@
104
  $this->modules[$menu_position] = $module;
105
 
106
  //process the module fields
107
- $module_settings = $this->functions->filter_settings( $module->get_module_settings() );
108
- $module_id = $module->get_module_id();
109
 
110
  if(!$this->disable_filters && is_array($module_settings) && count($module_settings) > 0)
111
  foreach($module_settings as $module_setting)
112
  {
 
113
  $field_id = $module_setting['id'];
114
- $saved_field_value = isset($this->settings['module_settings'][$module_id . '_' . $field_id]) ? $this->settings['module_settings'][$module_id . '_' . $field_id] : '';
 
 
115
 
116
  //ignore callbacks if permalink is turned OFF
117
  if($this->functions->is_permalink_enabled())
118
  {
119
  $_callback = isset($module_setting['callback']) ? $module_setting['callback'] : '';
120
  if(empty($_callback))
121
- $_callback = '_callback_' . $field_id;
122
 
123
- if (method_exists($module, $_callback) && is_callable(array($module, $_callback)))
124
- $processing_data[] = call_user_func(array($module, $_callback), $saved_field_value);
125
  }
126
 
127
- //action available for MU
128
- do_action('wp-hide/module_settings_process', $field_id, $saved_field_value, $module);
129
  }
130
 
131
  }
@@ -133,6 +138,9 @@
133
  //sort the modules array
134
  arsort($this->modules);
135
 
 
 
 
136
  //sort the replacement urls
137
  //$keys = array_map('strlen', array_keys($arr));
138
  //array_multisort($keys, SORT_DESC, $arr);
@@ -344,21 +352,26 @@
344
  //loop all module settings and run the callback functions
345
  foreach($this->modules as $module)
346
  {
347
- $module_settings = $this->functions->filter_settings( $module->get_module_settings() );
348
- $module_id = $module->get_module_id();
 
 
349
 
350
  if(is_array($module_settings) && count($module_settings) > 0)
351
  foreach($module_settings as $module_setting)
352
  {
353
- $field_id = $module_setting['id'];
354
- $saved_field_value = isset($this->settings['module_settings'][$module_id . '_' . $field_id]) ? $this->settings['module_settings'][$module_id . '_' . $field_id] : '';
355
 
 
 
 
 
356
  $_callback = isset($module_setting['callback_saved']) ? $module_setting['callback_saved'] : '';
357
  if(empty($_callback))
358
  $_callback = '_callback_saved_' . $field_id;
359
 
360
- if (method_exists($module, $_callback) && is_callable(array($module, $_callback)))
361
- $processing_data[] = call_user_func(array($module, $_callback), $saved_field_value);
 
362
  }
363
  }
364
 
@@ -388,6 +401,8 @@
388
  }
389
 
390
  $new_rules .= "\n";
 
 
391
 
392
  //update the main rule variable
393
  $rules = str_replace('RewriteRule ^index\\.php$ - [L]', $new_rules, $rules);
@@ -410,6 +425,9 @@
410
  $wp_upload_dir = wp_upload_dir();
411
  $this->default_variables['upload_url'] = $wp_upload_dir['baseurl'];
412
 
 
 
 
413
  $template = get_template();
414
 
415
  $this->templates_data['is_child_theme'] = (get_option( 'stylesheet' ) != get_option( 'template' )) ? TRUE : FALSE;
@@ -433,8 +451,9 @@
433
  $this->default_variables['content_directory'] = '';
434
  $this->default_variables['plugins_directory'] = '';
435
 
436
- //CONTENT_DIR
437
- //SITECOOKIEPATH
 
438
 
439
  $home_url = defined('WP_HOME') ? WP_HOME : get_option('home');
440
  $home_url = untrailingslashit($home_url);
49
 
50
  $this->add_default_replacements();
51
 
52
+ //----------------------
53
+ remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
54
+
55
  add_action('plugins_loaded', array($this, 'session_ob_start') , -1);
56
 
57
  //process redirects
98
  $module_class_name = 'WPH_module_' . $module_name;
99
  $module = new $module_class_name;
100
 
101
+ //action available for mu-plugins
102
  do_action('wp-hide/loaded_module', $module);
103
 
104
  $interface_menu_data = $module->get_interface_menu_data();
107
  $this->modules[$menu_position] = $module;
108
 
109
  //process the module fields
110
+ $module_settings = $this->functions->filter_settings( $module->get_module_settings(), TRUE );
 
111
 
112
  if(!$this->disable_filters && is_array($module_settings) && count($module_settings) > 0)
113
  foreach($module_settings as $module_setting)
114
  {
115
+
116
  $field_id = $module_setting['id'];
117
+ $saved_field_value = isset($this->settings['module_settings'][ $field_id ]) ? $this->settings['module_settings'][ $field_id ] : '';
118
+
119
+ $_class_instance = isset($module_setting['class_instance']) ? $module_setting['class_instance'] : $module;
120
 
121
  //ignore callbacks if permalink is turned OFF
122
  if($this->functions->is_permalink_enabled())
123
  {
124
  $_callback = isset($module_setting['callback']) ? $module_setting['callback'] : '';
125
  if(empty($_callback))
126
+ $_callback = '_init_' . $field_id;
127
 
128
+ if (method_exists($_class_instance, $_callback) && is_callable(array($_class_instance, $_callback)))
129
+ $processing_data[] = call_user_func(array($_class_instance, $_callback), $saved_field_value);
130
  }
131
 
132
+ //action available for mu-plugins
133
+ do_action('wp-hide/module_settings_process', $field_id, $saved_field_value, $_class_instance, $module);
134
  }
135
 
136
  }
138
  //sort the modules array
139
  arsort($this->modules);
140
 
141
+ //filter available for mu-plugins
142
+ $this->modules = apply_filters('wp-hide/loaded_modules', $this->modules);
143
+
144
  //sort the replacement urls
145
  //$keys = array_map('strlen', array_keys($arr));
146
  //array_multisort($keys, SORT_DESC, $arr);
352
  //loop all module settings and run the callback functions
353
  foreach($this->modules as $module)
354
  {
355
+ $module_settings = $this->functions->filter_settings( $module->get_module_settings(), TRUE );
356
+
357
+ //sort by processing order
358
+ usort($module_settings, array($this->functions, 'array_sort_by_processing_order'));
359
 
360
  if(is_array($module_settings) && count($module_settings) > 0)
361
  foreach($module_settings as $module_setting)
362
  {
 
 
363
 
364
+ $field_id = $module_setting['id'];
365
+ $saved_field_value = isset($this->settings['module_settings'][ $field_id ]) ? $this->settings['module_settings'][ $field_id ] : '';
366
+
367
+ $_class_instance = isset($module_setting['class_instance']) ? $module_setting['class_instance'] : $module;
368
  $_callback = isset($module_setting['callback_saved']) ? $module_setting['callback_saved'] : '';
369
  if(empty($_callback))
370
  $_callback = '_callback_saved_' . $field_id;
371
 
372
+ if (method_exists($_class_instance, $_callback) && is_callable(array($_class_instance, $_callback)))
373
+ $processing_data[] = call_user_func(array($_class_instance, $_callback), $saved_field_value);
374
+
375
  }
376
  }
377
 
401
  }
402
 
403
  $new_rules .= "\n";
404
+
405
+ $new_rules = apply_filters('wp-hide/mod_rewrite_rules', $new_rules);
406
 
407
  //update the main rule variable
408
  $rules = str_replace('RewriteRule ^index\\.php$ - [L]', $new_rules, $rules);
425
  $wp_upload_dir = wp_upload_dir();
426
  $this->default_variables['upload_url'] = $wp_upload_dir['baseurl'];
427
 
428
+ //used across modules
429
+ $this->default_variables['site_relative_path'] = $this->functions->get_url_path( trailingslashit( site_url() ));
430
+
431
  $template = get_template();
432
 
433
  $this->templates_data['is_child_theme'] = (get_option( 'stylesheet' ) != get_option( 'template' )) ? TRUE : FALSE;
451
  $this->default_variables['content_directory'] = '';
452
  $this->default_variables['plugins_directory'] = '';
453
 
454
+
455
+ //content_directory
456
+ $this->default_variables['content_directory'] = str_replace(ABSPATH, "", WP_CONTENT_DIR);
457
 
458
  $home_url = defined('WP_HOME') ? WP_HOME : get_option('home');
459
  $home_url = untrailingslashit($home_url);
languages/wp-hide-security-enhancer.mo CHANGED
Binary file
languages/wp-hide-security-enhancer.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Types Order\n"
4
- "POT-Creation-Date: 2016-01-15 13:34+0200\n"
5
- "PO-Revision-Date: 2016-01-15 13:34+0200\n"
6
- "Last-Translator: Nsp Code <electronice_delphi@yahoo.com>\n"
7
  "Language-Team: \n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -13,89 +13,273 @@ msgstr ""
13
  "X-Poedit-Basepath: ../\n"
14
  "X-Poedit-SearchPath-0: .\n"
15
 
16
- #: include/wph.class.php:186
17
  msgid "Help us to improve this plugin by reporting any issues at "
18
  msgstr ""
19
 
20
- #: include/wph.class.php:191
21
  msgid ""
22
  "Permalink is required to be turned ON for WP Hide & Security Enhancer to work"
23
  msgstr ""
24
 
25
- #: include/wph.class.php:196
26
  msgid "Settings saved"
27
  msgstr ""
28
 
29
- #: include/wph.class.php:203
30
  msgid ""
31
  "W3 Total Cache Plugin is active, make sure you clear the cache for new "
32
  "changes to apply"
33
  msgstr ""
34
 
35
- #: include/wph.class.php:207
36
  msgid ""
37
  "WP Super Cache Plugin is active, make sure you clear the cache for new "
38
  "changes to apply"
39
  msgstr ""
40
 
41
- #: modules/module-admin.php:54
42
- msgid "Map a new wp-login.php instead default."
43
- msgstr ""
44
-
45
- #: modules/module-admin.php:65
46
- msgid "Block default wp-login.php file from being accesible."
47
  msgstr ""
48
 
49
- #: modules/module-admin.php:69 modules/module-admin.php:100
50
- #: modules/module-general.php:58 modules/module-general.php:78
51
- #: modules/module-general.php:94 modules/module-general.php:111
52
- #: modules/module-general.php:127 modules/module-general.php:145
53
- #: modules/module-rewrite.php:155 modules/module-rewrite.php:188
54
- msgid "Yes"
55
  msgstr ""
56
 
57
- #: modules/module-admin.php:70 modules/module-admin.php:101
58
- #: modules/module-general.php:59 modules/module-general.php:79
59
- #: modules/module-general.php:95 modules/module-general.php:112
60
- #: modules/module-general.php:128 modules/module-general.php:146
61
- #: modules/module-rewrite.php:156 modules/module-rewrite.php:189
62
- msgid "No"
63
  msgstr ""
64
 
65
- #: modules/module-admin.php:85
66
  msgid "Create a new admin url instead default /wp-admin and /login."
67
  msgstr ""
68
 
69
- #: modules/module-admin.php:96
70
  msgid "Block default admin url and files from being accesible."
71
  msgstr ""
72
 
73
- #: modules/module-admin.php:96
74
  msgid ""
75
  "Warning: Write down your new admin url, or if lost, will not be able to log-"
76
  "in ."
77
  msgstr ""
78
 
79
- #: modules/module-general.php:54
80
- msgid "Remove version number from enqueued style and script files."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  msgstr ""
82
 
83
- #: modules/module-general.php:74
84
- msgid "Remove the autogenerated meta generator tag within head."
 
85
  msgstr ""
86
 
87
- #: modules/module-general.php:90
88
  msgid "Remove the wlwmanifest tag within head."
89
  msgstr ""
90
 
91
- #: modules/module-general.php:107
92
  msgid "Remove the feed_links tag within head."
93
  msgstr ""
94
 
95
- #: modules/module-general.php:123
96
  msgid "Remove the rsd_link tag within head."
97
  msgstr ""
98
 
99
- #: modules/module-general.php:141
100
  msgid "Remove the adjacent_posts_rel tag within head."
101
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Types Order\n"
4
+ "POT-Creation-Date: 2016-02-11 21:36+0200\n"
5
+ "PO-Revision-Date: 2016-02-11 21:36+0200\n"
6
+ "Last-Translator: Nsp-Code <contact@nsp-code.com>\n"
7
  "Language-Team: \n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "X-Poedit-Basepath: ../\n"
14
  "X-Poedit-SearchPath-0: .\n"
15
 
16
+ #: include/wph.class.php:194
17
  msgid "Help us to improve this plugin by reporting any issues at "
18
  msgstr ""
19
 
20
+ #: include/wph.class.php:199
21
  msgid ""
22
  "Permalink is required to be turned ON for WP Hide & Security Enhancer to work"
23
  msgstr ""
24
 
25
+ #: include/wph.class.php:204
26
  msgid "Settings saved"
27
  msgstr ""
28
 
29
+ #: include/wph.class.php:211
30
  msgid ""
31
  "W3 Total Cache Plugin is active, make sure you clear the cache for new "
32
  "changes to apply"
33
  msgstr ""
34
 
35
+ #: include/wph.class.php:215
36
  msgid ""
37
  "WP Super Cache Plugin is active, make sure you clear the cache for new "
38
  "changes to apply"
39
  msgstr ""
40
 
41
+ #: modules/module-rewrite.php:49 modules/module-rewrite.php:60
42
+ msgid "Rewrite"
 
 
 
 
43
  msgstr ""
44
 
45
+ #: modules/module-rewrite.php:60
46
+ msgid "WP Hide & Security Enhancer"
 
 
 
 
47
  msgstr ""
48
 
49
+ #: modules/module-rewrite.php:62
50
+ msgid "Rewrite Settings"
 
 
 
 
51
  msgstr ""
52
 
53
+ #: modules/components/admin-admin_url.php:11
54
  msgid "Create a new admin url instead default /wp-admin and /login."
55
  msgstr ""
56
 
57
+ #: modules/components/admin-admin_url.php:23
58
  msgid "Block default admin url and files from being accesible."
59
  msgstr ""
60
 
61
+ #: modules/components/admin-admin_url.php:23
62
  msgid ""
63
  "Warning: Write down your new admin url, or if lost, will not be able to log-"
64
  "in ."
65
  msgstr ""
66
 
67
+ #: modules/components/admin-admin_url.php:23
68
+ msgid "An e-mail will be sent to"
69
+ msgstr ""
70
+
71
+ #: modules/components/admin-admin_url.php:23
72
+ msgid "with the new Login URL"
73
+ msgstr ""
74
+
75
+ #: modules/components/admin-admin_url.php:27
76
+ #: modules/components/admin-new_wp_login_php.php:27
77
+ #: modules/components/admin-new_wp_login_php.php:44
78
+ #: modules/components/general-meta.php:15
79
+ #: modules/components/general-meta.php:31
80
+ #: modules/components/general-meta.php:48
81
+ #: modules/components/general-meta.php:64
82
+ #: modules/components/general-meta.php:82
83
+ #: modules/components/general-remove_version.php:15
84
+ #: modules/components/general-wpemoji.php:15
85
+ #: modules/components/general-wpemoji.php:31
86
+ #: modules/components/rewrite-new_plugin_path.php:28
87
+ #: modules/components/rewrite-new_upload_path.php:28
88
+ #: modules/components/rewrite-wp_content_path.php:16
89
+ msgid "Yes"
90
+ msgstr ""
91
+
92
+ #: modules/components/admin-admin_url.php:28
93
+ #: modules/components/admin-new_wp_login_php.php:28
94
+ #: modules/components/admin-new_wp_login_php.php:45
95
+ #: modules/components/general-meta.php:16
96
+ #: modules/components/general-meta.php:32
97
+ #: modules/components/general-meta.php:49
98
+ #: modules/components/general-meta.php:65
99
+ #: modules/components/general-meta.php:83
100
+ #: modules/components/general-remove_version.php:16
101
+ #: modules/components/general-wpemoji.php:16
102
+ #: modules/components/general-wpemoji.php:32
103
+ #: modules/components/rewrite-new_plugin_path.php:29
104
+ #: modules/components/rewrite-new_upload_path.php:29
105
+ #: modules/components/rewrite-wp_content_path.php:17
106
+ msgid "No"
107
+ msgstr ""
108
+
109
+ #: modules/components/admin-admin_url.php:175
110
+ msgid "Hello"
111
+ msgstr ""
112
+
113
+ #: modules/components/admin-admin_url.php:176
114
+ msgid ""
115
+ "This is an automated message to inform that your login url has been changed "
116
+ "at"
117
+ msgstr ""
118
+
119
+ #: modules/components/admin-admin_url.php:177
120
+ msgid "The new login url is"
121
+ msgstr ""
122
+
123
+ #: modules/components/admin-admin_url.php:178
124
+ msgid "Please keep this url safe for recover, if forgot"
125
+ msgstr ""
126
+
127
+ #: modules/components/admin-new_wp_login_php.php:11
128
+ msgid "Map a new wp-login.php instead default."
129
+ msgstr ""
130
+
131
+ #: modules/components/admin-new_wp_login_php.php:23
132
+ msgid "Block default wp-login.php file from being accesible."
133
+ msgstr ""
134
+
135
+ #: modules/components/admin-new_wp_login_php.php:40
136
+ msgid ""
137
+ "Block default wp-signup.php file from being accesible. This redirect to new "
138
+ "admin login if changed. The registration page remain available."
139
  msgstr ""
140
 
141
+ #: modules/components/general-meta.php:11
142
+ msgid ""
143
+ "Remove the autogenerated meta generator tag within head (WordPress Version)."
144
  msgstr ""
145
 
146
+ #: modules/components/general-meta.php:27
147
  msgid "Remove the wlwmanifest tag within head."
148
  msgstr ""
149
 
150
+ #: modules/components/general-meta.php:44
151
  msgid "Remove the feed_links tag within head."
152
  msgstr ""
153
 
154
+ #: modules/components/general-meta.php:60
155
  msgid "Remove the rsd_link tag within head."
156
  msgstr ""
157
 
158
+ #: modules/components/general-meta.php:78
159
  msgid "Remove the adjacent_posts_rel tag within head."
160
  msgstr ""
161
+
162
+ #: modules/components/general-remove_version.php:11
163
+ msgid "Remove version number from enqueued style and script files."
164
+ msgstr ""
165
+
166
+ #: modules/components/general-wpemoji.php:11
167
+ msgid "Disable the Emoji icon library from being loaded."
168
+ msgstr ""
169
+
170
+ #: modules/components/general-wpemoji.php:27
171
+ msgid "Disable the TinyMC Emoji icons library from being loaded into TinyMC."
172
+ msgstr ""
173
+
174
+ #: modules/components/rewrite-new_include_path.php:10
175
+ msgid "New Include Path"
176
+ msgstr ""
177
+
178
+ #: modules/components/rewrite-new_include_path.php:11
179
+ #: modules/components/rewrite-new_plugin_path.php:11
180
+ #: modules/components/rewrite-new_theme_path.php:11
181
+ #: modules/components/rewrite-new_theme_path.php:26
182
+ msgid "The default theme path is set to"
183
+ msgstr ""
184
+
185
+ #: modules/components/rewrite-new_include_path.php:12
186
+ #: modules/components/rewrite-new_plugin_path.php:12
187
+ #: modules/components/rewrite-new_theme_path.php:12
188
+ #: modules/components/rewrite-new_theme_path.php:27
189
+ #: modules/components/rewrite-new_upload_path.php:12
190
+ #: modules/components/rewrite-wp_content_path.php:12
191
+ msgid "More details can be found at"
192
+ msgstr ""
193
+
194
+ #: modules/components/rewrite-new_include_path.php:14
195
+ msgid "e.g. my_include"
196
+ msgstr ""
197
+
198
+ #: modules/components/rewrite-new_plugin_path.php:10
199
+ msgid "New Plugin Path"
200
+ msgstr ""
201
+
202
+ #: modules/components/rewrite-new_plugin_path.php:23
203
+ msgid "Block plugins URL"
204
+ msgstr ""
205
+
206
+ #: modules/components/rewrite-new_plugin_path.php:24
207
+ msgid "Block plugins files from being accesible through default urls."
208
+ msgstr ""
209
+
210
+ #: modules/components/rewrite-new_plugin_path.php:24
211
+ msgid "Apply only if "
212
+ msgstr ""
213
+
214
+ #: modules/components/rewrite-new_plugin_path.php:24
215
+ #: modules/components/rewrite-new_upload_path.php:24
216
+ msgid "is not empty."
217
+ msgstr ""
218
+
219
+ #: modules/components/rewrite-new_theme_path.php:10
220
+ msgid "New Theme Path"
221
+ msgstr ""
222
+
223
+ #: modules/components/rewrite-new_theme_path.php:14
224
+ msgid "e.g. my_template"
225
+ msgstr ""
226
+
227
+ #: modules/components/rewrite-new_theme_path.php:25
228
+ msgid "New Theme Child Path"
229
+ msgstr ""
230
+
231
+ #: modules/components/rewrite-new_theme_path.php:29
232
+ msgid "e.g. my_child_template"
233
+ msgstr ""
234
+
235
+ #: modules/components/rewrite-new_theme_path.php:39
236
+ msgid "New Style File Path"
237
+ msgstr ""
238
+
239
+ #: modules/components/rewrite-new_theme_path.php:40
240
+ msgid "The default theme style file style.css path is set to"
241
+ msgstr ""
242
+
243
+ #: modules/components/rewrite-new_theme_path.php:42
244
+ msgid "e.g. custom-style-file.css"
245
+ msgstr ""
246
+
247
+ #: modules/components/rewrite-new_upload_path.php:10
248
+ msgid "New Upload Path"
249
+ msgstr ""
250
+
251
+ #: modules/components/rewrite-new_upload_path.php:11
252
+ msgid "The default upload path is set to"
253
+ msgstr ""
254
+
255
+ #: modules/components/rewrite-new_upload_path.php:14
256
+ msgid "e.g. my_uploads"
257
+ msgstr ""
258
+
259
+ #: modules/components/rewrite-new_upload_path.php:23
260
+ msgid "Block upload URL"
261
+ msgstr ""
262
+
263
+ #: modules/components/rewrite-new_upload_path.php:24
264
+ msgid "Block upload files from being accesible through default urls."
265
+ msgstr ""
266
+
267
+ #: modules/components/rewrite-new_upload_path.php:24
268
+ msgid ""
269
+ "If set to Yes, all new images inserted into posts will use the new Upload "
270
+ "Url, as old url become blocked. Using the No, new images inesrted will use "
271
+ "old url, which however are being updated on front side. This may be helpfull "
272
+ "on plugin disable, so image urls can be accessible as before."
273
+ msgstr ""
274
+
275
+ #: modules/components/rewrite-new_upload_path.php:24
276
+ msgid "Apply only if"
277
+ msgstr ""
278
+
279
+ #: modules/components/rewrite-wp_content_path.php:10
280
+ msgid "Block wp-content URL"
281
+ msgstr ""
282
+
283
+ #: modules/components/rewrite-wp_content_path.php:11
284
+ msgid "Your wp-content path is set to"
285
+ msgstr ""
modules/components/admin-admin_url.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_admin_admin_url extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'admin_url',
10
+ 'label' => 'New Admin Url',
11
+ 'description' => __('Create a new admin url instead default /wp-admin and /login.', 'wp-hide-security-enhancer'),
12
+
13
+ 'input_type' => 'text',
14
+
15
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
16
+ 'processing_order' => 60
17
+
18
+ );
19
+
20
+ $this->module_settings[] = array(
21
+ 'id' => 'block_default_admin_url',
22
+ 'label' => 'Block default Admin Url',
23
+ 'description' => __('Block default admin url and files from being accesible.', 'wp-hide-security-enhancer') . '<br /><span class="important">' . __('Warning: Write down your new admin url, or if lost, will not be able to log-in .', 'wp-hide-security-enhancer') . '</span> ' . __('An e-mail will be sent to', 'wp-hide-security-enhancer') . " " . get_option('admin_email') . " " . __('with the new Login URL', 'wp-hide-security-enhancer'),
24
+
25
+ 'input_type' => 'radio',
26
+ 'options' => array(
27
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
28
+ 'no' => __('No', 'wp-hide-security-enhancer'),
29
+ ),
30
+ 'default_value' => 'no',
31
+
32
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
33
+ 'processing_order' => 65
34
+
35
+ );
36
+
37
+ return $this->module_settings;
38
+ }
39
+
40
+
41
+
42
+ function _init_admin_url($saved_field_data)
43
+ {
44
+ //check if the value has changed, to e-mail the new url to site administrator
45
+ $previous_url = get_option('wph-previous-admin-url');
46
+ if($saved_field_data != $previous_url)
47
+ {
48
+ $this->new_url_email_nottice($saved_field_data);
49
+ update_option('wph-previous-admin-url', $saved_field_data);
50
+ }
51
+
52
+ if(empty($saved_field_data))
53
+ return FALSE;
54
+
55
+ $default_url = $this->wph->functions->get_url_path( trailingslashit( site_url() ) . 'wp-admin' );
56
+ $new_url = $this->wph->functions->get_url_path( trailingslashit( site_url() ) . $saved_field_data );
57
+
58
+
59
+ //add replacement
60
+ if(!isset($this->wph->urls_replacement[$default_url]))
61
+ {
62
+ $this->wph->urls_replacement[$default_url] = $new_url;
63
+ }
64
+
65
+ add_filter('admin_url', array($this,'admin_url'), 999, 3 );
66
+ add_action('set_auth_cookie', array($this,'set_auth_cookie'), 999, 5);
67
+ add_filter('style_loader_src', array($this->wph, 'generic_string_replacement' ), 999);
68
+
69
+ add_filter('wp_default_scripts', array($this, 'wp_default_scripts' ), 999);
70
+ }
71
+
72
+ function _callback_saved_admin_url($saved_field_data)
73
+ {
74
+ $processing_response = array();
75
+
76
+ //check if the field is noe empty
77
+ if(empty($saved_field_data))
78
+ return $processing_response;
79
+
80
+ $admin_url = $this->wph->functions->get_url_path( trailingslashit( site_url() ) . 'wp-admin' );
81
+
82
+ $path = '';
83
+ if(!empty($this->wph->default_variables['wordpress_directory']))
84
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
85
+ $path .= trailingslashit( $saved_field_data );
86
+
87
+ $text = "\nRewriteCond %{REQUEST_URI} ". $saved_field_data ."$";
88
+ $text .= "\nRewriteRule ^(.*)$ ". $saved_field_data ."/ [R=301,L]";
89
+ $text .= "\nRewriteRule ^" . $path . '(.*) '. $admin_url .'$1 [L,QSA]';
90
+
91
+ $processing_response['htaccess'] = $text;
92
+ $processing_response['page_refresh'] = TRUE;
93
+
94
+ return $processing_response;
95
+ }
96
+
97
+
98
+ function admin_url($url, $path, $blog_id)
99
+ {
100
+ if($this->wph->uninstall === TRUE)
101
+ return $url;
102
+
103
+ $new_admin_url = $this->wph->functions->get_module_item_setting('admin_url');
104
+
105
+ $admin_dir_uri = trailingslashit( site_url() ) . trim($new_admin_url, "/");
106
+ $new_url = trailingslashit( $admin_dir_uri ) . $path;
107
+
108
+ //add replacement
109
+ if(!isset($this->wph->urls_replacement[$url]))
110
+ {
111
+ $this->wph->urls_replacement[$url] = $new_url;
112
+ }
113
+
114
+ return $new_url;
115
+
116
+ }
117
+
118
+ function set_auth_cookie($auth_cookie, $expire, $expiration, $user_id, $scheme)
119
+ {
120
+
121
+ $new_admin_url = $this->wph->functions->get_module_item_setting('admin_url');
122
+
123
+ if ( $scheme == 'secure_auth' )
124
+ {
125
+ $auth_cookie_name = SECURE_AUTH_COOKIE;
126
+ $secure = TRUE;
127
+ }
128
+ else
129
+ {
130
+ $auth_cookie_name = AUTH_COOKIE;
131
+ $secure = FALSE;
132
+ }
133
+
134
+ setcookie($auth_cookie_name, $auth_cookie, $expire, SITECOOKIEPATH . $new_admin_url, COOKIE_DOMAIN, $secure, true);
135
+
136
+ $manager = WP_Session_Tokens::get_instance( $user_id );
137
+ $token = $manager->create( $expiration );
138
+
139
+ $logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
140
+
141
+ }
142
+
143
+ function wp_default_scripts($scripts)
144
+ {
145
+ //check if custom admin url is set
146
+ $admin_url = $this->wph->functions->get_module_item_setting('admin_url');
147
+ if (empty( $admin_url ))
148
+ return;
149
+
150
+ //update default dirs
151
+ if(isset($scripts->default_dirs))
152
+ {
153
+ foreach($scripts->default_dirs as $key => $value)
154
+ {
155
+ $scripts->default_dirs[$key] = str_replace('wp-admin', $admin_url, $value);
156
+ }
157
+ }
158
+
159
+ foreach($scripts->registered as $script_name => $script_data)
160
+ {
161
+ $script_data->src = str_replace('wp-admin', $admin_url, $script_data->src);
162
+
163
+ $scripts->registered[$script_name] = $script_data;
164
+ }
165
+ }
166
+
167
+
168
+ function new_url_email_nottice($new_url)
169
+ {
170
+ if(empty($new_url))
171
+ $new_url = 'wp-admin';
172
+
173
+ $to = get_option('admin_email');
174
+ $subject = 'New Login Url for your WordPress - ' .get_option('blogname');
175
+ $message = __('Hello', 'wp-hide-security-enhancer') . ", \n\n"
176
+ . __('This is an automated message to inform that your login url has been changed at', 'wp-hide-security-enhancer') . " " . trailingslashit(site_url()) . "\n"
177
+ . __('The new login url is', 'wp-hide-security-enhancer') . ": " . trailingslashit( trailingslashit(site_url()) . $new_url) . "\n\n"
178
+ . __('Please keep this url safe for recover, if forgot', 'wp-hide-security-enhancer') . ".";
179
+ $headers = 'From: '. get_option('blogname') .' <'. get_option('admin_email') .'>' . "\r\n";
180
+ $this->wph->functions->wp_mail( $to, $subject, $message, $headers );
181
+ }
182
+
183
+
184
+ function _init_block_default_admin_url($saved_field_data)
185
+ {
186
+ if(empty($saved_field_data) || $saved_field_data == 'no')
187
+ return FALSE;
188
+
189
+ }
190
+
191
+ function _callback_saved_block_default_admin_url($saved_field_data)
192
+ {
193
+ $processing_response = array();
194
+
195
+ //check if the field is noe empty
196
+ if(empty($saved_field_data) || $saved_field_data == 'no')
197
+ return $processing_response;
198
+
199
+ //prevent from blocking if the admin_url is empty
200
+ $admin_url = $this->wph->functions->get_module_item_setting('admin_url');
201
+ if (empty( $admin_url ))
202
+ return FALSE;
203
+
204
+ $site_index = $this->wph->functions->get_url_path ( trailingslashit( site_url() ) . 'index.php', TRUE );
205
+
206
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
207
+ $text .= "RewriteRule ^wp-admin(.*) $site_index [L]\n";
208
+ $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
209
+
210
+ //theme my login usage
211
+ //$text .= "RewriteRule ^login(.*) $site_index?throw_404 [L]\n";
212
+ //$text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
213
+
214
+ $text .= "RewriteRule ^dashboard(.*) $site_index [L]\n";
215
+ $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
216
+ $text .= "RewriteRule ^admin(.*) $site_index [L]\n";
217
+
218
+ $path = '';
219
+ if(!empty($this->wph->default_variables['wordpress_directory']))
220
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
221
+
222
+ if(!empty($path))
223
+ {
224
+ $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
225
+ $text .= "RewriteRule ^".$path."wp-admin(.*) $site_index [L]\n";
226
+ $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
227
+ $text .= "RewriteRule ^".$path."dashboard(.*) $site_index [L]\n";
228
+ $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
229
+ $text .= "RewriteRule ^".$path."admin(.*) $site_index [L]";
230
+ }
231
+
232
+
233
+ $processing_response['htaccess'] = $text;
234
+
235
+ return $processing_response;
236
+ }
237
+
238
+
239
+ }
240
+ ?>
modules/components/admin-new_wp_login_php.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_admin_new_wp_login_php extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'new_wp_login_php',
10
+ 'label' => 'New wp-login.php',
11
+ 'description' => __('Map a new wp-login.php instead default.', 'wp-hide-security-enhancer'),
12
+
13
+ 'input_type' => 'text',
14
+
15
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
16
+ 'processing_order' => 50
17
+
18
+ );
19
+
20
+ $this->module_settings[] = array(
21
+ 'id' => 'block_default_wp_login_php',
22
+ 'label' => 'Block default wp-login.php',
23
+ 'description' => __('Block default wp-login.php file from being accesible.', 'wp-hide-security-enhancer'),
24
+
25
+ 'input_type' => 'radio',
26
+ 'options' => array(
27
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
28
+ 'no' => __('No', 'wp-hide-security-enhancer'),
29
+ ),
30
+ 'default_value' => 'no',
31
+
32
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
33
+ 'processing_order' => 55
34
+
35
+ );
36
+
37
+ $this->module_settings[] = array(
38
+ 'id' => 'block_default_wp_signup_php',
39
+ 'label' => 'Block default wp-signup.php',
40
+ 'description' => __('Block default wp-signup.php file from being accesible. This redirect to new admin login if changed. The registration page remain available.', 'wp-hide-security-enhancer'),
41
+
42
+ 'input_type' => 'radio',
43
+ 'options' => array(
44
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
45
+ 'no' => __('No', 'wp-hide-security-enhancer'),
46
+ ),
47
+ 'default_value' => 'no',
48
+
49
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
50
+ 'processing_order' => 55
51
+
52
+ );
53
+
54
+ return $this->module_settings;
55
+ }
56
+
57
+
58
+
59
+ function _init_new_wp_login_php($saved_field_data)
60
+ {
61
+ if(empty($saved_field_data) || $saved_field_data == 'no')
62
+ return FALSE;
63
+
64
+
65
+ //add replacement
66
+ $url = trailingslashit( site_url() ) . 'wp-login.php';
67
+ if(!isset($this->wph->urls_replacement[$url]))
68
+ {
69
+ $this->wph->urls_replacement[ $url ] = trailingslashit( site_url() ) . $saved_field_data;
70
+ }
71
+ }
72
+
73
+ function _callback_saved_new_wp_login_php($saved_field_data)
74
+ {
75
+ $processing_response = array();
76
+
77
+ //check if the field is noe empty
78
+ if(empty($saved_field_data))
79
+ return $processing_response;
80
+
81
+ $new_wp_login_php = untrailingslashit ( $this->wph->functions->get_url_path( trailingslashit( site_url() ) . 'wp-login.php' ) );
82
+
83
+ $path = '';
84
+ if(!empty($this->wph->default_variables['wordpress_directory']))
85
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
86
+ $path .= $saved_field_data;
87
+
88
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $new_wp_login_php .'$1 [L,QSA]';
89
+
90
+ return $processing_response;
91
+ }
92
+
93
+
94
+ function _init_block_default_wp_login_php($saved_field_data)
95
+ {
96
+ if(empty($saved_field_data) || $saved_field_data == 'no')
97
+ return FALSE;
98
+
99
+
100
+ }
101
+
102
+ function _callback_saved_block_default_wp_login_php($saved_field_data)
103
+ {
104
+ $processing_response = array();
105
+
106
+ //check if the field is noe empty
107
+ if(empty($saved_field_data) || $saved_field_data == 'no')
108
+ return $processing_response;
109
+
110
+ //prevent from blocking if the new_wp_login_php is empty
111
+ $new_wp_login_php = $this->wph->functions->get_module_item_setting('new_wp_login_php');
112
+ if (empty( $new_wp_login_php ))
113
+ return FALSE;
114
+
115
+ $path = '';
116
+ if(!empty($this->wph->default_variables['wordpress_directory']))
117
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
118
+ $path .= 'wp-login.php';
119
+
120
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
121
+ $text .= "RewriteRule ^" . $path ." ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
122
+
123
+ $processing_response['htaccess'] = $text;
124
+
125
+ return $processing_response;
126
+ }
127
+
128
+
129
+ function _callback_saved_block_default_wp_signup_php($saved_field_data)
130
+ {
131
+ $processing_response = array();
132
+
133
+ //check if the field is noe empty
134
+ if(empty($saved_field_data) || $saved_field_data == 'no')
135
+ return $processing_response;
136
+
137
+
138
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
139
+ $text .= "RewriteRule ^wp-signup.php ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
140
+
141
+ $processing_response['htaccess'] = $text;
142
+
143
+ return $processing_response;
144
+ }
145
+
146
+
147
+ }
148
+ ?>
modules/components/general-meta.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_general_meta extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'remove_generator_meta',
10
+ 'label' => 'Remove Generator Meta',
11
+ 'description' => __('Remove the autogenerated meta generator tag within head (WordPress Version).', 'wp-hide-security-enhancer'),
12
+
13
+ 'input_type' => 'radio',
14
+ 'options' => array(
15
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
16
+ 'no' => __('No', 'wp-hide-security-enhancer'),
17
+ ),
18
+ 'default_value' => 'no',
19
+
20
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
21
+
22
+ );
23
+
24
+ $this->module_settings[] = array(
25
+ 'id' => 'remove_wlwmanifest',
26
+ 'label' => 'Remove wlwmanifest Meta',
27
+ 'description' => __('Remove the wlwmanifest tag within head.', 'wp-hide-security-enhancer'),
28
+
29
+ 'input_type' => 'radio',
30
+ 'options' => array(
31
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
32
+ 'no' => __('No', 'wp-hide-security-enhancer'),
33
+ ),
34
+ 'default_value' => 'no',
35
+
36
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
37
+
38
+ );
39
+
40
+
41
+ $this->module_settings[] = array(
42
+ 'id' => 'remove_feed_links',
43
+ 'label' => 'Remove feed_links Meta',
44
+ 'description' => __('Remove the feed_links tag within head.', 'wp-hide-security-enhancer'),
45
+
46
+ 'input_type' => 'radio',
47
+ 'options' => array(
48
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
49
+ 'no' => __('No', 'wp-hide-security-enhancer'),
50
+ ),
51
+ 'default_value' => 'no',
52
+
53
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
54
+
55
+ );
56
+
57
+ $this->module_settings[] = array(
58
+ 'id' => 'remove_rsd_link',
59
+ 'label' => 'Remove rsd_link Meta',
60
+ 'description' => __('Remove the rsd_link tag within head.', 'wp-hide-security-enhancer'),
61
+
62
+ 'input_type' => 'radio',
63
+ 'options' => array(
64
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
65
+ 'no' => __('No', 'wp-hide-security-enhancer'),
66
+ ),
67
+ 'default_value' => 'no',
68
+
69
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
70
+
71
+ );
72
+
73
+
74
+
75
+ $this->module_settings[] = array(
76
+ 'id' => 'remove_adjacent_posts_rel',
77
+ 'label' => 'Remove adjacent_posts_rel Meta',
78
+ 'description' => __('Remove the adjacent_posts_rel tag within head.', 'wp-hide-security-enhancer'),
79
+
80
+ 'input_type' => 'radio',
81
+ 'options' => array(
82
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
83
+ 'no' => __('No', 'wp-hide-security-enhancer'),
84
+ ),
85
+ 'default_value' => 'no',
86
+
87
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
88
+
89
+ );
90
+
91
+ return $this->module_settings;
92
+ }
93
+
94
+
95
+
96
+ function _init_remove_generator_meta($saved_field_data)
97
+ {
98
+ if(empty($saved_field_data) || $saved_field_data == 'no')
99
+ return FALSE;
100
+
101
+ add_filter('the_generator', create_function('', 'return "";'));
102
+ remove_action( 'wp_head', 'wp_generator' );
103
+ }
104
+
105
+
106
+ function _init_remove_wlwmanifest($saved_field_data)
107
+ {
108
+ if(empty($saved_field_data) || $saved_field_data == 'no')
109
+ return FALSE;
110
+
111
+ remove_action( 'wp_head', 'wlwmanifest_link' );
112
+
113
+ }
114
+
115
+
116
+ function _init_remove_feed_links($saved_field_data)
117
+ {
118
+ if(empty($saved_field_data) || $saved_field_data == 'no')
119
+ return FALSE;
120
+
121
+ remove_action('wp_head', 'feed_links', 2);
122
+ remove_action('wp_head', 'feed_links_extra', 3);
123
+
124
+ }
125
+
126
+ function _init_remove_rsd_link($saved_field_data)
127
+ {
128
+ if(empty($saved_field_data) || $saved_field_data == 'no')
129
+ return FALSE;
130
+
131
+ remove_action('wp_head', 'rsd_link');
132
+
133
+ }
134
+
135
+
136
+ function _init_adjacent_posts_rel($saved_field_data)
137
+ {
138
+ if(empty($saved_field_data) || $saved_field_data == 'no')
139
+ return FALSE;
140
+
141
+ remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
142
+
143
+ }
144
+
145
+
146
+ }
147
+ ?>
modules/components/general-remove_version.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_general_remove_version extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'remove_version',
10
+ 'label' => 'Remove Version',
11
+ 'description' => __('Remove version number from enqueued style and script files.', 'wp-hide-security-enhancer'),
12
+
13
+ 'input_type' => 'radio',
14
+ 'options' => array(
15
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
16
+ 'no' => __('No', 'wp-hide-security-enhancer'),
17
+ ),
18
+ 'default_value' => 'no',
19
+
20
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
21
+
22
+ );
23
+
24
+ return $this->module_settings;
25
+ }
26
+
27
+
28
+
29
+ function _init_remove_version($saved_field_data)
30
+ {
31
+ if(empty($saved_field_data) || $saved_field_data == 'no')
32
+ return FALSE;
33
+
34
+ add_filter( 'style_loader_src', array(&$this, 'remove_file_version'), 999 );
35
+ add_filter( 'script_loader_src', array(&$this, 'remove_file_version'), 999 );
36
+
37
+ }
38
+
39
+ function remove_file_version($src)
40
+ {
41
+
42
+ $src = remove_query_arg( 'ver', $src );
43
+
44
+ return $src;
45
+
46
+ }
47
+
48
+
49
+ }
50
+ ?>
modules/components/general-wpemoji.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_general_wpemoji extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'disable_wpemojia',
10
+ 'label' => 'Disable Emoji',
11
+ 'description' => __('Disable the Emoji icon library from being loaded.', 'wp-hide-security-enhancer'),
12
+
13
+ 'input_type' => 'radio',
14
+ 'options' => array(
15
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
16
+ 'no' => __('No', 'wp-hide-security-enhancer'),
17
+ ),
18
+ 'default_value' => 'no',
19
+
20
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
21
+
22
+ );
23
+
24
+ $this->module_settings[] = array(
25
+ 'id' => 'disable_tinymce_wpemojia',
26
+ 'label' => 'Disable TinyMC Emoji',
27
+ 'description' => __('Disable the TinyMC Emoji icons library from being loaded into TinyMC.', 'wp-hide-security-enhancer'),
28
+
29
+ 'input_type' => 'radio',
30
+ 'options' => array(
31
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
32
+ 'no' => __('No', 'wp-hide-security-enhancer'),
33
+ ),
34
+ 'default_value' => 'no',
35
+
36
+ 'sanitize_type' => array('sanitize_title', 'strtolower')
37
+
38
+ );
39
+
40
+
41
+
42
+ return $this->module_settings;
43
+ }
44
+
45
+
46
+
47
+ function _init_disable_wpemojia($saved_field_data)
48
+ {
49
+ if(empty($saved_field_data) || $saved_field_data == 'no')
50
+ return FALSE;
51
+
52
+ add_action( 'init', array($this, 'disable_emojicons' ));
53
+ }
54
+
55
+
56
+ function disable_emojicons()
57
+ {
58
+ remove_action( 'admin_print_styles', 'print_emoji_styles' );
59
+ remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
60
+ remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
61
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
62
+ remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
63
+ remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
64
+ remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
65
+ }
66
+
67
+
68
+ function _init_disable_tinymce_wpemojia($saved_field_data)
69
+ {
70
+ if(empty($saved_field_data) || $saved_field_data == 'no')
71
+ return FALSE;
72
+
73
+ add_action( 'init', array($this, 'disable_tinymce_emojicons' ));
74
+ }
75
+
76
+
77
+ function disable_tinymce_emojicons()
78
+ {
79
+ add_filter( 'tiny_mce_plugins', 'disable_emojicons_tiny_mce_plugins' );
80
+ }
81
+
82
+
83
+ function disable_emojicons_tiny_mce_plugins( $plugins )
84
+ {
85
+ return array_diff( $plugins, array( 'wpemoji' ) );
86
+ }
87
+ }
88
+ ?>
modules/components/rewrite-default.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_default extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'rewrite_default',
10
+ 'visible' => FALSE,
11
+ 'processing_order' => 1
12
+ );
13
+
14
+ return $this->module_settings;
15
+ }
16
+
17
+
18
+
19
+ function _callback_saved_rewrite_default($saved_field_data)
20
+ {
21
+ $processing_response = array();
22
+
23
+ $processing_response['htaccess'] = "\nRewriteCond %{REQUEST_URI} /+[^\.]+$\n"
24
+ . "RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]";
25
+
26
+ return $processing_response;
27
+ }
28
+
29
+
30
+
31
+ }
32
+ ?>
modules/components/rewrite-new_include_path.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_new_include_path extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'new_include_path',
10
+ 'label' => __('New Include Path', 'wp-hide-security-enhancer'),
11
+ 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>wp-include</strong>
12
+ '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
13
+
14
+ 'value_description' => __('e.g. my_include', 'wp-hide-security-enhancer'),
15
+ 'input_type' => 'text',
16
+
17
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
18
+ 'processing_order' => 20
19
+ );
20
+
21
+ return $this->module_settings;
22
+ }
23
+
24
+
25
+
26
+ function _init_new_include_path($saved_field_data)
27
+ {
28
+ if(empty($saved_field_data))
29
+ return FALSE;
30
+
31
+
32
+ add_filter('includes_url', array( $this, 'includes_url' ), 999, 2);
33
+ add_filter('script_loader_src', array( $this, 'script_loader_src' ), 999, 2);
34
+ add_filter('style_loader_src', array( $this, 'style_loader_src' ), 999, 2);
35
+
36
+ add_filter('wp_default_scripts', array($this, 'wp_default_scripts' ), 999);
37
+
38
+ //add default plugin path replacement
39
+ $new_include_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_include_path') );
40
+ $new_include_path = trailingslashit( site_url() ) . untrailingslashit( $new_include_path );
41
+ $this->wph->urls_replacement[trailingslashit( site_url() ) . 'wp-includes' ] = $new_include_path;
42
+ }
43
+
44
+ function _callback_saved_new_include_path($saved_field_data)
45
+ {
46
+ $processing_response = array();
47
+
48
+ //check if the field is noe empty
49
+ if(empty($saved_field_data))
50
+ return $processing_response;
51
+
52
+
53
+ $include_path = $this->wph->functions->get_url_path( trailingslashit(site_url()) . WPINC );
54
+
55
+ $path = '';
56
+ if(!empty($this->wph->default_variables['wordpress_directory']))
57
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
58
+ $path .= trailingslashit( $saved_field_data );
59
+
60
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $include_path .'$1 [L,QSA]';
61
+
62
+ return $processing_response;
63
+ }
64
+
65
+
66
+
67
+ function includes_url($url, $path)
68
+ {
69
+ if ( $this->wph->disable_filters )
70
+ return $url;
71
+
72
+ $new_include_path = $this->wph->functions->get_module_item_setting('new_include_path');
73
+
74
+ $new_url = str_replace('/wp-includes/', '/' . $new_include_path . '/', $url);
75
+
76
+ return $new_url;
77
+
78
+ }
79
+
80
+ function script_loader_src($src, $handle)
81
+ {
82
+ if ( $this->wph->disable_filters )
83
+ return $src;
84
+
85
+ $new_include_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_include_path'), "/"), "/");
86
+
87
+ $current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
88
+ $new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
89
+ $src = str_replace( $current_include_url , $new_include_url , $src);
90
+
91
+ return $src;
92
+ }
93
+
94
+
95
+ function style_loader_src($src, $handle)
96
+ {
97
+ if ( $this->wph->disable_filters )
98
+ return $src;
99
+
100
+ $new_include_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_include_path'), "/"), "/");
101
+
102
+ $current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
103
+ $new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
104
+ $src = str_replace( $current_include_url , $new_include_url , $src);
105
+
106
+ return $src;
107
+ }
108
+
109
+ function wp_default_scripts($scripts)
110
+ {
111
+ //check if custom admin url is set
112
+ $include_path = $this->wph->functions->get_module_item_setting('new_include_path');
113
+ if (empty( $include_path ))
114
+ return;
115
+
116
+ $scripts = $this->wph->functions->default_scripts_styles_replace($scripts, array('wp-includes' => $include_path));
117
+ }
118
+
119
+
120
+ }
121
+ ?>
modules/components/rewrite-new_plugin_path.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_new_plugin_path extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'new_plugin_path',
10
+ 'label' => __('New Plugin Path', 'wp-hide-security-enhancer'),
11
+ 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['plugins_url']) .'</strong>
12
+ '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
13
+
14
+ 'value_description' => 'e.g. my_plugin',
15
+ 'input_type' => 'text',
16
+
17
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
18
+ 'processing_order' => 25
19
+ );
20
+
21
+ $this->module_settings[] = array(
22
+ 'id' => 'block_plugins_url',
23
+ 'label' => __('Block plugins URL', 'wp-hide-security-enhancer'),
24
+ 'description' => __('Block plugins files from being accesible through default urls.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New Plugin Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
25
+
26
+ 'input_type' => 'radio',
27
+ 'options' => array(
28
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
29
+ 'no' => __('No', 'wp-hide-security-enhancer'),
30
+ ),
31
+ 'default_value' => 'no',
32
+
33
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
34
+ 'processing_order' => 30
35
+
36
+ );
37
+
38
+ return $this->module_settings;
39
+ }
40
+
41
+
42
+
43
+ function _init_new_plugin_path($saved_field_data)
44
+ {
45
+ if(empty($saved_field_data))
46
+ return FALSE;
47
+
48
+ //add default plugin path replacement
49
+ $new_plugin_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_plugin_path') );
50
+ $new_plugin_path = trailingslashit( site_url() ) . untrailingslashit( $new_plugin_path );
51
+ $this->wph->urls_replacement[WP_PLUGIN_URL] = $new_plugin_path;
52
+ }
53
+
54
+ function _callback_saved_new_plugin_path($saved_field_data)
55
+ {
56
+ $processing_response = array();
57
+
58
+ //check if the field is noe empty
59
+ if(empty($saved_field_data))
60
+ return $processing_response;
61
+
62
+ $plugin_path = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
63
+
64
+ $path = '';
65
+ if(!empty($this->wph->default_variables['wordpress_directory']))
66
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
67
+ $path .= trailingslashit( $saved_field_data );
68
+
69
+ $processing_response['htaccess'] = "\nRewriteRule ^" . trailingslashit( $path ) . '(.*) '. $plugin_path .'$1 [L,QSA]';
70
+
71
+ return $processing_response;
72
+ }
73
+
74
+
75
+
76
+ function _callback_saved_block_plugins_url($saved_field_data)
77
+ {
78
+ $processing_response = array();
79
+
80
+ if(empty($saved_field_data) || $saved_field_data == 'no')
81
+ return FALSE;
82
+
83
+ //prevent from blocking if the wp-include is not modified
84
+ $new_theme_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_plugin_path'), "/"), "/");
85
+ if (empty( $new_theme_path ))
86
+ return FALSE;
87
+
88
+ $home_url = defined('WP_HOME') ? WP_HOME : get_option('home');
89
+ $home_url = untrailingslashit($home_url);
90
+
91
+ $default_plugin_url = untrailingslashit ( WP_PLUGIN_URL );
92
+ $default_plugin_url = str_replace( $home_url, "", $default_plugin_url);
93
+ $default_plugin_url = ltrim(rtrim($default_plugin_url, "/"), "/");
94
+
95
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
96
+ $text .= "RewriteRule ^". $default_plugin_url ."(.*) ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
97
+
98
+ $processing_response['htaccess'] = $text;
99
+
100
+ return $processing_response;
101
+
102
+
103
+ }
104
+
105
+
106
+ }
107
+ ?>
modules/components/rewrite-new_theme_path.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_new_theme_path extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'new_theme_path',
10
+ 'label' => __('New Theme Path', 'wp-hide-security-enhancer'),
11
+ 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['template_url']) .'</strong>
12
+ '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
13
+
14
+ 'value_description' => __('e.g. my_template', 'wp-hide-security-enhancer'),
15
+ 'input_type' => 'text',
16
+
17
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
18
+ 'processing_order' => 10
19
+ );
20
+
21
+ if($this->wph->templates_data['is_child_theme'])
22
+ {
23
+ $this->module_settings[] = array(
24
+ 'id' => 'new_theme_child_path',
25
+ 'label' => __('New Theme Child Path', 'wp-hide-security-enhancer'),
26
+ 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' , trailingslashit($this->wph->templates_data['themes_url']) . $this->wph->templates_data['child']['folder_name']) .'</strong>
27
+ '.__('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
28
+
29
+ 'value_description' => __('e.g. my_child_template', 'wp-hide-security-enhancer'),
30
+ 'input_type' => 'text',
31
+
32
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
33
+ 'processing_order' => 15
34
+ );
35
+ }
36
+
37
+ $this->module_settings[] = array(
38
+ 'id' => 'new_style_file_path',
39
+ 'label' => __('New Style File Path', 'wp-hide-security-enhancer'),
40
+ 'description' => __('The default theme style file style.css path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' , $this->wph->default_variables['template_url']) .'/style.css</strong>',
41
+
42
+ 'value_description' => __('e.g. custom-style-file.css', 'wp-hide-security-enhancer'),
43
+ 'input_type' => 'text',
44
+
45
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
46
+
47
+ 'processing_order' => 5
48
+ );
49
+
50
+ return $this->module_settings;
51
+ }
52
+
53
+
54
+
55
+
56
+ /**
57
+ * New Theme Path
58
+ *
59
+ * @param mixed $saved_field_data
60
+ */
61
+ function _init_new_theme_path($saved_field_data)
62
+ {
63
+ //check for child
64
+ if($this->wph->templates_data['is_child_theme'] === TRUE)
65
+ {
66
+ $child_theme_saved_field_data = $this->wph->functions->get_module_item_setting('new_theme_child_path');
67
+ if(empty($child_theme_saved_field_data) && empty($saved_field_data))
68
+ return FALSE;
69
+ }
70
+ else
71
+ {
72
+ if(empty($saved_field_data))
73
+ return FALSE;
74
+ }
75
+
76
+ //applay when not admin and not customize.php
77
+ /*
78
+ if(is_admin() || $this->functions->is_theme_customize())
79
+ return;
80
+ */
81
+
82
+ add_filter('stylesheet_directory_uri', array(&$this, 'stylesheet_directory_uri'), 999, 1);
83
+ add_filter('template_directory_uri', array(&$this, 'template_directory_uri'), 999, 3);
84
+ //add_filter('theme_root_uri', array(&$this, 'theme_root_uri'), 999, 3);
85
+
86
+ }
87
+
88
+ function _callback_saved_new_theme_path($saved_field_data)
89
+ {
90
+ $processing_response = array();
91
+
92
+ //check if the field is noe empty
93
+ if(empty($saved_field_data))
94
+ return $processing_response;
95
+
96
+ $theme_path = $this->wph->functions->get_url_path( $this->wph->templates_data['themes_url'] . $this->wph->templates_data['main']['folder_name'] );
97
+
98
+ $path = '';
99
+ if(!empty($this->wph->default_variables['wordpress_directory']))
100
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
101
+ $path .= trailingslashit( $saved_field_data );
102
+
103
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
104
+
105
+ return $processing_response;
106
+ }
107
+
108
+
109
+
110
+ function stylesheet_directory_uri($url)
111
+ {
112
+ if ( $this->wph->disable_filters )
113
+ return $url;
114
+
115
+ $template_slug = str_replace($this->wph->templates_data['themes_url'], "", $url);
116
+
117
+ //??
118
+ /*
119
+ if($this->wph->functions->is_other_template($template))
120
+ return $url;
121
+ */
122
+
123
+ if($this->wph->templates_data['_template_' . $template_slug] == 'main')
124
+ $new_theme_path = $this->wph->functions->get_module_item_setting('new_theme_path');
125
+ else
126
+ $new_theme_path = $this->wph->functions->get_module_item_setting('new_theme_child_path');
127
+
128
+ if(empty($new_theme_path))
129
+ return $url;
130
+
131
+ $template_dir_uri = trailingslashit( site_url() ) . ltrim(rtrim($new_theme_path, "/"), "/");
132
+
133
+ //add replacement
134
+ if(!isset($this->wph->urls_replacement[$url]))
135
+ {
136
+ $this->wph->urls_replacement[$url] = $template_dir_uri;
137
+ }
138
+
139
+ return $template_dir_uri;
140
+ }
141
+
142
+
143
+ function template_directory_uri($template_dir_uri, $template, $theme_root_uri)
144
+ {
145
+ if ( $this->wph->disable_filters )
146
+ return $template_dir_uri;
147
+
148
+
149
+ //????
150
+ /*
151
+ if($this->wph->functions->is_other_template($template))
152
+ return $template_dir_uri;
153
+ */
154
+
155
+ if($this->wph->templates_data['_template_' . $template] == 'main')
156
+ $new_theme_path = $this->wph->functions->get_module_item_setting('new_theme_path');
157
+ else
158
+ $new_theme_path = $this->wph->functions->get_module_item_setting('new_theme_child_path');
159
+
160
+ if(empty($new_theme_path))
161
+ return $template_dir_uri;
162
+
163
+ $new_template_dir_uri = trailingslashit( site_url() ) . trim($new_theme_path, "/") ;
164
+
165
+ //add replacement
166
+ if(!isset($this->wph->urls_replacement[$template_dir_uri]))
167
+ {
168
+ $this->wph->urls_replacement[$template_dir_uri] = $new_template_dir_uri;
169
+ }
170
+
171
+ return $new_template_dir_uri;
172
+ }
173
+
174
+
175
+ /*
176
+ function theme_root_uri($theme_root_uri, $siteurl, $stylesheet_or_template)
177
+ {
178
+ if ( $this->wph->disable_filters )
179
+ return $theme_root_uri;
180
+
181
+ //only for current theme
182
+ $current_theme = get_stylesheet();
183
+ if($current_theme != $stylesheet_or_template)
184
+ return $theme_root_uri;
185
+
186
+ $theme_root_uri = untrailingslashit( site_url() ) ;
187
+
188
+ return $theme_root_uri;
189
+ }
190
+ */
191
+
192
+
193
+ function _callback_saved_new_theme_child_path($saved_field_data)
194
+ {
195
+ $processing_response = array();
196
+
197
+ //check if the field is noe empty
198
+ if(empty($saved_field_data))
199
+ return $processing_response;
200
+
201
+ $theme_path = $this->wph->functions->get_url_path( $this->wph->templates_data['themes_url'] . $this->wph->templates_data['child']['folder_name'] );
202
+
203
+ $path = '';
204
+ if(!empty($this->wph->default_variables['wordpress_directory']))
205
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
206
+ $path .= trailingslashit( $saved_field_data );
207
+
208
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
209
+
210
+ return $processing_response;
211
+ }
212
+
213
+
214
+
215
+ function _init_new_style_file_path($saved_field_data)
216
+ {
217
+ if(empty($saved_field_data))
218
+ return FALSE;
219
+
220
+ if($this->wph->functions->is_theme_customize())
221
+ return;
222
+
223
+ add_filter('stylesheet_uri', array(&$this, 'stylesheet_uri'), 999, 2);
224
+ }
225
+
226
+ function _callback_saved_new_style_file_path($saved_field_data)
227
+ {
228
+ $processing_response = array();
229
+
230
+ //check if the field is noe empty
231
+ if(empty($saved_field_data))
232
+ return $processing_response;
233
+
234
+ $current_stylesheet_uri = $this->wph->default_variables['stylesheet_uri'];
235
+
236
+ $current_stylesheet_uri = $this->wph->functions->get_url_path( $current_stylesheet_uri, TRUE );
237
+
238
+ $path = '';
239
+ if(!empty($this->wph->default_variables['wordpress_directory']))
240
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
241
+ $path .= $saved_field_data;
242
+
243
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
244
+
245
+ return $processing_response;
246
+ }
247
+
248
+ function stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri)
249
+ {
250
+ if ( $this->wph->disable_filters )
251
+ return $stylesheet_uri;
252
+
253
+ $new_style_file_path = $this->wph->functions->get_module_item_setting('new_style_file_path');
254
+
255
+ $new_style_file_path = trailingslashit( site_url() ) . $new_style_file_path;
256
+
257
+ return $new_style_file_path;
258
+ }
259
+
260
+ }
261
+ ?>
modules/components/rewrite-new_upload_path.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_new_upload_path extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'new_upload_path',
10
+ 'label' => __('New Upload Path', 'wp-hide-security-enhancer'),
11
+ 'description' => __('The default upload path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['upload_url']) .'</strong>
12
+ '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
13
+
14
+ 'value_description' => __('e.g. my_uploads', 'wp-hide-security-enhancer'),
15
+ 'input_type' => 'text',
16
+
17
+ 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
18
+ 'processing_order' => 40
19
+ );
20
+
21
+ $this->module_settings[] = array(
22
+ 'id' => 'block_upload_url',
23
+ 'label' => __('Block upload URL', 'wp-hide-security-enhancer'),
24
+ 'description' => __('Block upload files from being accesible through default urls.', 'wp-hide-security-enhancer') . ' <br />'.__('If set to Yes, all new images inserted into posts will use the new Upload Url, as old url become blocked. Using the No, new images inesrted will use old url, which however are being updated on front side. This may be helpfull on plugin disable, so image urls can be accessible as before.', 'wp-hide-security-enhancer').'<br />'. __('Apply only if', 'wp-hide-security-enhancer') .' <b>New Upload Path</b> '.__('is not empty.', 'wp-hide-security-enhancer'),
25
+
26
+ 'input_type' => 'radio',
27
+ 'options' => array(
28
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
29
+ 'no' => __('No', 'wp-hide-security-enhancer'),
30
+ ),
31
+ 'default_value' => 'no',
32
+
33
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
34
+ 'processing_order' => 45
35
+
36
+ );
37
+
38
+ return $this->module_settings;
39
+ }
40
+
41
+
42
+
43
+ function _init_new_upload_path($saved_field_data)
44
+ {
45
+ if(empty($saved_field_data))
46
+ return FALSE;
47
+
48
+
49
+ add_filter('upload_dir', array( $this, 'upload_dir' ), 999);
50
+ //add_filter('wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 999, 2);
51
+ }
52
+
53
+ function _callback_saved_new_upload_path($saved_field_data)
54
+ {
55
+ $processing_response = array();
56
+
57
+ //check if the field is noe empty
58
+ if(empty($saved_field_data))
59
+ return $processing_response;
60
+
61
+ $wp_upload_dir = wp_upload_dir();
62
+
63
+ $uploads_path = $this->wph->functions->get_url_path( $wp_upload_dir['baseurl'] );
64
+
65
+ $path = '';
66
+ if(!empty($this->wph->default_variables['wordpress_directory']))
67
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
68
+ $path .= trailingslashit( $saved_field_data );
69
+
70
+ $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $uploads_path .'$1 [L,QSA]';
71
+
72
+ return $processing_response;
73
+ }
74
+
75
+
76
+ function upload_dir($data)
77
+ {
78
+
79
+ $new_upload_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_upload_path') );
80
+
81
+ $new_url = trailingslashit( site_url() ) . $new_upload_path;
82
+
83
+ //$data['baseurl'] = $new_url;
84
+
85
+ //add replacement
86
+ if(!isset($this->wph->urls_replacement[ $this->wph->default_variables['upload_url'] ]))
87
+ {
88
+ //prevent media images from being replaced on admin, as when plugin disable the links will not work anymore
89
+ $block_upload_url = $this->wph->functions->get_module_item_setting('block_upload_url');
90
+ if(!is_admin() || (is_admin() && !empty($block_upload_url) && $block_upload_url != 'no'))
91
+ {
92
+ $this->wph->urls_replacement[$this->wph->default_variables['upload_url']] = $new_url;
93
+ }
94
+ }
95
+
96
+ return $data;
97
+ }
98
+
99
+ function _callback_saved_block_upload_url($saved_field_data)
100
+ {
101
+ $processing_response = array();
102
+
103
+ if(empty($saved_field_data) || $saved_field_data == 'no')
104
+ return FALSE;
105
+
106
+ //prevent from blocking if the wp-include is not modified
107
+ $new_upload_path = $this->wph->functions->get_module_item_setting('new_upload_path');
108
+ if (empty( $new_upload_path ))
109
+ return FALSE;
110
+
111
+ $wp_upload_dir = wp_upload_dir();
112
+
113
+ $default_upload_url = untrailingslashit ( $wp_upload_dir['baseurl'] );
114
+ $default_upload_url = str_replace( site_url(), "", $default_upload_url);
115
+ $default_upload_url = ltrim(rtrim($default_upload_url, "/"), "/");
116
+
117
+ $path = '';
118
+ if(!empty($this->wph->default_variables['wordpress_directory']))
119
+ $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
120
+ $path .= $default_upload_url;
121
+
122
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
123
+ $text .= "RewriteRule ^". $path ."(.*) ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
124
+
125
+ $processing_response['htaccess'] = $text;
126
+
127
+ return $processing_response;
128
+
129
+
130
+ }
131
+
132
+
133
+ }
134
+ ?>
modules/components/rewrite-wp_content_path.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPH_module_rewrite_wp_content_path extends WPH_module_component
4
+ {
5
+
6
+ function get_module_settings()
7
+ {
8
+ $this->module_settings[] = array(
9
+ 'id' => 'block_wp_content_path',
10
+ 'label' => __('Block wp-content URL', 'wp-hide-security-enhancer'),
11
+ 'description' => __('Your wp-content path is set to', 'wp-hide-security-enhancer') . ' <strong>'. $this->wph->default_variables['content_directory'] .'</strong>
12
+ '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.wp-hide.com/" target="_blank">Link</a>',
13
+
14
+ 'input_type' => 'radio',
15
+ 'options' => array(
16
+ 'yes' => __('Yes', 'wp-hide-security-enhancer'),
17
+ 'no' => __('No', 'wp-hide-security-enhancer'),
18
+ ),
19
+ 'default_value' => 'no',
20
+
21
+ 'sanitize_type' => array('sanitize_title', 'strtolower'),
22
+ 'processing_order' => 22
23
+ );
24
+
25
+ return $this->module_settings;
26
+ }
27
+
28
+
29
+
30
+ function _init_block_wp_content_path($saved_field_data)
31
+ {
32
+
33
+ }
34
+
35
+ function _callback_saved_block_wp_content_path($saved_field_data)
36
+ {
37
+ $processing_response = array();
38
+
39
+ if(empty($saved_field_data) || $saved_field_data == 'no')
40
+ return FALSE;
41
+
42
+ $content_directory = $this->wph->default_variables['content_directory'];
43
+
44
+ $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
45
+ $text .= "RewriteRule ^". $content_directory ."(.*) ". $this->wph->default_variables['site_relative_path'] ."index.php [L]";
46
+
47
+ $processing_response['htaccess'] = $text;
48
+
49
+ return $processing_response;
50
+ }
51
+
52
+
53
+
54
+ }
55
+ ?>
modules/module-admin.php CHANGED
@@ -4,13 +4,28 @@
4
  class WPH_module_admin extends WPH_module
5
  {
6
 
7
- static function get_module_id()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  {
9
 
10
  return 'admin';
11
  }
12
 
13
- static function get_module_slug()
14
  {
15
 
16
  return 'wp-hide-admin';
@@ -40,322 +55,7 @@
40
 
41
  }
42
 
43
-
44
- function get_module_settings()
45
- {
46
- global $wph;
47
-
48
- $module_settings = array();
49
-
50
-
51
- $module_settings[] = array(
52
- 'id' => 'new_wp_login_php',
53
- 'label' => 'New wp-login.php',
54
- 'description' => __('Map a new wp-login.php instead default.', 'wp-hide-security-enhancer'),
55
-
56
- 'input_type' => 'text',
57
-
58
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
59
-
60
- );
61
-
62
- $module_settings[] = array(
63
- 'id' => 'block_default_wp_login_php',
64
- 'label' => 'Block default wp-login.php',
65
- 'description' => __('Block default wp-login.php file from being accesible.', 'wp-hide-security-enhancer'),
66
-
67
- 'input_type' => 'radio',
68
- 'options' => array(
69
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
70
- 'no' => __('No', 'wp-hide-security-enhancer'),
71
- ),
72
- 'default_value' => 'no',
73
-
74
- 'sanitize_type' => array('sanitize_title', 'strtolower')
75
-
76
- );
77
-
78
- $module_settings[] = array(
79
- 'type' => 'split',
80
- );
81
-
82
- $module_settings[] = array(
83
- 'id' => 'admin_url',
84
- 'label' => 'New Admin Url',
85
- 'description' => __('Create a new admin url instead default /wp-admin and /login.', 'wp-hide-security-enhancer'),
86
-
87
- 'input_type' => 'text',
88
-
89
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
90
-
91
- );
92
-
93
- $module_settings[] = array(
94
- 'id' => 'block_default_admin_url',
95
- 'label' => 'Block default Admin Url',
96
- 'description' => __('Block default admin url and files from being accesible.', 'wp-hide-security-enhancer') . '<br /><span class="important">' . __('Warning: Write down your new admin url, or if lost, will not be able to log-in .', 'wp-hide-security-enhancer') . '</span>',
97
-
98
- 'input_type' => 'radio',
99
- 'options' => array(
100
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
101
- 'no' => __('No', 'wp-hide-security-enhancer'),
102
- ),
103
- 'default_value' => 'no',
104
-
105
- 'sanitize_type' => array('sanitize_title', 'strtolower')
106
-
107
- );
108
-
109
-
110
- $module_settings = apply_filters('wp-hide/module_settings', $module_settings, $this);
111
-
112
- return $module_settings;
113
-
114
- }
115
-
116
- function _callback_admin_url($saved_field_data)
117
- {
118
- if(empty($saved_field_data) || $saved_field_data == 'no')
119
- return FALSE;
120
-
121
- $default_url = $this->functions->get_url_path( trailingslashit( site_url() ) . 'wp-admin' );
122
- $new_url = $this->functions->get_url_path( trailingslashit( site_url() ) . $saved_field_data );
123
- //add replacement
124
- if(!isset($this->wph->urls_replacement[$default_url]))
125
- {
126
- $this->wph->urls_replacement[$default_url] = $new_url;
127
- }
128
-
129
- add_filter('admin_url', array($this,'admin_url'), 999, 3 );
130
- add_action('set_auth_cookie', array($this,'set_auth_cookie'), 999, 5);
131
- add_filter('style_loader_src', array($this->wph, 'generic_string_replacement' ), 999);
132
-
133
- add_filter('wp_default_scripts', array($this, 'wp_default_scripts' ), 999);
134
- }
135
-
136
- function _callback_saved_admin_url($saved_field_data)
137
- {
138
- $processing_response = array();
139
-
140
- //check if the field is noe empty
141
- if(empty($saved_field_data))
142
- return $processing_response;
143
-
144
- $admin_url = $this->functions->get_url_path( trailingslashit( site_url() ) . 'wp-admin' );
145
-
146
- $path = '';
147
- if(!empty($this->wph->default_variables['wordpress_directory']))
148
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
149
- $path .= trailingslashit( $saved_field_data );
150
-
151
- $text = "\nRewriteCond %{REQUEST_URI} ". $saved_field_data ."$";
152
- $text .= "\nRewriteRule ^(.*)$ ". $saved_field_data ."/ [R=301,L]";
153
- $text .= "\nRewriteRule ^" . $path . '(.*) '. $admin_url .'$1 [L,QSA]';
154
-
155
- $processing_response['htaccess'] = $text;
156
- $processing_response['page_refresh'] = TRUE;
157
-
158
- return $processing_response;
159
- }
160
-
161
-
162
- function admin_url($url, $path, $blog_id)
163
- {
164
- if($this->wph->uninstall === TRUE)
165
- return $url;
166
-
167
- $new_admin_url = $this->functions->get_module_item_setting('admin_url' , $this->get_module_id());
168
-
169
- $admin_dir_uri = trailingslashit( site_url() ) . trim($new_admin_url, "/");
170
- $new_url = trailingslashit( $admin_dir_uri ) . $path;
171
-
172
- //add replacement
173
- if(!isset($this->wph->urls_replacement[$url]))
174
- {
175
- $this->wph->urls_replacement[$url] = $new_url;
176
- }
177
-
178
- return $new_url;
179
-
180
- }
181
-
182
- function set_auth_cookie($auth_cookie, $expire, $expiration, $user_id, $scheme)
183
- {
184
-
185
- $new_admin_url = $this->functions->get_module_item_setting('admin_url' , $this->get_module_id());
186
-
187
- if ( $scheme == 'secure_auth' )
188
- {
189
- $auth_cookie_name = SECURE_AUTH_COOKIE;
190
- $secure = TRUE;
191
- }
192
- else
193
- {
194
- $auth_cookie_name = AUTH_COOKIE;
195
- $secure = FALSE;
196
- }
197
-
198
- setcookie($auth_cookie_name, $auth_cookie, $expire, SITECOOKIEPATH . $new_admin_url, COOKIE_DOMAIN, $secure, true);
199
-
200
- $manager = WP_Session_Tokens::get_instance( $user_id );
201
- $token = $manager->create( $expiration );
202
-
203
- $logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
204
-
205
- }
206
-
207
- function wp_default_scripts($scripts)
208
- {
209
- //check if custom admin url is set
210
- $admin_url = $this->functions->get_module_item_setting('admin_url' , $this->get_module_id());
211
- if (empty( $admin_url ))
212
- return;
213
-
214
- //update default dirs
215
- if(isset($scripts->default_dirs))
216
- {
217
- foreach($scripts->default_dirs as $key => $value)
218
- {
219
- $scripts->default_dirs[$key] = str_replace('wp-admin', $admin_url, $value);
220
- }
221
- }
222
 
223
- foreach($scripts->registered as $script_name => $script_data)
224
- {
225
- $script_data->src = str_replace('wp-admin', $admin_url, $script_data->src);
226
-
227
- $scripts->registered[$script_name] = $script_data;
228
- }
229
- }
230
-
231
-
232
- function _callback_block_default_admin_url($saved_field_data)
233
- {
234
- if(empty($saved_field_data) || $saved_field_data == 'no')
235
- return FALSE;
236
-
237
- }
238
-
239
- function _callback_saved_block_default_admin_url($saved_field_data)
240
- {
241
- $processing_response = array();
242
-
243
- //check if the field is noe empty
244
- if(empty($saved_field_data) || $saved_field_data == 'no')
245
- return $processing_response;
246
-
247
- //prevent from blocking if the admin_url is empty
248
- $admin_url = $this->functions->get_module_item_setting('admin_url' , $this->get_module_id());
249
- if (empty( $admin_url ))
250
- return FALSE;
251
-
252
- $site_index = $this->functions->get_url_path ( trailingslashit( site_url() ) . 'index.php', TRUE );
253
-
254
- $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
255
- $text .= "RewriteRule ^wp-admin(.*) $site_index?throw_404 [L]\n";
256
- $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
257
-
258
- //theme my login usage
259
- //$text .= "RewriteRule ^login(.*) $site_index?throw_404 [L]\n";
260
- //$text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
261
-
262
- $text .= "RewriteRule ^dashboard(.*) $site_index?throw_404 [L]\n";
263
- $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
264
- $text .= "RewriteRule ^admin(.*) $site_index?throw_404 [L]\n";
265
-
266
- $path = '';
267
- if(!empty($this->wph->default_variables['wordpress_directory']))
268
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
269
-
270
- if(!empty($path))
271
- {
272
- $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
273
- $text .= "RewriteRule ^".$path."wp-admin(.*) $site_index?throw_404 [L]\n";
274
- $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
275
- $text .= "RewriteRule ^".$path."dashboard(.*) $site_index?throw_404 [L]\n";
276
- $text .= "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
277
- $text .= "RewriteRule ^".$path."admin(.*) $site_index?throw_404 [L]";
278
- }
279
-
280
-
281
- $processing_response['htaccess'] = $text;
282
-
283
- return $processing_response;
284
- }
285
-
286
-
287
- function _callback_new_wp_login_php($saved_field_data)
288
- {
289
- if(empty($saved_field_data) || $saved_field_data == 'no')
290
- return FALSE;
291
-
292
-
293
- //add replacement
294
- $url = trailingslashit( site_url() ) . 'wp-login.php';
295
- if(!isset($this->wph->urls_replacement[$url]))
296
- {
297
- $this->wph->urls_replacement[ $url ] = trailingslashit( site_url() ) . $saved_field_data;
298
- }
299
- }
300
-
301
- function _callback_saved_new_wp_login_php($saved_field_data)
302
- {
303
- $processing_response = array();
304
-
305
- //check if the field is noe empty
306
- if(empty($saved_field_data))
307
- return $processing_response;
308
-
309
- $new_wp_login_php = untrailingslashit ( $this->functions->get_url_path( trailingslashit( site_url() ) . 'wp-login.php' ) );
310
-
311
- $path = '';
312
- if(!empty($this->wph->default_variables['wordpress_directory']))
313
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
314
- $path .= $saved_field_data;
315
-
316
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $new_wp_login_php .'$1 [L,QSA]';
317
-
318
- return $processing_response;
319
- }
320
-
321
-
322
- function _callback_block_default_wp_login_php($saved_field_data)
323
- {
324
- if(empty($saved_field_data) || $saved_field_data == 'no')
325
- return FALSE;
326
-
327
-
328
- }
329
-
330
- function _callback_saved_block_default_wp_login_php($saved_field_data)
331
- {
332
- $processing_response = array();
333
-
334
- //check if the field is noe empty
335
- if(empty($saved_field_data) || $saved_field_data == 'no')
336
- return $processing_response;
337
-
338
- //prevent from blocking if the new_wp_login_php is empty
339
- $new_wp_login_php = $this->functions->get_module_item_setting('new_wp_login_php' , $this->get_module_id());
340
- if (empty( $new_wp_login_php ))
341
- return FALSE;
342
-
343
- $site_index = $this->functions->get_url_path ( trailingslashit( site_url() ) . 'index.php', TRUE );
344
-
345
- $path = '';
346
- if(!empty($this->wph->default_variables['wordpress_directory']))
347
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
348
- $path .= 'wp-login.php';
349
-
350
- $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
351
- $text .= "RewriteRule ^" . $path ." /404 [L]";
352
-
353
- $processing_response['htaccess'] = $text;
354
-
355
- return $processing_response;
356
- }
357
-
358
-
359
  }
360
 
361
 
4
  class WPH_module_admin extends WPH_module
5
  {
6
 
7
+ function load_components()
8
+ {
9
+
10
+ //add components
11
+ include(WPH_PATH . "/modules/components/admin-new_wp_login_php.php");
12
+ $this->components[] = new WPH_module_admin_new_wp_login_php();
13
+
14
+ include(WPH_PATH . "/modules/components/admin-admin_url.php");
15
+ $this->components[] = new WPH_module_admin_admin_url();
16
+
17
+ //action available for mu-plugins
18
+ do_action('wp-hide/module_load_components', $this);
19
+
20
+ }
21
+
22
+ function get_module_id()
23
  {
24
 
25
  return 'admin';
26
  }
27
 
28
+ function get_module_slug()
29
  {
30
 
31
  return 'wp-hide-admin';
55
 
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
 
modules/module-general.php CHANGED
@@ -4,13 +4,31 @@
4
  class WPH_module_general extends WPH_module
5
  {
6
 
7
- static function get_module_id()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  {
9
 
10
  return 'general';
11
  }
12
 
13
- static function get_module_slug()
14
  {
15
 
16
  return 'wp-hide-general';
@@ -39,193 +57,9 @@
39
  return $interface_data;
40
 
41
  }
42
-
43
-
44
- function get_module_settings()
45
- {
46
- global $wph;
47
-
48
- $module_settings = array();
49
-
50
-
51
- $module_settings[] = array(
52
- 'id' => 'remove_version',
53
- 'label' => 'Remove Version',
54
- 'description' => __('Remove version number from enqueued style and script files.', 'wp-hide-security-enhancer'),
55
-
56
- 'input_type' => 'radio',
57
- 'options' => array(
58
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
59
- 'no' => __('No', 'wp-hide-security-enhancer'),
60
- ),
61
- 'default_value' => 'no',
62
-
63
- 'sanitize_type' => array('sanitize_title', 'strtolower')
64
-
65
- );
66
-
67
- $module_settings[] = array(
68
- 'type' => 'split',
69
- );
70
-
71
- $module_settings[] = array(
72
- 'id' => 'remove_generator_meta',
73
- 'label' => 'Remove Generator Meta',
74
- 'description' => __('Remove the autogenerated meta generator tag within head.', 'wp-hide-security-enhancer'),
75
-
76
- 'input_type' => 'radio',
77
- 'options' => array(
78
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
79
- 'no' => __('No', 'wp-hide-security-enhancer'),
80
- ),
81
- 'default_value' => 'no',
82
-
83
- 'sanitize_type' => array('sanitize_title', 'strtolower')
84
-
85
- );
86
-
87
- $module_settings[] = array(
88
- 'id' => 'remove_wlwmanifest',
89
- 'label' => 'Remove wlwmanifest Meta',
90
- 'description' => __('Remove the wlwmanifest tag within head.', 'wp-hide-security-enhancer'),
91
-
92
- 'input_type' => 'radio',
93
- 'options' => array(
94
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
95
- 'no' => __('No', 'wp-hide-security-enhancer'),
96
- ),
97
- 'default_value' => 'no',
98
-
99
- 'sanitize_type' => array('sanitize_title', 'strtolower')
100
-
101
- );
102
-
103
 
104
- $module_settings[] = array(
105
- 'id' => 'remove_feed_links',
106
- 'label' => 'Remove feed_links Meta',
107
- 'description' => __('Remove the feed_links tag within head.', 'wp-hide-security-enhancer'),
108
-
109
- 'input_type' => 'radio',
110
- 'options' => array(
111
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
112
- 'no' => __('No', 'wp-hide-security-enhancer'),
113
- ),
114
- 'default_value' => 'no',
115
-
116
- 'sanitize_type' => array('sanitize_title', 'strtolower')
117
-
118
- );
119
-
120
- $module_settings[] = array(
121
- 'id' => 'remove_rsd_link',
122
- 'label' => 'Remove rsd_link Meta',
123
- 'description' => __('Remove the rsd_link tag within head.', 'wp-hide-security-enhancer'),
124
-
125
- 'input_type' => 'radio',
126
- 'options' => array(
127
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
128
- 'no' => __('No', 'wp-hide-security-enhancer'),
129
- ),
130
- 'default_value' => 'no',
131
-
132
- 'sanitize_type' => array('sanitize_title', 'strtolower')
133
-
134
- );
135
-
136
-
137
-
138
- $module_settings[] = array(
139
- 'id' => 'remove_adjacent_posts_rel',
140
- 'label' => 'Remove adjacent_posts_rel Meta',
141
- 'description' => __('Remove the adjacent_posts_rel tag within head.', 'wp-hide-security-enhancer'),
142
-
143
- 'input_type' => 'radio',
144
- 'options' => array(
145
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
146
- 'no' => __('No', 'wp-hide-security-enhancer'),
147
- ),
148
- 'default_value' => 'no',
149
-
150
- 'sanitize_type' => array('sanitize_title', 'strtolower')
151
-
152
- );
153
-
154
- $module_settings = apply_filters('wp-hide/module_settings', $module_settings, $this);
155
-
156
- return $module_settings;
157
-
158
- }
159
 
160
- function _callback_remove_version($saved_field_data)
161
- {
162
- if(empty($saved_field_data) || $saved_field_data == 'no')
163
- return FALSE;
164
-
165
- add_filter( 'style_loader_src', array(&$this, 'remove_file_version'), 999 );
166
- add_filter( 'script_loader_src', array(&$this, 'remove_file_version'), 999 );
167
-
168
- }
169
-
170
 
171
- function remove_file_version($src)
172
- {
173
-
174
- $src = remove_query_arg( 'ver', $src );
175
-
176
- return $src;
177
-
178
- }
179
-
180
-
181
- function _callback_remove_generator_meta($saved_field_data)
182
- {
183
- if(empty($saved_field_data) || $saved_field_data == 'no')
184
- return FALSE;
185
-
186
- add_filter('the_generator', create_function('', 'return "";'));
187
- remove_action( 'wp_head', 'wp_generator' );
188
- }
189
-
190
-
191
- function _callback_remove_wlwmanifest($saved_field_data)
192
- {
193
- if(empty($saved_field_data) || $saved_field_data == 'no')
194
- return FALSE;
195
-
196
- remove_action( 'wp_head', 'wlwmanifest_link' );
197
-
198
- }
199
-
200
-
201
- function _callback_remove_feed_links($saved_field_data)
202
- {
203
- if(empty($saved_field_data) || $saved_field_data == 'no')
204
- return FALSE;
205
-
206
- remove_action('wp_head', 'feed_links', 2);
207
- remove_action('wp_head', 'feed_links_extra', 3);
208
-
209
- }
210
-
211
- function _callback_remove_rsd_link($saved_field_data)
212
- {
213
- if(empty($saved_field_data) || $saved_field_data == 'no')
214
- return FALSE;
215
-
216
- remove_action('wp_head', 'rsd_link');
217
-
218
- }
219
-
220
-
221
- function _callback_adjacent_posts_rel($saved_field_data)
222
- {
223
- if(empty($saved_field_data) || $saved_field_data == 'no')
224
- return FALSE;
225
-
226
- remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
227
-
228
- }
229
 
230
 
231
  }
4
  class WPH_module_general extends WPH_module
5
  {
6
 
7
+ function load_components()
8
+ {
9
+
10
+ //add components
11
+ include(WPH_PATH . "/modules/components/general-wpemoji.php");
12
+ $this->components[] = new WPH_module_general_wpemoji();
13
+
14
+ include(WPH_PATH . "/modules/components/general-remove_version.php");
15
+ $this->components[] = new WPH_module_general_remove_version();
16
+
17
+ include(WPH_PATH . "/modules/components/general-meta.php");
18
+ $this->components[] = new WPH_module_general_meta();
19
+
20
+ //action available for mu-plugins
21
+ do_action('wp-hide/module_load_components', $this);
22
+
23
+ }
24
+
25
+ function get_module_id()
26
  {
27
 
28
  return 'general';
29
  }
30
 
31
+ function get_module_slug()
32
  {
33
 
34
  return 'wp-hide-general';
57
  return $interface_data;
58
 
59
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
 
 
 
 
 
 
 
 
 
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
 
65
  }
modules/module-rewrite.php CHANGED
@@ -3,7 +3,35 @@
3
 
4
  class WPH_module_rewrite extends WPH_module
5
  {
6
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  function get_module_id()
8
  {
9
  return 'rewrite';
@@ -36,679 +64,6 @@
36
  return $interface_data;
37
  }
38
 
39
- function get_module_settings()
40
- {
41
-
42
- $module_settings = array();
43
-
44
- $module_settings[] = array(
45
- 'id' => 'new_theme_path',
46
- 'label' => __('New Theme Path', 'wp-hide-security-enhancer'),
47
- 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['template_url']) .'</strong>
48
- '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
49
-
50
- 'value_description' => __('e.g. my_template', 'wp-hide-security-enhancer'),
51
- 'input_type' => 'text',
52
-
53
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
54
- );
55
-
56
- if($this->wph->templates_data['is_child_theme'])
57
- {
58
- $module_settings[] = array(
59
- 'id' => 'new_theme_child_path',
60
- 'label' => __('New Theme Child Path', 'wp-hide-security-enhancer'),
61
- 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' , trailingslashit($this->wph->templates_data['themes_url']) . $this->wph->templates_data['child']['folder_name']) .'</strong>
62
- '.__('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
63
-
64
- 'value_description' => __('e.g. my_child_template', 'wp-hide-security-enhancer'),
65
- 'input_type' => 'text',
66
-
67
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
68
- );
69
- }
70
-
71
- $module_settings[] = array(
72
- 'id' => 'new_style_file_path',
73
- 'label' => __('New Style File Path', 'wp-hide-security-enhancer'),
74
- 'description' => __('The default theme style file style.css path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' , $this->wph->default_variables['template_url']) .'/style.css</strong>',
75
-
76
- 'value_description' => __('e.g. custom-style-file.css', 'wp-hide-security-enhancer'),
77
- 'input_type' => 'text',
78
-
79
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
80
- );
81
-
82
- /*
83
- $module_settings[] = array(
84
- 'id' => 'new_style_path',
85
- 'label' => 'New Style Path',
86
- 'description' => 'The default theme style path is set to <strong>'. str_replace(get_bloginfo('wpurl'), '' , $this->wph->default_variables['template_url']) .'/css</strong>',
87
-
88
- 'value_description' => 'e.g. styling',
89
- 'input_type' => 'text',
90
-
91
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
92
- );
93
- */
94
-
95
- $module_settings[] = array(
96
- 'type' => 'split',
97
- );
98
-
99
- /*
100
- $module_settings[] = array(
101
- 'id' => 'block_wpcontent_themes_url',
102
- 'label' => 'Block wp-content/themes URL',
103
- 'description' => 'Block themes files from being accesible through default urls. Apply only if <b>New Theme Path</b> is not empty.',
104
-
105
- 'input_type' => 'radio',
106
- 'options' => array(
107
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
108
- 'no' => __('No', 'wp-hide-security-enhancer'),
109
- ),
110
- 'default_value' => 'no',
111
-
112
- 'sanitize_type' => array('sanitize_title', 'strtolower')
113
-
114
- );
115
- */
116
-
117
-
118
-
119
- $module_settings[] = array(
120
- 'id' => 'new_include_path',
121
- 'label' => __('New Include Path', 'wp-hide-security-enhancer'),
122
- 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>wp-include</strong>
123
- '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
124
-
125
- 'value_description' => __('e.g. my_include', 'wp-hide-security-enhancer'),
126
- 'input_type' => 'text',
127
-
128
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
129
- );
130
-
131
- $module_settings[] = array(
132
- 'type' => 'split',
133
- );
134
-
135
-
136
- $module_settings[] = array(
137
- 'id' => 'new_plugin_path',
138
- 'label' => __('New Plugin Path', 'wp-hide-security-enhancer'),
139
- 'description' => __('The default theme path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['plugins_url']) .'</strong>
140
- '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
141
-
142
- 'value_description' => 'e.g. my_plugin',
143
- 'input_type' => 'text',
144
-
145
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
146
- );
147
-
148
- $module_settings[] = array(
149
- 'id' => 'block_plugins_url',
150
- 'label' => __('Block plugins URL', 'wp-hide-security-enhancer'),
151
- 'description' => __('Block plugins files from being accesible through default urls.', 'wp-hide-security-enhancer') . '<br />'.__('Apply only if ', 'wp-hide-security-enhancer') . '<b>New Plugin Path</b> ' . __('is not empty.', 'wp-hide-security-enhancer'),
152
-
153
- 'input_type' => 'radio',
154
- 'options' => array(
155
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
156
- 'no' => __('No', 'wp-hide-security-enhancer'),
157
- ),
158
- 'default_value' => 'no',
159
-
160
- 'sanitize_type' => array('sanitize_title', 'strtolower')
161
-
162
- );
163
-
164
- $module_settings[] = array(
165
- 'type' => 'split',
166
- );
167
-
168
-
169
- $module_settings[] = array(
170
- 'id' => 'new_upload_path',
171
- 'label' => __('New Upload Path', 'wp-hide-security-enhancer'),
172
- 'description' => __('The default upload path is set to', 'wp-hide-security-enhancer') . ' <strong>'. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['upload_url']) .'</strong>
173
- '. __('More details can be found at', 'wp-hide-security-enhancer') .' <a href="http://www.nsp-code.com" target="_blank">Link</a>',
174
-
175
- 'value_description' => __('e.g. my_uploads', 'wp-hide-security-enhancer'),
176
- 'input_type' => 'text',
177
-
178
- 'sanitize_type' => array(array($this->functions, 'sanitize_file_path_name'))
179
- );
180
-
181
- $module_settings[] = array(
182
- 'id' => 'block_upload_url',
183
- 'label' => __('Block upload URL', 'wp-hide-security-enhancer'),
184
- 'description' => __('Block upload files from being accesible through default urls.', 'wp-hide-security-enhancer') . ' <br />'.__('If set to Yes, all new images inserted into posts will use the new Upload Url, as old url become blocked. Using the No, new images inesrted will use old url, which however are being updated on front side. This may be helpfull on plugin disable, so image urls can be accessible as before.', 'wp-hide-security-enhancer').'<br />'. __('Apply only if', 'wp-hide-security-enhancer') .' <b>New Upload Path</b> '.__('is not empty.', 'wp-hide-security-enhancer'),
185
-
186
- 'input_type' => 'radio',
187
- 'options' => array(
188
- 'yes' => __('Yes', 'wp-hide-security-enhancer'),
189
- 'no' => __('No', 'wp-hide-security-enhancer'),
190
- ),
191
- 'default_value' => 'no',
192
-
193
- 'sanitize_type' => array('sanitize_title', 'strtolower')
194
-
195
- );
196
-
197
-
198
- $module_settings = apply_filters('wp-hide/module_settings', $module_settings, $this);
199
-
200
-
201
- return $module_settings;
202
-
203
- }
204
-
205
- /**
206
- * New Theme Path
207
- *
208
- * @param mixed $saved_field_data
209
- */
210
- function _callback_new_theme_path($saved_field_data)
211
- {
212
- if(empty($saved_field_data))
213
- return FALSE;
214
-
215
- //applay when not admin and not customize.php
216
- /*
217
- if(is_admin() || $this->functions->is_theme_customize())
218
- return;
219
- */
220
-
221
- add_filter('stylesheet_directory_uri', array(&$this, 'stylesheet_directory_uri'), 999, 1);
222
- add_filter('template_directory_uri', array(&$this, 'template_directory_uri'), 999, 3);
223
- //add_filter('theme_root_uri', array(&$this, 'theme_root_uri'), 999, 3);
224
-
225
- }
226
-
227
- function _callback_saved_new_theme_path($saved_field_data)
228
- {
229
- $processing_response = array();
230
-
231
- //check if the field is noe empty
232
- if(empty($saved_field_data))
233
- return $processing_response;
234
-
235
- $theme_path = $this->functions->get_url_path( $this->wph->templates_data['themes_url'] . $this->wph->templates_data['main']['folder_name'] );
236
-
237
- $path = '';
238
- if(!empty($this->wph->default_variables['wordpress_directory']))
239
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
240
- $path .= trailingslashit( $saved_field_data );
241
-
242
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
243
-
244
- return $processing_response;
245
- }
246
-
247
-
248
-
249
- function stylesheet_directory_uri($url)
250
- {
251
- if ( $this->wph->disable_filters )
252
- return $url;
253
-
254
- $template = str_replace($this->wph->templates_data['themes_url'], "", $url);
255
-
256
- if($this->functions->is_other_template($template))
257
- return $url;
258
-
259
- if($this->wph->templates_data['_template_' . $template] == 'main')
260
- $new_theme_path = $this->functions->get_module_item_setting('new_theme_path' , $this->get_module_id());
261
- else
262
- $new_theme_path = $this->functions->get_module_item_setting('new_theme_child_path' , $this->get_module_id());
263
-
264
- $template_dir_uri = trailingslashit( site_url() ) . ltrim(rtrim($new_theme_path, "/"), "/");
265
-
266
- //add replacement
267
- if(!isset($this->wph->urls_replacement[$url]))
268
- {
269
- $this->wph->urls_replacement[$url] = $template_dir_uri;
270
- }
271
-
272
- return $template_dir_uri;
273
- }
274
-
275
-
276
- function template_directory_uri($template_dir_uri, $template, $theme_root_uri)
277
- {
278
- if ( $this->wph->disable_filters )
279
- return $template_dir_uri;
280
-
281
- if($this->functions->is_other_template($template))
282
- return $template_dir_uri;
283
-
284
- if($this->wph->templates_data['_template_' . $template] == 'main')
285
- $new_theme_path = $this->functions->get_module_item_setting('new_theme_path' , $this->get_module_id());
286
- else
287
- $new_theme_path = $this->functions->get_module_item_setting('new_theme_child_path' , $this->get_module_id());
288
-
289
- $new_template_dir_uri = trailingslashit( site_url() ) . trim($new_theme_path, "/") ;
290
-
291
- //add replacement
292
- if(!isset($this->wph->urls_replacement[$template_dir_uri]))
293
- {
294
- $this->wph->urls_replacement[$template_dir_uri] = $new_template_dir_uri;
295
- }
296
-
297
- return $new_template_dir_uri;
298
- }
299
-
300
-
301
- function theme_root_uri($theme_root_uri, $siteurl, $stylesheet_or_template)
302
- {
303
- if ( $this->wph->disable_filters )
304
- return $theme_root_uri;
305
-
306
- //only for current theme
307
- $current_theme = get_stylesheet();
308
- if($current_theme != $stylesheet_or_template)
309
- return $theme_root_uri;
310
-
311
- $theme_root_uri = untrailingslashit( site_url() ) ;
312
-
313
- return $theme_root_uri;
314
- }
315
-
316
-
317
- function _callback_saved_new_theme_child_path($saved_field_data)
318
- {
319
- $processing_response = array();
320
-
321
- //check if the field is noe empty
322
- if(empty($saved_field_data))
323
- return $processing_response;
324
-
325
- $theme_path = $this->functions->get_url_path( $this->wph->templates_data['themes_url'] . $this->wph->templates_data['child']['folder_name'] );
326
-
327
- $path = '';
328
- if(!empty($this->wph->default_variables['wordpress_directory']))
329
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
330
- $path .= trailingslashit( $saved_field_data );
331
-
332
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $theme_path .'$1 [L,QSA]';
333
-
334
- return $processing_response;
335
- }
336
-
337
-
338
- function _callback_new_style_file_path($saved_field_data)
339
- {
340
- if(empty($saved_field_data))
341
- return FALSE;
342
-
343
- if($this->functions->is_theme_customize())
344
- return;
345
-
346
- add_filter('stylesheet_uri', array(&$this, 'stylesheet_uri'), 999, 2);
347
- }
348
-
349
- function _callback_saved_new_style_file_path($saved_field_data)
350
- {
351
- $processing_response = array();
352
-
353
- //check if the field is noe empty
354
- if(empty($saved_field_data))
355
- return $processing_response;
356
-
357
- $current_stylesheet_uri = $this->wph->default_variables['stylesheet_uri'];
358
-
359
- $current_stylesheet_uri = $this->functions->get_url_path( $current_stylesheet_uri, TRUE );
360
-
361
- $path = '';
362
- if(!empty($this->wph->default_variables['wordpress_directory']))
363
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
364
- $path .= $saved_field_data;
365
-
366
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . ' '. $current_stylesheet_uri .' [L,QSA]';
367
-
368
- return $processing_response;
369
- }
370
-
371
- function stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri)
372
- {
373
- if ( $this->wph->disable_filters )
374
- return $stylesheet_uri;
375
-
376
- $new_style_file_path = $this->functions->get_module_item_setting('new_style_file_path' , $this->get_module_id());
377
-
378
- $new_style_file_path = trailingslashit( site_url() ) . $new_style_file_path;
379
-
380
- return $new_style_file_path;
381
- }
382
-
383
-
384
- function _callback_saved_block_wpcontent_themes_url($saved_field_data)
385
- {
386
- $processing_response = array();
387
-
388
- if(empty($saved_field_data) || $saved_field_data == 'no')
389
- return FALSE;
390
-
391
- //prevent from blocking if the wp-include is not modified
392
- $new_theme_path = ltrim(rtrim($this->functions->get_module_item_setting('new_theme_path' , $this->get_module_id()), "/"), "/");
393
- if (empty( $new_theme_path ))
394
- return FALSE;
395
-
396
- $default_content_url = untrailingslashit ( WP_CONTENT_URL );
397
- $default_content_url = str_replace( site_url(), "", $default_content_url);
398
- $default_content_url = ltrim(rtrim($default_content_url, "/"), "/");
399
-
400
- $theme_roots = ltrim(rtrim(get_theme_roots(), "/"), "/");
401
-
402
- $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
403
- $text .= "RewriteRule ^". trailingslashit ( $default_content_url ) . $theme_roots ."(.*) /404 [L]";
404
-
405
- $processing_response['htaccess'] = $text;
406
-
407
- return $processing_response;
408
-
409
-
410
- }
411
-
412
-
413
-
414
- /**
415
- * New Include Path
416
- * *
417
- * @param mixed $saved_field_data
418
- */
419
- function _callback_new_include_path($saved_field_data)
420
- {
421
- if(empty($saved_field_data))
422
- return FALSE;
423
-
424
-
425
- add_filter('includes_url', array( $this, 'includes_url' ), 999, 2);
426
- add_filter('script_loader_src', array( $this, 'script_loader_src' ), 999, 2);
427
- add_filter('style_loader_src', array( $this, 'style_loader_src' ), 999, 2);
428
-
429
- add_filter('wp_default_scripts', array($this, 'wp_default_scripts' ), 999);
430
-
431
- //add default plugin path replacement
432
- $new_include_path = $this->functions->untrailingslashit_all( $this->functions->get_module_item_setting('new_include_path' , $this->get_module_id()) );
433
- $new_include_path = trailingslashit( site_url() ) . untrailingslashit( $new_include_path );
434
- $this->wph->urls_replacement[trailingslashit( site_url() ) . 'wp-includes' ] = $new_include_path;
435
- }
436
-
437
- function _callback_saved_new_include_path($saved_field_data)
438
- {
439
- $processing_response = array();
440
-
441
- //check if the field is noe empty
442
- if(empty($saved_field_data))
443
- return $processing_response;
444
-
445
-
446
- $include_path = $this->functions->get_url_path( trailingslashit(site_url()) . WPINC );
447
-
448
- $path = '';
449
- if(!empty($this->wph->default_variables['wordpress_directory']))
450
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
451
- $path .= trailingslashit( $saved_field_data );
452
-
453
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $include_path .'$1 [L,QSA]';
454
-
455
- return $processing_response;
456
- }
457
-
458
-
459
-
460
- function includes_url($url, $path)
461
- {
462
- if ( $this->wph->disable_filters )
463
- return $url;
464
-
465
- $new_include_path = $this->functions->get_module_item_setting('new_include_path' , $this->get_module_id());
466
-
467
- $new_url = str_replace('/wp-includes/', '/' . $new_include_path . '/', $url);
468
-
469
- return $new_url;
470
-
471
- /*
472
- $current_include = trailingslashit( $this->wph->default_variables['include_url'] );
473
-
474
- $new_include_url = str_replace( $current_include , '' , $include_url);
475
- $new_include_url = ltrim($new_include_url, "/");
476
-
477
- $new_include_url = trailingslashit( site_url() ) . trailingslashit( ltrim(rtrim($new_include_path, "/"), "/") ) . $new_include_url;
478
- */
479
-
480
- return $new_include_url;
481
- }
482
-
483
- function script_loader_src($src, $handle)
484
- {
485
- if ( $this->wph->disable_filters )
486
- return $src;
487
-
488
- $new_include_path = ltrim(rtrim($this->functions->get_module_item_setting('new_include_path' , $this->get_module_id()), "/"), "/");
489
-
490
- $current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
491
- $new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
492
- $src = str_replace( $current_include_url , $new_include_url , $src);
493
-
494
- return $src;
495
- }
496
-
497
-
498
- function style_loader_src($src, $handle)
499
- {
500
- if ( $this->wph->disable_filters )
501
- return $src;
502
-
503
- $new_include_path = ltrim(rtrim($this->functions->get_module_item_setting('new_include_path' , $this->get_module_id()), "/"), "/");
504
-
505
- $current_include_url = trailingslashit( $this->wph->default_variables['include_url'] );
506
- $new_include_url = trailingslashit( trailingslashit( site_url() ) . $new_include_path );
507
- $src = str_replace( $current_include_url , $new_include_url , $src);
508
-
509
- return $src;
510
- }
511
-
512
- function wp_default_scripts($scripts)
513
- {
514
- //check if custom admin url is set
515
- $include_path = $this->functions->get_module_item_setting('new_include_path' , $this->get_module_id());
516
- if (empty( $include_path ))
517
- return;
518
-
519
- $scripts = $this->functions->default_scripts_styles_replace($scripts, array('wp-includes' => $include_path));
520
- }
521
-
522
-
523
-
524
- /**
525
- * New Plugin Path
526
- *
527
- * @param mixed $saved_field_data
528
- */
529
- function _callback_new_plugin_path($saved_field_data)
530
- {
531
- if(empty($saved_field_data))
532
- return FALSE;
533
-
534
- //add_filter('plugins_url',array( $this, 'plugins_url' ), 10, 3);
535
-
536
- //add default plugin path replacement
537
- $new_plugin_path = $this->functions->untrailingslashit_all( $this->functions->get_module_item_setting('new_plugin_path' , $this->get_module_id()) );
538
- $new_plugin_path = trailingslashit( site_url() ) . untrailingslashit( $new_plugin_path );
539
- $this->wph->urls_replacement[WP_PLUGIN_URL] = $new_plugin_path;
540
- }
541
-
542
- function _callback_saved_new_plugin_path($saved_field_data)
543
- {
544
- $processing_response = array();
545
-
546
- //check if the field is noe empty
547
- if(empty($saved_field_data))
548
- return $processing_response;
549
-
550
- $plugin_path = $this->functions->get_url_path( WP_PLUGIN_URL );
551
-
552
- $path = '';
553
- if(!empty($this->wph->default_variables['wordpress_directory']))
554
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
555
- $path .= trailingslashit( $saved_field_data );
556
-
557
- $processing_response['htaccess'] = "\nRewriteRule ^" . trailingslashit( $path ) . '(.*) '. $plugin_path .'$1 [L,QSA]';
558
-
559
- return $processing_response;
560
- }
561
-
562
- function plugins_url($url, $path, $plugin)
563
- {
564
- $new_url = str_replace(WP_PLUGIN_URL, "", $url);
565
- $new_url = $this->functions->untrailingslashit_all( $new_url );
566
-
567
- $new_plugin_path = $this->functions->untrailingslashit_all( $this->functions->get_module_item_setting('new_plugin_path' , $this->get_module_id()) );
568
-
569
- $new_url = trailingslashit( site_url() ) . trailingslashit( $new_plugin_path ) . $new_url;
570
-
571
- return $new_url;
572
- }
573
-
574
- function _callback_saved_block_plugins_url($saved_field_data)
575
- {
576
- $processing_response = array();
577
-
578
- if(empty($saved_field_data) || $saved_field_data == 'no')
579
- return FALSE;
580
-
581
- //prevent from blocking if the wp-include is not modified
582
- $new_theme_path = ltrim(rtrim($this->functions->get_module_item_setting('new_plugin_path' , $this->get_module_id()), "/"), "/");
583
- if (empty( $new_theme_path ))
584
- return FALSE;
585
-
586
- $home_url = defined('WP_HOME') ? WP_HOME : get_option('home');
587
- $home_url = untrailingslashit($home_url);
588
-
589
- $default_plugin_url = untrailingslashit ( WP_PLUGIN_URL );
590
- $default_plugin_url = str_replace( $home_url, "", $default_plugin_url);
591
- $default_plugin_url = ltrim(rtrim($default_plugin_url, "/"), "/");
592
-
593
- $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
594
- $text .= "RewriteRule ^". $default_plugin_url ."(.*) /404 [L]";
595
-
596
- $processing_response['htaccess'] = $text;
597
-
598
- return $processing_response;
599
-
600
-
601
- }
602
-
603
-
604
-
605
- /**
606
- * New Upload Path
607
- *
608
- * @param mixed $saved_field_data
609
- */
610
- function _callback_new_upload_path($saved_field_data)
611
- {
612
- if(empty($saved_field_data))
613
- return FALSE;
614
-
615
-
616
- add_filter('upload_dir', array( $this, 'upload_dir' ), 999);
617
- //add_filter('wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 999, 2);
618
- }
619
-
620
- function _callback_saved_new_upload_path($saved_field_data)
621
- {
622
- $processing_response = array();
623
-
624
- //check if the field is noe empty
625
- if(empty($saved_field_data))
626
- return $processing_response;
627
-
628
- $wp_upload_dir = wp_upload_dir();
629
-
630
- $uploads_path = $this->functions->get_url_path( $wp_upload_dir['baseurl'] );
631
-
632
- $path = '';
633
- if(!empty($this->wph->default_variables['wordpress_directory']))
634
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
635
- $path .= trailingslashit( $saved_field_data );
636
-
637
- $processing_response['htaccess'] = "\nRewriteRule ^" . $path . '(.*) '. $uploads_path .'$1 [L,QSA]';
638
-
639
- return $processing_response;
640
- }
641
-
642
-
643
- function upload_dir($data)
644
- {
645
-
646
- $new_upload_path = $this->functions->untrailingslashit_all( $this->functions->get_module_item_setting('new_upload_path' , $this->get_module_id()) );
647
-
648
- $new_url = trailingslashit( site_url() ) . $new_upload_path;
649
-
650
- //$data['baseurl'] = $new_url;
651
-
652
- //add replacement
653
- if(!isset($this->wph->urls_replacement[ $this->wph->default_variables['upload_url'] ]))
654
- {
655
- //prevent media images from being replaced on admin, as when plugin disable the links will not work anymore
656
- $block_upload_url = $this->functions->get_module_item_setting('block_upload_url' , $this->get_module_id());
657
- if(!is_admin() || (is_admin() && !empty($block_upload_url) && $block_upload_url != 'no'))
658
- {
659
- $this->wph->urls_replacement[$this->wph->default_variables['upload_url']] = $new_url;
660
- }
661
- }
662
-
663
- return $data;
664
- }
665
-
666
- /*
667
- function wp_get_attachment_url($url, $post_ID)
668
- {
669
- $new_upload_path = $this->functions->untrailingslashit_all( $this->functions->get_module_item_setting('new_upload_path' , $this->get_module_id()) );
670
- $new_url = trailingslashit( site_url() ) . $new_upload_path;
671
-
672
- $url = str_replace($this->wph->default_variables['upload_url'], $new_url, $url);
673
-
674
- return $url;
675
- }
676
- */
677
-
678
- function _callback_saved_block_upload_url($saved_field_data)
679
- {
680
- $processing_response = array();
681
-
682
- if(empty($saved_field_data) || $saved_field_data == 'no')
683
- return FALSE;
684
-
685
- //prevent from blocking if the wp-include is not modified
686
- $new_upload_path = $this->functions->get_module_item_setting('new_upload_path' , $this->get_module_id());
687
- if (empty( $new_upload_path ))
688
- return FALSE;
689
-
690
- $wp_upload_dir = wp_upload_dir();
691
-
692
- $default_upload_url = untrailingslashit ( $wp_upload_dir['baseurl'] );
693
- $default_upload_url = str_replace( site_url(), "", $default_upload_url);
694
- $default_upload_url = ltrim(rtrim($default_upload_url, "/"), "/");
695
-
696
- $path = '';
697
- if(!empty($this->wph->default_variables['wordpress_directory']))
698
- $path = trailingslashit($this->wph->default_variables['wordpress_directory']);
699
- $path .= $default_upload_url;
700
-
701
- $text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
702
- $text .= "RewriteRule ^". $path ."(.*) /404 [L]";
703
-
704
- $processing_response['htaccess'] = $text;
705
-
706
- return $processing_response;
707
-
708
-
709
- }
710
-
711
-
712
 
713
 
714
  }
3
 
4
  class WPH_module_rewrite extends WPH_module
5
  {
6
+
7
+ function load_components()
8
+ {
9
+
10
+ //add components
11
+ include(WPH_PATH . "/modules/components/rewrite-default.php");
12
+ $this->components[] = new WPH_module_rewrite_default();
13
+
14
+ include(WPH_PATH . "/modules/components/rewrite-new_theme_path.php");
15
+ $this->components[] = new WPH_module_rewrite_new_theme_path();
16
+
17
+ include(WPH_PATH . "/modules/components/rewrite-new_include_path.php");
18
+ $this->components[] = new WPH_module_rewrite_new_include_path();
19
+
20
+ include(WPH_PATH . "/modules/components/rewrite-wp_content_path.php");
21
+ $this->components[] = new WPH_module_rewrite_wp_content_path();
22
+
23
+ include(WPH_PATH . "/modules/components/rewrite-new_plugin_path.php");
24
+ $this->components[] = new WPH_module_rewrite_new_plugin_path();
25
+
26
+ include(WPH_PATH . "/modules/components/rewrite-new_upload_path.php");
27
+ $this->components[] = new WPH_module_rewrite_new_upload_path();
28
+
29
+
30
+ //action available for mu-plugins
31
+ do_action('wp-hide/module_load_components', $this);
32
+
33
+ }
34
+
35
  function get_module_id()
36
  {
37
  return 'rewrite';
64
  return $interface_data;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
 
69
  }
readme.txt CHANGED
@@ -3,30 +3,33 @@ Contributors: nsp-code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: hide, security, improve security, hacking, wp hide, wordpress hide
5
  Requires at least: 2.8
6
- Tested up to: 4.4.1
7
- Stable tag: 1.0.4
8
 
9
- Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
10
 
11
  == Description ==
12
 
13
- The easy way to completely hide your WordPress core files path from being show on front side. This is a huge improvement over Site Security. Provide a simple way to clean up html by removing WordPress fingerprints.
14
 
15
  Being the best content management system, widely used, WordPress is susceptible to a large range of hacking attacks including brute-force, SQL injections, XSS, XSRF etc. Despite the fact the WordPress core is a very secure code maintained by a team of professional enthusiast, the additional plugins and themes makes the vulnerable spot of every website. In many cases, those are created by pseudo-developers who do not follow the best coding practices or simply do not own the experience to create a secure plugin.
16
  Statistics reveal that every day new vulnerabilities are discovered, many affecting hundreds of thousands of WordPress websites.
17
  Over 99,9% of hacked WordPress websites are target of automated malware scripts, who search for certain WordPress fingerprints. This plugin hide or replace those traces, making the hacking boots attacks useless.
18
 
19
- Main plugin functionality:
20
 
21
  * Custom admin Url
22
  * Block default urls
 
23
  * Custom wp-login.php filename
24
- * Block default wo-login.php
 
25
  * Adjustable theme url
26
  * New child theme url
27
  * Change theme style file name
28
  * Custom wp-include
29
  * Block default wp-include paths
 
30
  * Custom plugins urls
31
  * Block default plugins paths
32
  * New upload url
@@ -35,6 +38,7 @@ Main plugin functionality:
35
  * Meta Generator block
36
  * Remove wlwmanifest Meta
37
  * Remove rsd_link Meta
 
38
 
39
  and many more.
40
 
@@ -56,13 +60,19 @@ and many more.
56
 
57
  Feel free to contact us at electronice_delphi@yahoo.com
58
 
 
 
 
 
 
 
59
  = I have no PHP knowledge at all, is this plugin for me? =
60
 
61
  There's no requirements on php knowledge. All plugin features and functionality are applied automatically, controlled through a descriptive admin interface.
62
 
63
- = I can't find a functionality that i feel i need =
64
 
65
- Please get in touch with us and we'll do our best to include it for a later version.
66
 
67
  == Screenshots ==
68
 
@@ -71,6 +81,23 @@ Please get in touch with us and we'll do our best to include it for a later vers
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  = 1.0.4 =
75
  * Text Domain fix from wp-hide to wp-hide-security-enhancer
76
 
@@ -90,4 +117,5 @@ Always keep plugin up to date.
90
 
91
 
92
  == Localization ==
93
- Available in English.
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: hide, security, improve security, hacking, wp hide, wordpress hide
5
  Requires at least: 2.8
6
+ Tested up to: 4.4.2
7
+ Stable tag: 1.1
8
 
9
+ Hide and increase Security for your WordPress website instance using smart techniques. **No files are changed on your server**.
10
 
11
  == Description ==
12
 
13
+ The **easy way to completely hide your WordPress** core files path from being show on front side. This is a huge improvement over Site Security. Provide a simple way to clean up html by removing WordPress fingerprints.
14
 
15
  Being the best content management system, widely used, WordPress is susceptible to a large range of hacking attacks including brute-force, SQL injections, XSS, XSRF etc. Despite the fact the WordPress core is a very secure code maintained by a team of professional enthusiast, the additional plugins and themes makes the vulnerable spot of every website. In many cases, those are created by pseudo-developers who do not follow the best coding practices or simply do not own the experience to create a secure plugin.
16
  Statistics reveal that every day new vulnerabilities are discovered, many affecting hundreds of thousands of WordPress websites.
17
  Over 99,9% of hacked WordPress websites are target of automated malware scripts, who search for certain WordPress fingerprints. This plugin hide or replace those traces, making the hacking boots attacks useless.
18
 
19
+ **Main plugin functionality:**
20
 
21
  * Custom admin Url
22
  * Block default urls
23
+ * Block any direct folder access to completely hide the structure
24
  * Custom wp-login.php filename
25
+ * Block default wp-login.php
26
+ * Block default wp-signup.php
27
  * Adjustable theme url
28
  * New child theme url
29
  * Change theme style file name
30
  * Custom wp-include
31
  * Block default wp-include paths
32
+ * Block defalt wp-content
33
  * Custom plugins urls
34
  * Block default plugins paths
35
  * New upload url
38
  * Meta Generator block
39
  * Remove wlwmanifest Meta
40
  * Remove rsd_link Meta
41
+ * Remove wpemoji
42
 
43
  and many more.
44
 
60
 
61
  Feel free to contact us at electronice_delphi@yahoo.com
62
 
63
+ = Something is wrong, what can i do? =
64
+
65
+ Go to admin, and change some of plugin options to see which one cause the problem. Then report it to forum or get in touch with us to fix it.
66
+ If for some reason the site appear broken, you should back-up then replace the .htaccess file located on your WordPress root. Then replace the wp-hide-security-enhancer from your plugin directory.
67
+ If still not luck, please get in touch with us at electronice_delphi@yahoo.com and we'll fix it for you in no time!
68
+
69
  = I have no PHP knowledge at all, is this plugin for me? =
70
 
71
  There's no requirements on php knowledge. All plugin features and functionality are applied automatically, controlled through a descriptive admin interface.
72
 
73
+ = I can't find a functionality that i'am looking for =
74
 
75
+ Please get in touch with us and we'll do our best to include it for a next version.
76
 
77
  == Screenshots ==
78
 
81
 
82
  == Changelog ==
83
 
84
+ = 1.1 =
85
+ * Po / Mo localisation files update
86
+ * Update class to process the further structure changes and current components fields name change.
87
+ * New Component : Wp-content folder access block
88
+ * New Component : Block default wp-signup.php file from being accesible.
89
+ * Fix: New admin url save when permalinks disable. keep on default admin url instead redirect.
90
+ * Rewrite Default mod_rewrite code, append slashes to all urls to avoid actual directory reveal
91
+ * Send e-mail notification when admin e-mail change, to prevent url forget / lose
92
+ * New Component Disable Emoji
93
+ * New Component Disable TinyMC Emoji
94
+ * Structure change on the modules, split into chunks called components
95
+ * Code Clean-up
96
+ * Set processing order for component settings to allow mod_rewrite rules placement at certain position related to another line
97
+ * Improved Template dir when child theme is active
98
+ * Allow parent theme / child theme rewrite
99
+ * mod_rewrite change for 404 error, set for WordPress internal 404 error page instead default server
100
+
101
  = 1.0.4 =
102
  * Text Domain fix from wp-hide to wp-hide-security-enhancer
103
 
117
 
118
 
119
  == Localization ==
120
+ Available in English.
121
+ Please help and translate this plugin to your language at https://translate.wordpress.org/projects/wp-plugins/wp-hide-security-enhancer
wp-hide.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.0.4
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */
@@ -22,13 +22,16 @@ Domain Path: /languages/
22
 
23
  include_once(WPH_PATH . '/include/wph.class.php');
24
  include_once(WPH_PATH . '/include/functions.class.php');
 
25
  include_once(WPH_PATH . '/include/module.class.php');
 
26
 
27
  register_deactivation_hook(__FILE__, 'WPH_deactivated');
28
  register_activation_hook(__FILE__, 'WPH_activated');
29
 
30
  function WPH_activated($network_wide)
31
  {
 
32
  flush_rewrite_rules();
33
  }
34
 
@@ -46,6 +49,10 @@ Domain Path: /languages/
46
  $wph = new WPH();
47
  $wph->init();
48
 
 
 
 
 
49
  define('WPH_URL', plugins_url('', __FILE__));
50
 
51
  add_action( 'activated_plugin', array($wph, 'activated_plugin'), 999, 2 );
5
  Description: Hide and increase Security for your WordPress website instance using smart techniques. No files are changed on your server.
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.1
9
  Text Domain: wp-hide-security-enhancer
10
  Domain Path: /languages/
11
  */
22
 
23
  include_once(WPH_PATH . '/include/wph.class.php');
24
  include_once(WPH_PATH . '/include/functions.class.php');
25
+
26
  include_once(WPH_PATH . '/include/module.class.php');
27
+ include_once(WPH_PATH . '/include/module.component.class.php');
28
 
29
  register_deactivation_hook(__FILE__, 'WPH_deactivated');
30
  register_activation_hook(__FILE__, 'WPH_activated');
31
 
32
  function WPH_activated($network_wide)
33
  {
34
+
35
  flush_rewrite_rules();
36
  }
37
 
49
  $wph = new WPH();
50
  $wph->init();
51
 
52
+ //check for update from older version
53
+ include_once(WPH_PATH . '/include/update.class.php');
54
+ new WPH_update();
55
+
56
  define('WPH_URL', plugins_url('', __FILE__));
57
 
58
  add_action( 'activated_plugin', array($wph, 'activated_plugin'), 999, 2 );