7
12
2016
0

PHP中过滤富文本编辑器的标签

在最近的工作中在用ThinkPHP做的后台,管理数据,前台的微信端读取数据。

后台的富文本编辑器是KindEditor,它经常会增加一些标签,特别是字体的标签,这样微信端的样式就会无法控制,很麻烦。

感谢Google,我找到了http://htmlpurifier.org/,不过官网是2015年更新的了,应该不支持PHP7

下载,解压,在Vendor目录下建立HTMLPurifier目录,然后把解压文件的Library文件全部拷进去

在ThinkPHP的控制器方法即可使用

vendor('HTMLPurifier.HTMLPurifier#auto');
$config = \HTMLPurifier_Config::createDefault();
$purifier = new \HTMLPurifier($config);
$config->set('HTML.Allowed','p,br,img[src]');
//保留p br img.src标签
$clean_html = $purifier->purify(I('post.postdata'));
Category: php | Tags: php thinkphp
6
16
2016
0

extensions for laravel i used in developing

1,artisan view

composer require sven/artisan-view

regisiter in config/app.php

then use php artisan make:view admin.user.index to generate views

2,laravel ide helper generator

composer require barryvdh/laravel-ide-helper

regisiter in config/app.php

then use php artisan ide-helper:generate

be sure to use it in first to connect database,in other words the web server

3,laravel debugbar

composer require barryvdh/larave-debugbar

regisiter in config/app.php

except serverprovider,the facades

Debugbar => Barryvdh\Debugbar\Facade::class,

Category: php | Tags: larave php
3
30
2016
0

Arch下安装 Infinality系列包

一,导入秘钥

 sudo dirmngr

 pacman-key -r 962DDE58

 pacman-key -f 962DDE58

pacman-key --lsign-key  962DDE58

二,增加源

vim /etc/pacman.conf

[infinality-bundle]
Server = http://bohoomil.com/repo/$arch
[infinality-bundle-multilib]
Server = http://bohoomil.com/repo/multilib/$arch
[infinality-bundle-fonts]
Server = http://bohoomil.com/repo/fonts

pacman -Syy

三,安装

yaourt infinality

Category: Linux | Tags:
3
24
2016
0

How to use i3lock as xfce's screensaver?

By default,in Archlinux's xflock4 doesn't work generally after basic install.

I decide to use i3lock to manage it.

First,download i3lock-fancy and it's dependancies

yaourt -S i3lock-color-git

cd /usr/bin

ln -s i3lock-color i3lock

sudo pacman -S imagemagick scrot xautolock

cd ~/software

git clone https://github.com/meskarune/i3lock-fancy

cd /usr/bin      make slock to communicate with xflock4

sudo vim slock

# ! /bin/bash

(path to i3lock fancy)

sudo chmod +x slock

 

after that,go to setting /session and startup,make an autostart with below script

xautolock -locker xflock4 -time 10 -corners 0-00

 

Category: Linux | Tags: linux
4
3
2015
0

Arch下安装aur时下载包太慢时的安装方法

安装aur的包时,很多源都很卡,下着下着就0kb了

这时可以先

yaourt -G package

然后打开PKGBUILD找到source,用下载工具下载好

再修改PKGBUILD中的source为本地地址

cd package

makepkg

sudo pacman -U pkg.pkg.tar.xz

 

package代表包名

Category: Linux | Tags: AUR

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com