Esempio n. 1
0
function my_upload_and_shorten_do_page()
{
    // Check if a form was submitted
    if (isset($_POST['submit'])) {
        $my_save_files_message = my_upload_and_shorten_save_files();
    }
    // prepare i18n messages
    $my_upload_and_shorten_domain = 'upload-and-shorten';
    $my_i18n = array();
    $my_i18n[1] = yourls_esc_html__('Upload & Shorten', $my_upload_and_shorten_domain);
    $my_i18n[2] = yourls_esc_html__('Here you can upload a file to your webserver and create a short-URL for it.', $my_upload_and_shorten_domain);
    $my_i18n[3] = yourls_esc_html__('Select file to upload: ', $my_upload_and_shorten_domain);
    $my_i18n[4] = yourls_esc_html__('Optional custom keyword: ', $my_upload_and_shorten_domain);
    $my_i18n[5] = yourls_esc_html__('Randomize filename ', $my_upload_and_shorten_domain);
    $my_i18n[6] = yourls_esc_attr__('  Go!  ', $my_upload_and_shorten_domain);
    // input form
    echo '
	<h2> ' . $my_i18n[1] . ' </h2>
	<p> ' . $my_i18n[2] . ' </p>
	<form method="post" enctype="multipart/form-data"> <fieldset>
	<p><label for="file_upload">' . $my_i18n[3] . '</label> <input type="file" id="file_upload" name="file_upload" /></p>
	<p><label for="custom_keyword">' . $my_i18n[4] . '</label> <input type="text" id="custom_keyword" name="custom_keyword" /></p>
	<p><input type="checkbox" id="randomize_filename" name="randomize_filename" checked="checked" /><label for="randomize_filename">' . $my_i18n[5] . '</label> <small>(mypicture.jpg -> http://domain.tld/9a3e97434689.jpg)</small></p>
	<p><input type="submit" name="submit" value="' . $my_i18n[6] . '" /></p>
	</fieldset></form>
	<strong>' . $my_save_files_message . '</strong>
	<div id="footer">This plugin is based on the plugin <a href="http://www.mattytemple.com/projects/yourls-share-files" target="_blank">"Share Files" by Matt Temple </a> with a few enhancements. The more you use it the more you\'ll like it! </div>';
}
Esempio n. 2
0
    $i = 0;
    foreach ($keyword_list as $k) {
        $i++;
        if ($i == 1) {
            yourls_html_link(yourls_link($k));
        } else {
            yourls_html_link(yourls_link($k), "/{$k}");
        }
        if ($i < count($keyword_list)) {
            echo ' + ';
        }
    }
} else {
    yourls_html_link(yourls_link($keyword));
    if (isset($keyword_list) && count($keyword_list) > 1) {
        echo ' <a href="' . yourls_link($keyword) . '+all" title="' . yourls_esc_attr__('Aggregate stats for duplicate short URLs') . '"><img src="' . yourls_match_current_protocol(YOURLS_SITE) . '/images/chart_bar_add.png" border="0" /></a>';
    }
}
?>
</h3>
<h3 id="longurl"><span class="label"><?php 
yourls_e('Long URL');
?>
:</span> <img class="fix_images" src="<?php 
echo yourls_get_favicon_url($longurl);
?>
" /> <?php 
yourls_html_link($longurl, yourls_trim_long_string($longurl), 'longurl');
?>
</h3>
Esempio n. 3
0
</th>
				<td><a href="javascript:(function()%7Bvar%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:enc(s)),f='<?php 
echo yourls_admin_url('index.php');
?>
',l=d.location,k=prompt(%22Custom%20URL%22),k2=(k?'&k='+k:%22%22),p='?u='+enc(l.href)+'&t='+enc(d.title)+'&s='+s2+k2,u=f+p;if(k!=null)%7Btry%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0)%7D%7D)()" class="bookmarklet" onclick="alert('<?php 
echo yourls_esc_attr__('Drag to your toolbar!');
?>
');return false;"><?php 
yourls_e('Custom shorten');
?>
</a></td>
				<td><a href="javascript:(function()%7Bvar%20d=document,k=prompt('Custom%20URL'),s=d.createElement('script');if(k!=null){window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='<?php 
