Version Description
- Fix attachment_url_to_postid
- Fix undefined get_metadata_raw
Download this release
Release Info
Developer | nsp-code |
Plugin | WP Hide & Security Enhancer |
Version | 1.6.3.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.3.2 to 1.6.3.3
- include/wph.class.php +57 -1
- readme.txt +5 -1
- wp-hide.php +1 -1
include/wph.class.php
CHANGED
@@ -173,6 +173,8 @@
|
|
173 |
|
174 |
//prevent the buffer processing if not filterable available
|
175 |
add_filter( 'wp-hide/ignore_ob_start_callback', array($this, 'ignore_ob_start_callback'), 999 );
|
|
|
|
|
176 |
|
177 |
}
|
178 |
|
@@ -1544,7 +1546,7 @@
|
|
1544 |
$passed_value = wp_slash($meta_value);
|
1545 |
|
1546 |
// Compare existing value to new value if no prev value given and the key exists only once.
|
1547 |
-
if ( empty( $prev_value ) )
|
1548 |
{
|
1549 |
$old_value = get_metadata_raw( $meta_type, $object_id, $meta_key );
|
1550 |
if ( is_countable( $old_value ) && count( $old_value ) === 1 )
|
@@ -1725,6 +1727,60 @@
|
|
1725 |
return $data;
|
1726 |
}
|
1727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1728 |
|
1729 |
|
1730 |
/**
|
173 |
|
174 |
//prevent the buffer processing if not filterable available
|
175 |
add_filter( 'wp-hide/ignore_ob_start_callback', array($this, 'ignore_ob_start_callback'), 999 );
|
176 |
+
|
177 |
+
add_filter( 'attachment_url_to_postid', array ( $this, 'attachment_url_to_postid' ) , 999, 2 );
|
178 |
|
179 |
}
|
180 |
|
1546 |
$passed_value = wp_slash($meta_value);
|
1547 |
|
1548 |
// Compare existing value to new value if no prev value given and the key exists only once.
|
1549 |
+
if ( empty( $prev_value ) && function_exists( 'get_metadata_raw' ) )
|
1550 |
{
|
1551 |
$old_value = get_metadata_raw( $meta_type, $object_id, $meta_key );
|
1552 |
if ( is_countable( $old_value ) && count( $old_value ) === 1 )
|
1727 |
return $data;
|
1728 |
}
|
1729 |
|
1730 |
+
|
1731 |
+
|
1732 |
+
function attachment_url_to_postid ( $post_id, $url )
|
1733 |
+
{
|
1734 |
+
|
1735 |
+
if ( $post_id > 0 )
|
1736 |
+
return $post_id;
|
1737 |
+
|
1738 |
+
|
1739 |
+
global $wpdb, $wph;
|
1740 |
+
|
1741 |
+
$url = $wph->functions->content_urls_replacement( $url, array_flip ( $wph->functions->get_replacement_list() ) );
|
1742 |
+
|
1743 |
+
$dir = wp_get_upload_dir();
|
1744 |
+
$path = $url;
|
1745 |
+
|
1746 |
+
$site_url = parse_url( $dir['url'] );
|
1747 |
+
$image_path = parse_url( $path );
|
1748 |
+
|
1749 |
+
// Force the protocols to match if needed.
|
1750 |
+
if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) {
|
1751 |
+
$path = str_replace( $image_path['scheme'], $site_url['scheme'], $path );
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
|
1755 |
+
$path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
$sql = $wpdb->prepare(
|
1759 |
+
"SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
|
1760 |
+
$path
|
1761 |
+
);
|
1762 |
+
|
1763 |
+
$results = $wpdb->get_results( $sql );
|
1764 |
+
$post_id = null;
|
1765 |
+
|
1766 |
+
if ( $results ) {
|
1767 |
+
// Use the first available result, but prefer a case-sensitive match, if exists.
|
1768 |
+
$post_id = reset( $results )->post_id;
|
1769 |
+
|
1770 |
+
if ( count( $results ) > 1 ) {
|
1771 |
+
foreach ( $results as $result ) {
|
1772 |
+
if ( $path === $result->meta_value ) {
|
1773 |
+
$post_id = $result->post_id;
|
1774 |
+
break;
|
1775 |
+
}
|
1776 |
+
}
|
1777 |
+
}
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
return $post_id;
|
1781 |
+
|
1782 |
+
}
|
1783 |
+
|
1784 |
|
1785 |
|
1786 |
/**
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.nsp-code.com/
|
|
4 |
Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 5.7
|
7 |
-
Stable tag: 1.6.3.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide WordPress default paths, wp-content, wp-includes, wp-admin, login URL, plugins, themes etc. Block the defaults for being still accessible. No files and data are changed on your server.
|
@@ -355,6 +355,10 @@ Please get in touch with us and we'll do our best to include it for a next versi
|
|
355 |
|
356 |
== Changelog ==
|
357 |
|
|
|
|
|
|
|
|
|
358 |
= 1.6.3.2 =
|
359 |
* Confirmation page for Recovery link
|
360 |
* Use home_url() instead site_url() for recovery links to ensure the format is correct for WordPress instances using own directory
|
4 |
Tags: wordpress hide, hide, security, improve security, hacking, wp hide, custom login, wp-loging.php, wp-admin, admin hide, login change,
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 5.7
|
7 |
+
Stable tag: 1.6.3.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Hide WordPress default paths, wp-content, wp-includes, wp-admin, login URL, plugins, themes etc. Block the defaults for being still accessible. No files and data are changed on your server.
|
355 |
|
356 |
== Changelog ==
|
357 |
|
358 |
+
= 1.6.3.3 =
|
359 |
+
* Fix attachment_url_to_postid
|
360 |
+
* Fix undefined get_metadata_raw
|
361 |
+
|
362 |
= 1.6.3.2 =
|
363 |
* Confirmation page for Recovery link
|
364 |
* Use home_url() instead site_url() for recovery links to ensure the format is correct for WordPress instances using own directory
|
wp-hide.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.wp-hide.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.6.3.
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|
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.6.3.3
|
9 |
Text Domain: wp-hide-security-enhancer
|
10 |
Domain Path: /languages/
|
11 |
*/
|