当前位置: 首页>>代码示例>>PHP>>正文


PHP link_for函数代码示例

本文整理汇总了PHP中link_for函数的典型用法代码示例。如果您正苦于以下问题:PHP link_for函数的具体用法?PHP link_for怎么用?PHP link_for使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了link_for函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getlangnav

function getlangnav($langs)
{
    foreach ($langs as $lang_name => $langkey) {
        echo $langkey == get_lang() ? '<div class="lang active">' : '<div class="lang">';
        echo '<a href="' . link_for('lang', 'change', TRUE) . '&amp;code=' . $langkey . '&amp;origin=' . base64_encode($_SERVER['REQUEST_URI']) . '">' . $lang_name . '</a>';
        echo '</div>';
    }
}
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:8,代码来源:actionpanel.php

示例2: build

 public function build($settings, $board_name)
 {
     global $config, $board;
     if ($board['uri'] != $board_name) {
         if (!openBoard($board_name)) {
             error(sprintf(_("Board %s doesn't exist"), $board_name));
         }
     }
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $query = query(sprintf("SELECT *, `id` AS `thread_id`,\n\t\t\t\t(SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`,\n\t\t\t\t(SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `image_count`,\n\t\t\t\t'%s' AS `board` FROM ``posts_%s`` WHERE `thread`  IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error());
     while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post);
         $post['board_name'] = $board['name'];
         if ($post['embed'] && preg_match('/^https?:\\/\\/(\\w+\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9\\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
             $post['youtube'] = $matches[2];
         }
         if (isset($post['files']) && $post['files']) {
             $files = json_decode($post['files']);
             if ($files[0]) {
                 if ($files[0]->file == 'deleted') {
                     if (count($files) > 1) {
                         foreach ($files as $file) {
                             if ($file == $files[0] || $file->file == 'deleted') {
                                 continue;
                             }
                             $post['file'] = $config['uri_thumb'] . $file->thumb;
                         }
                         if (empty($post['file'])) {
                             $post['file'] = $config['image_deleted'];
                         }
                     } else {
                         $post['file'] = $config['image_deleted'];
                     }
                 } else {
                     if ($files[0]->thumb == 'spoiler') {
                         $post['file'] = '/' . $config['spoiler_image'];
                     } else {
                         $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
                     }
                 }
             }
         }
         if (empty($post['image_count'])) {
             $post['image_count'] = 0;
         }
         $recent_posts[] = $post;
     }
     $required_scripts = array('js/jquery.min.js', 'js/jquery.mixitup.min.js', 'js/catalog.js');
     foreach ($required_scripts as $i => $s) {
         if (!in_array($s, $config['additional_javascript'])) {
             $config['additional_javascript'][] = $s;
         }
     }
     file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', array('settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), 'recent_images' => $recent_images, 'recent_posts' => $recent_posts, 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'])));
 }
开发者ID:0151n,项目名称:vichan,代码行数:57,代码来源:theme.php

示例3: sb_thread

