| Server IP : 89.108.64.180 / Your IP : 216.73.217.95 Web Server : Apache/2.4.41 (Ubuntu) System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-root ( 1010) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/smileyalta.ru/wp-content/plugins/loco-translate/src/package/ |
Upload File : |
<?php
/**
* Common access to bundle headers.
* Because access to theme and plugin header data via WordPress is a total mess.
*
* @property-read string $Name
* @property-read string $Author
* @property-read string $AuthorURI
* @property-read string $TextDomain
* @property-read string $DomainPath
*/
class Loco_package_Header {
/**
* WordPress's internal data
* @var array|ArrayAccess
*/
private $wp;
public function __construct( $header ){
$this->wp = $header;
}
/**
* @return string
*/
public function __get( $prop ){
$wp = $this->wp;
// prefer require "get" method to access raw properties (WP_Theme)
if( method_exists($wp, 'get') && ( $value = $wp->get($prop) ) ){
return $value;
}
// may have key directly, e.g. TextDomain in plugin array
if( isset($wp[$prop]) ){
return $wp[$prop];
}
// else header not defined, which is probably fine
return '';
}
/**
* @codeCoverageIgnore
*/
public function __set( $prop, $value ){
throw new RuntimeException('Read only');
}
/**
* Get bundle author as linked text, just like the WordPress plugin list does
* @return string escaped HTML
*/
public function getAuthorLink(){
if( ( $link = $this->AuthorURI ) || ( $link = $this->PluginURI ) || ( $link = $this->ThemeURI ) ){
$author = $this->Author or $author = $link;
return '<a href="'.esc_url($link).'" target="_blank">'.esc_html($author).'</a>';
}
return '';
}
/**
* Get "name" by <author> credit
* @return string escaped HTML
*/
public function getAuthorCredit(){
if( $author = $this->Author ){
$author = esc_html( strip_tags($author) );
if( $link = $this->AuthorURI ){
$author = '<a href="'.esc_url($link).'" target="_blank">'.$author.'</a>';
}
}
else {
$author = __('Unknown author','loco-translate');
}
// translators: Author credit: "<product>" <version> by <author>
$html = sprintf( __('"%s" %s by %s','default'), esc_html($this->Name), $this->Version, $author );
if( ( $link = $this->PluginURI ) || ( $link = $this->ThemeURI ) ){
$html .= sprintf( ' — <a href="%s" target="_blank">%s</a>', esc_url($link), __('Visit official site','loco-translate') );
}
return $html;
}
/**
* Get hostname of vendor that hosts theme/plugin
* @return string e.g. "wordpress.org"
*/
public function getVendorHost(){
$host = '';
if( ( $url = $this->PluginURI ) || ( $url = $this->ThemeURI ) ){
if( $host = parse_url($url,PHP_URL_HOST) ){
$bits = explode( '.', $host );
$host = implode( '.', array_slice($bits,-2) );
}
}
return $host;
}
}