PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
<?php /** * WPML_File class file. * * @package wpml-core */ /** * Class WPML_File */ class WPML_File { /** * WPML WP API instance. * * @var WPML_WP_API $wp_api */ private $wp_api; /** * WP_Filesystem_Direct instance. * * @var WP_Filesystem_Direct */ private $filesystem; /** * WPML_File constructor. * * @param WPML_WP_API|null $wp_api WPML WP API instance. * @param WP_Filesystem_Direct|null $filesystem WP_Filesystem_Direct instance. */ public function __construct( WPML_WP_API $wp_api = null, WP_Filesystem_Direct $filesystem = null ) { if ( ! $wp_api ) { $wp_api = new WPML_WP_API(); } $this->wp_api = $wp_api; if ( ! $filesystem ) { $filesystem = new WP_Filesystem_Direct( null ); } $this->filesystem = $filesystem; } /** * Fix directory separator if backslash is used. * * @param string $path Path to fix. * * @return string */ public function fix_dir_separator( $path ) { $directory_separator = $this->wp_api->constant( 'DIRECTORY_SEPARATOR' ); return ( '\\' === $directory_separator ) ? str_replace( '/', '\\', $path ) : str_replace( '\\', '/', $path ); } /** * Get uri from file path. * * @param string $path File path. * * @return string */ public function get_uri_from_path( $path ) { $base = null; if ( $this->wp_api->defined( 'WP_CONTENT_DIR' ) && $this->wp_api->defined( 'WP_CONTENT_URL' ) ) { $base_path = $this->fix_dir_separator( $this->wp_api->constant( 'WP_CONTENT_DIR' ) ); if ( 0 === strpos( $path, $base_path ) ) { $base = array( 'path' => $base_path, 'uri' => $this->wp_api->constant( 'WP_CONTENT_URL' ), ); } if ( false === strpos( $path, $base_path ) ) { $base = array( 'path' => $base_path, 'uri' => $this->wp_api->constant( 'WP_CONTENT_URL' ), ); $wpml_plugin_folder_parts = explode( $this->wp_api->constant( 'DIRECTORY_SEPARATOR' ), $this->wp_api->constant( 'WPML_PLUGIN_PATH' ) ); $wpml_plugin_folder_parts = $this->pop_folder_array( 1, $wpml_plugin_folder_parts ); $wpml_plugins_folder = implode( $this->wp_api->constant( 'DIRECTORY_SEPARATOR' ), $wpml_plugin_folder_parts ); $path = str_replace( $wpml_plugins_folder, $this->wp_api->constant( 'WP_PLUGIN_DIR' ), $path ); } } if ( ! $base ) { $base = array( 'path' => $this->wp_api->constant( 'ABSPATH' ), 'uri' => site_url(), ); } $base['uri'] = preg_replace( '/(^https?:)/', '', $base['uri'] ); $relative_path = substr( $path, strlen( $base['path'] ) ); $relative_path = str_replace( array( '/', '\\' ), '/', $relative_path ); $relative_path = ltrim( $relative_path, '/' ); return trailingslashit( $base['uri'] ) . $relative_path; } /** * Recursive function to pop a folder array. * * @param int $times * @param string[] $folder_array * @return string[] */ private function pop_folder_array( $times, $folder_array ) { $latest_folder = array_pop( $folder_array ); if ( '..' === $latest_folder ) { return $this->pop_folder_array( $times + 1, $folder_array ); } if ( '.' === $latest_folder ) { return $this->pop_folder_array( $times, $folder_array ); } if ( $times > 1 ) { return $this->pop_folder_array( $times - 1, $folder_array ); } return $folder_array; } /** * Get path relative to ABSPATH. * * @param string $path File path. * * @return string */ public function get_relative_path( $path ) { return str_replace( $this->fix_dir_separator( ABSPATH ), '', $this->fix_dir_separator( $path ) ); } /** * Get full file path. * * @param string $path File path. * * @return string */ public function get_full_path( $path ) { return ABSPATH . $this->get_relative_path( $path ); } /** * Check if file exists. * * @param string $path File path. * * @return bool */ public function file_exists( $path ) { return $this->filesystem->is_readable( $this->get_full_path( $path ) ); } /** * Get file modification time. * * @param string $path File path. * * @return int */ public function get_file_modified_timestamp( $path ) { return $this->filesystem->mtime( $this->get_full_path( $path ) ); } }
[+]
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