PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
wpml-string-translation
/
classes
<?php class WPML_ST_String_Factory { private $wpdb; /** * WPML_ST_String_Factory constructor. * * @param wpdb $wpdb */ public function __construct( wpdb $wpdb ) { $this->wpdb = $wpdb; } /** @var int[] $string_id_cache */ private $string_id_cache = array(); /** @var WPML_ST_String $string_cache */ private $string_cache = array(); /** * @param int $string_id * * @return WPML_ST_String */ public function find_by_id( $string_id ) { $this->string_cache[ $string_id ] = isset( $this->string_cache[ $string_id ] ) ? $this->string_cache[ $string_id ] : new WPML_ST_String( $string_id, $this->wpdb ); return $this->string_cache[ $string_id ]; } /** * @param string $name * * @return WPML_ST_String */ public function find_by_name( $name ) { $sql = $this->wpdb->prepare( "SELECT id FROM {$this->wpdb->prefix}icl_strings WHERE name=%s LIMIT 1", $name ); $cache_key = md5( $sql ); $this->string_id_cache[ $cache_key ] = isset( $this->string_id_cache[ $cache_key ] ) ? $this->string_id_cache[ $cache_key ] : (int) $this->wpdb->get_var( $sql ); $string_id = $this->string_id_cache[ $cache_key ]; $this->string_cache[ $string_id ] = isset( $this->string_cache[ $string_id ] ) ? $this->string_cache[ $string_id ] : new WPML_ST_String( $string_id, $this->wpdb ); return $this->string_cache[ $this->string_id_cache[ $cache_key ] ]; } /** * @param string $name * * @return WPML_ST_Admin_String */ public function find_admin_by_name( $name ) { $sql = $this->wpdb->prepare( "SELECT id FROM {$this->wpdb->prefix}icl_strings WHERE name=%s LIMIT 1", $name ); $string_id = (int) $this->wpdb->get_var( $sql ); return new WPML_ST_Admin_String( $string_id, $this->wpdb ); } /** * @param string $string * @param string|array $context * @param bool|false $name * * @return mixed */ public function get_string_id( $string, $context, $name = false ) { list( $domain, $gettext_context ) = wpml_st_extract_context_parameters( $context ); $sql = "SELECT id FROM {$this->wpdb->prefix}icl_strings WHERE BINARY value=%s"; $prepare_args = array( $string ); if ( $gettext_context ) { $sql .= ' AND gettext_context=%s'; $prepare_args[] = $gettext_context; } if ( $domain ) { $sql .= ' AND context=%s'; $prepare_args[] = $domain; } if ( $name !== false ) { $sql .= ' AND name = %s '; $prepare_args[] = $name; } $sql = $this->wpdb->prepare( $sql . ' LIMIT 1', $prepare_args ); $cache_key = md5( $sql ); $this->string_id_cache[ $cache_key ] = isset( $this->string_id_cache[ $cache_key ] ) ? $this->string_id_cache[ $cache_key ] : (int) $this->wpdb->get_var( $sql ); return $this->string_id_cache[ $cache_key ]; } }
[+]
string-tracking
[+]
package
[-] class-wpml-st-verify-dependencies.php
[edit]
[-] class-wpml-st-user-fields.php
[edit]
[+]
translation-memory
[+]
utilities
[-] Shortcode.php
[edit]
[+]
batch-translation
[+]
admin-texts
[-] class-wpml-st-admin-string.php
[edit]
[+]
menus
[+]
container
[-] class-wpml-st-settings.php
[edit]
[-] class-wpml-st-strings.php
[edit]
[+]
string-translation
[+]
po-import
[+]
db-mappers
[+]
shortcode
[+]
records
[+]
Troubleshooting
[+]
strings-scanning
[+]
MO
[-] class-wpml-st-initialize.php
[edit]
[+]
wpml-tm
[-] class-wpml-st-string-factory.php
[edit]
[+]
basket
[-] class-wpml-st-string-statuses.php
[edit]
[+]
string-translation-ui
[-] class-wpml-language-of-domain.php
[edit]
[+]
translation-files
[+]
translations-file-scan
[+]
filters
[+]
..
[+]
gettext-hooks
[-] TranslateWpmlString.php
[edit]
[-] class-wpml-st-string.php
[edit]
[+]
API
[+]
privacy
[+]
actions
[-] class-wpml-st-reset.php
[edit]
[+]
package-translation
[+]
support
[+]
strings-cleanup
[-] class-wpml-admin-notifier.php
[edit]
[+]
slug-translation
[+]
upgrade