JA_content 1.4

简爱代码>PHP2013-5-16 20:22693411
<?php
/*
Plugin Name: 文章版权(QRCode)
Version: 1.4
Plugin URL: http://www.gouji.org/?post=61
Description: 在文章底部添加版权
Author: 简爱
Author Email: sc.419@qq.com
Author URL: http://www.gouji.org/
时间: 201305162216 具体设置   见 24 -- 43 行
*/

!defined('EMLOG_ROOT') && exit('access deined!');
addAction('log_related', 'JA_content_f');


function JA_content_f($arr){
	global $CACHE;
	$user_cache = $CACHE->readCache('user');
  $uid = $arr['author']; // 作者 ID


  // 以下设置版权 字体颜色
  $config = array(
    'color'     => '000000',  // 普通字体 颜色
    'blog_name' => '79FF79',  // 博客名称 颜色
    'author'    => '00A600',  // 日志作者 颜色
    'log_title' => '00DB00',  // 日志标题 颜色
    'log_url'   => '28FF28',  // 日志地址 颜色       (颜色代码详见 http://www.gouji.org/?post=219)
    'off'       => 'N',       // 是否新窗口 打开连接 (Y / 其他)
    'QRCode'    => 'Y',       // 是否显示二维码      (Y / 其他)
  );

  // 以下设置版权 显示 内容
  // 可用标签:  {QRCode}、{博客名称}、{日志作者}、{日志标题}、{日志地址}
  $text = '
  <div style="color:#' . $config['color'] . ';">
    <p>
      {QRCode}
      版权所有:《{日志作者}》 => 《{日志标题}》<br />
      本文地址:{日志地址}<br />
      除非注明,文章均为 《{博客名称}》 原创,欢迎转载!转载请注明本文地址,谢谢。<br />
    </p>
    <br />
  </div>';




  $off = $config['off'] == 'Y' ? '_blank' : '_self';
	$author = $user_cache[$uid]['name'];
	$mail   = $user_cache[$uid]['mail'];
	$des    = $user_cache[$uid]['des'];
	$title  = !empty($mail) || !empty($des) ? "title=\"$des $mail\"" : '';
	$author = "<a target=\"" . $off . "\" style=\"color:#" . $config['author'] . ";\"href=\"".Url::author($uid)."\" $title>$author</a>";
  $blog_name = Option::get('blogname');
  $url   = Url::log($arr['logid']);
  $blog_name = "<a target=\"" . $off . "\" style=\"color:#" . $config['blog_name'] . ";\" href=\"".BLOG_URL."\">".$blog_name."</a>";
  $log_title  = "<a target=\"" . $off . "\" style=\"color:#" . $config['log_title'] . ";\" href=\"".$log_url."\">".$arr['log_title']."</a>";
  $log_url   = "<a target=\"" . $off . "\" style=\"color:#" . $config['log_url'] . ";\" href=\"".$url."\">".$url."</a>";
  $QRCode = $config['QRCode'] == 'Y' ? '<img src ="http://api.asilu.com/qrcode/?s=200&text=' . urlencode($url) . '" align ="left" />' : '';
  $str_arr = array(
    '{博客名称}' => $blog_name,
    '{日志标题}' => $log_title,
    '{日志作者}' => $author,
    '{日志地址}' => $log_url,
    '{QRCode}'   => $QRCode,
  );
  echo "\r\n<!-- JA_content Start -->".
  strtr($text, $str_arr).
  "\r\n<!-- JA_content End -->\r\n";
}

本文出自简爱博客,转载时请注明出处及相应链接。

评论

  1. 谷歌图2014-12-03 20:46回复

    有需要的就用这个

  2. wlp2014-11-11 01:49回复

    不错不错。收藏

  3. 寒汐2013-07-12 03:01回复

    博主啊,你这个代码地方的灰色背景是怎么弄的啊???

    1. 简爱2013-07-12 23:10回复

      @寒汐:迷你高亮插件

      1. 寒汐2013-07-12 23:20回复

        @简爱:我装的一个插件 都不能这样。。有背景的  而且里面的颜色也不可以 再加牧歌字符的颜色。。。难道是我操作错了。。

  4. dysnyl2013-06-16 23:45回复

    请问我安装了后,怎么把框架给撑破了~~~侧边栏跑到下面去了

    1. 简爱2013-06-16 23:49回复

      @dysnyl:地址呢?  可以帮忙看下

  5. 刹那2013-05-28 11:07回复

    解决了,谢谢楼主,自己改了一下,去掉了二维码。

  6. 刹那2013-05-28 11:03回复

    谢谢楼主,这个怎么去掉二维码?能够更新一个版本在后台弄一个设置界面就好了,各种颜色,二维码是否显示等等。

  7. 黎健雄2013-05-17 08:58回复

    这个有什么用。

    1. 简爱2013-05-17 14:13回复

      @黎健雄:有需要的就用这个  跟 1.3 没有太大区别

发表评论

电子邮件地址不会被公开。必填项已用*标注