¨
rõõU ˙˙˙˙P m ?˙rõõU Ā n =ÄæqõõU P P n uØ
rõõU n <ĘĶqõõU ` n &ÁqõõU p ` o &˙rõõU ` q =ÄæqõõU p P q urõõU ° q bÄqõõU ° Ā q
ÜŊqõõU Ā q +˙rõõU Đ r =ÄæqõõU P P r uØ
rõõU Đ r <ĘĶqõõU p Đ r &ėqõõU p u +˙rõõU 0 v =˙rõõU @ v =ÄæqõõU ` P v uØ
rõõU đ v <ũqõõU đ P v u˙rõõU P v =ÄæqõõU ` P v uØ
rõõU v <rõõU ` v 5ŊqõõU ` v AÄæqõõU ` p v urõõU v ĘĶqõõU ` v &˙rõõU ` p w =ÄæqõõU ` P w urõõU @ w ÎĖqõõU @ P w ˙rõõU 0 w =˙rõõU ` w =ÄæqõõU ` P w urõõU ` w ũqõõU ` P w u˙rõõU ° w =ÄæqõõU ` P w uØ
rõõU p w <ũqõõU p ` w uØ
rõõU w <JĮqõõU P w NÔqõõU ` w &˙rõõU Ā } =˙rõõU ` Đ } =ÄæqõõU ` P } urõõU ° } ũqõõU ° P } u×rõõU } <˙rõõU p ā =ÄæqõõU p P uÄæqõõU ` ` urõõU Đ bÄqõõU Đ ā
ÜŊqõõU ā @ +ÖqõõU ` đ &ZĩqõõU @ *ÖqõõU ` &íqõõU ` >^rõõU ˙˙˙˙ > ¨
rõõU ˙˙˙˙P
?¨
rõõU ˙˙˙˙`
?¨
rõõU ˙˙˙˙p
?¨
rõõU ˙˙˙˙
?rõõU
@rõõU
@rõõU °
@rõõU 0 Ā
@˙rõõU @ @ =ÄæqõõU P P uÄæqõõU Ā ` uyrõõU P p AÄæqõõU uÄæqõõU ° uØ
rõõU ā <ĘĶqõõU Đ ā &ėqõõU ā +*įqõõU {ÜŊqõõU +˙rõõU ` =ÄæqõõU P uØ
rõõU <rõõU p ÎĖqõõU 0 NÔqõõU 0 &ZĩqõõU *āįqõõU P P rõõU P ` ÎĖqõõU ` p NÔqõõU p
&ZĩqõõU @ *ÖqõõU ° &ėqõõU ` +˙rõõU Ā =ÄæqõõU P uØ
rõõU <rõõU Đ ° ÎĖqõõU ° ā Ā ZÆqõõU Ā Đ ÎĖqõõU Đ đ ā ZÆqõõU ā Đ đ ÎĖqõõU đ NÔqõõU Đ &˙rõõU `
¨ =yrõõU P ¨ AÄæqõõU Đ ` ¨ uÄæqõõU P p ¨ uÄæqõõU ` ¨ uÄæqõõU p ¨ uÄæqõõU ¨ uÄæqõõU ° ¨ uÄæqõõU ° Ā ¨ uÄæqõõU Ā Đ ¨ uÄæqõõU
ā ¨ uØ
rõõU ¨ <ĘĶqõõU Đ ¨ &íqõõU Đ Ē >^rõõU 0 ˙˙˙˙Ģ > m m 6 ° m 7 m 7 m 7 m 8 'sanitize_type' => array(array($this->wph->functions, 'sanitize_file_path_name')),
'processing_order' => 16
);
}
return $this->module_settings;
}
function set_module_components_description( $component_settings )
{
$all_plugins = $this->wph->functions->get_plugins();
foreach ( $component_settings as $component_key => $component_setting )
{
if ( ! isset ( $component_setting['id'] ) )
continue;
switch ( $component_setting['id'] )
{
case 'new_plugin_path' :
$component_setting = array_merge ( $component_setting , array(
'label' => __('New Plugins Path', 'wp-hide-security-enhancer'),
'description' => __('The default plugins path is set to', 'wp-hide-security-enhancer') . ' '. str_replace(get_bloginfo('wpurl'), '' ,$this->wph->default_variables['plugins_url']) .'',
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('New Plugins Path', 'wp-hide-security-enhancer'),
'description' => __("Use any alphanumeric symbols for this field which will be used as the new slug for the plugins folder. Presuming the `apps` slug is being used, all plugins urls become to something like this:", 'wp-hide-security-enhancer') . "
http://-domain-name-/apps/jetpack/
",
'option_documentation_url' => 'https://wp-hide.com/documentation/rewrite-plugins/'
),
'value_description' => 'e.g. apps',
) );
break;
case 'block_plugins_url' :
$component_setting = array_merge ( $component_setting , array(
'label' => __('Block plugins URL', 'wp-hide-security-enhancer'),
'description' => __('Block default /wp-content/plugins/ files from being accesible through default urls.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('Block plugins URL', 'wp-hide-security-enhancer'),
'description' => __("This blocks the default wp-content/plugins/ url.
The functionality apply only if New Plugins Path option is filled in.", 'wp-hide-security-enhancer'),
'option_documentation_url' => 'https://wp-hide.com/documentation/rewrite-plugins/'
),
'advanced_option' => array(
'description' => '' . __('This is an advanced option !', 'wp-hide-security-enhancer') . '
' . __('This can break the layout if server not supporting the feature. Ensure `New Plugins Path` option works fine before activate this. Once active test it thoroughly.
If not working, set to No to revert.', 'wp-hide-security-enhancer')
),
'options' => array(
'no' => __('No', 'wp-hide-security-enhancer'),
'yes' => __('Yes', 'wp-hide-security-enhancer'),
),
) );
break;
case preg_match('/^new_plugin_path_[\w-]+$/', $component_setting['id'] ) === 1 :
//get active plugins
$active_plugins = (array) get_option( 'active_plugins', array() );
foreach( $active_plugins as $active_plugin )
{
//exclude this plugins
if( in_array($active_plugin, array('wp-hide-security-enhancer/wp-hide.php', 'wp-hide-security-enhancer-pro/wp-hide.php')) )
continue;
$plugin_slug = sanitize_title($active_plugin);
if(!isset($all_plugins[$active_plugin]))
continue;
if ( 'new_plugin_path_' . $plugin_slug !== $component_setting['id'] )
continue;
$pluding_data = $all_plugins[$active_plugin];
$component_setting = array_merge ( $component_setting , array(
'label' => __('New Path for', 'wp-hide-security-enhancer') . " " . $pluding_data['Name'] ." ". __('plugin', 'wp-hide-security-enhancer'),
'description' => __('This setting if set, overwrites the', 'wp-hide-security-enhancer') . ' ' . __('New Plugin Path', 'wp-hide-security-enhancer') . ' ' . __('value for this plugin.', 'wp-hide-security-enhancer'),
'help' => array(
'title' => __('Help', 'wp-hide-security-enhancer') . ' - ' . __('New Path for', 'wp-hide-security-enhancer') . " " . $pluding_data['Name'] ." ",
'description' => "Use any alphanumeric symbols for this field which will be used as the new slug for the plugin folder. Presuming the `module_name` slug is being used, this particular plugin urls become to:
http://-domain-name-/module_name/
",
'option_documentation_url' => 'https://wp-hide.com/documentation/rewrite-plugins/'
),
'value_description' => 'e.g. modules/module' . rand( 100,999 ),
));
}
break;
}
$component_settings[ $component_key ] = $component_setting;
}
return $component_settings;
}
function _init_new_plugin_path($saved_field_data)
{
//add custom plugins path replacements
//get active plugins
$active_plugins = (array) get_option( 'active_plugins', array() );
foreach($active_plugins as $active_plugin)
{
$active_plugin_split = explode('/', $active_plugin);
$active_plugin_directory = $active_plugin_split[0];
$plugin_slug = sanitize_title($active_plugin);
$option_namespace = 'new_plugin_path_' . $plugin_slug;
//check if plugin have custom url
$plugin_custom_path = $this->wph->functions->get_module_item_setting($option_namespace);
if(empty($plugin_custom_path))
continue;
//add custom path
$new_url = trailingslashit( site_url() ) . $plugin_custom_path;
if(!empty($path))
$new_url = trailingslashit( $new_url ) . $path;
//add replacement
$new_plugin_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_plugin_path') );
$replace_url = trailingslashit( trailingslashit( WP_PLUGIN_URL ) . $active_plugin_directory );
$replacement_url = trailingslashit( trailingslashit( home_url() ) . $plugin_custom_path );
//replace any spaces
$replace_url = str_replace (" ", "%20", $replace_url );
$this->wph->functions->add_replacement( $replace_url, $replacement_url);
}
if(empty($saved_field_data))
return FALSE;
//add default plugin path replacement
$new_plugin_path = $this->wph->functions->untrailingslashit_all( $this->wph->functions->get_module_item_setting('new_plugin_path') );
$new_plugin_path = trailingslashit( home_url() ) . untrailingslashit( $new_plugin_path );
$this->wph->functions->add_replacement( WP_PLUGIN_URL, $new_plugin_path );
return TRUE;
}
function _callback_saved_new_plugin_path($saved_field_data)
{
$processing_response = array();
$rewrite = '';
$plugin_path = $this->wph->functions->get_url_path( WP_PLUGIN_URL );
$path = '';
if(!empty($saved_field_data))
$path .= trailingslashit( $saved_field_data );
$rewrite_to = $this->wph->functions->get_rewrite_to_base( $plugin_path );
//add custom rewrite for plugins
//get active plugins
$active_plugins = (array) get_option( 'active_plugins', array() );
foreach($active_plugins as $active_plugin)
{
$active_plugin_split = explode('/', $active_plugin);
$active_plugin_directory = $active_plugin_split[0];
$plugin_slug = sanitize_title($active_plugin);
$option_namespace = 'new_plugin_path_' . $plugin_slug;
//check if plugin have custom url
$plugin_custom_path = $this->wph->functions->get_module_item_setting($option_namespace);
if(empty($plugin_custom_path))
continue;
//add custom path
$new_url = trailingslashit( site_url() ) . $plugin_custom_path;
if($path != '/')
$new_url = trailingslashit( $new_url ) . $path;
$plugin_rewrite_to = $this->wph->functions->get_rewrite_to_base( trailingslashit($plugin_path) . $active_plugin_directory );
if($this->wph->server_htaccess_config === TRUE)
$rewrite .= "\nRewriteRule ^" . trailingslashit( $plugin_custom_path ) . '(.+) "'. $plugin_rewrite_to .'$1" [L,QSA]';
if($this->wph->server_web_config === TRUE)
$rewrite .= '
';
}
if( !empty($path) && !empty($saved_field_data))
{
if($this->wph->server_htaccess_config === TRUE)
$rewrite .= "\nRewriteRule ^" . trailingslashit( $path ) . '(.+) '. $rewrite_to .'$1 [L,QSA]';
if($this->wph->server_web_config === TRUE)
$rewrite .= '
';
}
$processing_response['rewrite'] = $rewrite;
return $processing_response;
}
function _callback_saved_block_plugins_url($saved_field_data)
{
$processing_response = array();
if(empty($saved_field_data) || $saved_field_data == 'no')
return FALSE;
//prevent from blocking if the wp-include is not modified
$new_theme_path = ltrim(rtrim($this->wph->functions->get_module_item_setting('new_plugin_path'), "/"), "/");
if (empty( $new_theme_path ))
return FALSE;
$home_url = defined('WP_HOME') ? WP_HOME : get_option('home');
$home_url = untrailingslashit($home_url);
$default_plugin_url = untrailingslashit ( WP_PLUGIN_URL );
$default_plugin_url = str_replace( $home_url, "", $default_plugin_url);
$default_plugin_url = ltrim(rtrim($default_plugin_url, "/"), "/");
$rewrite_to = $this->wph->functions->get_rewrite_to_base( 'index.php', TRUE, FALSE, 'site_path' );
$text = '';
if($this->wph->server_htaccess_config === TRUE)
{
$text = "RewriteCond %{ENV:REDIRECT_STATUS} ^$\n";
$text .= "RewriteRule ^". $default_plugin_url ."(.+) ". $rewrite_to ."?wph-throw-404 [L]";
}
if($this->wph->server_web_config === TRUE)
$text = '
';
$processing_response['rewrite'] = $text;
return $processing_response;
}
}
?>