function sb_thread($b, $thread, $slugcheck = false)
{
    global $config;
    $thread = (int) $thread;
    if ($thread < 1) {
        return false;
    }
    if (!preg_match('/^' . $config['board_regex'] . '$/u', $b)) {
        return false;
    }
    if (Cache::get("thread_exists_" . $b . "_" . $thread) == "no") {
        return false;
    }
    $query = prepare(sprintf("SELECT MAX(`id`) AS `max` FROM ``posts_%s``", $b));
    if (!$query->execute()) {
        return false;
    }
    $s = $query->fetch(PDO::FETCH_ASSOC);
    $max = $s['max'];
    if ($thread > $max) {
        return false;
    }
    $query = prepare(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL", $b));
    $query->bindValue(':id', $thread);
    if (!$query->execute() || !$query->fetch(PDO::FETCH_ASSOC)) {
        Cache::set("thread_exists_" . $b . "_" . $thread, "no");
        return false;
    }
    if ($slugcheck && $config['slugify']) {
        global $request;
        $link = link_for(array("id" => $thread), $slugcheck === 50, array("uri" => $b));
        $link = "/" . $b . "/" . $config['dir']['res'] . $link;
        if ($link != $request) {
            header("Location: {$link}", true, 301);
            die;
        }
    }
    if ($slugcheck == 50) {
        // Should we really generate +50 page? Maybe there are not enough posts anyway
        global $request;
        $r = str_replace("+50", "", $request);
        $r = substr($r, 1);
        // Cut the slash
        if (file_exists($r)) {
            return false;
        }
    }
    if (!openBoard($b)) {
        return false;
    }
    buildThread($thread);
    return true;
}
开发者ID:0151n,项目名称:vichan,代码行数:53,代码来源:smart_build.php

示例4: build_link_list

function build_link_list($links = false)
{
    if (!$links) {
        return false;
    }
    $list = array();
    foreach ($links as $link) {
        if ($atag = link_for($link['title'], $link['ctrl'], $link['action'], $link['id'], $link['onclick'], $link['extra_params'])) {
            $list[] = $atag;
        }
    }
    if (count($list)) {
        return '<p>' . join(' | ', $list) . '</p>';
    } else {
        return false;
    }
}
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:17,代码来源:application_helper.php

示例5: add

 public function add()
 {
     if (filter_var($this->request['receipient'], FILTER_VALIDATE_EMAIL)) {
         if ($this->get_left_inv() > 0) {
             $uniq = $this->gen_unique($this->request['receipient']);
             $invationcheck = DB_DataObject::factory('invitations');
             $invationcheck->id_invhash = $uniq;
             if ($invationcheck->find(TRUE)) {
                 $invationcheck->fetch();
                 $this->session_msg($this->request['receipient'] . ' ' . e('already_invated'));
             } else {
                 $message = e('auto_inv_pre_text');
                 $message .= "\n-----------------\n";
                 $message .= trim(ltrim(trim($this->request['message']), '.'));
                 $message .= "\n\n-----------------\n";
                 $message .= e('auto_follow_this') . "\n" . link_for('register', 'invite&code=' . $uniq);
                 $message .= "\n\n" . e('auto_days_valid') . ' [' . $this->inv_valid_time_days . "]\n";
                 $message .= e('auto_inv_post_text', array($this->inv_abuse_mailaddr));
                 if (mail($this->request['receipient'], e('auto_inv_subj'), $message, $this->inv_mailh)) {
                     $invitations = DB_DataObject::factory('invitations');
                     $invitations->id_users = $this->id;
                     $this->request['time'] = TIME;
                     $this->request['id_invhash'] = $this->gen_unique($this->request['receipient']);
                     $this->request['id_active'] = 0;
                     $save_invation = $this->arc_encrypt_input($invitations, $this->request);
                     $save_invation->insert();
                     logit("[" . $this->id . "] generated hash [" . $this->request['id_invhash'] . "] and invitated someone.");
                     $this->session_msg($this->request['receipient'] . ' ' . e("successfully_invated"));
                 } else {
                     throw new arcException("[" . $this->id . "] Problem sending Invationmail TO SOMEONE.");
                 }
             }
         } else {
             $this->session_msg(e('inv_max_invs') . ' ' . $this->max_invs_per_month);
         }
     } else {
         $this->session_msg($this->request['receipient'] . ' ' . e('invalid_mail_address'));
     }
     redirect('invitation');
 }
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:40,代码来源:invitation.php

示例6: time_left_display

    protected function time_left_display()
    {
        $sessionlifetime = ini_get('session.gc_maxlifetime');
        $time = $sessionlifetime - (TIME - $this->session_get('logintime'));
        $time_in_min = $time / 60;
        $time_in_h = $time_in_min / 60;
        $h = floor($time_in_h);
        $min_comma = $time_in_h - $h;
        $min = floor($min_comma * 60);
        $time_r = '';
        if (defined('SESSION_TIMEOUT_LOGOUT')) {
            $time_r .= '
						<script type="text/JavaScript">
							window.location = \'' . link_for('login', 'logout') . '&msg=' . serialize(e('session_timeout')) . '\'
						</script>
					';
        }
        if ($time_in_h >= 1) {
            $time_r .= $h . ":" . $min . " h";
        } elseif ($time <= 61) {
            $time_r .= $time . ' <b style="color:red;">s</b>';
        } elseif ($min <= 60) {
            $time_r .= $min . ' <b style="color:darkred;">m</b>';
        } elseif ($min <= 5) {
            $time_r .= $min . ' <b style="color:red;">m</b>';
        }
        return $time_r;
    }
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:28,代码来源:arcanum.php

示例7: array

			<td><?php 
        echo $video['embedCode'];
        ?>
</td>
			<td>
				<?php 
        $link_list = array(array('title' => 'View', 'ctrl' => 'stories', 'action' => 'view_video', 'id' => $video['id']), array('title' => 'Edit', 'ctrl' => 'stories', 'action' => 'modify_video', 'id' => $video['id']), array('title' => 'Remove', 'ctrl' => 'stories', 'action' => 'destroy_video', 'id' => $video['id'], 'onclick' => "if(!confirm('Are you sure you want to remove this item?')) return false"));
        if ($links = build_link_list($link_list)) {
            echo $links;
        }
        ?>
			</td>
		</tr>
		<?php 
    }
    ?>
	</table>
