public static function getInstance() { if (self::$instance == null) { self::$instance = new Link_Model(); } return self::$instance; }
<?php /** * 链接管理 * @copyright (c) Emlog All Rights Reserved */ require_once 'globals.php'; $Link_Model = new Link_Model(); if ($action == '') { $links = $Link_Model->getLinks(); include View::getView('header'); require_once View::getView('links'); include View::getView('footer'); View::output(); } if ($action == 'link_taxis') { $link = isset($_POST['link']) ? $_POST['link'] : ''; if (!empty($link)) { foreach ($link as $key => $value) { $value = intval($value); $key = intval($key); $Link_Model->updateLink(array('taxis' => $value), $key); } $CACHE->updateCache('link'); emDirect("./link.php?active_taxis=1"); } else { emDirect("./link.php?error_b=1"); } } if ($action == 'addlink') { $taxis = isset($_POST['taxis']) ? intval(trim($_POST['taxis'])) : 0;
function widget_links() { ?> <div class="widget"> <h3>网站收藏</h3> <ul> <?php $links = Link_Model::getInstance()->getLinks(5); foreach ($links as $link) { $name = subString($link['link_name'], 0, 16); echo "<li><a class='link_description' href='{$link['link_url']}'>{$name}<span>{$link['link_description']}</span></a></li>"; } ?> </ul> </div> <?php }
public function copy(Link_Model $link) { $this->title = $link->get_title(); $this->link = $link->get_link(); $this->description = $link->get_description(); $this->uid = $link->get_uid(); $this->lid = $link->get_lid(); $this->privacy_status = $link->get_privacy_status(); }