echo yourls_admin_url('index.php');
?>
?u='+encodeURIComponent(d.location.href)+'&k='+k+'&jsonp=yourls';void(d.body.appendChild(s));%7D%7D)();" class="bookmarklet" onclick="alert('<?php 
echo yourls_esc_attr__('Drag to your toolbar!');
?>
');return false;"><?php 
yourls_e('Instant Custom Shorten');
?>
</a></td>
			</tr>
			</tbody>
		</table>
		
	<h2><?php 
yourls_e('Prefix-n-Shorten');
?>
</h2>
		
		<p><?php 
Esempio n. 4
0
/**
 * Display or return HTML for a bookmarklet link
 *
 * @since 1.7.1
 * @param string $href    bookmarklet link (presumably minified code with "javascript:" scheme)
 * @param string $anchor  link anchor
 * @param bool   $echo    true to display, false to return the HTML
 * @return string         the HTML for a bookmarklet link
 */
function yourls_bookmarklet_link($href, $anchor, $echo = true)
{
    $alert = yourls_esc_attr__('Drag to your toolbar!');
    $link = <<<LINK
    <a href="{$href}" class="bookmarklet" onclick="alert('{$alert}');return false;">{$anchor}</a>
LINK;
    if ($echo) {
        echo $link;
    }
    return $link;
}
Esempio n. 5
0
/**
 * Display the admin menu
 *
 */
function yourls_html_menu()
{
    // Build menu links
    if (defined('YOURLS_USER')) {
        $logout_link = yourls_apply_filter('logout_link', sprintf(yourls__('Hello <strong>%s</strong>'), YOURLS_USER) . ' (<a href="?action=logout" title="' . yourls_esc_attr__('Logout') . '">' . yourls__('Logout') . '</a>)');
    } else {
        $logout_link = yourls_apply_filter('logout_link', '');
    }
    $help_link = yourls_apply_filter('help_link', '<a href="' . yourls_site_url(false) . '/readme.html">' . yourls__('Help') . '</a>');
    $admin_links = array();
    $admin_sublinks = array();
    $admin_links['admin'] = array('url' => yourls_admin_url('index.php'), 'title' => yourls__('Go to the admin interface'), 'anchor' => yourls__('Admin interface'));
    if (yourls_is_admin()) {
        $admin_links['tools'] = array('url' => yourls_admin_url('tools.php'), 'anchor' => yourls__('Tools'));
        $admin_links['plugins'] = array('url' => yourls_admin_url('plugins.php'), 'anchor' => yourls__('Manage Plugins'));
        $admin_sublinks['plugins'] = yourls_list_plugin_admin_pages();
    }
    $admin_links = yourls_apply_filter('admin_links', $admin_links);
    $admin_sublinks = yourls_apply_filter('admin_sublinks', $admin_sublinks);
    // Now output menu
    echo '<ul id="admin_menu">' . "\n";
    if (yourls_is_private() && !empty($logout_link)) {
        echo '<li id="admin_menu_logout_link">' . $logout_link . '</li>';
    }
    foreach ((array) $admin_links as $link => $ar) {
        if (isset($ar['url'])) {
            $anchor = isset($ar['anchor']) ? $ar['anchor'] : $link;
            $title = isset($ar['title']) ? 'title="' . $ar['title'] . '"' : '';
            printf('<li id="admin_menu_%s_link" class="admin_menu_toplevel"><a href="%s" %s>%s</a>', $link, $ar['url'], $title, $anchor);
        }
        // Output submenu if any. TODO: clean up, too many code duplicated here
        if (isset($admin_sublinks[$link])) {
            echo "<ul>\n";
            foreach ($admin_sublinks[$link] as $link => $ar) {
                if (isset($ar['url'])) {
                    $anchor = isset($ar['anchor']) ? $ar['anchor'] : $link;
                    $title = isset($ar['title']) ? 'title="' . $ar['title'] . '"' : '';
                    printf('<li id="admin_menu_%s_link" class="admin_menu_sublevel admin_menu_sublevel_%s"><a href="%s" %s>%s</a>', $link, $link, $ar['url'], $title, $anchor);
                }
            }
            echo "</ul>\n";
        }
    }
    if (isset($help_link)) {
        echo '<li id="admin_menu_help_link">' . $help_link . '</li>';
    }
    yourls_do_action('admin_menu');
    echo "</ul>\n";
    yourls_do_action('admin_notices');
    yourls_do_action('admin_notice');
    // because I never remember if it's 'notices' or 'notice'
    /*
    To display a notice:
    $message = "<div>OMG, dude, I mean!</div>" );
    yourls_add_action( 'admin_notices', create_function( '', "echo '$message';" ) );
    */
}
Esempio n. 6
0
            ?>
