equal
deleted
inserted
replaced
39 * - extracted_comments (string) -- comments left by developers |
39 * - extracted_comments (string) -- comments left by developers |
40 * - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form |
40 * - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form |
41 * - flags (array) -- flags like php-format |
41 * - flags (array) -- flags like php-format |
42 */ |
42 */ |
43 function __construct( $args = array() ) { |
43 function __construct( $args = array() ) { |
44 // if no singular -- empty object |
44 // If no singular -- empty object. |
45 if ( ! isset( $args['singular'] ) ) { |
45 if ( ! isset( $args['singular'] ) ) { |
46 return; |
46 return; |
47 } |
47 } |
48 // get member variable values from args hash |
48 // Get member variable values from args hash. |
49 foreach ( $args as $varname => $value ) { |
49 foreach ( $args as $varname => $value ) { |
50 $this->$varname = $value; |
50 $this->$varname = $value; |
51 } |
51 } |
52 if ( isset( $args['plural'] ) && $args['plural'] ) { |
52 if ( isset( $args['plural'] ) && $args['plural'] ) { |
53 $this->is_plural = true; |
53 $this->is_plural = true; |
63 } |
63 } |
64 } |
64 } |
65 |
65 |
66 /** |
66 /** |
67 * PHP4 constructor. |
67 * PHP4 constructor. |
|
68 * |
|
69 * @deprecated 5.4.0 Use __construct() instead. |
|
70 * |
|
71 * @see Translation_Entry::__construct() |
68 */ |
72 */ |
69 public function Translation_Entry( $args = array() ) { |
73 public function Translation_Entry( $args = array() ) { |
|
74 _deprecated_constructor( self::class, '5.4.0', static::class ); |
70 self::__construct( $args ); |
75 self::__construct( $args ); |
71 } |
76 } |
72 |
77 |
73 /** |
78 /** |
74 * Generates a unique key for this entry |
79 * Generates a unique key for this entry |
78 function key() { |
83 function key() { |
79 if ( null === $this->singular || '' === $this->singular ) { |
84 if ( null === $this->singular || '' === $this->singular ) { |
80 return false; |
85 return false; |
81 } |
86 } |
82 |
87 |
83 // Prepend context and EOT, like in MO files |
88 // Prepend context and EOT, like in MO files. |
84 $key = ! $this->context ? $this->singular : $this->context . "\4" . $this->singular; |
89 $key = ! $this->context ? $this->singular : $this->context . "\4" . $this->singular; |
85 // Standardize on \n line endings |
90 // Standardize on \n line endings. |
86 $key = str_replace( array( "\r\n", "\r" ), "\n", $key ); |
91 $key = str_replace( array( "\r\n", "\r" ), "\n", $key ); |
87 |
92 |
88 return $key; |
93 return $key; |
89 } |
94 } |
90 |
95 |