Beispiel #1
0
    ?>
</span></dd>
			</dl>
			<?php 
}
?>
			<?php 
if ($t->extracted_comments) {
    ?>
			<dl>
				<dt><?php 
    _e('Comment:', 'glotpress');
    ?>
</dt>
				<dd><?php 
    echo make_clickable(esc_translation($t->extracted_comments));
    ?>
</dd>
			</dl>
			<?php 
}
?>
			<?php 
if ($t->translation_added && $t->translation_added != '0000-00-00 00:00:00') {
    ?>
			<dl>
				<dt><?php 
    _e('Date added:', 'glotpress');
    ?>
</dt>
				<dd><?php 
function textareas($entry, $permissions, $index = 0)
{
    list($can_edit, $can_approve) = $permissions;
    $disabled = $can_edit ? '' : 'disabled="disabled"';
    ?>
	<div class="textareas">
		<?php 
    if (isset($entry->warnings[$index])) {
        $referenceable = $entry->warnings[$index];
        $warning = each($referenceable);
        ?>
			<div class="warning secondary">
				<?php 
        printf(__('<strong>Warning:</strong> %s'), esc_html($warning['value']));
        ?>

				<?php 
        if ($can_approve) {
            ?>
					<a href="#" class="discard-warning" key="<?php 
            echo $warning['key'];
            ?>
" index="<?php 
            echo $index;
            ?>
"><?php 
            _e('Discard');
            ?>
</a>
				<?php 
        }
        ?>
			</div>
		<?php 
    }
    ?>
		<blockquote><em><small><?php 
    echo esc_translation(gp_array_get($entry->translations, $index));
    ?>
</small></em></blockquote>
		<textarea class="foreign-text" name="translation[<?php 
    echo $entry->original_id;
    ?>
][]" <?php 
    echo $disabled;
    ?>
><?php 
    echo esc_translation(gp_array_get($entry->translations, $index));
    ?>
</textarea>

		<p>
			<?php 
    if ($can_edit) {
        gp_entry_actions();
    } elseif (GP::$user->logged_in()) {
        _e('You are not allowed to edit this translation.');
    } else {
        printf(__('You <a href="%s">have to log in</a> to edit this translation.'), gp_url_login());
    }
    ?>
 
		</p>
	</div>
	<?php 
}
 /**
  * @dataProvider data_translations_with_entities
  */
 function test_esc_translation($expected, $translation)
 {
     $this->assertEquals($expected, esc_translation($translation));
 }
Beispiel #4
0
function textareas($entry, $can_edit, $index = 0)
{
    $disabled = $can_edit ? '' : 'disabled="disabled"';
    ?>
<div class="textareas">
	<?php 
    if (isset($entry->warnings[$index])) {
        $referenceable = $entry->warnings[$index];
        $warning = each($referenceable);
        ?>
		<div class="warning secondary">
			<strong>Warning:</strong> <?php 
        echo esc_html($warning['value']);
        ?>
			<?php 
        if (GP::$user->current()->admin()) {
            // TODO: allow users with write permissions, too
            ?>
			<a href="#" class="discard-warning" key="<?php 
            echo $warning['key'];
            ?>
" index="<?php 
            echo $index;
            ?>
">Discard</a>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
    ?>
	<textarea name="translation[<?php 
    echo $entry->original_id;
    ?>
][]" <?php 
    echo $disabled;
    ?>
><?php 
    echo esc_translation(gp_array_get($entry->translations, $index));
    ?>
</textarea>
<?php 
    if ($can_edit) {
        ?>
	<p>
		<a href="#" class="copy" tabindex="-1">Copy from original</a>
	</p>
<?php 
    } else {
        ?>
	<p>
		You <a href="<?php 
        echo gp_url_login();
        ?>
">have to log in</a> to edit this translation.
	</p>
	
<?php 
    }
    ?>
</div>
<?php 
}