<?php 
} else {
    ?>
<h2>Sorry no videos currently</h2>
<?php 
}
?>
<div class="spacer"></div><br /><br />
<p><?php 
echo link_for('Create a new video', 'stories', 'new_video');
?>
</p>
</div>
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:30,代码来源:video_posts.php

示例8: foreach

	<thead>
		<tr>
			<th>Story Title</th>
			<th>Date Posted</th>
			<th>Score</th>
			<th>Num Comments</th>
			<th>Caption</th>
		</tr>
	</thead>
	<tbody>
<?php 
    foreach ($stories as $story) {
        ?>
		<tr>
			<td><?php 
        echo link_for($story['title'], 'stories', 'view_story', $story['siteContentId']);
        ?>
</td>
			<td><?php 
        echo $story['date'];
        ?>
			<td><?php 
        echo $story['score'];
        ?>
			<td><?php 
        echo $story['numComments'];
        ?>
			<td><a target="_cts" href="<?php 
        echo $story['url'];
        ?>
"><?php 
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:31,代码来源:view_member.php

示例9: generateRecentPosts

 private function generateRecentPosts($threads)
 {
     global $config, $board;
     $posts = array();
     foreach ($threads as $post) {
         if ($board['uri'] !== $post['board']) {
             openBoard($post['board']);
         }
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post);
         $post['board_name'] = $board['name'];
         if ($post['embed'] && preg_match('/^https?:\\/\\/(\\w+\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9\\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
             $post['youtube'] = $matches[2];
         }
         if (isset($post['files']) && $post['files']) {
             $files = json_decode($post['files']);
             if ($files[0]) {
                 if ($files[0]->file == 'deleted') {
                     if (count($files) > 1) {
                         foreach ($files as $file) {
                             if ($file == $files[0] || $file->file == 'deleted') {
                                 continue;
                             }
                             $post['file'] = $config['uri_thumb'] . $file->thumb;
                         }
                         if (empty($post['file'])) {
                             $post['file'] = $config['image_deleted'];
                         }
                     } else {
                         $post['file'] = $config['image_deleted'];
                     }
                 } else {
                     if ($files[0]->thumb == 'spoiler') {
                         $post['file'] = '/' . $config['spoiler_image'];
                     } else {
                         $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
                     }
                 }
             }
         }
         if (empty($post['image_count'])) {
             $post['image_count'] = 0;
         }
         $posts[] = $post;
     }
     return $posts;
 }
开发者ID:anastiel,项目名称:lainchan,代码行数:46,代码来源:theme.php

示例10: link

 public function link($pre = '', $page = false)
 {
     global $config, $board;
     return $this->root . $board['dir'] . $config['dir']['res'] . link_for((array) $this, $page == '50') . '#' . $pre . $this->id;
 }
开发者ID:sebastianiag,项目名称:lainchan,代码行数:5,代码来源:display.php

示例11: timer_regenerate

                password = password + x;
        }
        return password;
}


function timer_regenerate () {
	$.get('<?php 
echo link_for('timer', 'regenerate');
?>
', 
		function(data) {
                        if (/^[0-9]/.test(data)){
				$('#timer').html(data);
                        } else {
				window.location = '<?php 
echo link_for('login', 'logout') . '&msg=' . serialize(e('exception_500'));
?>
';
                        }
		}
	);
}

function gen_passwd (id) {
        $('#arcanum_form_' + id + ' #input_pass_' + id).val(generate_password(12));
}
function gen_passwd_new (id){
	$('#input_portal_pass_' + id).val(generate_password(12));
}
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:30,代码来源:main.js.php

示例12: array

			<td><?php 
        echo $order['address2'];
        ?>
</td>
			<td>
			<?php 
        $link_list = array(array('title' => 'View', 'ctrl' => 'street_team', 'action' => 'view_order', 'id' => $order['id']), array('title' => 'Edit', 'ctrl' => 'street_team', 'action' => 'modify_order', 'id' => $order['id']), array('title' => 'remove', 'ctrl' => 'street_team', 'action' => 'destroy_order', 'id' => $order['id'], 'onclick' => "if(!confirm('Are you sure you want to remove this item?')) return false"));
        if ($links = build_link_list($link_list)) {
            echo $links;
        }
        ?>
			</td>
		</tr>
		<?php 
    }
    ?>
	</table>
<?php 
} else {
    ?>
<h2>Sorry no orders currently</h2>
<?php 
}
?>
<div class="spacer"></div><br /><br />
<p><?php 
echo link_for('Create a new Order', 'street_team', 'new_order');
?>
</p><br /><br />
</div>
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:30,代码来源:orders.php

