PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
/
utilities
<?php /** * Class WPML_Queried_Object * * @author OnTheGoSystems */ class WPML_Queried_Object { /** @var SitePress $sitepress */ private $sitepress; /** @var null|object */ private $queried_object; /** @var stdClass $queried_object_details */ private $queried_object_details; /** * WPML_TF_Queried_Object constructor. * * @param SitePress $sitepress */ public function __construct( SitePress $sitepress ) { $this->sitepress = $sitepress; $this->queried_object = get_queried_object(); } public function has_object() { return (bool) $this->queried_object; } /** * @return null|string */ public function get_source_language_code() { return $this->get_queried_object_detail( 'source_language_code' ); } /** * @return string */ public function get_language_code() { return $this->get_queried_object_detail( 'language_code' ); } /** * @param string $key * * @return null|mixed */ private function get_queried_object_detail( $key ) { $detail = null; if ( ! $this->queried_object_details ) { if ( $this->is_post() ) { $this->queried_object_details = $this->sitepress->get_element_language_details( $this->get_id(), $this->get_element_type() ); } } if ( isset( $this->queried_object_details->{$key} ) ) { $detail = $this->queried_object_details->{$key}; } return $detail; } /** * @return bool */ public function is_post() { return isset( $this->queried_object->ID, $this->queried_object->post_type ); } /** * @return null|int */ public function get_id() { $id = null; if ( isset( $this->queried_object->ID ) ) { $id = $this->queried_object->ID; } return $id; } /** * @return null|string */ public function get_element_type() { $type = null; if ( $this->is_instance_of_post_type() ) { $type = 'post_' . $this->get_post_type_name(); } if ( $this->is_instance_of_post() ) { $type = 'post_' . $this->get_post_type(); } if ( $this->is_instance_of_taxonomy() ) { $type = 'tax_' . $this->get_taxonomy(); } return $type; } /** * @return null|string */ public function get_source_url() { $url = null; $language_links = $this->sitepress->get_ls_languages(); if ( isset( $language_links[ $this->get_source_language_code() ]['url'] ) ) { $url = $language_links[ $this->get_source_language_code() ]['url']; } return $url; } public function get_post_type() { if ( $this->is_instance_of_post() ) { return $this->queried_object->post_type; } return null; } public function get_taxonomy() { if ( $this->is_instance_of_taxonomy() ) { return $this->queried_object->taxonomy; } } public function get_post_type_name() { if ( $this->is_instance_of_post_type() ) { return $this->queried_object->name; } } public function is_instance_of_post() { return $this->queried_object instanceof WP_Post; } public function is_instance_of_taxonomy() { return $this->queried_object instanceof WP_Term; } public function is_instance_of_post_type() { return $this->queried_object instanceof WP_Post_Type; } public function is_instance_of_user() { return $this->queried_object instanceof WP_User; } }
[-] class-wpml-wp-cache-factory.php
[edit]
[-] class-wpml-inactive-content.php
[edit]
[-] class-wpml-slash-management.php
[edit]
[-] class-wpml-transient.php
[edit]
[-] class-wpml-ajax.php
[edit]
[-] class-wpml-locale.php
[edit]
[-] class-wpml-string-functions.php
[edit]
[-] class-wpml-deactivate-old-media-factory.php
[edit]
[-] class-wpml-global-ajax.php
[edit]
[+]
admin
[-] AutoAdjustIdsFactory.php
[edit]
[-] wpml-queried-object.php
[edit]
[-] class-wpml-wp-query-api.php
[edit]
[-] class-debug-backtrace.php
[edit]
[-] class-wpml-temporary-switch-admin-language.php
[edit]
[-] class-wpml-flags-factory.php
[edit]
[-] class-wpml-deactivate-old-media.php
[edit]
[-] AutoAdjustIds.php
[edit]
[-] Resources.php
[edit]
[-] class-wpml-encoding.php
[edit]
[-] class-wpml-temporary-switch-language.php
[edit]
[-] class-wpml-flags.php
[edit]
[+]
..
[-] Pager.php
[edit]
[-] class-wpml-wp-post.php
[edit]
[-] class-wpml-cache-factory.php
[edit]
[-] wpml-uuid.php
[edit]
[-] class-wpml-encoding-validation.php
[edit]
[-] wpml-languages-notices.php
[edit]
[-] class-wpml-non-persistent-cache.php
[edit]
[+]
user
[-] class-wpml-wp-cache.php
[edit]
[+]
lock
[-] class-wpml-simple-language-selector.php
[edit]
[-] class-wpml-debug-backtrace.php
[edit]
[-] class-wpml-wp-taxonomy-query.php
[edit]
[-] class-wpml-wp-cache-item.php
[edit]
[-] class-wpml-translate-link-targets.php
[edit]