Exemple #1
0
/**
 * Display "Add new URL" box
 *
 * @param string $url URL to prefill the input with
 * @param string $keyword Keyword to prefill the input with
 */
function yourls_html_addnew($url = '', $keyword = '')
{
    ?>
	<main role="main">
	<div id="new_url">
		<div>
			<form id="new_url_form" action="" method="get">
				<div><strong><?php 
    yourls_e('Enter the URL');
    ?>
</strong>:<input type="text" id="add-url" name="url" value="<?php 
    echo $url;
    ?>
" class="text" size="80" placeholder="http://" />
				<?php 
    yourls_e('Optional ');
    ?>
 : <strong><?php 
    yourls_e('Custom short URL');
    ?>
</strong>:<input type="text" id="add-keyword" name="keyword" value="<?php 
    echo $keyword;
    ?>
" class="text" size="8" />
				<?php 
    yourls_nonce_field('add_url', 'nonce-add');
    ?>
				<input type="button" id="add-button" name="add-button" value="<?php 
    yourls_e('Shorten The URL');
    ?>
" class="button" onclick="add_link();" /></div>
			</form>
			<div id="feedback" style="display:none"></div>
		</div>
		<?php 
    yourls_do_action('html_addnew');
    ?>
	</div>
	<?php 
}
function yourls_html_addnew($url = '', $keyword = '')
{
    $url = $url ? $url : 'http://';
    ?>
	<div id="new_url">
		<div>
			<form id="new_url_form" action="" method="get">
				<div><strong>Enter the URL</strong>:<input type="text" id="add-url" name="url" value="<?php 
    echo $url;
    ?>
" class="text" size="80" />
				Optional: <strong>Custom short URL</strong>:<input type="text" id="add-keyword" name="keyword" value="<?php 
    echo $keyword;
    ?>
" class="text" size="8" />
				<?php 
    yourls_nonce_field('add_url', 'nonce-add');
    ?>
				<input type="button" id="add-button" name="add-button" value="Shorten The URL" class="button" onclick="add();" /></div>
			</form>
			<div id="feedback" style="display:none"></div>
		</div>
		<?php 
    yourls_do_action('html_addnew');
    ?>
	</div>
	<?php 
}