web/wp-includes/pomo/entry.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     1 <?php
     1 <?php
     2 /**
     2 /**
     3  * Contains Translation_Entry class
     3  * Contains Translation_Entry class
     4  *
     4  *
     5  * @version $Id: entry.php 222 2009-09-07 21:14:23Z nbachiyski $
     5  * @version $Id: entry.php 621 2011-06-13 12:21:50Z nbachiyski $
     6  * @package pomo
     6  * @package pomo
     7  * @subpackage entry
     7  * @subpackage entry
     8  */
     8  */
     9 
     9 
    10 if ( !class_exists( 'Translation_Entry' ) ):
    10 if ( !class_exists( 'Translation_Entry' ) ):
    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 		$object_varnames = array_keys(get_object_vars($this));
       
    50 		foreach ($args as $varname => $value) {
    49 		foreach ($args as $varname => $value) {
    51 			$this->$varname = $value;
    50 			$this->$varname = $value;
    52 		}
    51 		}
    53 		if (isset($args['plural'])) $this->is_plural = true;
    52 		if (isset($args['plural'])) $this->is_plural = true;
    54 		if (!is_array($this->translations)) $this->translations = array();
    53 		if (!is_array($this->translations)) $this->translations = array();
    64 	function key() {
    63 	function key() {
    65 		if (is_null($this->singular)) return false;
    64 		if (is_null($this->singular)) return false;
    66 		// prepend context and EOT, like in MO files
    65 		// prepend context and EOT, like in MO files
    67 		return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
    66 		return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
    68 	}
    67 	}
       
    68 	
       
    69 	function merge_with(&$other) {
       
    70 		$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
       
    71 		$this->references = array_unique( array_merge( $this->references, $other->references ) );
       
    72 		if ( $this->extracted_comments != $other->extracted_comments ) {
       
    73 			$this->extracted_comments .= $other->extracted_comments;
       
    74 		}
       
    75 		
       
    76 	}
    69 }
    77 }
    70 endif;
    78 endif;