Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../classes
File: class-wpml-current-screen.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Created by PhpStorm.
[3] Fix | Delete
* User: andreasciamanna
[4] Fix | Delete
* Date: 22/05/2018
[5] Fix | Delete
* Time: 08:44
[6] Fix | Delete
*/
[7] Fix | Delete
class WPML_Current_Screen {
[8] Fix | Delete
private $translatable_types = array();
[9] Fix | Delete
private $allowed_screen_ids_for_edit_posts_list = array();
[10] Fix | Delete
private $allowed_screen_ids_for_edit_post = array();
[11] Fix | Delete
[12] Fix | Delete
public function is_edit_posts_list() {
[13] Fix | Delete
return $this->get() && in_array( $this->get()->id, $this->get_allowed_screen_ids_for_edit_posts_list() )
[14] Fix | Delete
&& $this->has_posts();
[15] Fix | Delete
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function is_edit_post() {
[19] Fix | Delete
return $this->get() && in_array( $this->get()->id, $this->get_allowed_screen_ids_for_edit_post() )
[20] Fix | Delete
&& $this->has_post();
[21] Fix | Delete
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
private function get_translatable_types() {
[25] Fix | Delete
if ( ! $this->translatable_types ) {
[26] Fix | Delete
$translatable_types = apply_filters( 'wpml_translatable_documents', array() );
[27] Fix | Delete
if ( $translatable_types ) {
[28] Fix | Delete
$this->translatable_types = array_keys( $translatable_types );
[29] Fix | Delete
}
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
return $this->translatable_types;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
private function get_allowed_screen_ids_for_edit_posts_list() {
[36] Fix | Delete
if ( ! $this->allowed_screen_ids_for_edit_posts_list ) {
[37] Fix | Delete
foreach ( $this->get_translatable_types() as $translatable_type ) {
[38] Fix | Delete
$this->allowed_screen_ids_for_edit_posts_list[] = 'edit-' . $translatable_type;
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
return $this->allowed_screen_ids_for_edit_posts_list;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
[46] Fix | Delete
private function get_allowed_screen_ids_for_edit_post() {
[47] Fix | Delete
if ( ! $this->allowed_screen_ids_for_edit_post ) {
[48] Fix | Delete
foreach ( $this->get_translatable_types() as $translatable_type ) {
[49] Fix | Delete
$this->allowed_screen_ids_for_edit_post[] = $translatable_type;
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
return $this->allowed_screen_ids_for_edit_post;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
public function get_posts() {
[57] Fix | Delete
if ( $this->has_posts() && $this->is_edit_posts_list() ) {
[58] Fix | Delete
return $GLOBALS['posts'];
[59] Fix | Delete
} elseif ( $this->has_post() && $this->is_edit_post() ) {
[60] Fix | Delete
$post = $this->get_post();
[61] Fix | Delete
[62] Fix | Delete
if ( $post ) {
[63] Fix | Delete
return array( $post );
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
return array();
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
private function get_post() {
[71] Fix | Delete
if ( $this->has_post() && $this->is_edit_post() ) {
[72] Fix | Delete
$post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT );
[73] Fix | Delete
$post_type = $this->get_post_type();
[74] Fix | Delete
[75] Fix | Delete
return get_post( $post_id, $post_type );
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
return null;
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
public function get_post_type() {
[82] Fix | Delete
return $this->get() ? $this->get()->post_type : null;
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
public function id_ends_with( $suffix ) {
[86] Fix | Delete
return $this->get() && ( substr( $this->get()->id, - strlen( $suffix ) ) === $suffix );
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* @return WP_Screen|null
[91] Fix | Delete
*/
[92] Fix | Delete
private function get() {
[93] Fix | Delete
return array_key_exists( 'current_screen', $GLOBALS ) ? $GLOBALS['current_screen'] : null;
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
private function has_posts() {
[97] Fix | Delete
return $this->get()
[98] Fix | Delete
&& ( array_key_exists( 'posts', $GLOBALS ) )
[99] Fix | Delete
&& $GLOBALS['posts'];
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
private function has_post() {
[103] Fix | Delete
return $this->get()
[104] Fix | Delete
&& array_key_exists( 'post', $_GET );
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function