@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//插件信息
|
||||
return array(
|
||||
'hook'=>'home_index_footer', //钩子
|
||||
'name' => '友情连接插件',
|
||||
'version' => '1.0',
|
||||
'desc' => '开启友情连接插件后,将在首页显示友情链接',
|
||||
'url' => 'http://www.thinksaas.cn',
|
||||
'email' => 'thinksaas@qq.com',
|
||||
'author' => '邱君',
|
||||
'author_url' => 'http://www.thinksaas.cn',
|
||||
'isedit' => '1',
|
||||
);
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//插件编辑
|
||||
switch($ts){
|
||||
case "set":
|
||||
|
||||
$strAbout = fileRead('plugins/home/links/about.php');
|
||||
|
||||
$arrLink = fileRead('data/plugins_home_links.php');
|
||||
if($arrLink==''){
|
||||
$arrLink = $tsMySqlCache->get('plugins_home_links');
|
||||
}
|
||||
|
||||
include template('edit_set','links');
|
||||
break;
|
||||
|
||||
case "do":
|
||||
$arrLinkName = $_POST['linkname'];
|
||||
$arrLinkUrl = $_POST['linkurl'];
|
||||
|
||||
foreach($arrLinkName as $key=>$item){
|
||||
$linkname = tsTrim($item);
|
||||
$linkurl = tsTrim($arrLinkUrl[$key]);
|
||||
if($linkname && $linkurl){
|
||||
$arrLink[] = array(
|
||||
'linkname' => $linkname,
|
||||
'linkurl' => $linkurl,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fileWrite('plugins_home_links.php','data',$arrLink);
|
||||
$tsMySqlCache->set('plugins_home_links',$arrLink);
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=links&in=edit&ts=set');
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<script>
|
||||
function insertMenu(){
|
||||
$("#before").before('<tr><td><input name="linkname[]" /></td><td><input name="linkurl[]" style="width:350px;" /></td></tr>');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="midder">
|
||||
|
||||
{php include pubTemplate("plugin_menu")}
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=home&ac=plugin&plugin=links&in=edit&ts=do">
|
||||
<table class="table table-hover">
|
||||
<tr><td>链接名字</td><td>链接URL</td></tr>
|
||||
{loop $arrLink $key $item}
|
||||
<tr><td><input name="linkname[]" value="{$item['linkname']}" /></td><td><input name="linkurl[]" style="width:350px;" value="{$item['linkurl']}" /></td></tr>
|
||||
{/loop}
|
||||
|
||||
<tr id="before"><td><input type="submit" value="提 交" /></td><td><a href="javascript:void('0');" onclick="insertMenu();">点我增加链接</a>(说明:如需删除某一项,请将要删除的某项清空提交即可。)</td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="card">
|
||||
<div class="card-header">友情链接</div>
|
||||
<div class="card-body">
|
||||
{if $arrLink}
|
||||
{loop $arrLink $key $item}
|
||||
<a class="fs14 mr-3" target="_blank" href="{$item['linkurl']}">{$item['linkname']}</a>
|
||||
{/loop}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//友情连接插件
|
||||
|
||||
function links(){
|
||||
global $tsMySqlCache;
|
||||
$arrLink = fileRead('data/plugins_home_links.php');
|
||||
if($arrLink==''){
|
||||
$arrLink = $tsMySqlCache->get('plugins_home_links');
|
||||
}
|
||||
|
||||
include template('links','links');
|
||||
|
||||
}
|
||||
|
||||
addAction('home_index_footer','links');
|
||||
Reference in New Issue
Block a user