## Apache Zeta Components Manual :: File Source for complement_filter.php

## Source for file complement_filter.php

Documentation is available at complement_filter.php

1. <?php
2. /**
3. *
4. * Licensed to the Apache Software Foundation (ASF) under one
5. * or more contributor license agreements. See the NOTICE file
6. * distributed with this work for additional information
7. * regarding copyright ownership. The ASF licenses this file
8. * to you under the Apache License, Version 2.0 (the
9. * "License"); you may not use this file except in compliance
10. * with the License. You may obtain a copy of the License at
11. *
12. * http://www.apache.org/licenses/LICENSE-2.0
13. *
14. * Unless required by applicable law or agreed to in writing,
15. * software distributed under the License is distributed on an
16. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17. * KIND, either express or implied. See the License for the
18. * specific language governing permissions and limitations
19. * under the License.
20. *
21. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
22. * @version //autogentag//
23. * @filesource
24. * @package Translation
25. */
27. /**
28. * Implements the ComplementEmpty translation filter.
29. *
30. * The filter replaces a missing translated string with its original.
31. *
32. * @package Translation
33. * @version //autogentag//
34. * @mainclass
35. */
36. class ezcTranslationComplementEmptyFilter implements ezcTranslationFilter
37. {
38. /**
39. * Singleton instance
40. * @var ezcTranslationComplementEmptyFilter
41. */
42. static private $instance = null;
44. /**
45. * Private constructor to prevent non-singleton use.
46. */
47. private function __construct()
48. {
49. }
51. /**
52. * Returns an instance of the class ezcTranslationComplementEmptyFilter.
53. *
54. * @return ezcTranslationComplementEmptyFilter Instance of ezcTranslationComplementEmptyFilter
55. */
56. public static function getInstance ()
57. {
58. if ( is_null ( self::$instance ) )
59. {
60. self::$instance = new ezcTranslationComplementEmptyFilter();
61. }
62. return self::$instance;
63. }
65. /**
66. * Filters the context $context.
67. *
68. * Applies the fillin filter on the given context. The filter replaces a
69. * missing translated string with its original.
70. *
71. * @param array(ezcTranslationData) $context
72. * @return void
73. */
74. public function runFilter ( array $context )
75. {
76. foreach ( $context as $element )
77. {
78. if ( $element->status == ezcTranslationData::UNFINISHED )
79. {
80. $element->translation = $element->original;
81. }
82. }
83. }
84. }
85. ?>

Documentation generated by phpDocumentor 1.4.3