示例13: link_for

 }
 $root = $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
 if ($noko) {
     $redirect = $root . $board['dir'] . $config['dir']['res'] . link_for($post, false, false, $thread) . (!$post['op'] ? '#' . $id : '');
     if (!$post['op'] && isset($_SERVER['HTTP_REFERER'])) {
         $regex = array('board' => str_replace('%s', '(\\w{1,8})', preg_quote($config['board_path'], '/')), 'page' => str_replace('%d', '(\\d+)', preg_quote($config['file_page'], '/')), 'page50' => '(' . str_replace('%d', '(\\d+)', preg_quote($config['file_page50'], '/')) . '|' . str_replace(array('%d', '%s'), array('(\\d+)', '[a-z0-9-]+'), preg_quote($config['file_page50_slug'], '/')) . ')', 'res' => preg_quote($config['dir']['res'], '/'));
         if (preg_match('/\\/' . $regex['board'] . $regex['res'] . $regex['page50'] . '([?&].*)?$/', $_SERVER['HTTP_REFERER'])) {
             $redirect = $root . $board['dir'] . $config['dir']['res'] . link_for($post, true, false, $thread) . (!$post['op'] ? '#' . $id : '');
         }
     }
 } else {
     $redirect = $root . $board['dir'] . $config['file_index'];
 }
 buildThread($post['op'] ? $id : $post['thread']);
 if ($config['syslog']) {
     _syslog(LOG_INFO, 'New post: /' . $board['dir'] . $config['dir']['res'] . link_for($post) . (!$post['op'] ? '#' . $id : ''));
 }
 if (!$post['mod']) {
     header('X-Associated-Content: "' . $redirect . '"');
 }
 if (!isset($_POST['json_response'])) {
     header('Location: ' . $redirect, true, $config['redirect_http']);
 } else {
     header('Content-Type: text/json; charset=utf-8');
     echo json_encode(array('redirect' => $redirect, 'noko' => $noko, 'id' => $id));
 }
 if ($config['try_smarter'] && $post['op']) {
     $build_pages = range(1, $config['max_pages']);
 }
 if ($post['op']) {
     clean();
开发者ID:0xjove,项目名称:lainchan,代码行数:31,代码来源:post.php

示例14: dirname

        }
        return $files;
    }
}
//base for all links
$port = $_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '';
$base = 'http://' . $_SERVER['HTTP_HOST'] . $port . dirname($_SERVER['REQUEST_URI']) . '/';
//scan the directory this file is in
$files_base = dirname(__FILE__);
$files = scandir($files_base);
//build an unordered list of files
$out = '<ul class="dirlist">';
foreach ($files as $f) {
    //skip this file, any folders, and any hidden files
    if (!is_dir($files_base . '/' . $f) && $f != basename(__FILE__) && substr($f, 0, 1) != '.') {
        $out .= '<li class="' . alternate() . '">' . link_for($f, $base) . '</li>';
    }
}
$out .= '</ul>';
//support for Ajax.Updater using Prototype
if (isAjax()) {
    header('Content-type: text/html; charset="utf-8"');
    print $out;
    exit;
} else {
    $title = htmlentities(basename($files_base));
    $template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
开发者ID:joebillings,项目名称:freewayactions,代码行数:31,代码来源:_index.php

示例15: br

    echo '</div>';
}
if (isset($content['old_pws'])) {
    echo br() . img($this->infoicon) . '&nbsp;' . e('outdated_pws', array($pw_int_days), array(1));
    echo '<br><div class="look">';
    foreach ($content['old_pws'] as $cat_name => $portals) {
        foreach ($portals as $port_name => $pid) {
            echo '<div id="old_pw_' . $pid . '">' . img($this->eyeicon, $i, $i, '', '', 'remember_arc(\'' . $pid . '\');') . "&nbsp;&nbsp;<b class='info'>" . $port_name . "</b> [" . $cat_name . "]</div>";
        }
    }
    echo '</div>';
}
if (isset($content['double_pws'])) {
    echo br() . img($this->infoicon) . '&nbsp;' . e('double_pws');
    echo '<br><div class="look">';
    foreach ($content['double_pws'] as $cat_name => $portals) {
        foreach ($portals as $port_name => $pid) {
            echo "<b class='info'>" . $port_name . "</b> [" . $cat_name . "]<br>";
        }
    }
    echo '</div>';
}
if ($content['showall'] == FALSE) {
    echo br() . br() . '<b><a href="' . link_for('dashboard', 'showall') . '">[' . e('dashboard_showall') . ']</a></b>' . br();
}
?>


        <br />
</div>
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:30,代码来源:dashboard.php


注:本文中的link_for函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。