PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
<?php /** * Created by PhpStorm. * User: andreasciamanna * Date: 22/05/2018 * Time: 08:44 */ class WPML_Current_Screen { private $translatable_types = array(); private $allowed_screen_ids_for_edit_posts_list = array(); private $allowed_screen_ids_for_edit_post = array(); public function is_edit_posts_list() { return $this->get() && in_array( $this->get()->id, $this->get_allowed_screen_ids_for_edit_posts_list() ) && $this->has_posts(); } public function is_edit_post() { return $this->get() && in_array( $this->get()->id, $this->get_allowed_screen_ids_for_edit_post() ) && $this->has_post(); } private function get_translatable_types() { if ( ! $this->translatable_types ) { $translatable_types = apply_filters( 'wpml_translatable_documents', array() ); if ( $translatable_types ) { $this->translatable_types = array_keys( $translatable_types ); } } return $this->translatable_types; } private function get_allowed_screen_ids_for_edit_posts_list() { if ( ! $this->allowed_screen_ids_for_edit_posts_list ) { foreach ( $this->get_translatable_types() as $translatable_type ) { $this->allowed_screen_ids_for_edit_posts_list[] = 'edit-' . $translatable_type; } } return $this->allowed_screen_ids_for_edit_posts_list; } private function get_allowed_screen_ids_for_edit_post() { if ( ! $this->allowed_screen_ids_for_edit_post ) { foreach ( $this->get_translatable_types() as $translatable_type ) { $this->allowed_screen_ids_for_edit_post[] = $translatable_type; } } return $this->allowed_screen_ids_for_edit_post; } public function get_posts() { if ( $this->has_posts() && $this->is_edit_posts_list() ) { return $GLOBALS['posts']; } elseif ( $this->has_post() && $this->is_edit_post() ) { $post = $this->get_post(); if ( $post ) { return array( $post ); } } return array(); } private function get_post() { if ( $this->has_post() && $this->is_edit_post() ) { $post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT ); $post_type = $this->get_post_type(); return get_post( $post_id, $post_type ); } return null; } public function get_post_type() { return $this->get() ? $this->get()->post_type : null; } public function id_ends_with( $suffix ) { return $this->get() && ( substr( $this->get()->id, - strlen( $suffix ) ) === $suffix ); } /** * @return WP_Screen|null */ private function get() { return array_key_exists( 'current_screen', $GLOBALS ) ? $GLOBALS['current_screen'] : null; } private function has_posts() { return $this->get() && ( array_key_exists( 'posts', $GLOBALS ) ) && $GLOBALS['posts']; } private function has_post() { return $this->get() && array_key_exists( 'post', $_GET ); } }
[+]
wpml-wp
[+]
ajax
[-] class-wpml-tm-translators-dropdown.php
[edit]
[+]
translation-priorities
[-] class-wpml-tm-promotions.php
[edit]
[+]
hooks
[+]
ICL-20-migration
[+]
templates
[+]
action-filter-loader
[-] class-wpml-translation-proxy-api.php
[edit]
[+]
wpml-st
[+]
utilities
[-] class-wpml-tm-translated-field.php
[edit]
[+]
requirements
[+]
sticky-posts
[-] class-wpml-tm-page.php
[edit]
[+]
icl
[+]
display-as-translated
[+]
custom-field-translation
[+]
language
[+]
ATE
[+]
shortcodes
[+]
translate_link_targets
[+]
core-abstract-classes
[+]
full-site-editing
[+]
settings
[-] class-wpml-file.php
[edit]
[+]
xliff
[+]
reset
[+]
REST-hooks
[+]
comments
[+]
plugins
[+]
templating
[+]
container
[+]
taxonomy
[+]
cookie
[-] class-wpml-tm-requirements.php
[edit]
[+]
translation-dashboard
[+]
helpers
[+]
translation-feedback
[+]
admin-language-switcher
[-] class-wpml-tm-troubleshooting-clear-ts.php
[edit]
[+]
jobs
[+]
compatibility
[+]
wp-core-hooks
[+]
post-edit-screen
[-] class-wpml-tm-troubleshooting-clear-ts-ui.php
[edit]
[+]
translation-jobs
[+]
logging
[+]
roles
[+]
media
[-] class-wpml-active-plugin-provider.php
[edit]
[+]
media-translation
[-] class-wpml-config-update.php
[edit]
[+]
seo
[+]
options
[+]
Installer
[-] class-wpml-tm-ajax-factory-2.php
[edit]
[+]
automatic-translation
[+]
troubleshoot
[+]
records
[-] class-wpml-translate-independently.php
[edit]
[+]
abstract
[-] class-wpml-tm-resources-factory.php
[edit]
[+]
post-types
[+]
wp-cli
[+]
translation-proxy
[-] class-wpml-tm-loader.php
[edit]
[-] class-wpml-config-update-integrator.php
[edit]
[-] class-wpml-theme-localization-type.php
[edit]
[+]
taxonomy-term-translation
[+]
setup
[+]
language-switcher
[+]
translation-mode
[+]
jobs-deadline
[+]
database-queries
[+]
utils
[+]
translation-basket
[-] ISitePress.php
[edit]
[-] class-wpml-current-screen.php
[edit]
[-] class-wpml-tm-ajax-factory.php
[edit]
[+]
admin-bar
[+]
canonicals
[+]
custom-xml-config
[-] class-wpml-db-chunk.php
[edit]
[+]
url-handling
[+]
admin-resources
[+]
theme-plugin-localization
[+]
ui-elements
[+]
languages
[+]
wizard
[-] LanguageNegotiation.php
[edit]
[-] class-wpml-browser-redirect.php
[edit]
[+]
menu
[-] class-wpml-mo-file-search.php
[edit]
[+]
query-filtering
[+]
translation-management
[+]
filters
[-] class-wpml-xmlrpc.php
[edit]
[-] class-wpml-site-id.php
[edit]
[+]
block-editor
[+]
icl-to-ate-migration
[+]
translations
[+]
user-language
[+]
..
[+]
menu-elements
[+]
translation-batch
[-] class-wpml-tm-api.php
[edit]
[-] class-wpml-translation-management.php
[edit]
[-] class-wpml-translation-job-factory.php
[edit]
[+]
xml-config
[+]
REST
[+]
editor
[+]
admin-menu
[+]
localization
[+]
tp-client
[+]
translation-roles
[-] Geolocalization.php
[edit]
[+]
wp
[+]
API
[+]
twig-extensions
[+]
troubleshooting
[+]
privacy
[+]
user
[-] class-wpml-tm-service-activation-ajax.php
[edit]
[+]
widgets
[+]
super-globals
[+]
emails
[+]
words-count
[+]
support
[+]
post-translation
[+]
browser-language-redirect
[+]
request-handling
[+]
notices
[+]
upgrade