本文整理汇总了PHP中common::Link方法的典型用法代码示例。如果您正苦于以下问题:PHP common::Link方法的具体用法?PHP common::Link怎么用?PHP common::Link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::Link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Example_Ajax
function Example_Ajax()
{
global $page, $addonRelativeCode;
//prepare the page
$page->head_js[] = $addonRelativeCode . 'static/02_script.js';
$page->admin_js = true;
//get request parameters and execute any commands
$string = '';
if (isset($_REQUEST['string'])) {
$string = $_REQUEST['string'];
}
$cmd = common::GetCommand();
switch ($cmd) {
case 'randomstring':
$string = common::RandomString(10);
break;
}
//display the form
echo '<h2>Example Ajax Requests</h2>';
echo '<form method="post" action="' . $page->title . '">';
echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
echo '</form>';
//output the $_REQUEST variable
echo '<h3>Request</h3>';
echo showArray($_REQUEST);
//plugin example navigation
gpPlugin::incl('navigation.php');
PluginExampleNavigation();
}
示例2: Child
/**
* Get The Image
*
*/
public function Child($title)
{
global $dirPrefix;
$content = $this->TitleContent($title);
$img_pos = strpos($content, '<img');
if ($img_pos === false) {
return;
}
$src_pos = strpos($content, 'src=', $img_pos);
if ($src_pos === false) {
return;
}
$src = substr($content, $src_pos + 4);
$quote = $src[0];
if ($quote != '"' && $quote != "'") {
return;
}
$src_pos = strpos($src, $quote, 1);
$src = substr($src, 1, $src_pos - 1);
// check for resized image, get original source if img is resized
if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
$src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
}
$thumb_path = common::ThumbnailPath($src);
echo '<li>';
echo '<img src="' . $thumb_path . '"/>';
$label = common::GetLabel($title);
echo common::Link($title, $label);
echo '</li>';
}
示例3: Run
/**
* Print all categories and their contents on gadget
*
*/
function Run()
{
echo '<div class="simple_blog_gadget"><div>';
echo '<span class="simple_blog_gadget_label">';
echo gpOutput::GetAddonText('Categories');
echo '</span>';
echo '<ul>';
foreach ($this->categories as $catdata) {
if (!$catdata['visible']) {
continue;
//skip hidden categories
}
echo '<li>';
$sum = count($catdata['posts']);
echo '<a class="blog_gadget_link">' . $catdata['ct'] . ' (' . $sum . ')</a>';
if ($sum) {
echo '<ul class="nodisplay">';
foreach ($catdata['posts'] as $post_index => $post_title) {
echo '<li>';
echo common::Link('Special_Blog', $post_title, 'id=' . $post_index);
echo '</li>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul>';
echo '</div></div>';
}
示例4: Special_Example
function Special_Example()
{
echo '<h2>This is a Special Script</h2>';
echo '<p>This is an example of a gpEasy Addon in the form of a Special page.</p>';
echo '<p>Special pages can be used to add more than just content to a gpEasy installation. </p>';
echo '<p>';
echo common::Link('Admin_Example', 'An Example Link');
echo '</p>';
echo '<p>You can download <a href="http://gpeasy.com/Special_Addon_Plugins?id=160">a plugin with addtional examples</a> from gpEasy.com </p>';
}
示例5: __construct
function __construct()
{
echo '<h2>This is an Admin Only Script</h2>';
echo '<p>This is an example of a gpEasy Addon in the form of a Admin page.</p>';
echo '<p>Admin pages are only accessible to users with appropriate permissions on your installation of gpEasy. </p>';
echo '<p>';
echo \common::Link('Special_Example', 'An Example Link');
echo '</p>';
echo '<p>You can download <a href="http://gpeasy.com/Special_Addon_Plugins?id=160">a plugin with addtional examples</a> from gpEasy.com </p>';
}
示例6: ShowFiles
/**
* Show files in the cache
*
*/
function ShowFiles()
{
global $page, $langmessage;
$page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
$page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
if (!$this->all_files) {
return;
}
echo '<p>';
echo common::Link('Admin_Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
echo '</p>';
echo '<table class="bordered tablesorter full_width">';
echo '<thead>';
echo '<tr><th>';
echo $langmessage['file_name'];
echo '</th><th>';
echo $langmessage['File Size'];
echo '</th><th>';
echo 'Touched';
echo '</th><th>';
echo $langmessage['options'];
echo '</th></tr>';
echo '</thead>';
$total_size = 0;
echo '<tbody>';
foreach ($this->all_files as $file) {
$full = $this->cache_dir . '/' . $file;
echo '<tr><td>';
echo '<a href="?cmd=ViewFile&file=' . rawurlencode($file) . '">';
echo $file;
echo '</a>';
echo '</td><td>';
$size = filesize($full);
echo '<span style="display:none">' . $size . '</span>';
echo admin_tools::FormatBytes($size);
$total_size += $size;
echo '</td><td>';
$elapsed = admin_tools::Elapsed(time() - filemtime($full));
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
echo common::Link('Admin_Cache', $langmessage['delete'], 'cmd=DeleteFile&file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
echo '</tr>';
}
echo '</tbody>';
//totals
echo '<tfoot>';
echo '<tr><td>';
echo number_format(count($this->all_files)) . ' Files';
echo '</td><td>';
echo admin_tools::FormatBytes($total_size);
echo '</td><td>';
echo '</tr>';
echo '</table>';
}
示例7: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->requested);
if ($scriptinfo === false) {
switch ($this->requested) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->requested];
$this->label = common::GetLabel($this->requested);
$this->TitleInfo = $scriptinfo;
$menu_permissions = false;
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" ');
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"');
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" ');
}
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
示例8: AddResources
/**
* Add multi language elements to the $page
*
*/
public function AddResources()
{
global $page, $addonRelativeCode;
static $added = false;
if ($added) {
return;
}
if ($page->pagetype == 'display') {
$page->admin_links[] = common::Link('Admin_MultiLang', 'Multi Language', 'cmd=TitleSettings&index=' . $page->gp_index, ' name="gpabox"');
}
$page->head_js[] = $addonRelativeCode . '/script.js';
//needed for admin pages as well
$page->css_admin[] = $addonRelativeCode . '/admin.css';
$added = true;
}
示例9: AdminProtect
function AdminProtect()
{
global $gp_menu;
$this->PageProtect();
echo '<h2>';
echo common::Link('Admin_Protect', 'Protected Pages');
echo '</h2>';
$cmd = common::GetCommand();
switch ($cmd) {
case 'savecontent':
$this->SaveContent();
case 'editcontent':
$this->EditContent();
return;
}
echo '<p>';
echo '<b>' . common::Link('Admin_Protect', 'Protected Content', 'cmd=editcontent') . '</b> ';
echo 'Edit the content users will see if they navigate to a protected page and aren\'t logged in.';
echo '</p>';
if (!count($this->config['pages'])) {
echo '<p>There aren\'t any protected pages.</p>';
return;
}
echo '<table class="bordered">';
echo '<tr><th>Pages</th><th>Child Pages</th></tr>';
foreach ($this->config['pages'] as $page_index => $bool) {
$title = common::IndexToTitle($page_index);
//may be deleted
if (!$title) {
continue;
}
echo '<tr>';
echo '<td>';
echo common::Link_Page($title);
echo '</td>';
echo '<td>';
$affected = common::Descendants($page_index, $gp_menu);
$titles = array();
foreach ($affected as $temp_index) {
$title = common::IndexToTitle($temp_index);
$titles[] = common::Link_Page($title);
}
echo implode(', ', $titles);
echo '</td>';
echo '</tr>';
}
echo '</table>';
}
示例10: ShowRating
function ShowRating($arg, $rating)
{
echo '<span class="rating">';
$label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=1&arg=' . $arg, ' rel="1" ');
$label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=2&arg=' . $arg, ' rel="2" ');
$label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=3&arg=' . $arg, ' rel="3" ');
$label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=4&arg=' . $arg, ' rel="4" ');
$label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=5&arg=' . $arg, ' rel="5" ');
echo '<input type="hidden" name="rating" value="' . htmlspecialchars($rating) . '" readonly="readonly"/>';
echo '</span> ';
}
示例11: ProtectOptions
function ProtectOptions($title, $menu_key, $menu_value, $layout_info)
{
global $protect_object;
$is_protected = $protect_object->IsProtected($menu_key);
if (!$is_protected) {
$label = 'Protect Page';
} elseif ($is_protected === 1) {
$label = 'Remove Protection';
} elseif ($is_protected === 2) {
$label = 'Parent Protected';
}
$img = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" height="16" width="16" />';
//echo common::Link($title,$img.$label,'cmd=passprotect','name="gpajax"');
echo common::Link('Admin_Menu', $img . $label, 'cmd=passprotect&index=' . $menu_key, 'name="postlink"');
//menupost
}
示例12: PluginExampleNavigation
function PluginExampleNavigation()
{
global $page;
$examples = array();
$examples['special_example_map'] = 'Google Map Example with Directions';
$examples['special_example_ajax'] = 'Asynchronous Form Submission and Page Loading';
echo '<h3>All Examples</h3>';
echo '<ol>';
foreach ($examples as $slug => $label) {
if ($page->gp_index == $slug) {
echo '<li><b>' . $label . '</b></li>';
} else {
echo '<li>' . common::Link($slug, $label) . '</li>';
}
}
echo '</ol>';
}
示例13: Child
/**
* Get The Image
*
*/
function Child($title)
{
global $dirPrefix;
$file = gpFiles::PageFile($title);
$file_sections = $file_stats = array();
ob_start();
require $file;
ob_get_clean();
if (!is_array($file_sections)) {
return;
}
//get the image
$content = section_content::Render($file_sections, $title, $file_stats);
$img_pos = strpos($content, '<img');
if ($img_pos === false) {
return;
}
$src_pos = strpos($content, 'src=', $img_pos);
if ($src_pos === false) {
return;
}
$src = substr($content, $src_pos + 4);
$quote = $src[0];
if ($quote != '"' && $quote != "'") {
return;
}
$src_pos = strpos($src, $quote, 1);
$src = substr($src, 1, $src_pos - 1);
// check for resized image, get original source if img is resized
if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
$src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
}
$thumb_path = common::ThumbnailPath($src);
$img_pos2 = strpos($content, '>', $img_pos);
$img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
echo '<li>';
echo '<img src="' . $thumb_path . '"/>';
//echo $img;
$label = common::GetLabel($title);
echo common::Link($title, $label);
echo '</li>';
}
示例14: special_map
function special_map()
{
global $page, $langmessage, $config;
/*
An xml site map will not show any of the pages from dynamic add-ons
... which is precisely what the regular sitemap shows
*/
if (isset($_GET['xml'])) {
$this->xml();
return;
}
$this->MultiSiteData();
echo '<div class="sitemap_xml">';
echo common::Link('Special_Site_Map', 'XML', 'xml');
echo '</div>';
echo '<h2>';
echo gpOutput::ReturnText('site_map');
echo '</h2>';
gpOutput::GetFullMenu();
}
示例15: Heading
/**
* @param string $current
*/
function Heading($current)
{
global $langmessage;
$options = array('Admin_Blog' => 'Posts', 'Admin_BlogConfig' => $langmessage['configuration'], 'Admin_BlogCategories' => 'Categories', 'Admin_BlogComments' => gpOutput::SelectText('Comments'));
$links = array();
foreach ($options as $slug => $label) {
if ($slug == $current) {
$links[] = $label;
} else {
$links[] = common::Link($slug, $label);
}
}
echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' class="gpsubmit" style="float:right"');
echo '<h2 class="hmargin">';
$label = gpOutput::SelectText('Blog');
echo common::Link('Special_Blog', $label);
echo ' » ';
echo implode('<span>|</span>', $links);
echo '</h2>';
}