</p>
			<p><?php 
            yourls_e("On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix.");
            ?>
</p>
			<p><?php 
            yourls_e('If everything goes too fast and you cannot read, <span class="success">good for you</span>, let it go :)');
            ?>
</p>
			<p><?php 
            yourls_e('Once you are ready, press "Upgrade" !');
            ?>
</p>
			<?php 
            echo "\n\t\t\t<form action='upgrade.php?' method='get'>\n\t\t\t<input type='hidden' name='step' value='1' />\n\t\t\t<input type='hidden' name='oldver' value='{$oldver}' />\n\t\t\t<input type='hidden' name='newver' value='{$newver}' />\n\t\t\t<input type='hidden' name='oldsql' value='{$oldsql}' />\n\t\t\t<input type='hidden' name='newsql' value='{$newsql}' />\n\t\t\t<input type='submit' class='primary' value='" . yourls_esc_attr__('Upgrade') . "' />\n\t\t\t</form>";
            break;
        case 1:
        case 2:
            $upgrade = yourls_upgrade($step, $oldver, $newver, $oldsql, $newsql);
            break;
        case 3:
            $upgrade = yourls_upgrade(3, $oldver, $newver, $oldsql, $newsql);
            echo '<p>' . yourls__('Your installation is now up to date ! ') . '</p>';
            echo '<p>' . yourls_s('Go back to <a href="%s">the admin interface</a>', yourls_admin_url('index.php')) . '</p>';
    }
}
?>
	

<?php 
Esempio n. 7
0
/**
 * Rewrite logout link
 *
 * @param string $link   Default element
 * @param string $show   Allow muting
 * @return string        Logout element (HTML)
 */
function lc_full_bootstrap_logout_link($link, $show = false)
{
    if ($show && yourls_is_private() && defined('YOURLS_USER')) {
        return '<div class="navbar-right"><p class="navbar-text">' . sprintf(yourls__('Hello <strong>%s</strong>'), YOURLS_USER) . '</p><a href="?action=logout" title="' . yourls_esc_attr__('Logout') . '" class="btn btn-default navbar-btn"><i class="icon-signout"></i> ' . yourls__('Logout') . '</a></div>';
    } else {
        return '';
    }
}
Esempio n. 8
0
    printf("<tr class='plugin %s'><td class='plugin_name'><a href='%s'>%s</a></td><td class='plugin_version'>%s</td><td class='plugin_desc'>%s</td><td class='plugin_author'><a href='%s'>%s</a></td><td class='plugin_actions actions'><a href='%s'>%s</a></td></tr>", $class, $data['uri'], $data['name'], $data['version'], $data['desc'], $data['author_uri'], $data['author'], $action_url, $action_anchor);
}
?>
	</tbody>
	</table>
	
	<script type="text/javascript">
	yourls_defaultsort = 0;
	yourls_defaultorder = 0;
	<?php 
if ($count_active) {
    ?>
	$('#plugin_summary').append('<span id="toggle_plugins">filter</span>');
	$('#toggle_plugins').css({'background':'transparent url("../images/filter.gif") top left no-repeat','display':'inline-block','text-indent':'-9999px','width':'16px','height':'16px','margin-left':'3px','cursor':'pointer'})
		.attr('title', '<?php 
    echo yourls_esc_attr__('Toggle active/inactive plugins');
    ?>
')
		.click(function(){
			$('#main_table tr.inactive').toggle();
		});
	<?php 
}
?>
	</script>
	
	<p><?php 
yourls_e('If something goes wrong after you activate a plugin and you cannot use YOURLS or access this page, simply rename or delete its directory, or rename the plugin file to something different than <code>plugin.php</code>.');
?>
</p>