Showing preview only (1,500K chars total). Download the full file or copy to clipboard to get everything.
Repository: typecho/plugins
Branch: master
Commit: 975251b0f852
Files: 232
Total size: 1.4 MB
Directory structure:
gitextract_cbgp91ts/
├── .gitattributes
├── .gitignore
├── Akismet/
│ └── Plugin.php
├── AliUpload/
│ ├── Plugin.php
│ └── lib/
│ ├── mimetypes.class.php
│ ├── requestcore.class.php
│ ├── sdk.class.php
│ └── zh.inc.php
├── Avartar.php
├── B3logForHacPai/
│ ├── Action.php
│ ├── LICENSE.txt
│ ├── Plugin.php
│ ├── README.md
│ └── libs/
│ └── compat_json.php
├── BlockComment/
│ └── Plugin.php
├── ConnectToTwitter/
│ ├── OAuth.php
│ ├── Plugin.php
│ └── twitterOAuth.php
├── Creole/
│ ├── Creole_Wiki.php
│ ├── Parse/
│ │ ├── Address.php
│ │ ├── Blockquote.php
│ │ ├── Box.php
│ │ ├── Break.php
│ │ ├── Center.php
│ │ ├── Delete.php
│ │ ├── Delimiter.php
│ │ ├── Emphasis.php
│ │ ├── Footnote.php
│ │ ├── Heading.php
│ │ ├── Horiz.php
│ │ ├── Image.php
│ │ ├── List.php
│ │ ├── Newline.php
│ │ ├── Paragraph.php
│ │ ├── Prefilter.php
│ │ ├── Preformatted.php
│ │ ├── Raw.php
│ │ ├── Strong.php
│ │ ├── Subscript.php
│ │ ├── Superscript.php
│ │ ├── Table.php
│ │ ├── Tighten.php
│ │ ├── Trim.php
│ │ ├── Tt.php
│ │ ├── Underline.php
│ │ └── Url.php
│ ├── Parse.inc.php
│ ├── Plugin.php
│ ├── Render/
│ │ ├── Plain/
│ │ │ ├── Anchor.php
│ │ │ ├── Blockquote.php
│ │ │ ├── Bold.php
│ │ │ ├── Box.php
│ │ │ ├── Break.php
│ │ │ ├── Center.php
│ │ │ ├── Code.php
│ │ │ ├── Colortext.php
│ │ │ ├── Deflist.php
│ │ │ ├── Delete.php
│ │ │ ├── Delimiter.php
│ │ │ ├── Embed.php
│ │ │ ├── Emphasis.php
│ │ │ ├── Font.php
│ │ │ ├── Freelink.php
│ │ │ ├── Function.php
│ │ │ ├── Heading.php
│ │ │ ├── Horiz.php
│ │ │ ├── Html.php
│ │ │ ├── Image.php
│ │ │ ├── Include.php
│ │ │ ├── Interwiki.php
│ │ │ ├── Italic.php
│ │ │ ├── List.php
│ │ │ ├── Newline.php
│ │ │ ├── Page.php
│ │ │ ├── Paragraph.php
│ │ │ ├── Phplookup.php
│ │ │ ├── Plugin.php
│ │ │ ├── Prefilter.php
│ │ │ ├── Preformatted.php
│ │ │ ├── Raw.php
│ │ │ ├── Revise.php
│ │ │ ├── Smiley.php
│ │ │ ├── Specialchar.php
│ │ │ ├── Strong.php
│ │ │ ├── Subscript.php
│ │ │ ├── Superscript.php
│ │ │ ├── Table.php
│ │ │ ├── Tighten.php
│ │ │ ├── Titlebar.php
│ │ │ ├── Toc.php
│ │ │ ├── Tt.php
│ │ │ ├── Underline.php
│ │ │ ├── Url.php
│ │ │ └── Wikilink.php
│ │ ├── Plain.php
│ │ ├── Xhtml/
│ │ │ ├── Address.php
│ │ │ ├── Anchor.php
│ │ │ ├── Blockquote.php
│ │ │ ├── Bold.php
│ │ │ ├── Box.php
│ │ │ ├── Break.php
│ │ │ ├── Center.php
│ │ │ ├── Code.php
│ │ │ ├── Colortext.php
│ │ │ ├── Deflist.php
│ │ │ ├── Delete.php
│ │ │ ├── Delimiter.php
│ │ │ ├── Embed.php
│ │ │ ├── Emphasis.php
│ │ │ ├── Font.php
│ │ │ ├── Freelink.php
│ │ │ ├── Function.php
│ │ │ ├── Heading.php
│ │ │ ├── Horiz.php
│ │ │ ├── Html.php
│ │ │ ├── Image.php
│ │ │ ├── Include.php
│ │ │ ├── Interwiki.php
│ │ │ ├── Italic.php
│ │ │ ├── List.php
│ │ │ ├── Newline.php
│ │ │ ├── Page.php
│ │ │ ├── Paragraph.php
│ │ │ ├── Phplookup.php
│ │ │ ├── Plugin.php
│ │ │ ├── Prefilter.php
│ │ │ ├── Preformatted.php
│ │ │ ├── Raw.php
│ │ │ ├── Revise.php
│ │ │ ├── Smiley.php
│ │ │ ├── Specialchar.php
│ │ │ ├── Strong.php
│ │ │ ├── Subscript.php
│ │ │ ├── Superscript.php
│ │ │ ├── Table.php
│ │ │ ├── Tighten.php
│ │ │ ├── Titlebar.php
│ │ │ ├── Toc.php
│ │ │ ├── Tt.php
│ │ │ ├── Underline.php
│ │ │ ├── Url.php
│ │ │ └── Wikilink.php
│ │ └── Xhtml.php
│ └── Render.inc.php
├── FlashMp3Player/
│ ├── Plugin.php
│ └── swf/
│ └── dewplayer.swf
├── GitHubGit/
│ ├── Action.php
│ ├── Plugin.php
│ ├── README.md
│ └── Spyc.php
├── GoogleAnalytics/
│ └── Plugin.php
├── GoogleCodePrettify/
│ ├── Plugin.php
│ └── src/
│ ├── lang-apollo.js
│ ├── lang-css.js
│ ├── lang-hs.js
│ ├── lang-lisp.js
│ ├── lang-lua.js
│ ├── lang-ml.js
│ ├── lang-proto.js
│ ├── lang-sql.js
│ ├── lang-vb.js
│ ├── lang-wiki.js
│ ├── prettify.css
│ └── prettify.js
├── GoogleCodeSVN/
│ ├── Action.php
│ └── Plugin.php
├── LaTex/
│ ├── Plugin.php
│ └── latex.js
├── MagikeToTypecho/
│ ├── Action.php
│ ├── Plugin.php
│ └── panel.php
├── MathJax.php
├── PageToLinks.php
├── PostToQzone/
│ ├── Plugin.php
│ ├── phpmailer.php
│ └── smtp.php
├── README.md
├── SaeUpload/
│ └── Plugin.php
├── ShareCode/
│ └── Plugin.php
├── SimpleCode.php
├── Textile2/
│ ├── Plugin.php
│ └── Textile.php
├── TinyMCE/
│ ├── Plugin.php
│ └── tiny_mce/
│ ├── langs/
│ │ └── typecho.js
│ ├── langs.php
│ ├── plugins/
│ │ ├── coder/
│ │ │ └── editor_plugin.js
│ │ ├── inlinepopups/
│ │ │ ├── editor_plugin.js
│ │ │ ├── skins/
│ │ │ │ └── clearlooks2/
│ │ │ │ └── window.css
│ │ │ └── template.htm
│ │ ├── media/
│ │ │ ├── css/
│ │ │ │ ├── content.css
│ │ │ │ └── media.css
│ │ │ ├── editor_plugin.js
│ │ │ ├── img/
│ │ │ │ └── flv_player.swf
│ │ │ ├── js/
│ │ │ │ ├── embed.js
│ │ │ │ └── media.js
│ │ │ ├── langs/
│ │ │ │ └── typecho_dlg.js
│ │ │ └── media.htm
│ │ ├── morebreak/
│ │ │ ├── css/
│ │ │ │ └── content.css
│ │ │ └── editor_plugin.js
│ │ └── safari/
│ │ ├── blank.htm
│ │ └── editor_plugin.js
│ ├── themes/
│ │ └── advanced/
│ │ ├── about.htm
│ │ ├── anchor.htm
│ │ ├── charmap.htm
│ │ ├── color_picker.htm
│ │ ├── editor_template.js
│ │ ├── image.htm
│ │ ├── js/
│ │ │ ├── about.js
│ │ │ ├── anchor.js
│ │ │ ├── charmap.js
│ │ │ ├── color_picker.js
│ │ │ ├── image.js
│ │ │ ├── link.js
│ │ │ └── source_editor.js
│ │ ├── langs/
│ │ │ ├── typecho.js
│ │ │ └── typecho_dlg.js
│ │ ├── link.htm
│ │ ├── skins/
│ │ │ └── typecho/
│ │ │ ├── content.css
│ │ │ ├── dialog.css
│ │ │ └── ui.css
│ │ └── source_editor.htm
│ ├── tiny_mce.js
│ ├── tiny_mce_popup.js
│ └── utils/
│ ├── editable_selects.js
│ ├── form_utils.js
│ ├── mctabs.js
│ └── validate.js
├── WordpressToTypecho/
│ ├── Action.php
│ ├── Plugin.php
│ └── panel.php
└── ZenCoding/
├── Plugin.php
└── zen_textarea.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.php text eol=lf
*.js text eol=lf
*.css text eol=lf
*.html text eol=lf
*.xml text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
================================================
FILE: .gitignore
================================================
.*.swp
.*.swo
._*
.DS_Store
/Debug/
/ImgCache/
/Backup_rar/
/Debug/
/debug/
/upload/
/avatar/
/.idea/
.svn/
*.orig
*.aps
*.APS
*.chm
*.exp
*.pdb
*.rar
.smbdelete*
*.sublime*
.sass-cache
config.rb
/config.inc.php
/usr/uploads/
================================================
FILE: Akismet/Plugin.php
================================================
<?php
/**
* Akismet 反垃圾评论插件 for Typecho
*
* @package Akismet
* @author qining
* @version 1.1.4
* @link http://typecho.org
*/
class Akismet_Plugin implements Typecho_Plugin_Interface
{
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
if (false == Typecho_Http_Client::get()) {
throw new Typecho_Plugin_Exception(_t('对不起, 您的主机不支持 php-curl 扩展而且没有打开 allow_url_fopen 功能, 无法正常使用此功能'));
}
Typecho_Plugin::factory('Widget_Feedback')->comment = array('Akismet_Plugin', 'filter');
Typecho_Plugin::factory('Widget_Feedback')->trackback = array('Akismet_Plugin', 'filter');
Typecho_Plugin::factory('Widget_XmlRpc')->pingback = array('Akismet_Plugin', 'filter');
Typecho_Plugin::factory('Widget_Comments_Edit')->mark = array('Akismet_Plugin', 'mark');
return _t('请配置此插件的API KEY, 以使您的反垃圾策略生效');
}
/**
* 禁用插件方法,如果禁用失败,直接抛出异常
*
* @static
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function deactivate(){}
/**
* 获取插件配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form 配置面板
* @return void
*/
public static function config(Typecho_Widget_Helper_Form $form)
{
$key = new Typecho_Widget_Helper_Form_Element_Textarea('key', NULL, NULL, _t('服务密钥'), _t('此密钥需要向服务提供商注册<br />
它是一个用于表明您合法用户身份的字符串'));
$form->addInput($key->addRule('required', _t('您必须填写一个服务密钥'))
->addRule(array('Akismet_Plugin', 'validate'), _t('您使用的服务密钥错误')));
$url = new Typecho_Widget_Helper_Form_Element_Text('url', NULL, 'http://rest.akismet.com',
_t('服务地址'), _t('这是反垃圾评论服务提供商的服务器地址<br />
我们推荐您使用 <a href="http://akismet.com">Akismet</a> 或者 <a href="http://antispam.typepad.com">Typepad</a> 的反垃圾服务'));
$form->addInput($url->addRule('url', _t('您使用的地址格式错误')));
}
/**
* 个人用户的配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form
* @return void
*/
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
/**
* 验证api的key值
*
* @access public
* @param string $key 服务密钥
* @return boolean
*/
public static function validate($key)
{
$options = Typecho_Widget::widget('Widget_Options');
$url = Typecho_Request::getInstance()->url;
$data = array(
'key' => $key,
'blog' => $options->siteUrl
);
$client = Typecho_Http_Client::get('Curl', 'Socket');
if (false != $client) {
$client->setData($data)
->setHeader('User-Agent', $options->generator . ' | Akismet/1.1')
->send(Typecho_Common::url('/1.1/verify-key', $url));
if ('valid' == $client->getResponseBody()) {
return true;
}
}
return false;
}
/**
* 标记评论状态时的插件接口
*
* @access public
* @param array $comment 评论数据的结构体
* @param Typecho_Widget $commentWidget 评论组件
* @param string $status 评论状态
* @return void
*/
public static function mark($comment, $commentWidget, $status)
{
if ('spam' == $comment['status'] && $status != 'spam') {
self::filter($comment, $commentWidget, NULL, 'submit-ham');
} else if ('spam' != $comment['status'] && $status == 'spam') {
self::filter($comment, $commentWidget, NULL, 'submit-spam');
}
}
/**
* 评论过滤器
*
* @access public
* @param array $comment 评论结构
* @param Typecho_Widget $post 被评论的文章
* @param array $result 返回的结果上下文
* @param string $api api地址
* @return void
*/
public static function filter($comment, $post, $result, $api = 'comment-check')
{
$comment = empty($result) ? $comment : $result;
$options = Typecho_Widget::widget('Widget_Options');
$url = $options->plugin('Akismet')->url;
$key = $options->plugin('Akismet')->key;
$allowedServerVars = 'comment-check' == $api ? array(
'SCRIPT_URI',
'HTTP_HOST',
'HTTP_USER_AGENT',
'HTTP_ACCEPT',
'HTTP_ACCEPT_LANGUAGE',
'HTTP_ACCEPT_ENCODING',
'HTTP_ACCEPT_CHARSET',
'HTTP_KEEP_ALIVE',
'HTTP_CONNECTION',
'HTTP_CACHE_CONTROL',
'HTTP_PRAGMA',
'HTTP_DATE',
'HTTP_EXPECT',
'HTTP_MAX_FORWARDS',
'HTTP_RANGE',
'CONTENT_TYPE',
'CONTENT_LENGTH',
'SERVER_SIGNATURE',
'SERVER_SOFTWARE',
'SERVER_NAME',
'SERVER_ADDR',
'SERVER_PORT',
'REMOTE_PORT',
'GATEWAY_INTERFACE',
'SERVER_PROTOCOL',
'REQUEST_METHOD',
'QUERY_STRING',
'REQUEST_URI',
'SCRIPT_NAME',
'REQUEST_TIME'
) : array();
$data = array(
'blog' => $options->siteUrl,
'user_ip' => $comment['ip'],
'user_agent' => $comment['agent'],
'referrer' => Typecho_Request::getInstance()->getReferer(),
'permalink' => $post->permalink,
'comment_type' => $comment['type'],
'comment_author' => $comment['author'],
'comment_author_email' => $comment['mail'],
'comment_author_url' => $comment['url'],
'comment_content' => $comment['text']
);
foreach ($allowedServerVars as $val) {
if (array_key_exists($val, $_SERVER)) {
$data[$val] = $_SERVER[$val];
}
}
try {
$client = Typecho_Http_Client::get();
if (false != $client && $key) {
$params = parse_url($url);
$url = $params['scheme'] . '://' . $key . '.' . $params['host'] . (isset($params['path']) ? $params['path'] : NULL);
$client->setHeader('User-Agent', $options->generator . ' | Akismet/1.1')
->setTimeout(5)
->setData($data)
->send(Typecho_Common::url('/1.1/' . $api, $url));
if ('true' == $client->getResponseBody()) {
$comment['status'] = 'spam';
}
}
} catch (Typecho_Http_Client_Exception $e) {
//do nothing
error_log($e->getMessage());
}
return $comment;
}
}
================================================
FILE: AliUpload/Plugin.php
================================================
<?php
if(!defined('OSS_API_PATH'))
define('OSS_API_PATH', dirname(__FILE__));
//ACCESS_ID
define('OSS_ACCESS_ID', '');
//ACCESS_KEY
define('OSS_ACCESS_KEY', '');
//是否记录日志
define('ALI_LOG', FALSE);
//自定义日志路径,如果没有设置,则使用系统默认路径,在./logs/
define('ALI_LOG_PATH',OSS_API_PATH.'/logs/');
//是否显示LOG输出
define('ALI_DISPLAY_LOG', FALSE);
require_once 'lib/sdk.class.php';
/**
* <a href="http://loftor.com/" target="_blank">Alioss</a>专用的文件上传插件。
*
* @package AliUpload
* @author loftor
* @version 1.0.0 Beta
* @link http://loftor.com/
*/
class AliUpload_Plugin implements Typecho_Plugin_Interface
{
//上传文件目录
const UPLOAD_PATH = 'usr/uploads';
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Typecho_Plugin::factory('Widget_Upload')->uploadHandle = array('AliUpload_Plugin', 'uploadHandle');
Typecho_Plugin::factory('Widget_Upload')->modifyHandle = array('AliUpload_Plugin', 'modifyHandle');
Typecho_Plugin::factory('Widget_Upload')->deleteHandle = array('AliUpload_Plugin', 'deleteHandle');
Typecho_Plugin::factory('Widget_Upload')->attachmentHandle = array('AliUpload_Plugin', 'attachmentHandle');
Typecho_Plugin::factory('Widget_Upload')->attachmentDataHandle = array('AliUpload_Plugin', 'attachmentDataHandle');
return _t('启用成功,请进行相应设置!');
}
/**
* 禁用插件方法,如果禁用失败,直接抛出异常
*
* @static
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function deactivate(){}
/**
* 获取插件配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form 配置面板
* @return void
*/
public static function config(Typecho_Widget_Helper_Form $form)
{
$buketName = new Typecho_Widget_Helper_Form_Element_Text('bucket', NULL, 'loftor',
_t('Bucket名称'), _t('请填写Buket名称!'));
$form->addInput($buketName);
$accessID = new Typecho_Widget_Helper_Form_Element_Text('access_id', NULL, '',
_t('ACCESS_ID'), _t('请填写ACCESS_ID!'));
$form->addInput($accessID);
$accessKEY = new Typecho_Widget_Helper_Form_Element_Text('access_key', NULL, '',
_t('ACCESS_KEY'), _t('请填写请填写ACCESS_KEY!'));
$form->addInput($accessKEY);
$domianName = new Typecho_Widget_Helper_Form_Element_Text('domian', NULL, 'http://oss.loftor.com/',
_t('域名名称'), _t('请填写域名名称!'));
$form->addInput($domianName);
}
/**
* 个人用户的配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form
* @return void
*/
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
/**
* 上传文件处理函数
*
* @access public
* @param array $file 上传的文件
* @return mixed
*/
public static function uploadHandle($file)
{
if (empty($file['name'])) {
return false;
}
$fileName = preg_split("(\/|\\|:)", $file['name']);
$file['name'] = array_pop($fileName);
//获取扩展名
$ext = '';
$part = explode('.', $file['name']);
if (($length = count($part)) > 1) {
$ext = strtolower($part[$length - 1]);
}
if (!self::checkFileType($ext)) {
return false;
}
$options = Typecho_Widget::widget('Widget_Options');
$date = new Typecho_Date($options->gmtTime);
$path = self::UPLOAD_PATH;
$options = Typecho_Widget::widget('Widget_Options');
$access_id=$options->plugin('AliUpload')->access_id;
$access_key=$options->plugin('AliUpload')->access_key;
$bucket = $options->plugin('AliUpload')->bucket;
$oss_service = new ALIOSS($access_id,$access_key);
$path = $path . '/' . $date->year . '/' . $date->month;
//获取文件名
$fileName = sprintf('%u', crc32(uniqid())) . '.' . $ext;
$path = $path . '/' . $fileName;//add for mkdir
$response;
if (isset($file['tmp_name'])) {
//移动上传文件
$response = $oss_service->upload_file_by_file($bucket,$path,$file['tmp_name']);
if (!$response->isOk()) {
return false;
}
} else if (isset($file['bits'])) {
//直接写入文件
$upload_file_options = array(
'content' => $file['bits'],
'length' => strlen($file['bits'])
);
$response = $oss_service->upload_file_by_content($bucket,$path,$upload_file_options);
if (!$response->isOk()) {
return false;
}
} else {
return false;
}
if (!isset($file['size'])) {
$file['size'] = $response->header['_info']['size_upload'];
}
$path=$response->header['x-oss-request-url'];
//返回相对存储路径
return array(
'name' => $file['name'],
'path' => self::UPLOAD_PATH . '/' . $date->year . '/' . $date->month . '/' . $fileName,
'size' => $file['size'],
'type' => $ext,
'mime' => self::mimeContentType($ext)
);
}
/**
* 修改文件处理函数
*
* @access public
* @param array $content 老文件
* @param array $file 新上传的文件
* @return mixed
*/
public static function modifyHandle($content, $file)
{
if (empty($file['name'])) {
return false;
}
$fileName = preg_split("(\/|\\|:)", $file['name']);
$file['name'] = array_pop($fileName);
//获取扩展名
$ext = '';
$part = explode('.', $file['name']);
if (($length = count($part)) > 1) {
$ext = strtolower($part[$length - 1]);
}
if ($content['attachment']->type != $ext) {
return false;
}
//获取文件名
$fileName = $content['attachment']->path;
$path = $path . '/' . $fileName;//add for mkdir
$path=substr($path, 1);
$options = Typecho_Widget::widget('Widget_Options');
$access_id=$options->plugin('AliUpload')->access_id;
$access_key=$options->plugin('AliUpload')->access_key;
$bucket = $options->plugin('AliUpload')->bucket;
$oss_service = new ALIOSS($access_id,$access_key);
if (isset($file['tmp_name'])) {
//移动上传文件
$response = $oss_service->upload_file_by_file($bucket,$path,$file['tmp_name']);
if (!$response->isOk()) {
return false;
}
} else if (isset($file['bits'])) {
//直接写入文件
$upload_file_options = array(
'content' => $file['bits'],
'length' => strlen($file['bits'])
);
$response = $oss_service->upload_file_by_content($bucket,$path,$upload_file_options);
if (!$response->isOk()) {
return false;
}
} else {
return false;
}
if (!isset($file['size'])) {
$file['size'] = $response->header['_info']['size_upload'];
}
//返回相对存储路径
return array(
'name' => $content['attachment']->name,
'path' => $content['attachment']->path,
'size' => $file['size'],
'type' => $content['attachment']->type,
'mime' => $content['attachment']->mime
);
}
/**
* 删除文件
*
* @access public
* @param array $content 文件相关信息
* @return string
*/
public static function deleteHandle(array $content)
{
$options = Typecho_Widget::widget('Widget_Options');
$access_id=$options->plugin('AliUpload')->access_id;
$access_key=$options->plugin('AliUpload')->access_key;
$bucket = $options->plugin('AliUpload')->bucket;
$oss_service = new ALIOSS($access_id,$access_key);
$response = $oss_service->delete_object($bucket,$content['attachment']->path);
return $response->isOk();
}
/**
* 获取实际文件绝对访问路径
*
* @access public
* @param array $content 文件相关信息
* @return string
*/
public static function attachmentHandle(array $content)
{
$options = Typecho_Widget::widget('Widget_Options');
$domian = $options->plugin('AliUpload')->domian;
return $domian.$content['attachment']->path;
}
/**
* 获取实际文件数据
*
* @access public
* @param array $content
* @return string
*/
public static function attachmentDataHandle(array $content)
{
$options = Typecho_Widget::widget('Widget_Options');
$domian = $options->plugin('AliUpload')->domian;
return file_get_contents($domian.$content['attachment']->path);
}
/**
* 检查文件名
*
* @access private
* @param string $ext 扩展名
* @return boolean
*/
public static function checkFileType($ext)
{
$options = Typecho_Widget::widget('Widget_Options');
return in_array($ext, $options->allowedAttachmentTypes);
}
/**
* 获取图片
*
* @access public
* @param string $fileName 文件名
* @return string
*/
public static function mimeContentType($ext)
{
$mimeTypes = array(
'ez' => 'application/andrew-inset',
'csm' => 'application/cu-seeme',
'cu' => 'application/cu-seeme',
'tsp' => 'application/dsptype',
'spl' => 'application/x-futuresplash',
'hta' => 'application/hta',
'cpt' => 'image/x-corelphotopaint',
'hqx' => 'application/mac-binhex40',
'nb' => 'application/mathematica',
'mdb' => 'application/msaccess',
'doc' => 'application/msword',
'dot' => 'application/msword',
'bin' => 'application/octet-stream',
'oda' => 'application/oda',
'ogg' => 'application/ogg',
'prf' => 'application/pics-rules',
'key' => 'application/pgp-keys',
'pdf' => 'application/pdf',
'pgp' => 'application/pgp-signature',
'ps' => 'application/postscript',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'rss' => 'application/rss+xml',
'rtf' => 'text/rtf',
'smi' => 'application/smil',
'smil' => 'application/smil',
'wp5' => 'application/wordperfect5.1',
'xht' => 'application/xhtml+xml',
'xhtml' => 'application/xhtml+xml',
'zip' => 'application/zip',
'cdy' => 'application/vnd.cinderella',
'mif' => 'application/x-mif',
'xls' => 'application/vnd.ms-excel',
'xlb' => 'application/vnd.ms-excel',
'cat' => 'application/vnd.ms-pki.seccat',
'stl' => 'application/vnd.ms-pki.stl',
'ppt' => 'application/vnd.ms-powerpoint',
'pps' => 'application/vnd.ms-powerpoint',
'pot' => 'application/vnd.ms-powerpoint',
'sdc' => 'application/vnd.stardivision.calc',
'sda' => 'application/vnd.stardivision.draw',
'sdd' => 'application/vnd.stardivision.impress',
'sdp' => 'application/vnd.stardivision.impress',
'smf' => 'application/vnd.stardivision.math',
'sdw' => 'application/vnd.stardivision.writer',
'vor' => 'application/vnd.stardivision.writer',
'sgl' => 'application/vnd.stardivision.writer-global',
'sxc' => 'application/vnd.sun.xml.calc',
'stc' => 'application/vnd.sun.xml.calc.template',
'sxd' => 'application/vnd.sun.xml.draw',
'std' => 'application/vnd.sun.xml.draw.template',
'sxi' => 'application/vnd.sun.xml.impress',
'sti' => 'application/vnd.sun.xml.impress.template',
'sxm' => 'application/vnd.sun.xml.math',
'sxw' => 'application/vnd.sun.xml.writer',
'sxg' => 'application/vnd.sun.xml.writer.global',
'stw' => 'application/vnd.sun.xml.writer.template',
'sis' => 'application/vnd.symbian.install',
'wbxml' => 'application/vnd.wap.wbxml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'wk' => 'application/x-123',
'dmg' => 'application/x-apple-diskimage',
'bcpio' => 'application/x-bcpio',
'torrent' => 'application/x-bittorrent',
'cdf' => 'application/x-cdf',
'vcd' => 'application/x-cdlink',
'pgn' => 'application/x-chess-pgn',
'cpio' => 'application/x-cpio',
'csh' => 'text/x-csh',
'deb' => 'application/x-debian-package',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'wad' => 'application/x-doom',
'dms' => 'application/x-dms',
'dvi' => 'application/x-dvi',
'pfa' => 'application/x-font',
'pfb' => 'application/x-font',
'gsf' => 'application/x-font',
'pcf' => 'application/x-font',
'pcf.Z' => 'application/x-font',
'gnumeric' => 'application/x-gnumeric',
'sgf' => 'application/x-go-sgf',
'gcf' => 'application/x-graphing-calculator',
'gtar' => 'application/x-gtar',
'tgz' => 'application/x-gtar',
'taz' => 'application/x-gtar',
'gz' => 'application/x-gtar',
'hdf' => 'application/x-hdf',
'phtml' => 'application/x-httpd-php',
'pht' => 'application/x-httpd-php',
'php' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'php3' => 'application/x-httpd-php3',
'php3p' => 'application/x-httpd-php3-preprocessed',
'php4' => 'application/x-httpd-php4',
'ica' => 'application/x-ica',
'ins' => 'application/x-internet-signup',
'isp' => 'application/x-internet-signup',
'iii' => 'application/x-iphone',
'jar' => 'application/x-java-archive',
'jnlp' => 'application/x-java-jnlp-file',
'ser' => 'application/x-java-serialized-object',
'class' => 'application/x-java-vm',
'js' => 'application/x-javascript',
'chrt' => 'application/x-kchart',
'kil' => 'application/x-killustrator',
'kpr' => 'application/x-kpresenter',
'kpt' => 'application/x-kpresenter',
'skp' => 'application/x-koan',
'skd' => 'application/x-koan',
'skt' => 'application/x-koan',
'skm' => 'application/x-koan',
'ksp' => 'application/x-kspread',
'kwd' => 'application/x-kword',
'kwt' => 'application/x-kword',
'latex' => 'application/x-latex',
'lha' => 'application/x-lha',
'lzh' => 'application/x-lzh',
'lzx' => 'application/x-lzx',
'frm' => 'application/x-maker',
'maker' => 'application/x-maker',
'frame' => 'application/x-maker',
'fm' => 'application/x-maker',
'fb' => 'application/x-maker',
'book' => 'application/x-maker',
'fbdoc' => 'application/x-maker',
'wmz' => 'application/x-ms-wmz',
'wmd' => 'application/x-ms-wmd',
'com' => 'application/x-msdos-program',
'exe' => 'application/x-msdos-program',
'bat' => 'application/x-msdos-program',
'dll' => 'application/x-msdos-program',
'msi' => 'application/x-msi',
'nc' => 'application/x-netcdf',
'pac' => 'application/x-ns-proxy-autoconfig',
'nwc' => 'application/x-nwc',
'o' => 'application/x-object',
'oza' => 'application/x-oz-application',
'pl' => 'application/x-perl',
'pm' => 'application/x-perl',
'p7r' => 'application/x-pkcs7-certreqresp',
'crl' => 'application/x-pkcs7-crl',
'qtl' => 'application/x-quicktimeplayer',
'rpm' => 'audio/x-pn-realaudio-plugin',
'shar' => 'application/x-shar',
'swf' => 'application/x-shockwave-flash',
'swfl' => 'application/x-shockwave-flash',
'sh' => 'text/x-sh',
'sit' => 'application/x-stuffit',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc',
'tar' => 'application/x-tar',
'tcl' => 'text/x-tcl',
'tex' => 'text/x-tex',
'gf' => 'application/x-tex-gf',
'pk' => 'application/x-tex-pk',
'texinfo' => 'application/x-texinfo',
'texi' => 'application/x-texinfo',
'~' => 'application/x-trash',
'%' => 'application/x-trash',
'bak' => 'application/x-trash',
'old' => 'application/x-trash',
'sik' => 'application/x-trash',
't' => 'application/x-troff',
'tr' => 'application/x-troff',
'roff' => 'application/x-troff',
'man' => 'application/x-troff-man',
'me' => 'application/x-troff-me',
'ms' => 'application/x-troff-ms',
'ustar' => 'application/x-ustar',
'src' => 'application/x-wais-source',
'wz' => 'application/x-wingz',
'crt' => 'application/x-x509-ca-cert',
'fig' => 'application/x-xfig',
'au' => 'audio/basic',
'snd' => 'audio/basic',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'kar' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mpega' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg',
'm3u' => 'audio/x-mpegurl',
'sid' => 'audio/prs.sid',
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'gsm' => 'audio/x-gsm',
'wma' => 'audio/x-ms-wma',
'wax' => 'audio/x-ms-wax',
'ra' => 'audio/x-realaudio',
'rm' => 'audio/x-pn-realaudio',
'ram' => 'audio/x-pn-realaudio',
'pls' => 'audio/x-scpls',
'sd2' => 'audio/x-sd2',
'wav' => 'audio/x-wav',
'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-xyz',
'bmp' => 'image/x-ms-bmp',
'gif' => 'image/gif',
'ief' => 'image/ief',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'pcx' => 'image/pcx',
'png' => 'image/png',
'svg' => 'image/svg+xml',
'svgz' => 'image/svg+xml',
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'wbmp' => 'image/vnd.wap.wbmp',
'ras' => 'image/x-cmu-raster',
'cdr' => 'image/x-coreldraw',
'pat' => 'image/x-coreldrawpattern',
'cdt' => 'image/x-coreldrawtemplate',
'djvu' => 'image/x-djvu',
'djv' => 'image/x-djvu',
'ico' => 'image/x-icon',
'art' => 'image/x-jg',
'jng' => 'image/x-jng',
'psd' => 'image/x-photoshop',
'pnm' => 'image/x-portable-anymap',
'pbm' => 'image/x-portable-bitmap',
'pgm' => 'image/x-portable-graymap',
'ppm' => 'image/x-portable-pixmap',
'rgb' => 'image/x-rgb',
'xbm' => 'image/x-xbitmap',
'xpm' => 'image/x-xpixmap',
'xwd' => 'image/x-xwindowdump',
'igs' => 'model/iges',
'iges' => 'model/iges',
'msh' => 'model/mesh',
'mesh' => 'model/mesh',
'silo' => 'model/mesh',
'wrl' => 'x-world/x-vrml',
'vrml' => 'x-world/x-vrml',
'csv' => 'text/comma-separated-values',
'css' => 'text/css',
'323' => 'text/h323',
'htm' => 'text/html',
'html' => 'text/html',
'uls' => 'text/iuls',
'mml' => 'text/mathml',
'asc' => 'text/plain',
'txt' => 'text/plain',
'text' => 'text/plain',
'diff' => 'text/plain',
'rtx' => 'text/richtext',
'sct' => 'text/scriptlet',
'wsc' => 'text/scriptlet',
'tm' => 'text/texmacs',
'ts' => 'text/texmacs',
'tsv' => 'text/tab-separated-values',
'jad' => 'text/vnd.sun.j2me.app-descriptor',
'wml' => 'text/vnd.wap.wml',
'wmls' => 'text/vnd.wap.wmlscript',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'h++' => 'text/x-c++hdr',
'hpp' => 'text/x-c++hdr',
'hxx' => 'text/x-c++hdr',
'hh' => 'text/x-c++hdr',
'c++' => 'text/x-c++src',
'cpp' => 'text/x-c++src',
'cxx' => 'text/x-c++src',
'cc' => 'text/x-c++src',
'h' => 'text/x-chdr',
'c' => 'text/x-csrc',
'java' => 'text/x-java',
'moc' => 'text/x-moc',
'p' => 'text/x-pascal',
'pas' => 'text/x-pascal',
'***' => 'text/x-pcs-***',
'shtml' => 'text/x-server-parsed-html',
'etx' => 'text/x-setext',
'tk' => 'text/x-tcl',
'ltx' => 'text/x-tex',
'sty' => 'text/x-tex',
'cls' => 'text/x-tex',
'vcs' => 'text/x-vcalendar',
'vcf' => 'text/x-vcard',
'dl' => 'video/dl',
'fli' => 'video/fli',
'gl' => 'video/gl',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'mxu' => 'video/vnd.mpegurl',
'dif' => 'video/x-dv',
'dv' => 'video/x-dv',
'lsf' => 'video/x-la-asf',
'lsx' => 'video/x-la-asf',
'mng' => 'video/x-mng',
'asf' => 'video/x-ms-asf',
'asx' => 'video/x-ms-asf',
'wm' => 'video/x-ms-wm',
'wmv' => 'video/x-ms-wmv',
'wmx' => 'video/x-ms-wmx',
'wvx' => 'video/x-ms-wvx',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'ice' => 'x-conference/x-cooltalk',
'vrm' => 'x-world/x-vrml',
'rar' => 'application/x-rar-compressed',
'cab' => 'application/vnd.ms-cab-compressed'
);
$ext=strtolower($ext);
if (isset($mimeTypes[$ext])) {
return $mimeTypes[$ext];
}
return 'application/octet-stream';
}
}
================================================
FILE: AliUpload/lib/mimetypes.class.php
================================================
<?php
/**
* 获得文件的mime type类型
* @author xiaobing.meng
*
*/
class MimeTypes {
public static $mime_types = array (
'apk' => 'application/vnd.android.package-archive',
'3gp' => 'video/3gpp', 'ai' => 'application/postscript',
'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff', 'asc' => 'text/plain',
'atom' => 'application/atom+xml', 'au' => 'audio/basic',
'avi' => 'video/x-msvideo', 'bcpio' => 'application/x-bcpio',
'bin' => 'application/octet-stream', 'bmp' => 'image/bmp',
'cdf' => 'application/x-netcdf', 'cgm' => 'image/cgm',
'class' => 'application/octet-stream',
'cpio' => 'application/x-cpio',
'cpt' => 'application/mac-compactpro',
'csh' => 'application/x-csh', 'css' => 'text/css',
'dcr' => 'application/x-director', 'dif' => 'video/x-dv',
'dir' => 'application/x-director', 'djv' => 'image/vnd.djvu',
'djvu' => 'image/vnd.djvu',
'dll' => 'application/octet-stream',
'dmg' => 'application/octet-stream',
'dms' => 'application/octet-stream',
'doc' => 'application/msword', 'dtd' => 'application/xml-dtd',
'dv' => 'video/x-dv', 'dvi' => 'application/x-dvi',
'dxr' => 'application/x-director',
'eps' => 'application/postscript', 'etx' => 'text/x-setext',
'exe' => 'application/octet-stream',
'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv',
'gif' => 'image/gif', 'gram' => 'application/srgs',
'grxml' => 'application/srgs+xml',
'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip',
'hdf' => 'application/x-hdf',
'hqx' => 'application/mac-binhex40', 'htm' => 'text/html',
'html' => 'text/html', 'ice' => 'x-conference/x-cooltalk',
'ico' => 'image/x-icon', 'ics' => 'text/calendar',
'ief' => 'image/ief', 'ifb' => 'text/calendar',
'iges' => 'model/iges', 'igs' => 'model/iges',
'jnlp' => 'application/x-java-jnlp-file', 'jp2' => 'image/jp2',
'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg', 'js' => 'application/x-javascript',
'kar' => 'audio/midi', 'latex' => 'application/x-latex',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'm3u' => 'audio/x-mpegurl', 'm4a' => 'audio/mp4a-latm',
'm4p' => 'audio/mp4a-latm', 'm4u' => 'video/vnd.mpegurl',
'm4v' => 'video/x-m4v', 'mac' => 'image/x-macpaint',
'man' => 'application/x-troff-man',
'mathml' => 'application/mathml+xml',
'me' => 'application/x-troff-me', 'mesh' => 'model/mesh',
'mid' => 'audio/midi', 'midi' => 'audio/midi',
'mif' => 'application/vnd.mif', 'mov' => 'video/quicktime',
'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4',
'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg',
'ms' => 'application/x-troff-ms', 'msh' => 'model/mesh',
'mxu' => 'video/vnd.mpegurl', 'nc' => 'application/x-netcdf',
'oda' => 'application/oda', 'ogg' => 'application/ogg',
'ogv' => 'video/ogv', 'pbm' => 'image/x-portable-bitmap',
'pct' => 'image/pict', 'pdb' => 'chemical/x-pdb',
'pdf' => 'application/pdf',
'pgm' => 'image/x-portable-graymap',
'pgn' => 'application/x-chess-pgn', 'pic' => 'image/pict',
'pict' => 'image/pict', 'png' => 'image/png',
'pnm' => 'image/x-portable-anymap',
'pnt' => 'image/x-macpaint', 'pntg' => 'image/x-macpaint',
'ppm' => 'image/x-portable-pixmap',
'ppt' => 'application/vnd.ms-powerpoint',
'ps' => 'application/postscript', 'qt' => 'video/quicktime',
'qti' => 'image/x-quicktime', 'qtif' => 'image/x-quicktime',
'ra' => 'audio/x-pn-realaudio',
'ram' => 'audio/x-pn-realaudio', 'ras' => 'image/x-cmu-raster',
'rdf' => 'application/rdf+xml', 'rgb' => 'image/x-rgb',
'rm' => 'application/vnd.rn-realmedia',
'roff' => 'application/x-troff', 'rtf' => 'text/rtf',
'rtx' => 'text/richtext', 'sgm' => 'text/sgml',
'sgml' => 'text/sgml', 'sh' => 'application/x-sh',
'shar' => 'application/x-shar', 'silo' => 'model/mesh',
'sit' => 'application/x-stuffit',
'skd' => 'application/x-koan', 'skm' => 'application/x-koan',
'skp' => 'application/x-koan', 'skt' => 'application/x-koan',
'smi' => 'application/smil', 'smil' => 'application/smil',
'snd' => 'audio/basic', 'so' => 'application/octet-stream',
'spl' => 'application/x-futuresplash',
'src' => 'application/x-wais-source',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc', 'svg' => 'image/svg+xml',
'swf' => 'application/x-shockwave-flash',
't' => 'application/x-troff', 'tar' => 'application/x-tar',
'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex',
'texi' => 'application/x-texinfo',
'texinfo' => 'application/x-texinfo', 'tif' => 'image/tiff',
'tiff' => 'image/tiff', 'tr' => 'application/x-troff',
'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain',
'ustar' => 'application/x-ustar',
'vcd' => 'application/x-cdlink', 'vrml' => 'model/vrml',
'vxml' => 'application/voicexml+xml', 'wav' => 'audio/x-wav',
'wbmp' => 'image/vnd.wap.wbmp',
'wbxml' => 'application/vnd.wap.wbxml', 'webm' => 'video/webm',
'wml' => 'text/vnd.wap.wml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmls' => 'text/vnd.wap.wmlscript',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'wmv' => 'video/x-ms-wmv', 'wrl' => 'model/vrml',
'xbm' => 'image/x-xbitmap', 'xht' => 'application/xhtml+xml',
'xhtml' => 'application/xhtml+xml',
'xls' => 'application/vnd.ms-excel',
'xml' => 'application/xml', 'xpm' => 'image/x-xpixmap',
'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml',
'xul' => 'application/vnd.mozilla.xul+xml',
'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz',
'zip' => 'application/zip' );
public static function get_mimetype($ext) {
return (isset ( self::$mime_types [$ext] ) ? self::$mime_types [$ext] : 'application/octet-stream');
}
}
================================================
FILE: AliUpload/lib/requestcore.class.php
================================================
<?php
/**
* Handles all HTTP requests using cURL and manages the responses.
*
* @version 2011.06.07
* @copyright 2006-2011 Ryan Parman
* @copyright 2006-2010 Foleeo Inc.
* @copyright 2010-2011 Amazon.com, Inc. or its affiliates.
* @copyright 2008-2011 Contributors
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
*/
class RequestCore
{
/**
* The URL being requested.
*/
public $request_url;
/**
* The headers being sent in the request.
*/
public $request_headers;
/**
* The body being sent in the request.
*/
public $request_body;
/**
* The response returned by the request.
*/
public $response;
/**
* The headers returned by the request.
*/
public $response_headers;
/**
* The body returned by the request.
*/
public $response_body;
/**
* The HTTP status code returned by the request.
*/
public $response_code;
/**
* Additional response data.
*/
public $response_info;
/**
* The handle for the cURL object.
*/
public $curl_handle;
/**
* The method by which the request is being made.
*/
public $method;
/**
* Stores the proxy settings to use for the request.
*/
public $proxy = null;
/**
* The username to use for the request.
*/
public $username = null;
/**
* The password to use for the request.
*/
public $password = null;
/**
* Custom CURLOPT settings.
*/
public $curlopts = null;
/**
* The state of debug mode.
*/
public $debug_mode = false;
/**
* The default class to use for HTTP Requests (defaults to <RequestCore>).
*/
public $request_class = 'RequestCore';
/**
* The default class to use for HTTP Responses (defaults to <ResponseCore>).
*/
public $response_class = 'ResponseCore';
/**
* Default useragent string to use.
*/
public $useragent = 'RequestCore/1.4.3';
/**
* File to read from while streaming up.
*/
public $read_file = null;
/**
* The resource to read from while streaming up.
*/
public $read_stream = null;
/**
* The size of the stream to read from.
*/
public $read_stream_size = null;
/**
* The length already read from the stream.
*/
public $read_stream_read = 0;
/**
* File to write to while streaming down.
*/
public $write_file = null;
/**
* The resource to write to while streaming down.
*/
public $write_stream = null;
/**
* Stores the intended starting seek position.
*/
public $seek_position = null;
/**
* The location of the cacert.pem file to use.
*/
public $cacert_location = false;
/**
* The state of SSL certificate verification.
*/
public $ssl_verification = true;
/**
* The user-defined callback function to call when a stream is read from.
*/
public $registered_streaming_read_callback = null;
/**
* The user-defined callback function to call when a stream is written to.
*/
public $registered_streaming_write_callback = null;
/*%******************************************************************************************%*/
// CONSTANTS
/**
* GET HTTP Method
*/
const HTTP_GET = 'GET';
/**
* POST HTTP Method
*/
const HTTP_POST = 'POST';
/**
* PUT HTTP Method
*/
const HTTP_PUT = 'PUT';
/**
* DELETE HTTP Method
*/
const HTTP_DELETE = 'DELETE';
/**
* HEAD HTTP Method
*/
const HTTP_HEAD = 'HEAD';
/*%******************************************************************************************%*/
// CONSTRUCTOR/DESTRUCTOR
/**
* Constructs a new instance of this class.
*
* @param string $url (Optional) The URL to request or service endpoint to query.
* @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
* @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
* @return $this A reference to the current instance.
*/
public function __construct($url = null, $proxy = null, $helpers = null)
{
// Set some default values.
$this->request_url = $url;
$this->method = self::HTTP_GET;
$this->request_headers = array();
$this->request_body = '';
// Set a new Request class if one was set.
if (isset($helpers['request']) && !empty($helpers['request']))
{
$this->request_class = $helpers['request'];
}
// Set a new Request class if one was set.
if (isset($helpers['response']) && !empty($helpers['response']))
{
$this->response_class = $helpers['response'];
}
if ($proxy)
{
$this->set_proxy($proxy);
}
return $this;
}
/**
* Destructs the instance. Closes opened file handles.
*
* @return $this A reference to the current instance.
*/
public function __destruct()
{
if (isset($this->read_file) && isset($this->read_stream))
{
fclose($this->read_stream);
}
if (isset($this->write_file) && isset($this->write_stream))
{
fclose($this->write_stream);
}
return $this;
}
/*%******************************************************************************************%*/
// REQUEST METHODS
/**
* Sets the credentials to use for authentication.
*
* @param string $user (Required) The username to authenticate with.
* @param string $pass (Required) The password to authenticate with.
* @return $this A reference to the current instance.
*/
public function set_credentials($user, $pass)
{
$this->username = $user;
$this->password = $pass;
return $this;
}
/**
* Adds a custom HTTP header to the cURL request.
*
* @param string $key (Required) The custom HTTP header to set.
* @param mixed $value (Required) The value to assign to the custom HTTP header.
* @return $this A reference to the current instance.
*/
public function add_header($key, $value)
{
$this->request_headers[$key] = $value;
return $this;
}
/**
* Removes an HTTP header from the cURL request.
*
* @param string $key (Required) The custom HTTP header to set.
* @return $this A reference to the current instance.
*/
public function remove_header($key)
{
if (isset($this->request_headers[$key]))
{
unset($this->request_headers[$key]);
}
return $this;
}
/**
* Set the method type for the request.
*
* @param string $method (Required) One of the following constants: <HTTP_GET>, <HTTP_POST>, <HTTP_PUT>, <HTTP_HEAD>, <HTTP_DELETE>.
* @return $this A reference to the current instance.
*/
public function set_method($method)
{
$this->method = strtoupper($method);
return $this;
}
/**
* Sets a custom useragent string for the class.
*
* @param string $ua (Required) The useragent string to use.
* @return $this A reference to the current instance.
*/
public function set_useragent($ua)
{
$this->useragent = $ua;
return $this;
}
/**
* Set the body to send in the request.
*
* @param string $body (Required) The textual content to send along in the body of the request.
* @return $this A reference to the current instance.
*/
public function set_body($body)
{
$this->request_body = $body;
return $this;
}
/**
* Set the URL to make the request to.
*
* @param string $url (Required) The URL to make the request to.
* @return $this A reference to the current instance.
*/
public function set_request_url($url)
{
$this->request_url = $url;
return $this;
}
/**
* Set additional CURLOPT settings. These will merge with the default settings, and override if
* there is a duplicate.
*
* @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings.
* @return $this A reference to the current instance.
*/
public function set_curlopts($curlopts)
{
$this->curlopts = $curlopts;
return $this;
}
/**
* Sets the length in bytes to read from the stream while streaming up.
*
* @param integer $size (Required) The length in bytes to read from the stream.
* @return $this A reference to the current instance.
*/
public function set_read_stream_size($size)
{
$this->read_stream_size = $size;
return $this;
}
/**
* Sets the resource to read from while streaming up. Reads the stream from its current position until
* EOF or `$size` bytes have been read. If `$size` is not given it will be determined by <php:fstat()> and
* <php:ftell()>.
*
* @param resource $resource (Required) The readable resource to read from.
* @param integer $size (Optional) The size of the stream to read.
* @return $this A reference to the current instance.
*/
public function set_read_stream($resource, $size = null)
{
if (!isset($size) || $size < 0)
{
$stats = fstat($resource);
if ($stats && $stats['size'] >= 0)
{
$position = ftell($resource);
if ($position !== false && $position >= 0)
{
$size = $stats['size'] - $position;
}
}
}
$this->read_stream = $resource;
return $this->set_read_stream_size($size);
}
/**
* Sets the file to read from while streaming up.
*
* @param string $location (Required) The readable location to read from.
* @return $this A reference to the current instance.
*/
public function set_read_file($location)
{
$this->read_file = $location;
$read_file_handle = fopen($location, 'r');
return $this->set_read_stream($read_file_handle);
}
/**
* Sets the resource to write to while streaming down.
*
* @param resource $resource (Required) The writeable resource to write to.
* @return $this A reference to the current instance.
*/
public function set_write_stream($resource)
{
$this->write_stream = $resource;
return $this;
}
/**
* Sets the file to write to while streaming down.
*
* @param string $location (Required) The writeable location to write to.
* @return $this A reference to the current instance.
*/
public function set_write_file($location)
{
$this->write_file = $location;
$write_file_handle = fopen($location, 'w');
return $this->set_write_stream($write_file_handle);
}
/**
* Set the proxy to use for making requests.
*
* @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
* @return $this A reference to the current instance.
*/
public function set_proxy($proxy)
{
$proxy = parse_url($proxy);
$proxy['user'] = isset($proxy['user']) ? $proxy['user'] : null;
$proxy['pass'] = isset($proxy['pass']) ? $proxy['pass'] : null;
$proxy['port'] = isset($proxy['port']) ? $proxy['port'] : null;
$this->proxy = $proxy;
return $this;
}
/**
* Set the intended starting seek position.
*
* @param integer $position (Required) The byte-position of the stream to begin reading from.
* @return $this A reference to the current instance.
*/
public function set_seek_position($position)
{
$this->seek_position = isset($position) ? (integer) $position : null;
return $this;
}
/**
* Register a callback function to execute whenever a data stream is read from using
* <CFRequest::streaming_read_callback()>.
*
* The user-defined callback function should accept three arguments:
*
* <ul>
* <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
* <li><code>$file_handle</code> - <code>resource</code> - Required - The file handle resource that represents the file on the local file system.</li>
* <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
* </ul>
*
* @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
* <li>The name of a global function to execute, passed as a string.</li>
* <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
* <li>An anonymous function (PHP 5.3+).</li></ul>
* @return $this A reference to the current instance.
*/
public function register_streaming_read_callback($callback)
{
$this->registered_streaming_read_callback = $callback;
return $this;
}
/**
* Register a callback function to execute whenever a data stream is written to using
* <CFRequest::streaming_write_callback()>.
*
* The user-defined callback function should accept two arguments:
*
* <ul>
* <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
* <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
* </ul>
*
* @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
* <li>The name of a global function to execute, passed as a string.</li>
* <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
* <li>An anonymous function (PHP 5.3+).</li></ul>
* @return $this A reference to the current instance.
*/
public function register_streaming_write_callback($callback)
{
$this->registered_streaming_write_callback = $callback;
return $this;
}
/*%******************************************************************************************%*/
// PREPARE, SEND, AND PROCESS REQUEST
/**
* A callback function that is invoked by cURL for streaming up.
*
* @param resource $curl_handle (Required) The cURL handle for the request.
* @param resource $file_handle (Required) The open file handle resource.
* @param integer $length (Required) The maximum number of bytes to read.
* @return binary Binary data from a stream.
*/
public function streaming_read_callback($curl_handle, $file_handle, $length)
{
// Once we've sent as much as we're supposed to send...
if ($this->read_stream_read >= $this->read_stream_size)
{
// Send EOF
return '';
}
// If we're at the beginning of an upload and need to seek...
if ($this->read_stream_read == 0 && isset($this->seek_position) && $this->seek_position !== ftell($this->read_stream))
{
if (fseek($this->read_stream, $this->seek_position) !== 0)
{
throw new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.');
}
}
$read = fread($this->read_stream, min($this->read_stream_size - $this->read_stream_read, $length)); // Remaining upload data or cURL's requested chunk size
$this->read_stream_read += strlen($read);
$out = $read === false ? '' : $read;
// Execute callback function
if ($this->registered_streaming_read_callback)
{
call_user_func($this->registered_streaming_read_callback, $curl_handle, $file_handle, $out);
}
return $out;
}
/**
* A callback function that is invoked by cURL for streaming down.
*
* @param resource $curl_handle (Required) The cURL handle for the request.
* @param binary $data (Required) The data to write.
* @return integer The number of bytes written.
*/
public function streaming_write_callback($curl_handle, $data)
{
$length = strlen($data);
$written_total = 0;
$written_last = 0;
while ($written_total < $length)
{
$written_last = fwrite($this->write_stream, substr($data, $written_total));
if ($written_last === false)
{
return $written_total;
}
$written_total += $written_last;
}
// Execute callback function
if ($this->registered_streaming_write_callback)
{
call_user_func($this->registered_streaming_write_callback, $curl_handle, $written_total);
}
return $written_total;
}
/**
* Prepares and adds the details of the cURL request. This can be passed along to a <php:curl_multi_exec()>
* function.
*
* @return resource The handle for the cURL object.
*/
public function prep_request()
{
$curl_handle = curl_init();
// Set default options.
curl_setopt($curl_handle, CURLOPT_URL, $this->request_url);
curl_setopt($curl_handle, CURLOPT_FILETIME, true);
curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false);
curl_setopt($curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
curl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5);
curl_setopt($curl_handle, CURLOPT_HEADER, true);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_TIMEOUT, 5184000);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($curl_handle, CURLOPT_NOSIGNAL, true);
curl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url);
curl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback'));
// Verification of the SSL cert
if ($this->ssl_verification)
{
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, true);
}
else
{
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false);
}
// chmod the file as 0755
if ($this->cacert_location === true)
{
curl_setopt($curl_handle, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
}
elseif (is_string($this->cacert_location))
{
curl_setopt($curl_handle, CURLOPT_CAINFO, $this->cacert_location);
}
// Debug mode
if ($this->debug_mode)
{
curl_setopt($curl_handle, CURLOPT_VERBOSE, true);
}
// Handle open_basedir & safe mode
if (!ini_get('safe_mode') && !ini_get('open_basedir'))
{
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
}
// Enable a proxy connection if requested.
if ($this->proxy)
{
curl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, true);
$host = $this->proxy['host'];
$host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : '';
curl_setopt($curl_handle, CURLOPT_PROXY, $host);
if (isset($this->proxy['user']) && isset($this->proxy['pass']))
{
curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']);
}
}
// Set credentials for HTTP Basic/Digest Authentication.
if ($this->username && $this->password)
{
curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
}
// Handle the encoding if we can.
if (extension_loaded('zlib'))
{
curl_setopt($curl_handle, CURLOPT_ENCODING, '');
}
// Process custom headers
if (isset($this->request_headers) && count($this->request_headers))
{
$temp_headers = array();
foreach ($this->request_headers as $k => $v)
{
$temp_headers[] = $k . ': ' . $v;
}
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);
}
switch ($this->method)
{
case self::HTTP_PUT:
//unset($this->read_stream);
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT');
if (isset($this->read_stream))
{
if (!isset($this->read_stream_size) || $this->read_stream_size < 0)
{
throw new RequestCore_Exception('The stream size for the streaming upload cannot be determined.');
}
curl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size);
curl_setopt($curl_handle, CURLOPT_UPLOAD, true);
}
else
{
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
}
break;
case self::HTTP_POST:
curl_setopt($curl_handle, CURLOPT_POST, true);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
break;
case self::HTTP_HEAD:
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD);
curl_setopt($curl_handle, CURLOPT_NOBODY, 1);
break;
default: // Assumed GET
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, $this->method);
if (isset($this->write_stream))
{
curl_setopt($curl_handle, CURLOPT_WRITEFUNCTION, array($this, 'streaming_write_callback'));
curl_setopt($curl_handle, CURLOPT_HEADER, false);
}
else
{
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
}
break;
}
// Merge in the CURLOPTs
if (isset($this->curlopts) && sizeof($this->curlopts) > 0)
{
foreach ($this->curlopts as $k => $v)
{
curl_setopt($curl_handle, $k, $v);
}
}
return $curl_handle;
}
/**
* Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the
* data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
* parameters.
*
* @param resource $curl_handle (Optional) The reference to the already executed cURL request.
* @param string $response (Optional) The actual response content itself that needs to be parsed.
* @return ResponseCore A <ResponseCore> object containing a parsed HTTP response.
*/
public function process_response($curl_handle = null, $response = null)
{
// Accept a custom one if it's passed.
if ($curl_handle && $response)
{
$this->curl_handle = $curl_handle;
$this->response = $response;
}
// As long as this came back as a valid resource...
if (is_resource($this->curl_handle))
{
// Determine what's what.
$header_size = curl_getinfo($this->curl_handle, CURLINFO_HEADER_SIZE);
$this->response_headers = substr($this->response, 0, $header_size);
$this->response_body = substr($this->response, $header_size);
$this->response_code = curl_getinfo($this->curl_handle, CURLINFO_HTTP_CODE);
$this->response_info = curl_getinfo($this->curl_handle);
// Parse out the headers
$this->response_headers = explode("\r\n\r\n", trim($this->response_headers));
$this->response_headers = array_pop($this->response_headers);
$this->response_headers = explode("\r\n", $this->response_headers);
array_shift($this->response_headers);
// Loop through and split up the headers.
$header_assoc = array();
foreach ($this->response_headers as $header)
{
$kv = explode(': ', $header);
$header_assoc[strtolower($kv[0])] = isset($kv[1])?$kv[1]:'';
}
// Reset the headers to the appropriate property.
$this->response_headers = $header_assoc;
$this->response_headers['_info'] = $this->response_info;
$this->response_headers['_info']['method'] = $this->method;
if ($curl_handle && $response)
{
return new $this->response_class($this->response_headers, $this->response_body, $this->response_code, $this->curl_handle);
}
}
// Return false
return false;
}
/**
* Sends the request, calling necessary utility functions to update built-in properties.
*
* @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not.
* @return string The resulting unparsed data from the request.
*/
public function send_request($parse = false)
{
set_time_limit(0);
$curl_handle = $this->prep_request();
$this->response = curl_exec($curl_handle);
if ($this->response === false)
{
throw new RequestCore_Exception('cURL resource: ' . (string) $curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
}
$parsed_response = $this->process_response($curl_handle, $this->response);
curl_close($curl_handle);
if ($parse)
{
return $parsed_response;
}
return $this->response;
}
/**
* Sends the request using <php:curl_multi_exec()>, enabling parallel requests. Uses the "rolling" method.
*
* @param array $handles (Required) An indexed array of cURL handles to process simultaneously.
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
* <li><code>callback</code> - <code>string|array</code> - Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the <code>[0]</code> index is the class and the <code>[1]</code> index is the method name.</li>
* <li><code>limit</code> - <code>integer</code> - Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.</li></ul>
* @return array Post-processed cURL responses.
*/
public function send_multi_request($handles, $opt = null)
{
set_time_limit(0);
// Skip everything if there are no handles to process.
if (count($handles) === 0) return array();
if (!$opt) $opt = array();
// Initialize any missing options
$limit = isset($opt['limit']) ? $opt['limit'] : -1;
// Initialize
$handle_list = $handles;
$http = new $this->request_class();
$multi_handle = curl_multi_init();
$handles_post = array();
$added = count($handles);
$last_handle = null;
$count = 0;
$i = 0;
// Loop through the cURL handles and add as many as it set by the limit parameter.
while ($i < $added)
{
if ($limit > 0 && $i >= $limit) break;
curl_multi_add_handle($multi_handle, array_shift($handles));
$i++;
}
do
{
$active = false;
// Start executing and wait for a response.
while (($status = curl_multi_exec($multi_handle, $active)) === CURLM_CALL_MULTI_PERFORM)
{
// Start looking for possible responses immediately when we have to add more handles
if (count($handles) > 0) break;
}
// Figure out which requests finished.
$to_process = array();
while ($done = curl_multi_info_read($multi_handle))
{
// Since curl_errno() isn't reliable for handles that were in multirequests, we check the 'result' of the info read, which contains the curl error number, (listed here http://curl.haxx.se/libcurl/c/libcurl-errors.html )
if ($done['result'] > 0)
{
throw new RequestCore_Exception('cURL resource: ' . (string) $done['handle'] . '; cURL error: ' . curl_error($done['handle']) . ' (' . $done['result'] . ')');
}
// Because curl_multi_info_read() might return more than one message about a request, we check to see if this request is already in our array of completed requests
elseif (!isset($to_process[(int) $done['handle']]))
{
$to_process[(int) $done['handle']] = $done;
}
}
// Actually deal with the request
foreach ($to_process as $pkey => $done)
{
$response = $http->process_response($done['handle'], curl_multi_getcontent($done['handle']));
$key = array_search($done['handle'], $handle_list, true);
$handles_post[$key] = $response;
if (count($handles) > 0)
{
curl_multi_add_handle($multi_handle, array_shift($handles));
}
curl_multi_remove_handle($multi_handle, $done['handle']);
curl_close($done['handle']);
}
}
while ($active || count($handles_post) < $added);
curl_multi_close($multi_handle);
ksort($handles_post, SORT_NUMERIC);
return $handles_post;
}
/*%******************************************************************************************%*/
// RESPONSE METHODS
/**
* Get the HTTP response headers from the request.
*
* @param string $header (Optional) A specific header value to return. Defaults to all headers.
* @return string|array All or selected header values.
*/
public function get_response_header($header = null)
{
if ($header)
{
return $this->response_headers[strtolower($header)];
}
return $this->response_headers;
}
/**
* Get the HTTP response body from the request.
*
* @return string The response body.
*/
public function get_response_body()
{
return $this->response_body;
}
/**
* Get the HTTP response code from the request.
*
* @return string The HTTP response code.
*/
public function get_response_code()
{
return $this->response_code;
}
}
/**
* Container for all response-related methods.
*/
class ResponseCore
{
/**
* Stores the HTTP header information.
*/
public $header;
/**
* Stores the SimpleXML response.
*/
public $body;
/**
* Stores the HTTP response code.
*/
public $status;
/**
* Constructs a new instance of this class.
*
* @param array $header (Required) Associative array of HTTP headers (typically returned by <RequestCore::get_response_header()>).
* @param string $body (Required) XML-formatted response from AWS.
* @param integer $status (Optional) HTTP response status code from the request.
* @return object Contains an <php:array> `header` property (HTTP headers as an associative array), a <php:SimpleXMLElement> or <php:string> `body` property, and an <php:integer> `status` code.
*/
public function __construct($header, $body, $status = null)
{
$this->header = $header;
$this->body = $body;
$this->status = $status;
return $this;
}
/**
* Did we receive the status code we expected?
*
* @param integer|array $codes (Optional) The status code(s) to expect. Pass an <php:integer> for a single acceptable value, or an <php:array> of integers for multiple acceptable values.
* @return boolean Whether we received the expected status code or not.
*/
public function isOK($codes = array(200, 201, 204, 206))
{
if (is_array($codes))
{
return in_array($this->status, $codes);
}
return $this->status === $codes;
}
}
/**
* Default RequestCore Exception.
*/
class RequestCore_Exception extends Exception {}
================================================
FILE: AliUpload/lib/sdk.class.php
================================================
<?php
/**
* OSS(Open Storage Services) PHP SDK v1.1.5
*/
//设置默认时区
date_default_timezone_set('Asia/Shanghai');
//检测API路径
if(!defined('OSS_API_PATH'))
define('OSS_API_PATH', dirname(__FILE__));
//加载RequestCore
require_once 'requestcore.class.php';
//加载MimeTypes
require_once 'mimetypes.class.php';
//加载MimeTypes
require_once 'zh.inc.php';
//定义软件名称,版本号等信息
define('OSS_NAME','oss-sdk-php');
define('OSS_VERSION','1.1.5');
define('OSS_BUILD','201210121010245');
define('OSS_AUTHOR', 'xiaobing.meng@alibaba-inc.com');
// EXCEPTIONS
/**
* OSS异常类,继承自基类
*/
class OSS_Exception extends Exception {}
//检测get_loaded_extensions函数是否被禁用。由于有些版本把该函数禁用了,所以先检测该函数是否存在。
if(function_exists('get_loaded_extensions')){
//检测curl扩展
$extensions = get_loaded_extensions();
if($extensions){
if(!in_array('curl', $extensions)){
throw new OSS_Exception(OSS_CURL_EXTENSION_MUST_BE_LOAD);
}
}else{
throw new OSS_Exception(OSS_NO_ANY_EXTENSIONS_LOADED);
}
}else{
throw new OSS_Exception('Function get_loaded_extensions has been disabled,Pls check php config.');
}
//CLASS
/**
* OSS基础类
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-05-31
*/
class ALIOSS{
/*%******************************************************************************************%*/
// CONSTANTS
/**
* OSS服务地址
*/
const DEFAULT_OSS_HOST = 'oss.aliyuncs.com';
/**
* 软件名称
*/
const NAME = OSS_NAME;
/**
* OSS软件Build ID
*/
const BUILD = OSS_BUILD;
/**
* 版本号
*/
const VERSION = OSS_VERSION;
/**
* 作者
*/
const AUTHOR = OSS_AUTHOR;
/*%******************************************************************************************%*/
//OSS 内部常量
const OSS_BUCKET = 'bucket';
const OSS_OBJECT = 'object';
const OSS_HEADERS = 'headers';
const OSS_METHOD = 'method';
const OSS_QUERY = 'query';
const OSS_BASENAME = 'basename';
const OSS_MAX_KEYS = 'max-keys';
const OSS_UPLOAD_ID = 'uploadId';
const OSS_MAX_KEYS_VALUE = 100;
const OSS_MAX_OBJECT_GROUP_VALUE = 1000;
const OSS_FILE_SLICE_SIZE = 8192;
const OSS_PREFIX = 'prefix';
const OSS_DELIMITER = 'delimiter';
const OSS_MARKER = 'marker';
const OSS_CONTENT_MD5 = 'Content-Md5';
const OSS_CONTENT_TYPE = 'Content-Type';
const OSS_CONTENT_LENGTH = 'Content-Length';
const OSS_IF_MODIFIED_SINCE = 'If-Modified-Since';
const OSS_IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';
const OSS_IF_MATCH = 'If-Match';
const OSS_IF_NONE_MATCH = 'If-None-Match';
const OSS_CACHE_CONTROL = 'Cache-Control';
const OSS_EXPIRES = 'Expires';
const OSS_PREAUTH = 'preauth';
const OSS_CONTENT_COING = 'Content-Coding';
const OSS_CONTENT_DISPOSTION = 'Content-Disposition';
const OSS_RANGE = 'Range';
const OS_CONTENT_RANGE = 'Content-Range';
const OSS_CONTENT = 'content';
const OSS_BODY = 'body';
const OSS_LENGTH = 'length';
const OSS_HOST = 'Host';
const OSS_DATE = 'Date';
const OSS_AUTHORIZATION = 'Authorization';
const OSS_FILE_DOWNLOAD = 'fileDownload';
const OSS_FILE_UPLOAD = 'fileUpload';
const OSS_PART_SIZE = 'partSize';
const OSS_SEEK_TO = 'seekTo';
const OSS_SIZE = 'size';
const OSS_QUERY_STRING = 'query_string';
const OSS_SUB_RESOURCE = 'sub_resource';
const OSS_DEFAULT_PREFIX = 'x-oss-';
/*%******************************************************************************************%*/
//私有URL变量
const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId';
const OSS_URL_EXPIRES = 'Expires';
const OSS_URL_SIGNATURE = 'Signature';
/*%******************************************************************************************%*/
//HTTP方法
const OSS_HTTP_GET = 'GET';
const OSS_HTTP_PUT = 'PUT';
const OSS_HTTP_HEAD = 'HEAD';
const OSS_HTTP_POST = 'POST';
const OSS_HTTP_DELETE = 'DELETE';
/*%******************************************************************************************%*/
//其他常量
//x-oss
const OSS_ACL = 'x-oss-acl';
//OBJECT GROUP
const OSS_OBJECT_GROUP = 'x-oss-file-group';
//Multi Part
const OSS_MULTI_PART = 'uploads';
//Multi Delete
const OSS_MULTI_DELETE = 'delete';
//OBJECT COPY SOURCE
const OSS_OBJECT_COPY_SOURCE = 'x-oss-copy-source';
//private,only owner
const OSS_ACL_TYPE_PRIVATE = 'private';
//public reand
const OSS_ACL_TYPE_PUBLIC_READ = 'public-read';
//public read write
const OSS_ACL_TYPE_PUBLIC_READ_WRITE = 'public-read-write';
//OSS ACL数组
static $OSS_ACL_TYPES = array(
self::OSS_ACL_TYPE_PRIVATE,
self::OSS_ACL_TYPE_PUBLIC_READ,
self::OSS_ACL_TYPE_PUBLIC_READ_WRITE
);
/*%******************************************************************************************%*/
// PROPERTIES
/**
* 是否使用SSL
*/
protected $use_ssl = false;
/**
* 是否开启debug模式
*/
private $debug_mode = true;
/**
* 最大重试次数
*/
private $max_retries = 3;
/**
* 已经重试次数
*/
private $redirects = 0;
/**
* 虚拟地址
*/
private $vhost;
/**
* 路径表现方式
*/
private $enable_domain_style = true;
/**
* 请求URL
*/
private $request_url;
/**
* OSS API ACCESS ID
*/
private $access_id;
/**
* OSS API ACCESS KEY
*/
private $access_key;
/**
* hostname
*/
private $hostname;
/**
* port number
*/
private $port;
/*%******************************************************************************************************%*/
//Constructor
/**
* 默认构造函数
* @param string $_access_id (Optional)
* @param string $access_key (Optional)
* @param string $hostname (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-08
*/
public function __construct($access_id = NULL,$access_key = NULL, $hostname = NULL ){
//验证access_id,access_key
if(!$access_id && !defined('OSS_ACCESS_ID')){
throw new OSS_Exception(NOT_SET_OSS_ACCESS_ID);
}
if(!$access_key && !defined('OSS_ACCESS_KEY')){
throw new OSS_Exception(NOT_SET_OSS_ACCESS_KEY);
}
if($access_id && $access_key){
$this->access_id = $access_id;
$this->access_key = $access_key;
}elseif (defined('OSS_ACCESS_ID') && defined('OSS_ACCESS_KEY')){
$this->access_id = OSS_ACCESS_ID;
$this->access_key = OSS_ACCESS_KEY;
}else{
throw new OSS_Exception(NOT_SET_OSS_ACCESS_ID_AND_ACCESS_KEY);
}
//校验access_id&access_key
if(empty($this->access_id) || empty($this->access_key)){
throw new OSS_Exception(OSS_ACCESS_ID_OR_ACCESS_KEY_EMPTY);
}
//校验hostname
if(NULL === $hostname){
$this->hostname = self::DEFAULT_OSS_HOST;
}else{
$this->hostname = $hostname;
}
}
/*%******************************************************************************************************%*/
//属性
/**
* 设置debug模式
* @param boolean $debug_mode (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-05-29
* @return void
*/
public function set_debug_mode($debug_mode = true){
$this->debug_mode = $debug_mode;
}
/**
* 设置最大尝试次数
* @param int $max_retries
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-05-29
* @return void
*/
public function set_max_retries($max_retries = 3){
$this->max_retries = $max_retries;
}
/**
* 获取最大尝试次数
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-05-29
* @return int
*/
public function get_max_retries(){
return $this->max_retries;
}
/**
* 设置host地址
* @author xiaobing.meng@alibaba-inc.com
* @param string $hostname host name
* @param int $port int
* @since 2012-06-11
* @return void
*/
public function set_host_name($hostname,$port = null){
$this->hostname = $hostname;
if($port){
$this->port = $port;
$this->hostname .= ':'.$port;
}
}
/**
* 设置vhost地址
* @author xiaobing.meng@alibaba-inc.com
* @param string $vhost vhost
* @since 2012-06-11
* @return void
*/
public function set_vhost($vhost){
$this->vhost = $vhost;
}
/**
* 设置路径形式,如果为true,则启用三级域名,如bucket.oss.aliyuncs.com
* @author xiaobing.meng@alibaba-inc.com
* @param boolean $enable_domain_style
* @since 2012-06-11
* @return void
*/
public function set_enable_domain_style($enable_domain_style = true){
$this->enable_domain_style = $enable_domain_style;
}
/*%******************************************************************************************************%*/
//请求
/**
* Authorization
* @param array $options (Required)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-05-31
*/
public function auth($options){
//开始记录LOG
$msg = "---LOG START---------------------------------------------------------------------------\n";
//验证Bucket,list_bucket时不需要验证
if(!( ('/' == $options[self::OSS_OBJECT]) && ('' == $options[self::OSS_BUCKET]) && ('GET' == $options[self::OSS_METHOD])) && !$this->validate_bucket($options[self::OSS_BUCKET])){
throw new OSS_Exception('"'.$options[self::OSS_BUCKET].'"'.OSS_BUCKET_NAME_INVALID);
}
//验证Object
if(isset($options[self::OSS_OBJECT]) && !$this->validate_object($options[self::OSS_OBJECT])){
throw new OSS_Exception($options[self::OSS_OBJECT].OSS_OBJECT_NAME_INVALID);
}
//Object编码为UTF-8
if($this->is_gb2312($options[self::OSS_OBJECT])){
$options[self::OSS_OBJECT] = iconv('GB2312', "UTF-8",$options[self::OSS_OBJECT]);
}elseif($this->check_char($options[self::OSS_OBJECT],true)){
$options[self::OSS_OBJECT] = iconv('GBK', "UTF-8",$options[self::OSS_OBJECT]);
}
//验证ACL
if(isset($options[self::OSS_HEADERS][self::OSS_ACL]) && !empty($options[self::OSS_HEADERS][self::OSS_ACL])){
if(!in_array(strtolower($options[self::OSS_HEADERS][self::OSS_ACL]), self::$OSS_ACL_TYPES)){
throw new OSS_Exception($options[self::OSS_HEADERS][self::OSS_ACL].':'.OSS_ACL_INVALID);
}
}
//定义scheme
$scheme = $this->use_ssl ? 'https://' : 'http://';
//匹配bucket
if(strpos($options[self::OSS_BUCKET],"-")!== false){//bucket 带"-"的时候
$this->set_enable_domain_style(false);
}else{
$this->set_enable_domain_style(true);
}
if($this->enable_domain_style){
$hostname = $this->vhost ? $this->vhost : (($options[self::OSS_BUCKET] =='')?$this->hostname:($options[self::OSS_BUCKET].'.').$this->hostname);
}else{
$hostname = (isset($options[self::OSS_BUCKET]) && ''!==$options[self::OSS_BUCKET])?$this->hostname.'/'.$options[self::OSS_BUCKET]:$this->hostname;
}
//请求参数
$resource = '';
$sub_resource = '';
$signable_resource = '';
$query_string_params = array();
$signable_query_string_params = array();
$string_to_sign = '';
$headers = array (
self::OSS_CONTENT_MD5 => '',
self::OSS_CONTENT_TYPE => isset($options[self::OSS_CONTENT_TYPE])?$options[self::OSS_CONTENT_TYPE]:'application/x-www-form-urlencoded',
self::OSS_DATE => isset($options[self::OSS_DATE])? $options[self::OSS_DATE]: gmdate('D, d M Y H:i:s \G\M\T'),
self::OSS_HOST => $this->enable_domain_style?$hostname:$this->hostname,
);
if(isset ( $options [self::OSS_OBJECT] ) && '/' !== $options [self::OSS_OBJECT]){
$signable_resource = '/'.str_replace('%2F', '/', rawurlencode($options[self::OSS_OBJECT]));
}
if(isset($options[self::OSS_QUERY_STRING])){
$query_string_params = array_merge($query_string_params,$options[self::OSS_QUERY_STRING]);
}
$query_string = $this->to_query_string($query_string_params);
$signable_list = array(
'partNumber',
'uploadId',
);
foreach ($signable_list as $item){
if(isset($options[$item])){
$signable_query_string_params[$item] = $options[$item];
}
}
$signable_query_string = $this->to_query_string($signable_query_string_params);
//合并 HTTP headers
if (isset ( $options [self::OSS_HEADERS] )) {
$headers = array_merge ( $headers, $options [self::OSS_HEADERS] );
}
//生成请求URL
$conjunction = '?';
$non_signable_resource = '';
if (isset($options[self::OSS_SUB_RESOURCE])){
$signable_resource .= $conjunction . $options[self::OSS_SUB_RESOURCE];
$conjunction = '&';
}
if($signable_query_string !== ''){
$signable_query_string = $conjunction.$signable_query_string;
$conjunction = '&';
}
if($query_string !== ''){
$non_signable_resource .= $conjunction . $query_string;
$conjunction = '&';
}
$this->request_url = $scheme . $hostname . $signable_resource . $signable_query_string . $non_signable_resource;
$msg .= "--REQUEST URL:----------------------------------------------\n".$this->request_url."\n";
//创建请求
$request = new RequestCore($this->request_url);
// Streaming uploads
if (isset($options[self::OSS_FILE_UPLOAD])){
if (is_resource($options[self::OSS_FILE_UPLOAD])){
$length = null;
if (isset($options[self::OSS_CONTENT_LENGTH])){
$length = $options[self::OSS_CONTENT_LENGTH];
}elseif (isset($options[self::OSS_SEEK_TO])){
$stats = fstat($options[self::OSS_FILE_UPLOAD]);
if ($stats && $stats[self::OSS_SIZE] >= 0){
$length = $stats[self::OSS_SIZE] - (integer) $options[self::OSS_SEEK_TO];
}
}
$request->set_read_stream($options[self::OSS_FILE_UPLOAD], $length);
if ($headers[self::OSS_CONTENT_TYPE] === 'application/x-www-form-urlencoded'){
$headers[self::OSS_CONTENT_TYPE] = 'application/octet-stream';
}
}else{
$request->set_read_file($options[self::OSS_FILE_UPLOAD]);
$length = $request->read_stream_size;
if (isset($options[self::OSS_CONTENT_LENGTH])){
$length = $options[self::OSS_CONTENT_LENGTH];
}elseif (isset($options[self::OSS_SEEK_TO]) && isset($length)){
$length -= (integer) $options[self::OSS_SEEK_TO];
}
$request->set_read_stream_size($length);
if (isset($headers[self::OSS_CONTENT_TYPE]) && ($headers[self::OSS_CONTENT_TYPE] === 'application/x-www-form-urlencoded')){
$extension = explode('.', $options[self::OSS_FILE_UPLOAD]);
$extension = array_pop($extension);
$mime_type = MimeTypes::get_mimetype($extension);
$headers[self::OSS_CONTENT_TYPE] = $mime_type;
}
}
$options[self::OSS_CONTENT_MD5] = '';
}
if (isset($options[self::OSS_SEEK_TO])){
$request->set_seek_position((integer) $options[self::OSS_SEEK_TO]);
}
if (isset($options[self::OSS_FILE_DOWNLOAD])){
if (is_resource($options[self::OSS_FILE_DOWNLOAD])){
$request->set_write_stream($options[self::OSS_FILE_DOWNLOAD]);
}else{
$request->set_write_file($options[self::OSS_FILE_DOWNLOAD]);
}
}
if(isset($options[self::OSS_METHOD])){
$request->set_method($options[self::OSS_METHOD]);
$string_to_sign .= $options[self::OSS_METHOD] . "\n";
}
if (isset ( $options [self::OSS_CONTENT] )) {
$request->set_body ( $options [self::OSS_CONTENT] );
if ($headers[self::OSS_CONTENT_TYPE] === 'application/x-www-form-urlencoded'){
$headers[self::OSS_CONTENT_TYPE] = 'application/octet-stream';
}
$headers[self::OSS_CONTENT_LENGTH] = strlen($options [self::OSS_CONTENT]);
$headers[self::OSS_CONTENT_MD5] = $this->hex_to_base64(md5($options[self::OSS_CONTENT]));
}
uksort($headers, 'strnatcasecmp');
foreach ( $headers as $header_key => $header_value ) {
$header_value = str_replace ( array ("\r", "\n" ), '', $header_value );
if ($header_value !== '') {
$request->add_header ( $header_key, $header_value );
}
if (
strtolower($header_key) === 'content-md5' ||
strtolower($header_key) === 'content-type' ||
strtolower($header_key) === 'date' ||
(isset($options['self::OSS_PREAUTH']) && (integer) $options['self::OSS_PREAUTH'] > 0)
){
$string_to_sign .= $header_value . "\n";
}elseif (substr(strtolower($header_key), 0, 6) === self::OSS_DEFAULT_PREFIX){
$string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
}
}
$string_to_sign .= '/' . $options[self::OSS_BUCKET];
$string_to_sign .= $this->enable_domain_style ? ($options[self::OSS_BUCKET]!=''? ($options[self::OSS_OBJECT]=='/'?'/':'') :'' ) : '';
$string_to_sign .= rawurldecode($signable_resource) . urldecode($signable_query_string);
$msg .= "STRING TO SIGN:----------------------------------------------\n".$string_to_sign."\n";
$signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->access_key, true));
$request->add_header('Authorization', 'OSS ' . $this->access_id . ':' . $signature);
if (isset($options[self::OSS_PREAUTH]) && (integer) $options[self::OSS_PREAUTH] > 0){
return $this->request_url . $conjunction . self::OSS_URL_ACCESS_KEY_ID.'=' . $this->access_id . '&'.self::OSS_URL_EXPIRES.'=' . $options[self::OSS_PREAUTH] . '&'.self::OSS_URL_SIGNATURE.'=' . rawurlencode($signature);
}elseif (isset($options[self::OSS_PREAUTH])){
return $this->request_url;
}
if ($this->debug_mode){
$request->debug_mode = $this->debug_mode;
}
$msg .= "REQUEST HEADERS:----------------------------------------------\n".serialize($request->request_headers)."\n";
$request->send_request();
$response_header = $request->get_response_header();
$response_header['x-oss-request-url'] = $this->request_url;
$response_header['x-oss-redirects'] = $this->redirects;
$response_header['x-oss-stringtosign'] = $string_to_sign;
$response_header['x-oss-requestheaders'] = $request->request_headers;
$msg .= "RESPONSE HEADERS:----------------------------------------------\n".serialize($response_header)."\n";
$data = new ResponseCore ( $response_header , $request->get_response_body (), $request->get_response_code () );
if((integer)$request->get_response_code() === 400 /*Bad Request*/ || (integer)$request->get_response_code() === 500 /*Internal Error*/ || (integer)$request->get_response_code() === 503 /*Service Unavailable*/){
if($this->redirects <= $this->max_retries ){
//设置休眠
$delay = (integer) (pow(4, $this->redirects) * 100000);
usleep($delay);
$this->redirects++;
$data = $this->auth($options);
}
}
$msg .= "RESPONSE DATA:----------------------------------------------\n".serialize($data)."\n";
$msg .= date('Y-m-d H:i:s').":---LOG END---------------------------------------------------------------------------\n";
//add log
$this->log($msg);
$this->redirects = 0;
return $data;
}
/*%******************************************************************************************************%*/
//Service Operation
/**
* Get Buket list
* @param array $options (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function list_bucket($options = NULL) {
//$options
$this->validate_options($options);
if (! $options) {
$options = array ();
}
$options[self::OSS_BUCKET] = '';
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = '/';
$response = $this->auth ( $options );
return $response;
}
/*%******************************************************************************************************%*/
//Bucket Operation
/**
* Create Bucket
* @param string $bucket (Required)
* @param string $acl (Optional)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function create_bucket($bucket,$acl = self::OSS_ACL_TYPE_PRIVATE, $options = NULL){
//$options
$this->validate_options($options);
if (! $options) {
$options = array ();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'PUT';
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl);
$response = $this->auth ( $options );
return $response;
}
/**
* Delete Bucket
* @param string $bucket (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function delete_bucket($bucket,$options = NULL){
//$options
$this->validate_options($options);
if (! $options) {
$options = array ();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'DELETE';
$options[self::OSS_OBJECT] = '/';
$response = $this->auth ( $options );
return $response;
}
/**
* Get Bucket's ACL
* @param string $bucket (Required)
* @param array $options (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_bucket_acl($bucket ,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'acl';
$response = $this->auth ( $options );
return $response;
}
/**
* Set bucket'ACL
* @param string $bucket (Required)
* @param string $acl (Required)
* @param array $options (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function set_bucket_acl($bucket ,$acl , $options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'PUT';
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl);
$response = $this->auth ( $options );
return $response;
}
/*%******************************************************************************************************%*/
//Object Operation
/**
* List Object
* @param string $bucket (Required)
* @param array $options (Optional)
* 其中options中的参数如下
* $options = array(
* 'max-keys' => max-keys用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于100。
* 'prefix' => 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。
* 'delimiter' => 是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素
* 'marker' => 用户设定结果从marker之后按字母排序的第一个开始返回。
* )
* 其中 prefix,marker用来实现分页显示效果,参数的长度必须小于256字节。
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function list_object($bucket,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_HEADERS] = array(
self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER])?$options[self::OSS_DELIMITER]:'/',
self::OSS_PREFIX => isset($options[self::OSS_PREFIX])?$options[self::OSS_PREFIX]:'',
self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS])?$options[self::OSS_MAX_KEYS]:self::OSS_MAX_KEYS_VALUE,
self::OSS_MARKER => isset($options[self::OSS_MARKER])?$options[self::OSS_MARKER]:'',
);
$response = $this->auth ( $options );
return $response;
}
/**
* 创建目录(目录和文件的区别在于,目录最后增加'/')
* @param string $bucket
* @param string $object
* @param array $options
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function create_object_dir($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'PUT';
$options[self::OSS_OBJECT] = $object.'/'; //虚拟目录需要以'/结尾'
$options[self::OSS_CONTENT_LENGTH] = array(self::OSS_CONTENT_LENGTH => 0);
$response = $this->auth ( $options );
return $response;
}
/**
* 通过在http body中添加内容来上传文件,适合比较小的文件
* 根据api约定,需要在http header中增加content-length字段
* @param string $bucket (Required)
* @param string $object (Required)
* @param string $content (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function upload_file_by_content($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
//内容校验
$this->validate_content($options);
$objArr = explode('/', $object);
$basename = array_pop($objArr);
$extension = explode ( '.', $basename );
$extension = array_pop ( $extension );
$content_type = MimeTypes::get_mimetype(strtolower($extension));
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'PUT';
$options[self::OSS_OBJECT] = $object;
if(!isset($options[self::OSS_LENGTH])){
$options[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]);
}else{
$options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
}
if(!isset($options[self::OSS_CONTENT_TYPE]) && isset($content_type) && !empty($content_type) ){
$options[self::OSS_CONTENT_TYPE] = $content_type;
}
$response = $this->auth ( $options );
return $response;
}
/**
* 上传文件,适合比较大的文件
* @param string $bucket (Required)
* @param string $object (Required)
* @param string $file (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-02-28
* @return ResponseCore
*/
public function upload_file_by_file($bucket,$object,$file,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
//file
$this->is_empty($file, OSS_FILE_PATH_IS_NOT_ALLOWED_EMPTY);
if($this->chk_chinese($file)){
$file = iconv('utf-8','gbk',$file);
}
$options[self::OSS_FILE_UPLOAD] = $file;
if(!file_exists($options[self::OSS_FILE_UPLOAD])){
throw new OSS_Exception($options[self::OSS_FILE_UPLOAD].OSS_FILE_NOT_EXIST);
}
$filesize = filesize($options[self::OSS_FILE_UPLOAD]);
$partsize = 1024 * 1024 ; //默认为 1M
$extension = explode ( '.', $file );
$extension = array_pop ( $extension );
$content_type = MimeTypes::get_mimetype(strtolower($extension));
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_CONTENT_TYPE] = $content_type;
$options[self::OSS_CONTENT_LENGTH] = $filesize;
$response = $this->auth($options);
return $response;
}
/**
* 拷贝Object
* @param string $bucket (Required)
* @param string $from_object (Required)
* @param string $to_object (Required)
* @param string $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-21
* @return ResponseCore
*/
public function copy_object($from_bucket,$from_object,$to_bucket,$to_object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//from bucket
$this->is_empty($from_bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//to bucket
$this->is_empty($to_bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//from object
$this->is_empty($from_object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
//to object
$this->is_empty($to_object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $to_bucket;
$options[self::OSS_METHOD] = 'PUT';
$options[self::OSS_OBJECT] = $to_object;
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => '/'.$from_bucket.'/'.$from_object);
$response = $this->auth ( $options );
return $response;
}
/**
* 获得object的meta信息
* @param string $bucket (Required)
* @param string $object (Required)
* @param string $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_object_meta($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'HEAD';
$options[self::OSS_OBJECT] = $object;
$response = $this->auth ( $options );
return $response;
}
/**
* 删除object
* @param string $bucket(Required)
* @param string $object (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function delete_object($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'DELETE';
$options[self::OSS_OBJECT] = $object;
$response = $this->auth ( $options );
return $response;
}
/**
* 批量删除objects
* @param string $bucket(Required)
* @param array $objects (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-09
* @return ResponseCore
*/
public function delete_objects($bucket,$objects,$options = null){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//objects
if(!is_array($objects) || !$objects){
throw new OSS_Exception('The ' . __FUNCTION__ . ' method requires the "objects" option to be set as an array.');
}
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'delete';
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Delete></Delete>');
// Quiet mode?
if (isset($options['quiet'])){
$quiet = 'false';
if (is_bool($options['quiet'])) { //Boolean
$quiet = $options['quiet'] ? 'true' : 'false';
}elseif (is_string($options['quiet'])){ // String
$quiet = ($options['quiet'] === 'true') ? 'true' : 'false';
}
$xml->addChild('Quiet', $quiet);
}
// Add the objects
foreach ($objects as $object){
$xobject = $xml->addChild('Object');
$object = $this->s_replace($object);
$xobject->addChild('Key', $object);
}
$options[self::OSS_CONTENT] = $xml->asXML();
return $this->auth($options);
}
/**
* 获得Object内容
* @param string $bucket(Required)
* @param string $object (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_object($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
if(isset($options[self::OSS_FILE_DOWNLOAD]) && $this->chk_chinese($options[self::OSS_FILE_DOWNLOAD])){
$options[self::OSS_FILE_DOWNLOAD] = iconv('utf-8','gbk',$options[self::OSS_FILE_DOWNLOAD]);
}
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = $object;
if(isset($options['lastmodified'])){
$options[self::OSS_HEADERS][self::OSS_IF_MODIFIED_SINCE] = $options['lastmodified'];
unset($options['lastmodified']);
}
if(isset($options['etag'])){
$options[self::OSS_HEADERS][self::OSS_IF_NONE_MATCH] = $options['etag'];
unset($options['etag']);
}
if(isset($options['range'])){
$options[self::OSS_HEADERS][self::OSS_RANGE] = 'bytes=' . $options['range'];
unset($options['range']);
}
return $this->auth ( $options );
}
/**
* 检测Object是否存在
* @param string $bucket(Required)
* @param string $object (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return boolean
*/
public function is_object_exist($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = $object;
$response = $this->get_object_meta($bucket, $object,$options);
return $response;
}
/*%******************************************************************************************************%*/
//Multi Part相关操作
/**
* 计算文件可以分成多少个part,以及每个part的长度以及起始位置
* 方法必须在 <upload_part()>中调用
*
* @param integer $filesize (Required) 文件大小
* @param integer $part_size (Required) part大小,默认5M
* @return array An array 包含 key-value 键值对. Key 为 `seekTo` 和 `length`.
*/
public function get_multipart_counts($filesize, $part_size = 5242880 ){
$i = 0;
$sizecount = $filesize;
$values = array();
if((integer)$part_size <= 5242880){
$part_size = 5242880; //5M
}elseif ((integer)$part_size > 524288000){
$part_size = 524288000; //500M
}else{
$part_size = 52428800; //50M
}
while ($sizecount > 0)
{
$sizecount -= $part_size;
$values[] = array(
self::OSS_SEEK_TO => ($part_size * $i),
self::OSS_LENGTH => (($sizecount > 0) ? $part_size : ($sizecount + $part_size)),
);
$i++;
}
return $values;
}
/**
* 初始化multi-part upload,并且返回uploadId
* @param string $bucket (Required) Bucket名称
* @param string $object (Required) Object名称
* @param array $options (Optional) Key-Value数组,其中可以包括以下的key
* @return ResponseCore
*/
public function initiate_multipart_upload($bucket,$object,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
// 发送请求
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_SUB_RESOURCE] = 'uploads';
$options[self::OSS_CONTENT] = '';
//$options[self::OSS_CONTENT_LENGTH] = 0;
$options[self::OSS_HEADERS] = array(self::OSS_CONTENT_TYPE => 'application/octet-stream');
$response = $this->auth ( $options );
return $response;
}
/**
* 上传part
* @param string $bucket (Required) Bucket名称
* @param string $object (Required) Object名称
* @param string $upload_id (Required) uploadId
* @param array $options (Optional) Key-Value数组,其中可以包括以下的key
* @return ResponseCore
*/
public function upload_part($bucket, $object, $upload_id, $options = null){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
if (!isset($options[self::OSS_FILE_UPLOAD]) || !isset($options['partNumber'])){
throw new OSS_Exception('The `fileUpload` and `partNumber` options are both required in ' . __FUNCTION__ . '().');
}
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_UPLOAD_ID] = $upload_id;
if(isset($options[self::OSS_LENGTH])){
$options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
}
return $this->auth($options);
}
/**
* list part
* @param string $bucket (Required) Bucket名称
* @param string $object (Required) Object名称
* @param string $upload_id (Required) uploadId
* @param array $options (Optional) Key-Value数组,其中可以包括以下的key
* @return ResponseCore
*/
public function list_parts($bucket, $object, $upload_id, $options = null){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_UPLOAD_ID] = $upload_id;
$options[self::OSS_QUERY_STRING] = array();
foreach (array('max-parts', 'part-number-marker') as $param){
if (isset($options[$param])){
$options[self::OSS_QUERY_STRING][$param] = $options[$param];
unset($options[$param]);
}
}
return $this->auth($options);
}
/**
* 中止上传mulit-part upload
* @param string $bucket (Required) Bucket名称
* @param string $object (Required) Object名称
* @param string $upload_id (Required) uploadId
* @param array $options (Optional) Key-Value数组,其中可以包括以下的key
* @return ResponseCore
*/
public function abort_multipart_upload($bucket, $object, $upload_id, $options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_UPLOAD_ID] = $upload_id;
return $this->auth($options);
}
/**
* 完成multi-part上传
* @param string $bucket (Required) Bucket名称
* @param string $object (Required) Object名称
* @param string $upload_id (Required) uploadId
* @param string $parts xml格式文件
* @param array $options (Optional) Key-Value数组,其中可以包括以下的key
* @return ResponseCore
*/
public function complete_multipart_upload($bucket, $object, $upload_id, $parts, $options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_UPLOAD_ID] = $upload_id;
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
if(is_string($parts)){
$options[self::OSS_CONTENT] = $parts;
}else if($parts instanceof SimpleXMLElement){
$options[self::OSS_CONTENT] = $parts->asXML();
}else if((is_array($parts) || $parts instanceof ResponseCore)){
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><CompleteMultipartUpload></CompleteMultipartUpload>');
if (is_array($parts)){
//生成关联的xml
foreach ($parts as $node){
$part = $xml->addChild('Part');
$part->addChild('PartNumber', $node['PartNumber']);
$part->addChild('ETag', $node['ETag']);
}
}elseif ($parts instanceof ResponseCore){
foreach ($parts->body->Part as $node){
$part = $xml->addChild('Part');
$part->addChild('PartNumber', (string) $node->PartNumber);
$part->addChild('ETag', (string) $node->ETag);
}
}
$options[self::OSS_CONTENT] = $xml->asXML();
}
return $this->auth($options);
}
/**
* 列出multipart上传
* @param string $bucket (Requeired) bucket
* @param array $options (Optional) 关联数组
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-05
* @return ResponseCore
*/
public function list_multipart_uploads($bucket, $options = null){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'uploads';
foreach (array('key-marker', 'max-uploads', 'upload-id-marker') as $param){
if (isset($options[$param])){
$options[self::OSS_QUERY_STRING][$param] = $options[$param];
unset($options[$param]);
}
}
return $this->auth($options);
}
/**
* multipart上传统一封装,从初始化到完成multipart,以及出错后中止动作
* @param unknown_type $bucket
* @param unknown_type $object
* @param unknown_type $options
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-05
* @return ResponseCore
*/
public function create_mpu_object($bucket, $object, $options = null){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
if(isset($options[self::OSS_LENGTH])){
$options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
unset($options[self::OSS_LENGTH]);
}
if(isset($options[self::OSS_FILE_UPLOAD])){
if($this->chk_chinese($options[self::OSS_FILE_UPLOAD])){
$options[self::OSS_FILE_UPLOAD] = mb_convert_encoding($options[self::OSS_FILE_UPLOAD],'UTF-8');
}
}
if(!isset($options[self::OSS_FILE_UPLOAD])){
throw new OSS_Exception('The `fileUpload` option is required in ' . __FUNCTION__ . '().');
}elseif (is_resource($options[self::OSS_FILE_UPLOAD])){
$upload_position = isset($options[self::OSS_SEEK_TO]) ? (integer) $options[self::OSS_SEEK_TO] : ftell($options[self::OSS_FILE_UPLOAD]);
$upload_filesize = isset($options[self::OSS_CONTENT_LENGTH]) ? (integer) $options[self::OSS_CONTENT_LENGTH] : null;
if (!isset($upload_filesize) && $upload_position !== false){
$stats = fstat($options[self::OSS_FILE_UPLOAD]);
if ($stats && $stats[self::OSS_SIZE] >= 0){
$upload_filesize = $stats[self::OSS_SIZE] - $upload_position;
}
}
}else{
$upload_position = isset($options[self::OSS_SEEK_TO]) ? (integer) $options[self::OSS_SEEK_TO] : 0;
if (isset($options[self::OSS_CONTENT_TYPE])){
$upload_filesize = (integer) $options[self::OSS_CONTENT_TYPE];
}
else{
$upload_filesize = filesize($options[self::OSS_FILE_UPLOAD]);
if ($upload_filesize !== false){
$upload_filesize -= $upload_position;
}
}
}
if ($upload_position === false || !isset($upload_filesize) || $upload_filesize === false || $upload_filesize < 0){
throw new OSS_Exception('The size of `fileUpload` cannot be determined in ' . __FUNCTION__ . '().');
}
// 处理partSize
if (isset($options[self::OSS_PART_SIZE])){
// 小于5M
if ((integer) $options[self::OSS_PART_SIZE] <= 5242880){
$options[self::OSS_PART_SIZE] = 5242880; // 5 MB
}
// 大于500M
elseif ((integer) $options[self::OSS_PART_SIZE] > 524288000){
$options[self::OSS_PART_SIZE] = 524288000; // 500 MB
}
}
else{
$options[self::OSS_PART_SIZE] = 52428800; // 50 MB
}
// 如果上传的文件小于partSize,则直接使用普通方式上传
if ($upload_filesize < $options[self::OSS_PART_SIZE] && !isset($options['uploadId'])){
return $this->upload_file_by_file($bucket, $object, $options[self::OSS_FILE_UPLOAD]);
}
// 初始化multipart
if (isset($options['uploadId'])){
$upload_id = $options['uploadId'];
}else{
//初始化
$upload = $this->initiate_multipart_upload($bucket, $object);
if (!$upload->isOK()){
throw new OSS_Exception('Init multi-part upload failed...');
}
$xml = new SimpleXmlIterator($upload->body);
$uploadId = (string)$xml->UploadId;
}
// 或的分片
$pieces = $this->get_multipart_counts($upload_filesize, (integer) $options[self::OSS_PART_SIZE]);
$response_upload_part = array();
foreach ($pieces as $i => $piece){
$response_upload_part[] = $this->upload_part($bucket, $object, $uploadId, array(
//'expect' => '100-continue',
self::OSS_FILE_UPLOAD => $options[self::OSS_FILE_UPLOAD],
'partNumber' => ($i + 1),
self::OSS_SEEK_TO => $upload_position + (integer) $piece[self::OSS_SEEK_TO],
self::OSS_LENGTH => (integer) $piece[self::OSS_LENGTH],
));
}
$upload_parts = array();
$upload_part_result = true;
foreach ($response_upload_part as $i=>$response){
$upload_part_result = $upload_part_result && $response->isOk();
}
if(!$upload_part_result){
throw new OSS_Exception('any part upload failed...,pls try again');
}
foreach ($response_upload_part as $i=>$response){
$upload_parts[] = array(
'PartNumber' => ($i + 1),
'ETag' => (string) $response->header['etag']
);
}
return $this->complete_multipart_upload($bucket, $object, $uploadId, $upload_parts);
}
/**
* 通过Multi-Part方式上传整个目录,其中的object默认为文件名
* @param string $bucket (Required)
* @param string $dir (Required) 必选
* @param boolean $recursive (Optional) 是否递归,如果为true,则递归读取所有目录,默认为不递归读取
* @param string $exclude 需要过滤的文件
* @param array $options (Optional) 关联数组
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-05
* @return ResponseCore
*/
public function create_mtu_object_by_dir($bucket,$dir,$recursive = false,$exclude = ".|..|.svn",$options = null){
//options
$this->validate_options($options);
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
if($this->chk_chinese($dir)){
$dir = iconv('utf-8','gbk',$dir);
}
//判断是否目录
if(!is_dir($dir)){
throw new OSS_Exception($dir.' is not a directory...,pls check it');
}
$file_list_array = $this->read_dir($dir,$exclude,$recursive);
if(!$file_list_array){
throw new OSS_Exception($dir.' is empty...');
}
$index = 1;
foreach ($file_list_array as $item){
$options = array(
self::OSS_FILE_UPLOAD => $item['path'],
self::OSS_PART_SIZE => 5242880,
);
echo $index++.". ";
$response = $this->create_mpu_object($bucket, $item['file'],$options);
if($response->isOK()){
echo "Upload file {".$item['path']." } successful..\n";
}else{
echo "Upload file {".$item['path']." } failed..\n";
continue;
}
}
}
/**
* 通过multi-part方式上传目录(优化版)
* $options = array(
* 'bucket' => (Required)
* 'object' => (Optional)
* 'directory' => (Required)
* 'exclude' => (Optional)
* 'recursive' => (Optional)
* )
*/
public function batch_upload_file($options = NULL){
if((NULL == $options) || !isset($options['bucket']) || empty($options['bucket']) || !isset($options['directory']) ||empty($options['directory']) ) {
throw new OSS_Exception('Bad Request',400);
}
$bucket = $options['bucket']; unset($options['bucket']);
$directory = $options['directory']; unset($options['directory']);
if($this->chk_chinese($directory)){
$directory = iconv('utf-8','gbk',$directory);
}
//判断是否目录
if(!is_dir($directory)){
throw new OSS_Exception($dir.' is not a directory...,pls check it');
}
$object = '';
if(isset($options['object'])){
$object = $options['object'];
unset($options['object']);
}
$exclude = '.|..|.svn';
if (isset($options['exclude']) && !empty($options['exclude'])){
$exclude = $options['exclude'];
unset($options['exclude']);
}
$recursive = false;
if(isset($options['recursive']) && !empty($options['recursive'])){
if(in_array($options['recursive'],array(true,false))){
$recursive = $options['recursive'];
}
unset($options['recursive']);
}
//read directory
$file_list_array = $this->read_dir($directory,$exclude,$recursive);
if(!$file_list_array){
throw new OSS_Exception($directory.' is empty...');
}
$index = 1;
foreach ($file_list_array as $item){
$options = array(
self::OSS_FILE_UPLOAD => $item['path'],
self::OSS_PART_SIZE => 5242880,
);
echo $index++.". ";
$response = $this->create_mpu_object($bucket, (!empty($object)?$object.'/':'').$item['file'],$options);
if($response->isOK()){
echo "Upload file {".$item['path']." } successful..\n";
}else{
echo "Upload file {".$item['path']." } failed..\n";
continue;
}
}
}
/*%******************************************************************************************************%*/
//Object Group相关操作
/**
* 创建Object Group
* @param string $object_group (Required) Object Group名称
* @param string $bucket (Required) Bucket名称
* @param array $object_arry (Required) object数组,所有的object必须在同一个bucket下
* 其中$object 数组的格式如下:
* $object = array(
* $object1,
* $object2,
* ...
* )
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function create_object_group($bucket,$object_group ,$object_arry,$options = NULL){
//options
$this->validate_options($options);
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object group
$this->is_empty($object_group,OSS_OBJECT_GROUP_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'POST';
$options[self::OSS_OBJECT] = $object_group;
$options[self::OSS_CONTENT_TYPE] = 'txt/xml'; //重设Content-Type
$options[self::OSS_SUB_RESOURCE] = 'group'; //设置?group
$options[self::OSS_CONTENT] = $this->make_object_group_xml($bucket,$object_arry); //格式化xml
$response = $this->auth ( $options );
return $response;
}
/**
* 获取Object Group
* @param string $object_group (Required)
* @param string $bucket (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_object_group($bucket,$object_group,$options = NULL){
//options
$this->validate_options($options);
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object group
$this->is_empty($object_group,OSS_OBJECT_GROUP_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = $object_group;
//$options[self::OSS_OBJECT_GROUP] = true; //设置?group
//$options[self::OSS_CONTENT_TYPE] = 'txt/xml'; //重设Content-Type
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_GROUP => self::OSS_OBJECT_GROUP); //header中的x-oss-file-group不能为空,否则返回值错误
$response = $this->auth ( $options );
return $response;
}
/**
* 获取Object Group 的Object List信息
* @param string $object_group (Required)
* @param string $bucket (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_object_group_index($bucket,$object_group,$options = NULL){
//options
$this->validate_options($options);
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object group
$this->is_empty($object_group,OSS_OBJECT_GROUP_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'GET';
$options[self::OSS_OBJECT] = $object_group;
$options[self::OSS_CONTENT_TYPE] = 'application/xml'; //重设Content-Type
//$options[self::OSS_OBJECT_GROUP] = true; //设置?group
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_GROUP => self::OSS_OBJECT_GROUP);
$response = $this->auth ( $options );
return $response;
}
/**
* 获得object group的meta信息
* @param string $bucket (Required)
* @param string $object_group (Required)
* @param string $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function get_object_group_meta($bucket,$object_group,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object group
$this->is_empty($object_group,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'HEAD';
$options[self::OSS_OBJECT] = $object_group;
$options[self::OSS_CONTENT_TYPE] = 'application/xml'; //重设Content-Type
//$options[self::OSS_SUB_RESOURCE] = 'group'; //设置?group
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_GROUP => self::OSS_OBJECT_GROUP);
$response = $this->auth ( $options );
return $response;
}
/**
* 删除Object Group
* @param string $bucket(Required)
* @param string $object_group (Required)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-11-14
* @return ResponseCore
*/
public function delete_object_group($bucket,$object_group,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object group
$this->is_empty($object_group,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = 'DELETE';
$options[self::OSS_OBJECT] = $object_group;
$response = $this->auth ( $options );
return $response;
}
/*%******************************************************************************************************%*/
//带签名的url相关
/**
* 获取带签名的url
* @param string $bucket (Required)
* @param string $object (Required)
* @param int $timeout (Optional)
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-21
* @return string
*/
public function get_sign_url($bucket,$object,$timeout = 60,$options = NULL){
//options
$this->validate_options($options);
if(!$options){
$options = array();
}
//bucket
$this->is_empty($bucket,OSS_BUCKET_IS_NOT_ALLOWED_EMPTY);
//object
$this->is_empty($object,OSS_OBJECT_IS_NOT_ALLOWED_EMPTY);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_OBJECT] = $object;
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_CONTENT_TYPE] = '';
$timeout = time() + $timeout;
$options[self::OSS_PREAUTH] = $timeout;
$options[self::OSS_DATE] = $timeout;
return $this->auth($options);
}
/*%******************************************************************************************************%*/
//日志相关
/**
* 记录日志
* @param string $msg (Required)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return void
*/
private function log($msg){
if(defined('ALI_LOG_PATH') ){
$log_path = ALI_LOG_PATH;
if(empty($log_path) || !file_exists($log_path)){
throw new OSS_Exception($log_path.OSS_LOG_PATH_NOT_EXIST);
}
}else{
$log_path = dirname(__FILE__).DIRECTORY_SEPARATOR.'logs'.DIRECTORY_SEPARATOR;
}
//检测日志目录是否存在
if(!file_exists($log_path)){
throw new OSS_Exception(OSS_LOG_PATH_NOT_EXIST);
}
$log_name = $log_path.'oss_sdk_php_'.date('Y-m-d').'.log';
if(ALI_DISPLAY_LOG){
echo $msg."\n<br/>";
}
if(ALI_LOG){
if(!error_log(date('Y-m-d H:i:s')." : ".$msg."\n", 3,$log_name)){
throw new OSS_Exception(OSS_WRITE_LOG_TO_FILE_FAILED);
}
}
}
/*%******************************************************************************************************%*/
//工具类相关
/**
* 生成query params
* @param array $array 关联数组
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-04
* @return string 返回诸如 key1=value1&key2=value2
*/
public function to_query_string($options = array()){
$temp = array();
foreach ($options as $key => $value){
if (is_string($key) && !is_array($value)){
$temp[] = rawurlencode($key) . '=' . rawurlencode($value);
}
}
return implode('&', $temp);
}
/**
* 转化十六进制的数据为base64
*
* @param string $str (Required) 要转化的字符串
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-20
* @return string Base64-encoded string.
*/
private function hex_to_base64($str){
$result = '';
for ($i = 0; $i < strlen($str); $i += 2){
$result .= chr(hexdec(substr($str, $i, 2)));
}
return base64_encode($result);
}
private function s_replace($subject){
$search = array('<','>','&','\'','"');
$replace = array('<','>','&',''','"');
return str_replace($search, $replace, $subject);
}
/**
* 检测是否含有中文
* @param string $subject
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-06-06
* @return boolean
*/
private function chk_chinese($str){
return preg_match('/[\x80-\xff]./', $str);
}
/**
* 检测是否GB2312编码
* @param string $str
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-20
* @return boolean false UTF-8编码 TRUE GB2312编码
*/
function is_gb2312($str) {
for($i=0; $i<strlen($str); $i++) {
$v = ord( $str[$i] );
if( $v > 127) {
if( ($v >= 228) && ($v <= 233) ){
if( ($i+2) >= (strlen($str) - 1)) return true; // not enough characters
$v1 = ord( $str[$i+1] );
$v2 = ord( $str[$i+2] );
if( ($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191) )
return false; //UTF-8编码
else
return true; //GB编码
}
}
}
}
/**
* 检测是否GBK编码
* @param string $str
* @param boolean $gbk
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-06-04
* @return boolean
*/
private function check_char($str,$gbk = true){
for($i=0; $i<strlen($str); $i++) {
$v = ord( $str[$i] );
if( $v > 127){
if( ($v >= 228) && ($v <= 233) ){
if(($i+2)>= (strlen($str)-1)) return $gbk?true:FALSE; // not enough characters
$v1 = ord( $str[$i+1] ); $v2 = ord( $str[$i+2] );
if($gbk){
return (($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191))?FALSE:TRUE;//GBK
}else{
return (($v1 >= 128) && ($v1 <=191) && ($v2 >=128) && ($v2 <= 191))?TRUE:FALSE;
}
}
}
}
return $gbk?TRUE:FALSE;
}
/**
* 读取目录
* @param string $dir (Required) 目录名
* @param boolean $recursive (Optional) 是否递归,默认为false
* @author xiaobing.meng@alibaba-inc.com
* @since 2012-03-05
* @return array
*/
private function read_dir($dir,$exclude = ".|..|.svn",$recursive = false){
static $file_list_array = array();
$exclude_array = explode("|", $exclude);
//读取目录
if($handle = opendir($dir)){
while ( false !== ($file = readdir($handle))){
if(!in_array(strtolower($file),$exclude_array)){
$new_file = $dir.'/'.$file;
if(is_dir($new_file) && $recursive){
$this->read_dir($new_file,$exclude,$recursive);
}else{
$file_list_array[] = array(
'path' => $new_file,
'file' => $file,
);
}
}
}
closedir($handle);
}
return $file_list_array;
}
/**
* 转化object数组为固定个xml格式
* @param string $bucket (Required)
* @param array $object_array (Required)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return string
*/
private function make_object_group_xml($bucket,$object_array){
$xml = '';
$xml .= '<CreateFileGroup>';
if($object_array){
if(count($object_array) > self::OSS_MAX_OBJECT_GROUP_VALUE){
throw new OSS_Exception(OSS_OBJECT_GROUP_TOO_MANY_OBJECT, '-401');
}
$index = 1;
foreach ($object_array as $key=>$value){
$object_meta = (array)$this->get_object_meta($bucket, $value);
if(isset($object_meta) && isset($object_meta['status']) && isset($object_meta['header']) && isset($object_meta['header']['etag']) && $object_meta['status'] == 200){
$xml .= '<Part>';
$xml .= '<PartNumber>'.intval($index).'</PartNumber>';
$xml .= '<PartName>'.$value.'</PartName>';
$xml .= '<ETag>'.$object_meta['header']['etag'].'</ETag>';
$xml .= '</Part>';
$index++;
}
}
}else{
throw new OSS_Exception(OSS_OBJECT_ARRAY_IS_EMPTY, '-400');
}
$xml .= '</CreateFileGroup>';
return $xml;
}
/**
* 检验bucket名称是否合法
* bucket的命名规范:
* 1. 只能包括小写字母,数字
* 2. 必须以小写字母或者数字开头
* 3. 长度必须在3-63字节之间
* @param string $bucket (Required)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return boolean
*/
private function validate_bucket($bucket){
$pattern = '/^[a-z0-9][a-z0-9-]{2,62}$/';
if (! preg_match ( $pattern, $bucket )) {
return false;
}
return true;
}
/**
* 检验object名称是否合法
* object命名规范:
* 1. 规则长度必须在1-1023字节之间
* 2. 使用UTF-8编码
* @param string $object (Required)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return boolean
*/
private function validate_object($object){
$pattern = '/^.{1,1023}$/';
if (empty ( $object ) || ! preg_match ( $pattern, $object )) {
return false;
}
return true;
}
/**
* 检验$options
* @param array $options (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return boolean
*/
private function validate_options($options){
//$options
if ($options != NULL && ! is_array ( $options )) {
throw new OSS_Exception ($options.':'.OSS_OPTIONS_MUST_BE_ARRAY);
}
}
/**
* 检测上传文件的内容
* @param array $options (Optional)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return string
*/
private function validate_content($options){
if(isset($options[self::OSS_CONTENT])){
if($options[self::OSS_CONTENT] == '' || !is_string($options[self::OSS_CONTENT])){
throw new OSS_Exception(OSS_INVALID_HTTP_BODY_CONTENT,'-600');
}
}else{
throw new OSS_Exception(OSS_NOT_SET_HTTP_CONTENT, '-601');
}
}
/**
* 验证文件长度
* @param array $options (Optional)
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return void
*/
private function validate_content_length($options){
if(isset($options[self::OSS_LENGTH]) && is_numeric($options[self::OSS_LENGTH])){
if( ! $options[self::OSS_LENGTH] > 0){
throw new OSS_Exception(OSS_CONTENT_LENGTH_MUST_MORE_THAN_ZERO, '-602');
}
}else{
throw new OSS_Exception(OSS_INVALID_CONTENT_LENGTH, '-602');
}
}
/**
* 校验BUCKET/OBJECT/OBJECT GROUP是否为空
* @param string $name (Required)
* @param string $errMsg (Required)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @since 2011-12-27
* @return void
*/
private function is_empty($name,$errMsg){
if(empty($name)){
throw new OSS_Exception($errMsg);
}
}
/**
* 设置http header
* @param string $key (Required)
* @param string $value (Required)
* @param array $options (Required)
* @throws OSS_Exception
* @author xiaobing.meng@alibaba-inc.com
* @return void
*/
private static function set_options_header($key, $value, &$options) {
if (isset ( $options [self::OSS_HEADERS] )) {
if (! is_array ( $options [self::OSS_HEADERS] )) {
throw new OSS_Exception(OSS_INVALID_OPTION_HEADERS, '-600');
}
} else {
$options [self::OSS_HEADERS] = array ();
}
$options [self::OSS_HEADERS] [$key] = $value;
}
}
================================================
FILE: AliUpload/lib/zh.inc.php
================================================
<?php
/*%*************************************************************************************%*/
//access id & access key 相关
define('NOT_SET_OSS_ACCESS_ID', '未设置OSS服务的ACCESS ID');
define('NOT_SET_OSS_ACCESS_KEY', '未设置OSS服务的ACCESS KEY');
define('NOT_SET_OSS_ACCESS_ID_AND_ACCESS_KEY', '没有设置ACCESS ID & ACCESS KEY');
define('OSS_ACCESS_ID_OR_ACCESS_KEY_EMPTY', 'ACCESS ID或ACCESS KEY为空');
/*%*************************************************************************************%*/
//OSS语言包以及文件相关
define('OSS_LANG_FILE_NOT_EXIST', 'OSS语言包文件不存在');
define('OSS_CONFIG_FILE_NOT_EXIST',OSS_API_PATH.DIRECTORY_SEPARATOR.'conf.inc.php不存在');
define('OSS_UTILS_FILE_NOT_EXIST',OSS_API_PATH.DIRECTORY_SEPARATOR.'util'.DIRECTORY_SEPARATOR.'utils.php不存在');
define('OSS_CURL_EXTENSION_MUST_BE_LOAD','系统没有安装CURL扩展');
define('OSS_NO_ANY_EXTENSIONS_LOADED','系统没有安装任何扩展,请检查系统配置');
/*%*************************************************************************************%*/
//日志文件相关
define('OSS_WRITE_LOG_TO_FILE_FAILED','日志写入失败,请检查日志文件是否存在或者日志文件的权限');
define('OSS_LOG_PATH_NOT_EXIST','日志路径不存在');
/*%**************************************************************************************%*/
//OSS bucket操作相关
define('OSS_OPTIONS_MUST_BE_ARRAY', '$option必须为数组');
define('OSS_GET_BUCKET_LIST_SUCCESS','获取Bucket列表成功!');
define('OSS_GET_BUCKET_LIST_FAILED', '获取Bucket列表失败!');
define('OSS_CREATE_BUCKET_SUCCESS', '创建Bucket成功');
define('OSS_CREATE_BUCKET_FAILED', '创建Bucket失败');
define('OSS_DELETE_BUCKET_SUCCESS', '删除Bucket成功');
define('OSS_DELETE_BUCKET_FAILED', '删除Bucket失败');
define('OSS_BUCKET_NAME_INVALID', '未通过Bucket名称规则校验');
define('OSS_GET_BUCKET_ACL_SUCCESS','获取Bucket ACL成功');
define('OSS_GET_BUCKET_ACL_FAILED','获取Bucket ACL失败');
define('OSS_SET_BUCKET_ACL_SUCCESS','设置Bucket ACL成功');
define('OSS_SET_BUCKET_ACL_FAILED','设置Bucket ACL失败');
define('OSS_ACL_INVALID','ACL不在允许范围,目前仅允许(private,public-read,public-read-write三种权限)');
define('OSS_BUCKET_IS_NOT_ALLOWED_EMPTY', 'Bucket不允许为空');
/*%****************************************************************************************%*/
//OSS object操作相关
define('OSS_GET_OBJECT_LIST_SUCCESS','获得OBJECT列表成功');
define('OSS_GET_OBJECT_LIST_FAILED','获得OBJECT列表失败');
define('OSS_CREATE_OBJECT_DIR_SUCCESS','创建OBJECT目录成功');
define('OSS_CREATE_OBJECT_DIR_FAILED','创建OBJECT目录失败');
define('OSS_DELETE_OBJECT_SUCCESS','删除OBJECT成功');
define('OSS_DELETE_OBJECT_FAILED','删除OBJECT失败');
define('OSS_UPLOAD_FILE_BY_CONTENT_SUCCESS','通过Http Body上传文件成功');
define('OSS_UPLOAD_FILE_BY_CONTENT_FAILED','通过Http Body上传文件失败');
define('OSS_GET_OBJECT_META_SUCCESS','获得OBJECT META成功');
define('OSS_GET_OBJECT_META_FAILED','获得OBJECT META失败');
define('OSS_OBJECT_NAME_INVALID','未通过Object名称规则校验');
define('OSS_OBJECT_IS_NOT_ALLOWED_EMPTY','Object不允许为空');
define('OSS_INVALID_HTTP_BODY_CONTENT','Http Body的内容非法');
define('OSS_GET_OBJECT_SUCCESS','获得Object成功');
define('OSS_GET_OBJECT_FAILED','获得Object失败');
define('OSS_OBJECT_EXIST','Object存在');
define('OSS_OBJECT_NOT_EXIST','Object不存在');
define('OSS_NOT_SET_HTTP_CONTENT','为设置Http Body');
define('OSS_INVALID_CONTENT_LENGTH','非法的Content-Length值');
define('OSS_CONTENT_LENGTH_MUST_MORE_THAN_ZERO','Content-Length必须大于0');
define('OSS_UPLOAD_FILE_NOT_EXIST','上传文件不存在');
define('OSS_COPY_OBJECT_SUCCESS','拷贝Object成功');
define('OSS_COPY_OBJECT_FAILED', '拷贝Object失败');
define('OSS_FILE_NOT_EXIST','文件不存在');
define('OSS_FILE_PATH_IS_NOT_ALLOWED_EMPTY', '上传文件路径为空');
/*%****************************************************************************************%*/
//OSS object Group操作相关
define('OSS_CREATE_OBJECT_GROUP_SUCCESS','创建Object Group成功');
define('OSS_CREATE_OBJECT_GROUP_FAILED','创建Object Group失败');
define('OSS_GET_OBJECT_GROUP_SUCCESS','获取Object Group成功');
define('OSS_GET_OBJECT_GROUP_FAILED','获取Object Group失败');
define('OSS_GET_OBJECT_GROUP_INDEX_SUCCESS','获取Object Group Index成功');
define('OSS_GET_OBJECT_GROUP_INDEX_FAILED','获取Object Group Index失败');
define('OSS_GET_OBJECT_GROUP_META_SUCCESS','获取Object Group Group Meta成功');
define('OSS_GET_OBJECT_GROUP_META_FAILED','获取Object Group Group Meta失败');
define('OSS_DELETE_OBJECT_GROUP_SUCCESS','删除Object Group Group成功');
define('OSS_DELETE_OBJECT_GROUP_FAILED','删除Object Group Group失败');
define('OSS_OBJECT_GROUP_IS_NOT_ALLOWED_EMPTY', 'Object Group不允许为空');
define('OSS_OBJECT_ARRAY_IS_EMPTY','创建Object Group的Object不允许为空');
define('OSS_OBJECT_GROUP_TOO_MANY_OBJECT','每个Object Group最多包含1000个Object');
/*%****************************************************************************************%*/
//OSS Multi-Part Upload相关
define('OSS_INITIATE_MULTI_PART_SUCCESS', '初始化Multi-Part Upload成功');
define('OSS_INITIATE_MULTI_PART_FAILED', '初始化Multi-Part Upload失败');
/*%*******************************************************************************************%*/
//其他
define('OSS_INVALID_OPTION_HEADERS', 'OPTIONS不是数组');
================================================
FILE: Avartar.php
================================================
<?php
/**
* 头像代理修改插件
*
* @package Avartar
* @author loftor
* @version 1.0.0 Beta
* @link http://loftor.com/
*/
class Avartar implements Typecho_Plugin_Interface
{
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Typecho_Plugin::factory('Widget_Abstract_Comments')->gravatar = array('Avartar', 'gravatar');
return _t('启用成功,请进行相应设置!');
}
/**
* 禁用插件方法,如果禁用失败,直接抛出异常
*
* @static
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function deactivate(){}
/**
* 获取插件配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form 配置面板
* @return void
*/
public static function config(Typecho_Widget_Helper_Form $form)
{
$http = new Typecho_Widget_Helper_Form_Element_Text('http', NULL, 'http://gravatar.duoshuo.com',
_t('http代理地址'), _t('请填写http代理地址!'));
$form->addInput($http);
$https = new Typecho_Widget_Helper_Form_Element_Text('https', NULL, 'https://secure.gravatar.com',
_t('https代理地址'), _t('请填写https代理地址!'));
$form->addInput($https);
}
/**
* 个人用户的配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form
* @return void
*/
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
/**
* 输出用户头像
*
* @access public
* @param array $file 上传的文件
* @return mixed
*/
public static function gravatar($size, $rating, $default, $ctx)
{
$mailHash = NULL;
if (!empty($ctx->mail)) {
$mailHash = md5(strtolower($ctx->mail));
}
$options = Typecho_Widget::widget('Widget_Options');
if ($ctx->request->isSecure()) {
$host=$options->plugin('Avartar')->https;
} else {
$host=$options->plugin('Avartar')->http;
}
$url = $host . '/avatar/';
if (!empty($ctx->mail)) {
$url .= $mailHash;
}
$url .= '?s=' . $size;
$url .= '&r=' . $rating;
$url .= '&d=' . $default;
echo '<img class="avatar" src="' . $url . '" alt="' .
$ctx->author . '" width="' . $size . '" height="' . $size . '" />';
}
}
================================================
FILE: B3logForHacPai/Action.php
================================================
<?php ! defined('__TYPECHO_ROOT_DIR__') and exit();
class B3logForHacPai_Action extends Typecho_Widget
{
/**
* 构造函数
*
* @param mixed $request
* @param mixed $response
* @param null $params
*/
public function __construct($request, $response, $params = NULL)
{
parent::__construct($request, $response, $params);
}
/**
* Article receiver (from B3log Symphony).
*
*/
public function articleReceiver(){
//print_r($_POST);
}
/**
* Comment receiver (from B3log Symphony).
*
*/
public function commentReceiver(){
if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
}
if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
$GLOBALS['HTTP_RAW_POST_DATA'] = trim($GLOBALS['HTTP_RAW_POST_DATA']);
}
$result = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
if($result->client->key == Typecho_Widget::widget('Widget_Options')->plugin('B3logForHacPai')->b3logKey) {
$post = Typecho_Db::get()->fetchRow(Typecho_Db::get()->select('authorId')->from('table.contents')->where('cid = ?', $result->comment->articleId));
if ($post) {
$comment = array(
'cid' => $result->comment->articleId,
'created' => Helper::options()->gmtTime,
'text' => $result->comment->content,
'author' => $result->comment->authorName,
'mail' => $result->comment->authorEmail,
'url' => $result->comment->authorURL,
'agent' => $this->request->getAgent(),
'ip' => $this->request->getIp(),
'ownerId' => $post['authorId'],
'type' => 'comment',
'status' => 'approved',
);
//print_r($result->comment->articleid);
//$article = Typecho_Widget::widget('Widget_Users_Author@' . $this->cid, array('cid' => $result->comment->articleId));
Typecho_Widget::widget('Widget_Feedback')->insert($comment);
}
}
}
}
================================================
FILE: B3logForHacPai/LICENSE.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: B3logForHacPai/Plugin.php
================================================
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
//如果没有json库,加载兼容包
! extension_loaded('json') and include('libs/compat_json.php');
/**
* 黑客派社区实时同步插件
*
* @package B3log for HacPai
* @author DT27
* @version 1.0.0
* @link https://dt27.org/B3log-for-HacPai/
*/
class B3logForHacPai_Plugin implements Typecho_Plugin_Interface
{
/**
* 激活插件方法,如果激活失败,直接抛出异常
*
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function activate()
{
Typecho_Plugin::factory('Widget_Contents_Post_Edit')->finishPublish =
array('B3logForHacPai_Plugin', 'finishPublish');
Typecho_Plugin::factory('Widget_Feedback')->finishComment =
array('B3logForHacPai_Plugin', 'finishComment');
// 创建路由
// from HacPai
Helper::addRoute('b3log.hacpai.article', '/b3log-hacpai/article', 'B3logForHacPai_Action', 'articleReceiver');
Helper::addRoute('b3log.hacpai.comment', '/b3log-hacpai/comment', 'B3logForHacPai_Action', 'commentReceiver');
}
/**
* 禁用插件方法,如果禁用失败,直接抛出异常
*
* @static
* @access public
* @return void
* @throws Typecho_Plugin_Exception
*/
public static function deactivate(){
Helper::removeRoute('b3log.hacpai.article');
Helper::removeRoute('b3log.hacpai.comment');
}
/**
* 获取插件配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form 配置面板
* @return void
*/
public static function config(Typecho_Widget_Helper_Form $form)
{
$b3logKey = new Typecho_Widget_Helper_Form_Element_Text('b3logKey', NULL, NULL,
_t('B3log Key'), _t('请填写黑客派社区中设置的 B3log Key,并在社区中设置接收接口。<a href="https://hacpai.com/settings#soloKey" target="_blank">点此设置</a><br>
客户端收文及更新接口:<strong style="color: red;">'.Helper::options()->siteUrl.'b3log-hacpai/article</strong><br>客户端收评接口:<strong style="color: red;">'.Helper::options()->siteUrl.'b3log-hacpai/comment</strong>'));
$form->addInput($b3logKey->addRule('required', _t('必须填写 B3log Key')));
$b3logTitle = new Typecho_Widget_Helper_Form_Element_Text('b3logTitle', NULL, Helper::options()->title,
_t('博客标题'), _t('请填写本博客标题'));
$form->addInput($b3logTitle);
$b3logHost = new Typecho_Widget_Helper_Form_Element_Text('b3logHost', NULL, Helper::options()->siteUrl,
_t('博客地址'), _t('请填写本博客地址,需包括 http 且末尾无斜杠,例如:<strong style="color: red;">https://dt27.org</strong>'));
$form->addInput($b3logHost);
Typecho_Widget::widget('Widget_User')->to($user);
$b3logEmail = new Typecho_Widget_Helper_Form_Element_Text('b3logEmail', NULL, $user->mail,
_t('博客邮箱'), _t('请填写本博客邮箱'));
$form->addInput($b3logEmail);
$isHacPai = new Typecho_Widget_Helper_Form_Element_Radio('isHacPai',
array(
'1' => '是',
'0' => '否',
),'1', _t('是否启用同步功能'), NULL);
$form->addInput($isHacPai);
}
/**
* 个人用户的配置面板
*
* @access public
* @param Typecho_Widget_Helper_Form $form
* @return void
*/
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
/**
* 发布文章
*
* @access public
* @return void
*/
public static function finishPublish($contents, $edit)
{
$b3log = Typecho_Widget::widget('Widget_Options')->plugin('B3logForHacPai');
if($b3log->isHacPai == 1) {
$postData = array(
"article" => array(
"id" => $edit->cid,
"title" => $contents['title'],
"permalink" => substr($edit->permalink,strlen($b3log->b3logHost)),//substr($str,4) [article.permalink] should start with /, for example, /hello-world
"tags" => $contents['tags'],
"content" => $contents['text'],
),
"client" => array(
"title" => $b3log->b3logTitle,
"host" => $b3log->b3logHost,
"email" => $b3log->b3logEmail,
"key" => $b3log->b3logKey,
));
$postString = json_encode($postData);
$ch = curl_init('http://rhythm.b3log.org/api/article');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$postString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postString))
);
$result = curl_exec($ch);
}
return $contents;
}
/**
* 发布评论
*
* @access public
* @return void
*/
public static function finishComment($comment)
{
$b3log = Typecho_Widget::widget('Widget_Options')->plugin('B3logForHacPai');
if ($b3log->isHacPai == 1) {
$postData = array(
"comment" => array(
"id" => $comment->coid,
"articleId" => $comment->cid,
"content" => $comment->text,
"authorName" => $comment->author,
"authorEmail" => $comment->mail,
),
"client" => array(
"title" => $b3log->b3logTitle,
"host" => $b3log->b3logHost,
"email" => $b3log->b3logEmail,
"key" => $b3log->b3logKey,
));
$postString = json_encode($postData);
$ch = curl_init('http://rhythm.b3log.org/api/comment');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content -Length: ' . strlen($postString))
);
$result = curl_exec($ch);
//print_r($result);exit;
}
return $comment;
}
}
================================================
FILE: B3logForHacPai/README.md
================================================
# [B3logForHacPai](https://dt27.org/php/b3log-hacpai-typecho/)
**黑客派社区实时同步插件 For Typecho**
基于[B3log理念][1],整合 [Typecho][2] 博客与 [黑客派][3] 社区,实现内容及评论互相实时同步。丰富博客与社区内容。
## Features&Todo
* [x] 博客发布博文 -> 社区发布帖子
* [x] 博客更新博文 -> 社区更新帖子
* [x] 博客发布评论 -> 社区发布回帖
* [x] 社区发布回帖 -> 博客发布评论
###### Plugin License
> Copyright © 2016 [DT27](https://dt27.org)
> License: [GNU General Public License v3.0](http://www.gnu.org/licenses/gpl-3.0.html)
[1]: https://hacpai.com/b3log
[2]: http://typecho.org/
[3]: https://hacpai.com/
================================================
FILE: B3logForHacPai/libs/compat_json.php
================================================
<?php
if ( !class_exists( 'Services_JSON' ) ) :
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
* completely language independent but uses conventions that are familiar
* to programmers of the C-family of languages, including C, C++, C#, Java,
* JavaScript, Perl, TCL, and many others. These properties make JSON an
* ideal data-interchange language.
*
* This package provides a simple encoder and decoder for JSON notation. It
* is intended for use with client-side Javascript applications that make
* use of HTTPRequest to perform server communication functions - data can
* be encoded into JSON notation for use in a client-side javascript, or
* decoded from incoming Javascript requests. JSON format is native to
* Javascript, and can be directly eval()'ed with no further parsing
* overhead
*
* All strings should be in ASCII or UTF-8 format!
*
* LICENSE: Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met: Redistributions of source code must retain the
* above copyright notice, this list of conditions and the following
* disclaimer. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php 288200 2009-09-09 15:41:29Z alan_k $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_SLICE', 1);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_STR', 2);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_ARR', 3);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_OBJ', 4);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_CMT', 5);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_LOOSE_TYPE', 16);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
/**
* Converts to and from JSON format.
*
* Brief example of use:
*
* <code>
* // create a new instance of Services_JSON
* $json = new Services_JSON();
*
* // convert a complexe value to JSON notation, and send it to the browser
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
* $output = $json->encode($value);
*
* print($output);
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
*
* // accept incoming POST data, assumed to be in JSON notation
* $input = file_get_contents('php://input', 1000000);
* $value = $json->decode($input);
* </code>
*/
class Services_JSON
{
/**
* constructs a new JSON instance
*
* @param int $use object behavior flags; combine with boolean-OR
*
* possible values:
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
* "{...}" syntax creates associative arrays
* instead of objects in decode().
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
* Values which can't be encoded (e.g. resources)
* appear as NULL instead of throwing errors.
* By default, a deeply-nested resource will
* bubble up with an error, so all return values
* from encode() should be checked with isError()
*/
function Services_JSON($use = 0)
{
$this->use = $use;
}
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf16 UTF-16 character
* @return string UTF-8 character
* @access private
*/
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* convert a string from one UTF-8 char to one UTF-16 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf8 UTF-8 character
* @return string UTF-16 character
* @access private
*/
function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
switch(strlen($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8[1])));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8[2])));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* encodes an arbitrary variable into JSON format (and sends JSON Header)
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encode($var)
{
header('Content-type: application/json');
return $this->_encode($var);
}
/**
* encodes an arbitrary variable into JSON format without JSON Header - warning - may allow CSS!!!!)
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encodeUnsafe($var)
{
return $this->_encode($var);
}
/**
* PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function _encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
case 'NULL':
return 'null';
case 'integer':
return (int) $var;
case 'double':
case 'float':
return (float) $var;
case 'string':
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
$ascii = '';
$strlen_var = strlen($var);
/*
* Iterate over every character in the string,
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var[$c]);
switch (true) {
case $ord_var_c == 0x08:
$ascii .= '\b';
break;
case $ord_var_c == 0x09:
$ascii .= '\t';
break;
case $ord_var_c == 0x0A:
$ascii .= '\n';
break;
case $ord_var_c == 0x0C:
$ascii .= '\f';
break;
case $ord_var_c == 0x0D:
$ascii .= '\r';
break;
case $ord_var_c == 0x22:
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var[$c];
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var[$c];
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+1 >= $strlen_var) {
$c += 1;
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c, ord($var[$c + 1]));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF0) == 0xE0):
if ($c+2 >= $strlen_var) {
$c += 2;
$ascii .= '?';
break;
}
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
@ord($var[$c + 1]),
@ord($var[$c + 2]));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF8) == 0xF0):
if ($c+3 >= $strlen_var) {
$c += 3;
$ascii .= '?';
break;
}
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+4 >= $strlen_var) {
$c += 4;
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c,
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFE) == 0xFC):
if ($c+5 >= $strlen_var) {
$c += 5;
$ascii .= '?';
break;
}
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]),
ord($var[$c + 5]));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
return '"'.$ascii.'"';
case 'array':
/*
* As per JSON spec if any array key is not an integer
* we must treat the the whole array as an object. We
* also try to catch a sparsely populated associative
* array with numeric keys here because some JS engines
* will create an array with empty indexes up to
* max_index which can cause memory issues and because
* the keys, which may be relevant, will be remapped
* otherwise.
*
* As per the ECMA and JSON specification an object may
* have any string as a property. Unfortunately due to
* a hole in the ECMA specification if the key is a
* ECMA reserved word or starts with a digit the
* parameter is only accessible using ECMAScript's
* bracket notation.
*/
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
}
// treat it like a regular array
$elements = array_map(array($this, '_encode'), $var);
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
return $element;
}
}
return '[' . join(',', $elements) . ']';
case 'object':
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
}
}
/**
* array-walking function for use in generating JSON-formatted name-value pairs
*
* @param string $name name of key to use
* @param mixed $value reference to an array element to be encoded
*
* @return string JSON-formatted name-value pair, like '"name":value'
* @access private
*/
function name_value($name, $value)
{
$encoded_value = $this->_encode($value);
if(Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
return $this->_encode(strval($name)) . ':' . $encoded_value;
}
/**
* reduce a string by removing leading and trailing comments and whitespace
*
* @param $str string string value to strip of comments and whitespace
*
* @return string string value stripped of comments and whitespace
* @access private
*/
function reduce_string($str)
{
$str = preg_replace(array(
// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'
), '', $str);
// eliminate extraneous space
return trim($str);
}
/**
* decodes a JSON string into appropriate variable
*
* @param string $str JSON-formatted string
*
* @return mixed number, boolean, string, array, or object
* corresponding to given JSON input string.
* See argument 1 to Services_JSON() above for object-output behavior.
* Note that decode() always returns strings
* in ASCII or UTF-8 format!
* @access public
*/
function decode($str)
{
$str = $this->reduce_string($str);
switch (strtolower($str)) {
case 'true':
return true;
case 'false':
return false;
case 'null':
return null;
default:
$m = array();
if (is_numeric($str)) {
// Lookie-loo, it's a number
// This would work on its own, but I'm trying to be
// good about returning integers where appropriate:
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// STRINGS RETURNED IN UTF-8 FORMAT
$delim = substr($str, 0, 1);
$chrs = substr($str, 1, -1);
$utf8 = '';
$strlen_chrs = strlen($chrs);
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs[$c]);
switch (true) {
case $substr_chrs_c_2 == '\b':
$utf8 .= chr(0x08);
++$c;
break;
case $substr_chrs_c_2 == '\t':
$utf8 .= chr(0x09);
++$c;
break;
case $substr_chrs_c_2 == '\n':
$utf8 .= chr(0x0A);
++$c;
break;
case $substr_chrs_c_2 == '\f':
$utf8 .= chr(0x0C);
gitextract_cbgp91ts/
├── .gitattributes
├── .gitignore
├── Akismet/
│ └── Plugin.php
├── AliUpload/
│ ├── Plugin.php
│ └── lib/
│ ├── mimetypes.class.php
│ ├── requestcore.class.php
│ ├── sdk.class.php
│ └── zh.inc.php
├── Avartar.php
├── B3logForHacPai/
│ ├── Action.php
│ ├── LICENSE.txt
│ ├── Plugin.php
│ ├── README.md
│ └── libs/
│ └── compat_json.php
├── BlockComment/
│ └── Plugin.php
├── ConnectToTwitter/
│ ├── OAuth.php
│ ├── Plugin.php
│ └── twitterOAuth.php
├── Creole/
│ ├── Creole_Wiki.php
│ ├── Parse/
│ │ ├── Address.php
│ │ ├── Blockquote.php
│ │ ├── Box.php
│ │ ├── Break.php
│ │ ├── Center.php
│ │ ├── Delete.php
│ │ ├── Delimiter.php
│ │ ├── Emphasis.php
│ │ ├── Footnote.php
│ │ ├── Heading.php
│ │ ├── Horiz.php
│ │ ├── Image.php
│ │ ├── List.php
│ │ ├── Newline.php
│ │ ├── Paragraph.php
│ │ ├── Prefilter.php
│ │ ├── Preformatted.php
│ │ ├── Raw.php
│ │ ├── Strong.php
│ │ ├── Subscript.php
│ │ ├── Superscript.php
│ │ ├── Table.php
│ │ ├── Tighten.php
│ │ ├── Trim.php
│ │ ├── Tt.php
│ │ ├── Underline.php
│ │ └── Url.php
│ ├── Parse.inc.php
│ ├── Plugin.php
│ ├── Render/
│ │ ├── Plain/
│ │ │ ├── Anchor.php
│ │ │ ├── Blockquote.php
│ │ │ ├── Bold.php
│ │ │ ├── Box.php
│ │ │ ├── Break.php
│ │ │ ├── Center.php
│ │ │ ├── Code.php
│ │ │ ├── Colortext.php
│ │ │ ├── Deflist.php
│ │ │ ├── Delete.php
│ │ │ ├── Delimiter.php
│ │ │ ├── Embed.php
│ │ │ ├── Emphasis.php
│ │ │ ├── Font.php
│ │ │ ├── Freelink.php
│ │ │ ├── Function.php
│ │ │ ├── Heading.php
│ │ │ ├── Horiz.php
│ │ │ ├── Html.php
│ │ │ ├── Image.php
│ │ │ ├── Include.php
│ │ │ ├── Interwiki.php
│ │ │ ├── Italic.php
│ │ │ ├── List.php
│ │ │ ├── Newline.php
│ │ │ ├── Page.php
│ │ │ ├── Paragraph.php
│ │ │ ├── Phplookup.php
│ │ │ ├── Plugin.php
│ │ │ ├── Prefilter.php
│ │ │ ├── Preformatted.php
│ │ │ ├── Raw.php
│ │ │ ├── Revise.php
│ │ │ ├── Smiley.php
│ │ │ ├── Specialchar.php
│ │ │ ├── Strong.php
│ │ │ ├── Subscript.php
│ │ │ ├── Superscript.php
│ │ │ ├── Table.php
│ │ │ ├── Tighten.php
│ │ │ ├── Titlebar.php
│ │ │ ├── Toc.php
│ │ │ ├── Tt.php
│ │ │ ├── Underline.php
│ │ │ ├── Url.php
│ │ │ └── Wikilink.php
│ │ ├── Plain.php
│ │ ├── Xhtml/
│ │ │ ├── Address.php
│ │ │ ├── Anchor.php
│ │ │ ├── Blockquote.php
│ │ │ ├── Bold.php
│ │ │ ├── Box.php
│ │ │ ├── Break.php
│ │ │ ├── Center.php
│ │ │ ├── Code.php
│ │ │ ├── Colortext.php
│ │ │ ├── Deflist.php
│ │ │ ├── Delete.php
│ │ │ ├── Delimiter.php
│ │ │ ├── Embed.php
│ │ │ ├── Emphasis.php
│ │ │ ├── Font.php
│ │ │ ├── Freelink.php
│ │ │ ├── Function.php
│ │ │ ├── Heading.php
│ │ │ ├── Horiz.php
│ │ │ ├── Html.php
│ │ │ ├── Image.php
│ │ │ ├── Include.php
│ │ │ ├── Interwiki.php
│ │ │ ├── Italic.php
│ │ │ ├── List.php
│ │ │ ├── Newline.php
│ │ │ ├── Page.php
│ │ │ ├── Paragraph.php
│ │ │ ├── Phplookup.php
│ │ │ ├── Plugin.php
│ │ │ ├── Prefilter.php
│ │ │ ├── Preformatted.php
│ │ │ ├── Raw.php
│ │ │ ├── Revise.php
│ │ │ ├── Smiley.php
│ │ │ ├── Specialchar.php
│ │ │ ├── Strong.php
│ │ │ ├── Subscript.php
│ │ │ ├── Superscript.php
│ │ │ ├── Table.php
│ │ │ ├── Tighten.php
│ │ │ ├── Titlebar.php
│ │ │ ├── Toc.php
│ │ │ ├── Tt.php
│ │ │ ├── Underline.php
│ │ │ ├── Url.php
│ │ │ └── Wikilink.php
│ │ └── Xhtml.php
│ └── Render.inc.php
├── FlashMp3Player/
│ ├── Plugin.php
│ └── swf/
│ └── dewplayer.swf
├── GitHubGit/
│ ├── Action.php
│ ├── Plugin.php
│ ├── README.md
│ └── Spyc.php
├── GoogleAnalytics/
│ └── Plugin.php
├── GoogleCodePrettify/
│ ├── Plugin.php
│ └── src/
│ ├── lang-apollo.js
│ ├── lang-css.js
│ ├── lang-hs.js
│ ├── lang-lisp.js
│ ├── lang-lua.js
│ ├── lang-ml.js
│ ├── lang-proto.js
│ ├── lang-sql.js
│ ├── lang-vb.js
│ ├── lang-wiki.js
│ ├── prettify.css
│ └── prettify.js
├── GoogleCodeSVN/
│ ├── Action.php
│ └── Plugin.php
├── LaTex/
│ ├── Plugin.php
│ └── latex.js
├── MagikeToTypecho/
│ ├── Action.php
│ ├── Plugin.php
│ └── panel.php
├── MathJax.php
├── PageToLinks.php
├── PostToQzone/
│ ├── Plugin.php
│ ├── phpmailer.php
│ └── smtp.php
├── README.md
├── SaeUpload/
│ └── Plugin.php
├── ShareCode/
│ └── Plugin.php
├── SimpleCode.php
├── Textile2/
│ ├── Plugin.php
│ └── Textile.php
├── TinyMCE/
│ ├── Plugin.php
│ └── tiny_mce/
│ ├── langs/
│ │ └── typecho.js
│ ├── langs.php
│ ├── plugins/
│ │ ├── coder/
│ │ │ └── editor_plugin.js
│ │ ├── inlinepopups/
│ │ │ ├── editor_plugin.js
│ │ │ ├── skins/
│ │ │ │ └── clearlooks2/
│ │ │ │ └── window.css
│ │ │ └── template.htm
│ │ ├── media/
│ │ │ ├── css/
│ │ │ │ ├── content.css
│ │ │ │ └── media.css
│ │ │ ├── editor_plugin.js
│ │ │ ├── img/
│ │ │ │ └── flv_player.swf
│ │ │ ├── js/
│ │ │ │ ├── embed.js
│ │ │ │ └── media.js
│ │ │ ├── langs/
│ │ │ │ └── typecho_dlg.js
│ │ │ └── media.htm
│ │ ├── morebreak/
│ │ │ ├── css/
│ │ │ │ └── content.css
│ │ │ └── editor_plugin.js
│ │ └── safari/
│ │ ├── blank.htm
│ │ └── editor_plugin.js
│ ├── themes/
│ │ └── advanced/
│ │ ├── about.htm
│ │ ├── anchor.htm
│ │ ├── charmap.htm
│ │ ├── color_picker.htm
│ │ ├── editor_template.js
│ │ ├── image.htm
│ │ ├── js/
│ │ │ ├── about.js
│ │ │ ├── anchor.js
│ │ │ ├── charmap.js
│ │ │ ├── color_picker.js
│ │ │ ├── image.js
│ │ │ ├── link.js
│ │ │ └── source_editor.js
│ │ ├── langs/
│ │ │ ├── typecho.js
│ │ │ └── typecho_dlg.js
│ │ ├── link.htm
│ │ ├── skins/
│ │ │ └── typecho/
│ │ │ ├── content.css
│ │ │ ├── dialog.css
│ │ │ └── ui.css
│ │ └── source_editor.htm
│ ├── tiny_mce.js
│ ├── tiny_mce_popup.js
│ └── utils/
│ ├── editable_selects.js
│ ├── form_utils.js
│ ├── mctabs.js
│ └── validate.js
├── WordpressToTypecho/
│ ├── Action.php
│ ├── Plugin.php
│ └── panel.php
└── ZenCoding/
├── Plugin.php
└── zen_textarea.js
SYMBOL INDEX (1078 symbols across 179 files)
FILE: Akismet/Plugin.php
class Akismet_Plugin (line 10) | class Akismet_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 41) | public static function deactivate(){}
method config (line 50) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 70) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method validate (line 79) | public static function validate($key)
method mark (line 112) | public static function mark($comment, $commentWidget, $status)
method filter (line 131) | public static function filter($comment, $post, $result, $api = 'commen...
FILE: AliUpload/Plugin.php
class AliUpload_Plugin (line 33) | class AliUpload_Plugin implements Typecho_Plugin_Interface
method activate (line 45) | public static function activate()
method deactivate (line 64) | public static function deactivate(){}
method config (line 73) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 99) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method uploadHandle (line 109) | public static function uploadHandle($file)
method modifyHandle (line 199) | public static function modifyHandle($content, $file)
method deleteHandle (line 278) | public static function deleteHandle(array $content)
method attachmentHandle (line 299) | public static function attachmentHandle(array $content)
method attachmentDataHandle (line 313) | public static function attachmentDataHandle(array $content)
method checkFileType (line 327) | public static function checkFileType($ext)
method mimeContentType (line 340) | public static function mimeContentType($ext)
FILE: AliUpload/lib/mimetypes.class.php
class MimeTypes (line 7) | class MimeTypes {
method get_mimetype (line 118) | public static function get_mimetype($ext) {
FILE: AliUpload/lib/requestcore.class.php
class RequestCore (line 12) | class RequestCore
method __construct (line 200) | public function __construct($url = null, $proxy = null, $helpers = null)
method __destruct (line 233) | public function __destruct()
method set_credentials (line 259) | public function set_credentials($user, $pass)
method add_header (line 273) | public function add_header($key, $value)
method remove_header (line 285) | public function remove_header($key)
method set_method (line 300) | public function set_method($method)
method set_useragent (line 312) | public function set_useragent($ua)
method set_body (line 324) | public function set_body($body)
method set_request_url (line 336) | public function set_request_url($url)
method set_curlopts (line 349) | public function set_curlopts($curlopts)
method set_read_stream_size (line 361) | public function set_read_stream_size($size)
method set_read_stream (line 377) | public function set_read_stream($resource, $size = null)
method set_read_file (line 405) | public function set_read_file($location)
method set_write_stream (line 419) | public function set_write_stream($resource)
method set_write_file (line 432) | public function set_write_file($location)
method set_proxy (line 446) | public function set_proxy($proxy)
method set_seek_position (line 462) | public function set_seek_position($position)
method register_streaming_read_callback (line 487) | public function register_streaming_read_callback($callback)
method register_streaming_write_callback (line 511) | public function register_streaming_write_callback($callback)
method streaming_read_callback (line 530) | public function streaming_read_callback($curl_handle, $file_handle, $l...
method streaming_write_callback (line 569) | public function streaming_write_callback($curl_handle, $data)
method prep_request (line 602) | public function prep_request()
method process_response (line 762) | public function process_response($curl_handle = null, $response = null)
method send_request (line 816) | public function send_request($parse = false)
method send_multi_request (line 849) | public function send_multi_request($handles, $opt = null)
method get_response_header (line 942) | public function get_response_header($header = null)
method get_response_body (line 956) | public function get_response_body()
method get_response_code (line 966) | public function get_response_code()
class ResponseCore (line 976) | class ResponseCore
method __construct (line 1001) | public function __construct($header, $body, $status = null)
method isOK (line 1016) | public function isOK($codes = array(200, 201, 204, 206))
class RequestCore_Exception (line 1030) | class RequestCore_Exception extends Exception {}
FILE: AliUpload/lib/sdk.class.php
class OSS_Exception (line 33) | class OSS_Exception extends Exception {}
class ALIOSS (line 58) | class ALIOSS{
method __construct (line 255) | public function __construct($access_id = NULL,$access_key = NULL, $hos...
method set_debug_mode (line 299) | public function set_debug_mode($debug_mode = true){
method set_max_retries (line 310) | public function set_max_retries($max_retries = 3){
method get_max_retries (line 320) | public function get_max_retries(){
method set_host_name (line 332) | public function set_host_name($hostname,$port = null){
method set_vhost (line 348) | public function set_vhost($vhost){
method set_enable_domain_style (line 359) | public function set_enable_domain_style($enable_domain_style = true){
method auth (line 374) | public function auth($options){
method list_bucket (line 646) | public function list_bucket($options = NULL) {
method create_bucket (line 675) | public function create_bucket($bucket,$acl = self::OSS_ACL_TYPE_PRIVAT...
method delete_bucket (line 703) | public function delete_bucket($bucket,$options = NULL){
method get_bucket_acl (line 731) | public function get_bucket_acl($bucket ,$options = NULL){
method set_bucket_acl (line 761) | public function set_bucket_acl($bucket ,$acl , $options = NULL){
method list_object (line 802) | public function list_object($bucket,$options = NULL){
method create_object_dir (line 838) | public function create_object_dir($bucket,$object,$options = NULL){
method upload_file_by_content (line 873) | public function upload_file_by_content($bucket,$object,$options = NULL){
method upload_file_by_file (line 926) | public function upload_file_by_file($bucket,$object,$file,$options = N...
method copy_object (line 982) | public function copy_object($from_bucket,$from_object,$to_bucket,$to_o...
method get_object_meta (line 1021) | public function get_object_meta($bucket,$object,$options = NULL){
method delete_object (line 1053) | public function delete_object($bucket,$object,$options = NULL){
method delete_objects (line 1085) | public function delete_objects($bucket,$objects,$options = null){
method get_object (line 1142) | public function get_object($bucket,$object,$options = NULL){
method is_object_exist (line 1191) | public function is_object_exist($bucket,$object,$options = NULL){
method get_multipart_counts (line 1226) | public function get_multipart_counts($filesize, $part_size = 5242880 ){
method initiate_multipart_upload (line 1259) | public function initiate_multipart_upload($bucket,$object,$options = N...
method upload_part (line 1295) | public function upload_part($bucket, $object, $upload_id, $options = n...
method list_parts (line 1333) | public function list_parts($bucket, $object, $upload_id, $options = nu...
method abort_multipart_upload (line 1371) | public function abort_multipart_upload($bucket, $object, $upload_id, $...
method complete_multipart_upload (line 1402) | public function complete_multipart_upload($bucket, $object, $upload_id...
method list_multipart_uploads (line 1459) | public function list_multipart_uploads($bucket, $options = null){
method create_mpu_object (line 1494) | public function create_mpu_object($bucket, $object, $options = null){
method create_mtu_object_by_dir (line 1632) | public function create_mtu_object_by_dir($bucket,$dir,$recursive = fal...
method batch_upload_file (line 1683) | public function batch_upload_file($options = NULL){
method create_object_group (line 1766) | public function create_object_group($bucket,$object_group ,$object_ar...
method get_object_group (line 1797) | public function get_object_group($bucket,$object_group,$options = NULL){
method get_object_group_index (line 1828) | public function get_object_group_index($bucket,$object_group,$options ...
method get_object_group_meta (line 1859) | public function get_object_group_meta($bucket,$object_group,$options =...
method delete_object_group (line 1894) | public function delete_object_group($bucket,$object_group,$options = N...
method get_sign_url (line 1931) | public function get_sign_url($bucket,$object,$timeout = 60,$options = ...
method log (line 1968) | private function log($msg){
method to_query_string (line 2007) | public function to_query_string($options = array()){
method hex_to_base64 (line 2027) | private function hex_to_base64($str){
method s_replace (line 2037) | private function s_replace($subject){
method chk_chinese (line 2050) | private function chk_chinese($str){
method is_gb2312 (line 2061) | function is_gb2312($str) {
method check_char (line 2087) | private function check_char($str,$gbk = true){
method read_dir (line 2114) | private function read_dir($dir,$exclude = ".|..|.svn",$recursive = fa...
method make_object_group_xml (line 2150) | private function make_object_group_xml($bucket,$object_array){
method validate_bucket (line 2191) | private function validate_bucket($bucket){
method validate_object (line 2209) | private function validate_object($object){
method validate_options (line 2225) | private function validate_options($options){
method validate_content (line 2240) | private function validate_content($options){
method validate_content_length (line 2257) | private function validate_content_length($options){
method is_empty (line 2276) | private function is_empty($name,$errMsg){
method set_options_header (line 2291) | private static function set_options_header($key, $value, &$options) {
FILE: Avartar.php
class Avartar (line 12) | class Avartar implements Typecho_Plugin_Interface
method activate (line 22) | public static function activate()
method deactivate (line 36) | public static function deactivate(){}
method config (line 45) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 63) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method gravatar (line 73) | public static function gravatar($size, $rating, $default, $ctx)
FILE: B3logForHacPai/Action.php
class B3logForHacPai_Action (line 3) | class B3logForHacPai_Action extends Typecho_Widget
method __construct (line 13) | public function __construct($request, $response, $params = NULL)
method articleReceiver (line 24) | public function articleReceiver(){
method commentReceiver (line 33) | public function commentReceiver(){
FILE: B3logForHacPai/Plugin.php
class B3logForHacPai_Plugin (line 13) | class B3logForHacPai_Plugin implements Typecho_Plugin_Interface
method activate (line 22) | public static function activate()
method deactivate (line 43) | public static function deactivate(){
method config (line 55) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 90) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method finishPublish (line 98) | public static function finishPublish($contents, $edit)
method finishComment (line 135) | public static function finishComment($comment)
FILE: B3logForHacPai/libs/compat_json.php
class Services_JSON (line 115) | class Services_JSON
method Services_JSON (line 133) | function Services_JSON($use = 0)
method utf162utf8 (line 149) | function utf162utf8($utf16)
method utf82utf16 (line 193) | function utf82utf16($utf8)
method encode (line 237) | function encode($var)
method encodeUnsafe (line 253) | function encodeUnsafe($var)
method _encode (line 268) | function _encode($var)
method name_value (line 491) | function name_value($name, $value)
method reduce_string (line 510) | function reduce_string($str)
method decode (line 541) | function decode($str)
method isError (line 823) | function isError($data, $code = null)
class Services_JSON_Error (line 838) | class Services_JSON_Error extends PEAR_Error
method Services_JSON_Error (line 840) | function Services_JSON_Error($message = 'unknown error', $code = null,
method Services_JSON_Error (line 854) | function Services_JSON_Error($message = 'unknown error', $code = null,
class Services_JSON_Error (line 852) | class Services_JSON_Error
method Services_JSON_Error (line 840) | function Services_JSON_Error($message = 'unknown error', $code = null,
method Services_JSON_Error (line 854) | function Services_JSON_Error($message = 'unknown error', $code = null,
function json_encode (line 870) | function json_encode( $string ) {
function json_decode (line 882) | function json_decode( $string, $assoc_array = false ) {
function _json_decode_object_helper (line 894) | function _json_decode_object_helper($data) {
FILE: BlockComment/Plugin.php
class BlockComment_Plugin (line 10) | class BlockComment_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 34) | public static function deactivate(){}
method config (line 43) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 58) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method mark (line 70) | public static function mark($comment, $commentWidget, $status)
method filter (line 89) | public static function filter($comment, $post, $result, $api = 'commen...
FILE: ConnectToTwitter/OAuth.php
class OAuthException (line 6) | class OAuthException extends Exception {/*{{{*/
class OAuthConsumer (line 10) | class OAuthConsumer {/*{{{*/
method __construct (line 14) | function __construct($key, $secret, $callback_url=NULL) {/*{{{*/
method __toString (line 20) | function __toString() {/*{{{*/
class OAuthToken (line 25) | class OAuthToken {/*{{{*/
method __construct (line 34) | function __construct($key, $secret) {/*{{{*/
method to_string (line 43) | function to_string() {/*{{{*/
method __toString (line 48) | function __toString() {/*{{{*/
class OAuthSignatureMethod (line 53) | class OAuthSignatureMethod {/*{{{*/
method check_signature (line 54) | public function check_signature(&$request, $consumer, $token, $signatu...
class OAuthSignatureMethod_HMAC_SHA1 (line 60) | class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {/*{{{*/
method get_name (line 61) | function get_name() {/*{{{*/
method build_signature (line 65) | public function build_signature($request, $consumer, $token) {/*{{{*/
class OAuthSignatureMethod_PLAINTEXT (line 81) | class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {/*{{{*/
method get_name (line 82) | public function get_name() {/*{{{*/
method build_signature (line 86) | public function build_signature($request, $consumer, $token) {/*{{{*/
class OAuthSignatureMethod_RSA_SHA1 (line 105) | class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod {/*{{{*/
method get_name (line 106) | public function get_name() {/*{{{*/
method fetch_public_cert (line 110) | protected function fetch_public_cert(&$request) {/*{{{*/
method fetch_private_cert (line 120) | protected function fetch_private_cert(&$request) {/*{{{*/
method build_signature (line 128) | public function build_signature(&$request, $consumer, $token) {/*{{{*/
method check_signature (line 147) | public function check_signature(&$request, $consumer, $token, $signatu...
class OAuthRequest (line 168) | class OAuthRequest {/*{{{*/
method __construct (line 176) | function __construct($http_method, $http_url, $parameters=NULL) {/*{{{*/
method from_request (line 187) | public static function from_request($http_method=NULL, $http_url=NULL,...
method from_consumer_and_token (line 222) | public static function from_consumer_and_token($consumer, $token, $htt...
method set_parameter (line 236) | public function set_parameter($name, $value) {/*{{{*/
method get_parameter (line 240) | public function get_parameter($name) {/*{{{*/
method get_parameters (line 244) | public function get_parameters() {/*{{{*/
method get_signable_parameters (line 260) | public function get_signable_parameters() {/*{{{*/
method get_signature_base_string (line 303) | public function get_signature_base_string() {/*{{{*/
method get_normalized_http_method (line 318) | public function get_normalized_http_method() {/*{{{*/
method get_normalized_http_url (line 326) | public function get_normalized_http_url() {/*{{{*/
method to_url (line 346) | public function to_url() {/*{{{*/
method to_postdata (line 359) | public function to_postdata() {/*{{{*/
method to_header (line 377) | public function to_header() {/*{{{*/
method __toString (line 388) | public function __toString() {/*{{{*/
method sign_request (line 393) | public function sign_request($signature_method, $consumer, $token) {/*...
method build_signature (line 399) | public function build_signature($signature_method, $consumer, $token) ...
method generate_timestamp (line 407) | private static function generate_timestamp() {/*{{{*/
method generate_nonce (line 414) | private static function generate_nonce() {/*{{{*/
method split_header (line 425) | private static function split_header($header) {/*{{{*/
method get_headers (line 447) | private static function get_headers() {/*{{{*/
class OAuthServer (line 469) | class OAuthServer {/*{{{*/
method __construct (line 476) | function __construct($data_store) {/*{{{*/
method add_signature_method (line 480) | public function add_signature_method($signature_method) {/*{{{*/
method fetch_request_token (line 491) | public function fetch_request_token(&$request) {/*{{{*/
method fetch_access_token (line 510) | public function fetch_access_token(&$request) {/*{{{*/
method verify_request (line 529) | public function verify_request(&$request) {/*{{{*/
method get_version (line 541) | private function get_version(&$request) {/*{{{*/
method get_signature_method (line 555) | private function get_signature_method(&$request) {/*{{{*/
method get_consumer (line 573) | private function get_consumer(&$request) {/*{{{*/
method get_token (line 590) | private function get_token(&$request, $consumer, $token_type="access")...
method check_signature (line 605) | private function check_signature(&$request, $consumer, $token) {/*{{{*/
method check_timestamp (line 631) | private function check_timestamp($timestamp) {/*{{{*/
method check_nonce (line 642) | private function check_nonce($consumer, $token, $nonce, $timestamp) {/...
class OAuthDataStore (line 654) | class OAuthDataStore {/*{{{*/
method lookup_consumer (line 655) | function lookup_consumer($consumer_key) {/*{{{*/
method lookup_token (line 659) | function lookup_token($consumer, $token_type, $token) {/*{{{*/
method lookup_nonce (line 663) | function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
method new_request_token (line 667) | function new_request_token($consumer) {/*{{{*/
method new_access_token (line 671) | function new_access_token($token, $consumer) {/*{{{*/
class SimpleOAuthDataStore (line 683) | class SimpleOAuthDataStore extends OAuthDataStore {/*{{{*/
method __construct (line 686) | function __construct($path = "oauth.gdbm") {/*{{{*/
method __destruct (line 690) | function __destruct() {/*{{{*/
method lookup_consumer (line 694) | function lookup_consumer($consumer_key) {/*{{{*/
method lookup_token (line 706) | function lookup_token($consumer, $token_type, $token) {/*{{{*/
method lookup_nonce (line 718) | function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
method new_token (line 727) | function new_token($consumer, $type="request") {/*{{{*/
method new_request_token (line 737) | function new_request_token($consumer) {/*{{{*/
method new_access_token (line 741) | function new_access_token($token, $consumer) {/*{{{*/
class OAuthUtil (line 749) | class OAuthUtil {/*{{{*/
method urlencode_rfc3986 (line 750) | public static function urlencode_rfc3986($input) {/*{{{*/
method urldecode_rfc3986 (line 765) | public static function urldecode_rfc3986($string) {/*{{{*/
FILE: ConnectToTwitter/Plugin.php
class ConnectToTwitter_Plugin (line 14) | class ConnectToTwitter_Plugin implements Typecho_Plugin_Interface
method activate (line 23) | public static function activate() {
method deactivate (line 36) | public static function deactivate() {
method config (line 47) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 65) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method initComment (line 67) | public static function initComment($api)
method twitterLogin (line 108) | public static function twitterLogin($info, $api)
method postToTwitter (line 120) | public static function postToTwitter($api)
method showButton (line 136) | function showButton()
FILE: ConnectToTwitter/twitterOAuth.php
class TwitterOAuth (line 19) | class TwitterOAuth {/*{{{*/
method requestTokenURL (line 32) | function requestTokenURL() { return self::$TO_API_ROOT.'/oauth/request...
method authorizeURL (line 33) | function authorizeURL() { return self::$TO_API_ROOT.'/oauth/authorize'; }
method accessTokenURL (line 34) | function accessTokenURL() { return self::$TO_API_ROOT.'/oauth/access_t...
method lastStatusCode (line 39) | function lastStatusCode() { return $this->http_status; }
method lastAPICall (line 40) | function lastAPICall() { return $this->last_api_call; }
method __construct (line 45) | function __construct($consumer_key, $consumer_secret, $oauth_token = N...
method getRequestToken (line 61) | function getRequestToken() {/*{{{*/
method oAuthParseResponse (line 73) | function oAuthParseResponse($responseString) {
method getAuthorizeURL (line 88) | function getAuthorizeURL($token) {/*{{{*/
method getAccessToken (line 100) | function getAccessToken($token = NULL) {/*{{{*/
method oAuthRequest (line 110) | function oAuthRequest($url, $args = array(), $method = NULL) {/*{{{*/
method http (line 125) | function http($url, $post_data = null) {/*{{{*/
FILE: Creole/Creole_Wiki.php
class Creole_Wiki (line 39) | class Creole_Wiki {
method __construct (line 357) | function __construct($rules = null)
method setParseConf (line 487) | public function setParseConf($rule, $arg1, $arg2 = null)
method getParseConf (line 521) | public function getParseConf($rule, $key = null)
method setRenderConf (line 565) | function setRenderConf($format, $rule, $arg1, $arg2 = null)
method getRenderConf (line 607) | function getRenderConf($format, $rule, $key = null)
method setFormatConf (line 649) | function setFormatConf($format, $arg1, $arg2 = null)
method getFormatConf (line 683) | function getFormatConf($format, $key = null)
method insertRule (line 723) | function insertRule($name, $tgt = null)
method deleteRule (line 789) | function deleteRule($name)
method changeRule (line 813) | function changeRule($old, $new)
method enableRule (line 838) | function enableRule($name)
method disableRule (line 860) | function disableRule($name)
method transform (line 898) | function transform($text, $format = 'Xhtml')
method parse (line 919) | function parse($text)
method render (line 961) | function render($format = 'Xhtml')
FILE: Creole/Parse.inc.php
class Text_Wiki_Parse (line 40) | class Text_Wiki_Parse {
method Text_Wiki_Parse (line 109) | function Text_Wiki_Parse(&$obj)
method parse (line 149) | function parse()
method process (line 177) | function process(&$matches)
method getConf (line 199) | function getConf($key, $default = null)
method getAttrs (line 231) | function getAttrs($text)
FILE: Creole/Parse/Address.php
class Text_Wiki_Parse_Address (line 22) | class Text_Wiki_Parse_Address extends Text_Wiki_Parse {
method process (line 54) | function process(&$matches)
FILE: Creole/Parse/Blockquote.php
class Text_Wiki_Parse_Blockquote (line 25) | class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
method process (line 65) | function process(&$matches)
FILE: Creole/Parse/Box.php
class Text_Wiki_Parse_Box (line 39) | class Text_Wiki_Parse_Box extends Text_Wiki_Parse {
method process (line 74) | function process(&$matches)
FILE: Creole/Parse/Break.php
class Text_Wiki_Parse_Break (line 34) | class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
method process (line 67) | function process(&$matches)
FILE: Creole/Parse/Center.php
class Text_Wiki_Parse_Center (line 25) | class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
method process (line 59) | function process(&$matches)
FILE: Creole/Parse/Delete.php
class Text_Wiki_Parse_Delete (line 21) | class Text_Wiki_Parse_Delete extends Text_Wiki_Parse {
method process (line 57) | function process(&$matches)
FILE: Creole/Parse/Delimiter.php
class Text_Wiki_Parse_Delimiter (line 24) | class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
method Text_Wiki_Parse_Delimiter (line 38) | function Text_Wiki_Parse_Delimiter(&$obj)
method process (line 60) | function process(&$matches)
FILE: Creole/Parse/Emphasis.php
class Text_Wiki_Parse_Emphasis (line 21) | class Text_Wiki_Parse_Emphasis extends Text_Wiki_Parse {
method process (line 57) | function process(&$matches)
FILE: Creole/Parse/Footnote.php
class Text_Wiki_Parse_Footnote (line 26) | class Text_Wiki_Parse_Footnote extends Text_Wiki_Parse {
method process (line 61) | function process(&$matches)
FILE: Creole/Parse/Heading.php
class Text_Wiki_Parse_Heading (line 27) | class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
method process (line 65) | function process(&$matches)
FILE: Creole/Parse/Horiz.php
class Text_Wiki_Parse_Horiz (line 22) | class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
method process (line 53) | function process(&$matches)
FILE: Creole/Parse/Image.php
class Text_Wiki_Parse_Image (line 20) | class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
method process (line 50) | function process(&$matches)
FILE: Creole/Parse/List.php
class Text_Wiki_Parse_List (line 29) | class Text_Wiki_Parse_List extends Text_Wiki_Parse {
method process (line 75) | function process(&$matches)
FILE: Creole/Parse/Newline.php
class Text_Wiki_Parse_Newline (line 21) | class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
method process (line 54) | function process(&$matches)
FILE: Creole/Parse/Paragraph.php
class Text_Wiki_Parse_Paragraph (line 23) | class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
method process (line 74) | function process(&$matches)
FILE: Creole/Parse/Prefilter.php
class Text_Wiki_Parse_Prefilter (line 23) | class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
method parse (line 34) | function parse()
FILE: Creole/Parse/Preformatted.php
class Text_Wiki_Parse_Preformatted (line 19) | class Text_Wiki_Parse_Preformatted extends Text_Wiki_Parse {
method process (line 52) | function process(&$matches)
FILE: Creole/Parse/Raw.php
class Text_Wiki_Parse_Raw (line 19) | class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
method process (line 53) | function process(&$matches)
FILE: Creole/Parse/Strong.php
class Text_Wiki_Parse_Strong (line 26) | class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
method process (line 62) | function process(&$matches)
FILE: Creole/Parse/Subscript.php
class Text_Wiki_Parse_Subscript (line 21) | class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse {
method process (line 56) | function process(&$matches)
FILE: Creole/Parse/Superscript.php
class Text_Wiki_Parse_Superscript (line 21) | class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
method process (line 56) | function process(&$matches)
FILE: Creole/Parse/Table.php
class Text_Wiki_Parse_Table (line 27) | class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
method process (line 77) | function process(&$matches)
FILE: Creole/Parse/Tighten.php
class Text_Wiki_Parse_Tighten (line 20) | class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
method parse (line 31) | function parse()
FILE: Creole/Parse/Trim.php
class Text_Wiki_Parse_Trim (line 17) | class Text_Wiki_Parse_Trim extends Text_Wiki_Parse {
method parse (line 28) | function parse()
FILE: Creole/Parse/Tt.php
class Text_Wiki_Parse_Tt (line 19) | class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
method process (line 53) | function process(&$matches)
FILE: Creole/Parse/Underline.php
class Text_Wiki_Parse_Underline (line 21) | class Text_Wiki_Parse_Underline extends Text_Wiki_Parse {
method process (line 57) | function process(&$matches)
FILE: Creole/Parse/Url.php
class Text_Wiki_Parse_Url (line 27) | class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
method Text_Wiki_Parse_Url (line 41) | function Text_Wiki_Parse_Url(&$obj)
method process (line 67) | function process(&$matches)
FILE: Creole/Plugin.php
class Creole_Plugin (line 13) | class Creole_Plugin implements Typecho_Plugin_Interface
method activate (line 22) | public static function activate() {
method deactivate (line 35) | public static function deactivate() {
method config (line 46) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 58) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method parse (line 67) | public static function parse($text, $widget, $lastResult) {
FILE: Creole/Render.inc.php
class Text_Wiki_Render (line 26) | class Text_Wiki_Render {
method Text_Wiki_Render (line 93) | function Text_Wiki_Render(&$obj)
method getConf (line 155) | function getConf($key, $default = null)
method formatConf (line 180) | function formatConf($format, $key)
method urlEncode (line 199) | function urlEncode($urlChunk)
method textEncode (line 213) | function textEncode($text)
FILE: Creole/Render/Plain.php
class Text_Wiki_Render_Plain (line 3) | class Text_Wiki_Render_Plain extends Text_Wiki_Render {
method pre (line 5) | function pre()
method post (line 10) | function post()
FILE: Creole/Render/Plain/Anchor.php
class Text_Wiki_Render_Plain_Anchor (line 15) | class Text_Wiki_Render_Plain_Anchor extends Text_Wiki_Render {
method token (line 17) | function token($options)
FILE: Creole/Render/Plain/Blockquote.php
class Text_Wiki_Render_Plain_Blockquote (line 3) | class Text_Wiki_Render_Plain_Blockquote extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Bold.php
class Text_Wiki_Render_Plain_Bold (line 3) | class Text_Wiki_Render_Plain_Bold extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Box.php
class Text_Wiki_Render_Plain_Box (line 28) | class Text_Wiki_Render_Plain_Box extends Text_Wiki_Render {
method token (line 43) | function token($options)
FILE: Creole/Render/Plain/Break.php
class Text_Wiki_Render_Plain_Break (line 3) | class Text_Wiki_Render_Plain_Break extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Center.php
class Text_Wiki_Render_Plain_Center (line 3) | class Text_Wiki_Render_Plain_Center extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Code.php
class Text_Wiki_Render_Plain_Code (line 3) | class Text_Wiki_Render_Plain_Code extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Plain/Colortext.php
class Text_Wiki_Render_Plain_Colortext (line 3) | class Text_Wiki_Render_Plain_Colortext extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Deflist.php
class Text_Wiki_Render_Plain_Deflist (line 3) | class Text_Wiki_Render_Plain_Deflist extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Delete.php
class Text_Wiki_Render_Plain_Delete (line 3) | class Text_Wiki_Render_Plain_Delete extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Delimiter.php
class Text_Wiki_Render_Plain_Delimiter (line 3) | class Text_Wiki_Render_Plain_Delimiter extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Embed.php
class Text_Wiki_Render_Plain_Embed (line 3) | class Text_Wiki_Render_Plain_Embed extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Emphasis.php
class Text_Wiki_Render_Plain_Emphasis (line 3) | class Text_Wiki_Render_Plain_Emphasis extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Font.php
class Text_Wiki_Render_Plain_Font (line 29) | class Text_Wiki_Render_Plain_Font extends Text_Wiki_Render {
method token (line 39) | function token($options)
FILE: Creole/Render/Plain/Freelink.php
class Text_Wiki_Render_Plain_Freelink (line 3) | class Text_Wiki_Render_Plain_Freelink extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Function.php
class Text_Wiki_Render_Plain_Function (line 5) | class Text_Wiki_Render_Plain_Function extends Text_Wiki_Render {
method token (line 20) | function token($options)
FILE: Creole/Render/Plain/Heading.php
class Text_Wiki_Render_Plain_Heading (line 3) | class Text_Wiki_Render_Plain_Heading extends Text_Wiki_Render {
method token (line 5) | function token($options)
FILE: Creole/Render/Plain/Horiz.php
class Text_Wiki_Render_Plain_Horiz (line 3) | class Text_Wiki_Render_Plain_Horiz extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Html.php
class Text_Wiki_Render_Plain_Html (line 3) | class Text_Wiki_Render_Plain_Html extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Plain/Image.php
class Text_Wiki_Render_Plain_Image (line 2) | class Text_Wiki_Render_Plain_Image extends Text_Wiki_Render {
method token (line 17) | function token($options)
FILE: Creole/Render/Plain/Include.php
class Text_Wiki_Render_Plain_Include (line 2) | class Text_Wiki_Render_Plain_Include extends Text_Wiki_Render {
method token (line 3) | function token()
FILE: Creole/Render/Plain/Interwiki.php
class Text_Wiki_Render_Plain_Interwiki (line 3) | class Text_Wiki_Render_Plain_Interwiki extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Italic.php
class Text_Wiki_Render_Plain_Italic (line 3) | class Text_Wiki_Render_Plain_Italic extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/List.php
class Text_Wiki_Render_Plain_List (line 4) | class Text_Wiki_Render_Plain_List extends Text_Wiki_Render {
method token (line 22) | function token($options)
FILE: Creole/Render/Plain/Newline.php
class Text_Wiki_Render_Plain_Newline (line 3) | class Text_Wiki_Render_Plain_Newline extends Text_Wiki_Render {
method token (line 6) | function token($options)
FILE: Creole/Render/Plain/Page.php
class Text_Wiki_Render_Plain_Page (line 28) | class Text_Wiki_Render_Plain_Page extends Text_Wiki_Render {
method token (line 43) | function token($options)
FILE: Creole/Render/Plain/Paragraph.php
class Text_Wiki_Render_Plain_Paragraph (line 3) | class Text_Wiki_Render_Plain_Paragraph extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Phplookup.php
class Text_Wiki_Render_Plain_Phplookup (line 3) | class Text_Wiki_Render_Plain_Phplookup extends Text_Wiki_Render {
method token (line 20) | function token($options)
FILE: Creole/Render/Plain/Plugin.php
class Text_Wiki_Render_Plain_Plugin (line 28) | class Text_Wiki_Render_Plain_Plugin extends Text_Wiki_Render {
method token (line 44) | function token($options)
FILE: Creole/Render/Plain/Prefilter.php
class Text_Wiki_Render_Plain_Prefilter (line 34) | class Text_Wiki_Render_Plain_Prefilter extends Text_Wiki_Render {
method token (line 35) | function token()
FILE: Creole/Render/Plain/Preformatted.php
class Text_Wiki_Render_Plain_Preformatted (line 28) | class Text_Wiki_Render_Plain_Preformatted extends Text_Wiki_Render {
method token (line 43) | function token($options)
FILE: Creole/Render/Plain/Raw.php
class Text_Wiki_Render_Plain_Raw (line 3) | class Text_Wiki_Render_Plain_Raw extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Revise.php
class Text_Wiki_Render_Plain_Revise (line 3) | class Text_Wiki_Render_Plain_Revise extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Plain/Smiley.php
class Text_Wiki_Render_Plain_Smiley (line 29) | class Text_Wiki_Render_Plain_Smiley extends Text_Wiki_Render {
method token (line 39) | function token($options)
FILE: Creole/Render/Plain/Specialchar.php
class Text_Wiki_Render_Plain_SpecialChar (line 28) | class Text_Wiki_Render_Plain_SpecialChar extends Text_Wiki_Render {
method token (line 44) | function token($options)
FILE: Creole/Render/Plain/Strong.php
class Text_Wiki_Render_Plain_Strong (line 3) | class Text_Wiki_Render_Plain_Strong extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Plain/Subscript.php
class Text_Wiki_Render_Plain_Subscript (line 28) | class Text_Wiki_Render_Plain_Subscript extends Text_Wiki_Render {
method token (line 43) | function token($options)
FILE: Creole/Render/Plain/Superscript.php
class Text_Wiki_Render_Plain_Superscript (line 3) | class Text_Wiki_Render_Plain_Superscript extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Table.php
class Text_Wiki_Render_Plain_Table (line 3) | class Text_Wiki_Render_Plain_Table extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Tighten.php
class Text_Wiki_Render_Plain_Tighten (line 2) | class Text_Wiki_Render_Plain_Tighten extends Text_Wiki_Render {
method token (line 5) | function token()
FILE: Creole/Render/Plain/Titlebar.php
class Text_Wiki_Render_Plain_Titlebar (line 28) | class Text_Wiki_Render_Plain_Titlebar extends Text_Wiki_Render {
method token (line 43) | function token($options)
FILE: Creole/Render/Plain/Toc.php
class Text_Wiki_Render_Plain_Toc (line 3) | class Text_Wiki_Render_Plain_Toc extends Text_Wiki_Render {
method token (line 20) | function token($options)
FILE: Creole/Render/Plain/Tt.php
class Text_Wiki_Render_Plain_tt (line 3) | class Text_Wiki_Render_Plain_tt extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Plain/Underline.php
class Text_Wiki_Render_Plain_Underline (line 3) | class Text_Wiki_Render_Plain_Underline extends Text_Wiki_Render {
method token (line 18) | function token($options)
FILE: Creole/Render/Plain/Url.php
class Text_Wiki_Render_Plain_Url (line 4) | class Text_Wiki_Render_Plain_Url extends Text_Wiki_Render {
method token (line 20) | function token($options)
FILE: Creole/Render/Plain/Wikilink.php
class Text_Wiki_Render_Plain_Wikilink (line 3) | class Text_Wiki_Render_Plain_Wikilink extends Text_Wiki_Render {
method token (line 19) | function token($options)
FILE: Creole/Render/Xhtml.php
class Text_Wiki_Render_Xhtml (line 26) | class Text_Wiki_Render_Xhtml extends Text_Wiki_Render {
method pre (line 35) | function pre()
method post (line 40) | function post()
method textEncode (line 55) | function textEncode($text)
FILE: Creole/Render/Xhtml/Address.php
class Text_Wiki_Render_Xhtml_Address (line 23) | class Text_Wiki_Render_Xhtml_Address extends Text_Wiki_Render {
method token (line 42) | function token($options)
FILE: Creole/Render/Xhtml/Anchor.php
class Text_Wiki_Render_Xhtml_Anchor (line 26) | class Text_Wiki_Render_Xhtml_Anchor extends Text_Wiki_Render {
method token (line 32) | function token($options)
FILE: Creole/Render/Xhtml/Blockquote.php
class Text_Wiki_Render_Xhtml_Blockquote (line 26) | class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Bold.php
class Text_Wiki_Render_Xhtml_Bold (line 26) | class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Box.php
class Text_Wiki_Render_Xhtml_Box (line 26) | class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Break.php
class Text_Wiki_Render_Xhtml_Break (line 26) | class Text_Wiki_Render_Xhtml_Break extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Center.php
class Text_Wiki_Render_Xhtml_Center (line 26) | class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Code.php
class Text_Wiki_Render_Xhtml_Code (line 26) | class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
method token (line 49) | function token($options)
FILE: Creole/Render/Xhtml/Colortext.php
class Text_Wiki_Render_Xhtml_Colortext (line 26) | class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
method token (line 61) | function token($options)
FILE: Creole/Render/Xhtml/Deflist.php
class Text_Wiki_Render_Xhtml_Deflist (line 26) | class Text_Wiki_Render_Xhtml_Deflist extends Text_Wiki_Render {
method token (line 47) | function token($options)
FILE: Creole/Render/Xhtml/Delete.php
class Text_Wiki_Render_Xhtml_Delete (line 26) | class Text_Wiki_Render_Xhtml_Delete extends Text_Wiki_Render {
method token (line 44) | function token($options)
FILE: Creole/Render/Xhtml/Delimiter.php
class Text_Wiki_Render_Xhtml_Delimiter (line 26) | class Text_Wiki_Render_Xhtml_Delimiter extends Text_Wiki_Render {
method token (line 41) | function token($options)
FILE: Creole/Render/Xhtml/Embed.php
class Text_Wiki_Render_Xhtml_Embed (line 26) | class Text_Wiki_Render_Xhtml_Embed extends Text_Wiki_Render {
method token (line 41) | function token($options)
FILE: Creole/Render/Xhtml/Emphasis.php
class Text_Wiki_Render_Xhtml_Emphasis (line 26) | class Text_Wiki_Render_Xhtml_Emphasis extends Text_Wiki_Render {
method token (line 46) | function token($options)
FILE: Creole/Render/Xhtml/Font.php
class Text_Wiki_Render_Xhtml_Font (line 29) | class Text_Wiki_Render_Xhtml_Font extends Text_Wiki_Render {
method token (line 62) | function token($options)
FILE: Creole/Render/Xhtml/Freelink.php
class Text_Wiki_Render_Xhtml_Freelink (line 31) | class Text_Wiki_Render_Xhtml_Freelink extends Text_Wiki_Render_Xhtml_Wik...
FILE: Creole/Render/Xhtml/Function.php
class Text_Wiki_Render_Xhtml_Function (line 26) | class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
method token (line 58) | function token($options)
FILE: Creole/Render/Xhtml/Heading.php
class Text_Wiki_Render_Xhtml_Heading (line 26) | class Text_Wiki_Render_Xhtml_Heading extends Text_Wiki_Render {
method token (line 37) | function token($options)
FILE: Creole/Render/Xhtml/Horiz.php
class Text_Wiki_Render_Xhtml_Horiz (line 26) | class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Html.php
class Text_Wiki_Render_Xhtml_Html (line 26) | class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render {
method token (line 42) | function token($options)
FILE: Creole/Render/Xhtml/Image.php
class Text_Wiki_Render_Xhtml_Image (line 26) | class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
method token (line 48) | function token($options)
FILE: Creole/Render/Xhtml/Include.php
class Text_Wiki_Render_Xhtml_Include (line 26) | class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render {
method token (line 27) | function token()
FILE: Creole/Render/Xhtml/Interwiki.php
class Text_Wiki_Render_Xhtml_Interwiki (line 26) | class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
method token (line 52) | function token($options)
FILE: Creole/Render/Xhtml/Italic.php
class Text_Wiki_Render_Xhtml_Italic (line 26) | class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/List.php
class Text_Wiki_Render_Xhtml_List (line 26) | class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
method token (line 51) | function token($options)
FILE: Creole/Render/Xhtml/Newline.php
class Text_Wiki_Render_Xhtml_Newline (line 26) | class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render {
method token (line 29) | function token($options)
FILE: Creole/Render/Xhtml/Page.php
class Text_Wiki_Render_Xhtml_Page (line 26) | class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render {
method token (line 41) | function token($options)
FILE: Creole/Render/Xhtml/Paragraph.php
class Text_Wiki_Render_Xhtml_Paragraph (line 26) | class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Phplookup.php
class Text_Wiki_Render_Xhtml_Phplookup (line 26) | class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
method token (line 47) | function token($options)
FILE: Creole/Render/Xhtml/Plugin.php
class Text_Wiki_Render_Xhtml_Plugin (line 26) | class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render {
method token (line 42) | function token($options)
FILE: Creole/Render/Xhtml/Prefilter.php
class Text_Wiki_Render_Xhtml_Prefilter (line 28) | class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render {
method token (line 29) | function token()
FILE: Creole/Render/Xhtml/Preformatted.php
class Text_Wiki_Render_Xhtml_Preformatted (line 26) | class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render {
method token (line 41) | function token($options)
FILE: Creole/Render/Xhtml/Raw.php
class Text_Wiki_Render_Xhtml_Raw (line 26) | class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render {
method token (line 41) | function token($options)
FILE: Creole/Render/Xhtml/Revise.php
class Text_Wiki_Render_Xhtml_Revise (line 26) | class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
method token (line 47) | function token($options)
FILE: Creole/Render/Xhtml/Smiley.php
class Text_Wiki_Render_Xhtml_Smiley (line 29) | class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
method token (line 59) | function token($options)
FILE: Creole/Render/Xhtml/Specialchar.php
class Text_Wiki_Render_Xhtml_SpecialChar (line 26) | class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render {
method token (line 42) | function token($options)
FILE: Creole/Render/Xhtml/Strong.php
class Text_Wiki_Render_Xhtml_Strong (line 26) | class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
method token (line 46) | function token($options)
FILE: Creole/Render/Xhtml/Subscript.php
class Text_Wiki_Render_Xhtml_Subscript (line 26) | class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Superscript.php
class Text_Wiki_Render_Xhtml_Superscript (line 26) | class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Table.php
class Text_Wiki_Render_Xhtml_Table (line 26) | class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
method token (line 50) | function token($options)
FILE: Creole/Render/Xhtml/Tighten.php
class Text_Wiki_Render_Xhtml_Tighten (line 26) | class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render {
method token (line 29) | function token()
FILE: Creole/Render/Xhtml/Titlebar.php
class Text_Wiki_Render_Xhtml_Titlebar (line 26) | class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render {
method token (line 45) | function token($options)
FILE: Creole/Render/Xhtml/Toc.php
class Text_Wiki_Render_Xhtml_Toc (line 26) | class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
method token (line 51) | function token($options)
FILE: Creole/Render/Xhtml/Tt.php
class Text_Wiki_Render_Xhtml_Tt (line 26) | class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render {
method token (line 46) | function token($options)
FILE: Creole/Render/Xhtml/Underline.php
class Text_Wiki_Render_Xhtml_Underline (line 26) | class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render {
method token (line 44) | function token($options)
FILE: Creole/Render/Xhtml/Url.php
class Text_Wiki_Render_Xhtml_Url (line 26) | class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
method token (line 50) | function token($options)
FILE: Creole/Render/Xhtml/Wikilink.php
class Text_Wiki_Render_Xhtml_Wikilink (line 26) | class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
method token (line 53) | function token($options)
FILE: FlashMp3Player/Plugin.php
class FlashMp3Player_Plugin (line 11) | class FlashMp3Player_Plugin implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 38) | public static function deactivate(){}
method config (line 47) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 56) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method toVisualEditor (line 65) | public static function toVisualEditor($content)
method toCodeEditor (line 82) | public static function toCodeEditor($content)
method parse (line 94) | public static function parse($text, $widget, $lastResult)
FILE: GitHubGit/Action.php
class GitHubGit_Action (line 5) | class GitHubGit_Action extends Widget_Abstract_Contents implements Widge...
method action (line 8) | public function action()
FILE: GitHubGit/Plugin.php
class GitHubGit_Plugin (line 11) | class GitHubGit_Plugin implements Typecho_Plugin_Interface
method activate (line 24) | public static function activate()
method deactivate (line 42) | public static function deactivate()
method config (line 54) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 63) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
FILE: GitHubGit/Spyc.php
function spyc_load (line 19) | function spyc_load ($string) {
function spyc_load_file (line 30) | function spyc_load_file ($file) {
function spyc_dump (line 41) | function spyc_dump ($data) {
class Spyc (line 68) | class Spyc {
method load (line 121) | public function load ($input) {
method loadFile (line 130) | public function loadFile ($file) {
method YAMLLoad (line 149) | public static function YAMLLoad($input) {
method YAMLLoadString (line 173) | public static function YAMLLoadString($input) {
method YAMLDump (line 199) | public static function YAMLDump($array, $indent = false, $wordwrap = f...
method dump (line 225) | public function dump($array,$indent = false,$wordwrap = false, $no_ope...
method _yamlize (line 267) | private function _yamlize($key,$value,$indent, $previous_key = -1, $fi...
method _yamlizeArray (line 292) | private function _yamlizeArray($array,$indent) {
method _dumpNode (line 315) | private function _dumpNode($key, $value, $indent, $previous_key = -1, ...
method _doLiteralBlock (line 364) | private function _doLiteralBlock($value,$indent) {
method _doFolding (line 388) | private function _doFolding($value,$indent) {
method isTrueWord (line 407) | private function isTrueWord($value) {
method isFalseWord (line 412) | private function isFalseWord($value) {
method isNullWord (line 417) | private function isNullWord($value) {
method isTranslationWord (line 422) | private function isTranslationWord($value) {
method coerceValue (line 437) | private function coerceValue(&$value) {
method getTranslations (line 453) | private static function getTranslations(array $words) {
method __load (line 463) | private function __load($input) {
method __loadString (line 468) | private function __loadString($input) {
method loadWithSource (line 473) | private function loadWithSource($Source) {
method loadFromSource (line 532) | private function loadFromSource ($input) {
method loadFromString (line 539) | private function loadFromString ($input) {
method _parseLine (line 553) | private function _parseLine($line) {
method _toType (line 589) | private function _toType($value) {
method _inlineEscape (line 679) | private function _inlineEscape($inline) {
method literalBlockContinues (line 807) | private function literalBlockContinues ($line, $lineIndent) {
method referenceContentsByAlias (line 813) | private function referenceContentsByAlias ($alias) {
method addArrayInline (line 825) | private function addArrayInline ($array, $indent) {
method addArray (line 836) | private function addArray ($incoming_data, $incoming_indent) {
method startsLiteralBlock (line 911) | private static function startsLiteralBlock ($line) {
method greedilyNeedNextLine (line 920) | private static function greedilyNeedNextLine($line) {
method addLiteralLine (line 929) | private function addLiteralLine ($literalBlock, $line, $literalBlockSt...
method revertLiteralPlaceHolder (line 948) | function revertLiteralPlaceHolder ($lineArray, $literalBlock) {
method stripIndent (line 958) | private static function stripIndent ($line, $indent = -1) {
method getParentPathByIndent (line 963) | private function getParentPathByIndent ($indent) {
method clearBiggerPathValues (line 974) | private function clearBiggerPathValues ($indent) {
method isComment (line 988) | private static function isComment ($line) {
method isEmpty (line 995) | private static function isEmpty ($line) {
method isArrayElement (line 1000) | private function isArrayElement ($line) {
method isHashElement (line 1009) | private function isHashElement ($line) {
method isLiteral (line 1013) | private function isLiteral ($line) {
method unquote (line 1020) | private static function unquote ($value) {
method startsMappedSequence (line 1028) | private function startsMappedSequence ($line) {
method returnMappedSequence (line 1032) | private function returnMappedSequence ($line) {
method checkKeysInValue (line 1040) | private function checkKeysInValue($value) {
method returnMappedValue (line 1048) | private function returnMappedValue ($line) {
method startsMappedValue (line 1056) | private function startsMappedValue ($line) {
method isPlainArray (line 1060) | private function isPlainArray ($line) {
method returnPlainArray (line 1064) | private function returnPlainArray ($line) {
method returnKeyValuePair (line 1068) | private function returnKeyValuePair ($line) {
method returnArrayElement (line 1096) | private function returnArrayElement ($line) {
method nodeContainsGroup (line 1109) | private function nodeContainsGroup ($line) {
method addGroup (line 1121) | private function addGroup ($line, $group) {
method stripGroup (line 1127) | private function stripGroup ($line, $group) {
FILE: GoogleAnalytics/Plugin.php
class GoogleAnalytics_Plugin (line 10) | class GoogleAnalytics_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 32) | public static function deactivate(){}
method config (line 41) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 55) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method render (line 63) | public static function render()
FILE: GoogleCodePrettify/Plugin.php
class GoogleCodePrettify_Plugin (line 11) | class GoogleCodePrettify_Plugin implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 37) | public static function deactivate(){}
method config (line 46) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 55) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method header (line 64) | public static function header() {
method footer (line 76) | public static function footer() {
method parseCallback (line 91) | public static function parseCallback($matches)
method parse (line 127) | public static function parse($text, $widget, $lastResult)
FILE: GoogleCodePrettify/src/prettify.js
function attribToHtml (line 230) | function attribToHtml(str) {
function textToHtml (line 238) | function textToHtml(str) {
function htmlToText (line 252) | function htmlToText(html) {
function isRawContent (line 284) | function isRawContent(node) {
function isPreformatted (line 292) | function isPreformatted(node, content) {
function normalizedHtml (line 309) | function normalizedHtml(node, out) {
function combinePrefixPatterns (line 345) | function combinePrefixPatterns(regexs) {
function getInnerHtml (line 567) | function getInnerHtml(node) {
function makeTabExpander (line 604) | function makeTabExpander(tabWidth) {
function extractTags (line 666) | function extractTags(s) {
function isNoCodeTag (line 729) | function isNoCodeTag(tag) {
function appendDecorations (line 744) | function appendDecorations(basePos, sourceCode, langHandler, out) {
function createSimpleLexer (line 800) | function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatter...
function sourceDecorator (line 944) | function sourceDecorator(options) {
function recombineTagsAndDecorations (line 1059) | function recombineTagsAndDecorations(job) {
function registerLangHandler (line 1175) | function registerLangHandler(handler, fileExtensions) {
function langHandlerForExtension (line 1185) | function langHandlerForExtension(extension, source) {
function applyDecorator (line 1285) | function applyDecorator(job) {
function prettyPrintOne (line 1319) | function prettyPrintOne(sourceCodeHtml, opt_langExtension) {
function prettyPrint (line 1328) | function prettyPrint(opt_whenDone) {
FILE: GoogleCodeSVN/Action.php
class GoogleCodeSVN_Action (line 3) | class GoogleCodeSVN_Action extends Widget_Abstract_Contents implements W...
method parseFileName (line 5) | private function parseFileName($fileName, $repositoryPath)
method action (line 87) | public function action()
FILE: GoogleCodeSVN/Plugin.php
class GoogleCodeSVN_Plugin (line 11) | class GoogleCodeSVN_Plugin implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 38) | public static function deactivate()
method config (line 50) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 68) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
FILE: LaTex/Plugin.php
class LaTex_Plugin (line 10) | class LaTex_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 32) | public static function deactivate()
method config (line 42) | public static function config(Typecho_Widget_Helper_Form $form){
method personalConfig (line 54) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method footer (line 63) | public static function footer() {
FILE: MagikeToTypecho/Action.php
class MagikeToTypecho_Action (line 3) | class MagikeToTypecho_Action extends Typecho_Widget implements Widget_In...
method doImport (line 5) | public function doImport()
method action (line 209) | public function action()
FILE: MagikeToTypecho/Plugin.php
class MagikeToTypecho_Plugin (line 10) | class MagikeToTypecho_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 44) | public static function deactivate()
method config (line 57) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 93) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
FILE: MathJax.php
class MathJax (line 10) | class MathJax implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 32) | public static function deactivate()
method config (line 42) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 51) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method footer (line 60) | public static function footer() {
FILE: PageToLinks.php
class PageToLinks (line 10) | class PageToLinks implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate(){}
method deactivate (line 29) | public static function deactivate(){}
method config (line 38) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 47) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method output (line 58) | public static function output($slug = 'links', $tag = 'h2', $listTag =...
FILE: PostToQzone/Plugin.php
class PostToQzone_Plugin (line 12) | class PostToQzone_Plugin implements Typecho_Plugin_Interface
method activate (line 21) | public static function activate()
method deactivate (line 38) | public static function deactivate()
method config (line 50) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 74) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method publish (line 83) | public function publish($contents)
function postToQzoneDefault (line 104) | function postToQzoneDefault($config){
class Mailer (line 115) | class Mailer extends PHPMailer
method Mailer (line 118) | function Mailer($qq,$psw) {
method Halo (line 133) | function Halo($subject,$body){
class Crypter (line 141) | class Crypter
method Crypter (line 145) | function Crypter($clave){
method keyED (line 149) | function keyED($txt) {
method encrypt (line 161) | function encrypt($txt){
method decrypt (line 175) | function decrypt($txt) {
FILE: PostToQzone/phpmailer.php
class PHPMailer (line 34) | class PHPMailer {
method IsHTML (line 272) | function IsHTML($bool) {
method IsSMTP (line 284) | function IsSMTP() {
method IsMail (line 292) | function IsMail() {
method IsSendmail (line 300) | function IsSendmail() {
method IsQmail (line 308) | function IsQmail() {
method AddAddress (line 323) | function AddAddress($address, $name = '') {
method AddCC (line 337) | function AddCC($address, $name = '') {
method AddBCC (line 351) | function AddBCC($address, $name = '') {
method AddReplyTo (line 363) | function AddReplyTo($address, $name = '') {
method Send (line 379) | function Send() {
method SendmailSend (line 430) | function SendmailSend($header, $body) {
method MailSend (line 461) | function MailSend($header, $body) {
method SmtpSend (line 511) | function SmtpSend($header, $body) {
method SmtpConnect (line 578) | function SmtpConnect() {
method SmtpClose (line 628) | function SmtpClose() {
method SetLanguage (line 646) | function SetLanguage($lang_type, $lang_path = 'language/') {
method AddrAppend (line 669) | function AddrAppend($type, $addr) {
method AddrFormat (line 687) | function AddrFormat($addr) {
method WrapText (line 704) | function WrapText($message, $length, $qp_mode = false) {
method UTF8CharBoundary (line 786) | function UTF8CharBoundary($encodedText, $maxLength) {
method SetWordWrap (line 823) | function SetWordWrap() {
method CreateHeader (line 845) | function CreateHeader() {
method GetMailMIME (line 925) | function GetMailMIME() {
method CreateBody (line 960) | function CreateBody() {
method GetBoundary (line 1030) | function GetBoundary($boundary, $charSet, $contentType, $encoding) {
method EndBoundary (line 1054) | function EndBoundary($boundary) {
method SetMessageType (line 1063) | function SetMessageType() {
method HeaderLine (line 1083) | function HeaderLine($name, $value) {
method TextLine (line 1092) | function TextLine($value) {
method AddAttachment (line 1110) | function AddAttachment($path, $name = '', $encoding = 'base64', $type ...
method AttachAll (line 1140) | function AttachAll() {
method EncodeFile (line 1198) | function EncodeFile ($path, $encoding = 'base64') {
method EncodeString (line 1219) | function EncodeString ($str, $encoding = 'base64') {
method EncodeHeader (line 1250) | function EncodeHeader ($str, $position = 'text') {
method HasMultiBytes (line 1311) | function HasMultiBytes($str) {
method Base64EncodeWrapMB (line 1327) | function Base64EncodeWrapMB($str) {
method EncodeQP (line 1364) | function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
method EncodeQ (line 1410) | function EncodeQ ($str, $position = 'text') {
method AddStringAttachment (line 1444) | function AddStringAttachment($string, $filename, $encoding = 'base64',...
method AddEmbeddedImage (line 1470) | function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64...
method InlineImageExists (line 1501) | function InlineImageExists() {
method ClearAddresses (line 1521) | function ClearAddresses() {
method ClearCCs (line 1529) | function ClearCCs() {
method ClearBCCs (line 1537) | function ClearBCCs() {
method ClearReplyTos (line 1545) | function ClearReplyTos() {
method ClearAllRecipients (line 1554) | function ClearAllRecipients() {
method ClearAttachments (line 1565) | function ClearAttachments() {
method ClearCustomHeaders (line 1573) | function ClearCustomHeaders() {
method SetError (line 1587) | function SetError($msg) {
method RFCDate (line 1597) | function RFCDate() {
method ServerVar (line 1614) | function ServerVar($varName) {
method ServerHostname (line 1637) | function ServerHostname() {
method Lang (line 1654) | function Lang($key) {
method IsError (line 1670) | function IsError() {
method FixEOL (line 1679) | function FixEOL($str) {
method AddCustomHeader (line 1690) | function AddCustomHeader($custom_header) {
method MsgHTML (line 1699) | function MsgHTML($message,$basedir='') {
method _mime_types (line 1737) | function _mime_types($ext = '') {
method set (line 1841) | function set ( $name, $value = '' ) {
method getFile (line 1856) | function getFile($filename) {
method SecureHeader (line 1875) | function SecureHeader($str) {
method Sign (line 1889) | function Sign($key_filename, $key_pass) {
FILE: PostToQzone/smtp.php
class SMTP (line 36) | class SMTP
method SMTP (line 75) | function SMTP() {
method Connect (line 100) | function Connect($host,$port=0,$tval=30) {
method Authenticate (line 161) | function Authenticate($username, $password) {
method Connected (line 224) | function Connected() {
method Close (line 249) | function Close() {
method Data (line 282) | function Data($msg_data) {
method Expand (line 421) | function Expand($name) {
method Hello (line 472) | function Hello($host="") {
method SendHello (line 504) | function SendHello($hello, $host) {
method Help (line 546) | function Help($keyword="") {
method Mail (line 598) | function Mail($from) {
method Noop (line 641) | function Noop() {
method Quit (line 684) | function Quit($close_on_error=true) {
method Recipient (line 738) | function Recipient($to) {
method Reset (line 782) | function Reset() {
method Send (line 831) | function Send($from) {
method SendAndMail (line 879) | function SendAndMail($from) {
method SendOrMail (line 927) | function SendOrMail($from) {
method Turn (line 972) | function Turn() {
method Verify (line 994) | function Verify($name) {
method get_lines (line 1039) | function get_lines() {
FILE: SaeUpload/Plugin.php
class SaeUpload_Plugin (line 10) | class SaeUpload_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 38) | public static function deactivate(){}
method config (line 47) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 61) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method validateDomainName (line 70) | public static function validateDomainName($domainName)
method uploadHandle (line 91) | public static function uploadHandle($file)
method modifyHandle (line 156) | public static function modifyHandle($content, $file)
method deleteHandle (line 220) | public static function deleteHandle(array $content)
method attachmentHandle (line 235) | public static function attachmentHandle(array $content)
method attachmentDataHandle (line 250) | public static function attachmentDataHandle(array $content)
method checkFileType (line 265) | public static function checkFileType($ext)
FILE: ShareCode/Plugin.php
class ShareCode_Plugin (line 11) | class ShareCode_Plugin implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 35) | public static function deactivate(){}
method config (line 44) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 53) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method parse (line 62) | public static function parse($value, $lastResult)
FILE: SimpleCode.php
class SimpleCode (line 11) | class SimpleCode implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 35) | public static function deactivate(){}
method config (line 44) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 53) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method parseCallback (line 62) | public static function parseCallback($matches)
method parse (line 73) | public static function parse($text, $widget, $lastResult)
FILE: Textile2/Plugin.php
class Textile2_Plugin (line 14) | class Textile2_Plugin implements Typecho_Plugin_Interface
method activate (line 23) | public static function activate()
method deactivate (line 38) | public static function deactivate(){}
method config (line 47) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 90) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method parse (line 98) | public static function parse($text, $widget, $lastResult)
FILE: Textile2/Textile.php
class Textile (line 30) | class Textile {
method Textile (line 186) | function Textile($options = array()) {
method set (line 221) | function set($opt, $value = NULL) {
method get (line 251) | function get($opt) {
method disable_html (line 269) | function disable_html($disable_html = NULL) {
method head_offset (line 290) | function head_offset($head_offset = NULL) {
method flavor (line 313) | function flavor($flavor = NULL) {
method css (line 404) | function css($css = NULL) {
method charset (line 433) | function charset($charset = NULL) {
method docroot (line 458) | function docroot($docroot = NULL) {
method trim_spaces (line 478) | function trim_spaces($trim_spaces = NULL) {
method filter_param (line 495) | function filter_param($filter_param = NULL) {
method preserve_spaces (line 518) | function preserve_spaces($preserve_spaces = NULL) {
method filters (line 537) | function filters($filters = NULL) {
method char_encoding (line 558) | function char_encoding($char_encoding = NULL) {
method handle_quotes (line 577) | function handle_quotes($do_quotes = NULL) {
method _create_re (line 599) | function _create_re() {
method process (line 746) | function process($str) {
method format_paragraph (line 1202) | function format_paragraph($args) {
method format_inline (line 1298) | function format_inline($args) {
method format_macro (line 1530) | function format_macro($attrs) {
method format_cite (line 1570) | function format_cite($args) {
method format_code (line 1610) | function format_code($args) {
method format_classstyle (line 1662) | function format_classstyle($clsty = NULL, $class = NULL, $style = NULL) {
method format_tag (line 1749) | function format_tag($args) {
method format_deflist (line 1782) | function format_deflist($args) {
method add_term (line 1824) | function add_term($dt, $dd) {
method format_list (line 1883) | function format_list($args) {
method format_block (line 2003) | function format_block($args) {
method format_link (line 2043) | function format_link($args) {
method format_url (line 2081) | function format_url($args) {
method format_span (line 2102) | function format_span($args) {
method format_image (line 2186) | function format_image($args) {
method format_table (line 2317) | function format_table($args) {
method apply_filters (line 2617) | function apply_filters($args) {
method encode_html (line 2654) | function encode_html($html, $can_double_encode = FALSE) {
method decode_html (line 2674) | function decode_html($html) {
method encode_html_basic (line 2698) | function encode_html_basic($html, $can_double_encode = FALSE) {
method image_size (line 2729) | function image_size($file) {
method encode_url (line 2757) | function encode_url($str) {
method mail_encode (line 2773) | function mail_encode($addr) {
method process_quotes (line 2790) | function process_quotes($str) {
method default_macros (line 2807) | function default_macros() {
method _css_defaults (line 2980) | function _css_defaults() {
method _halign (line 3025) | function _halign($align) {
method _valign (line 3063) | function _valign($align) {
method _imgalign (line 3109) | function _imgalign($align) {
method _strip_borders (line 3130) | function _strip_borders(&$pre, &$post) {
method _repl (line 3162) | function _repl(&$array, $str) {
method _tokenize (line 3177) | function _tokenize($str) {
method version (line 3221) | function version() {
method _cb (line 3243) | function _cb($function) {
method _current_store (line 3263) | function &_current_store(&$new) {
method _current (line 3283) | function &_current() {
class MTLikeTextile (line 3337) | class MTLikeTextile extends Textile {
method MTLikeTextile (line 3349) | function MTLikeTextile($options = array()) {
method process_quotes (line 3356) | function process_quotes($str) {
method format_url (line 3367) | function format_url($args) {
FILE: TinyMCE/Plugin.php
class TinyMCE_Plugin (line 11) | class TinyMCE_Plugin implements Typecho_Plugin_Interface
method activate (line 20) | public static function activate()
method deactivate (line 40) | public static function deactivate()
method config (line 52) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 61) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method filter (line 70) | public static function filter($post)
method render (line 82) | public static function render($post)
FILE: TinyMCE/tiny_mce/plugins/inlinepopups/editor_plugin.js
function D (line 1) | function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mc...
FILE: TinyMCE/tiny_mce/plugins/media/editor_plugin.js
function f (line 1) | function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia...
function d (line 1) | function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom....
FILE: TinyMCE/tiny_mce/plugins/media/js/embed.js
function writeFlash (line 5) | function writeFlash(p) {
function writeShockWave (line 14) | function writeShockWave(p) {
function writeQuickTime (line 23) | function writeQuickTime(p) {
function writeRealMedia (line 32) | function writeRealMedia(p) {
function writeWindowsMedia (line 41) | function writeWindowsMedia(p) {
function writeEmbed (line 51) | function writeEmbed(cls, cb, mt, p) {
FILE: TinyMCE/tiny_mce/plugins/media/js/media.js
function init (line 8) | function init() {
function insertMedia (line 180) | function insertMedia() {
function updatePreview (line 272) | function updatePreview() {
function getMediaListHTML (line 284) | function getMediaListHTML() {
function getType (line 302) | function getType(v) {
function switchType (line 335) | function switchType(v) {
function changedType (line 353) | function changedType(t) {
function serializeParameters (line 367) | function serializeParameters() {
function setBool (line 468) | function setBool(pl, p, n) {
function setStr (line 475) | function setStr(pl, p, n) {
function getBool (line 487) | function getBool(p, n, d, tv, fv) {
function getStr (line 496) | function getStr(p, n, d) {
function getInt (line 506) | function getInt(p, n, d) {
function jsEncode (line 513) | function jsEncode(s) {
function generatePreview (line 521) | function generatePreview(c) {
FILE: TinyMCE/tiny_mce/plugins/safari/editor_plugin.js
function e (line 1) | function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,nul...
FILE: TinyMCE/tiny_mce/themes/advanced/js/about.js
function init (line 3) | function init() {
function insertHelpIFrame (line 62) | function insertHelpIFrame() {
FILE: TinyMCE/tiny_mce/themes/advanced/js/charmap.js
function renderCharMapHTML (line 270) | function renderCharMapHTML() {
function insertChar (line 299) | function insertChar(chr) {
function previewChar (line 310) | function previewChar(codeA, codeB, codeN) {
FILE: TinyMCE/tiny_mce/themes/advanced/js/color_picker.js
function init (line 61) | function init() {
function insertAction (line 78) | function insertAction() {
function showColor (line 89) | function showColor(color, name) {
function convertRGBToHex (line 97) | function convertRGBToHex(col) {
function convertHexToRGB (line 119) | function convertHexToRGB(col) {
function generatePicker (line 133) | function generatePicker() {
function generateWebColors (line 150) | function generateWebColors() {
function generateNamedColors (line 173) | function generateNamedColors() {
function dechex (line 188) | function dechex(n) {
function computeColor (line 192) | function computeColor(e) {
function updateLight (line 215) | function updateLight(r, g, b) {
function changeFinalColor (line 237) | function changeFinalColor(color) {
function setCol (line 245) | function setCol(e, c) {
FILE: TinyMCE/tiny_mce/themes/advanced/js/source_editor.js
function saveContent (line 4) | function saveContent() {
function onLoadInit (line 9) | function onLoadInit() {
function setWrap (line 26) | function setWrap(val) {
function toggleWordWrap (line 40) | function toggleWordWrap(elm) {
function resizeInputs (line 49) | function resizeInputs() {
FILE: TinyMCE/tiny_mce/tiny_mce.js
function c (line 1) | function c(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?...
function b (line 1) | function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){...
function g (line 1) | function g(){var h=document;if(h.readyState=="interactive"){function f()...
function d (line 1) | function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}
function f (line 1) | function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10...
function f (line 1) | function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-righ...
function g (line 1) | function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[...
function o (line 1) | function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catc...
function f (line 1) | function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/...
function h (line 1) | function h(o,m,n){if(n==="false"||n==="0"){return""}return" "+m+'="'+m+'"'}
function l (line 1) | function l(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="st...
function i (line 1) | function i(m,l,p){var q,o;o=p.createElement("body");o.innerHTML=l;q=o.la...
function g (line 1) | function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}
function o (line 1) | function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,funct...
function g (line 1) | function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r...
function i (line 1) | function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q...
function h (line 1) | function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}r...
function g (line 1) | function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild...
function b (line 1) | function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}r...
function i (line 1) | function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.fi...
function a (line 1) | function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,e...
function a (line 1) | function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.it...
function m (line 1) | function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.l...
function q (line 1) | function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.l...
function e (line 1) | function e(f){return f.replace(/[\n\r]+/g,"")}
function q (line 1) | function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEX...
function i (line 1) | function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEX...
function h (line 1) | function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEX...
function b (line 1) | function b(){var e=document.implementation;if(!e||!e.createDocument){try...
function c (line 1) | function c(h){return h.replace(/([?+*])/g,".$1")}
function m (line 1) | function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){...
function h (line 1) | function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){retu...
function k (line 1) | function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){ret...
function loadScript (line 1) | function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinym...
function done (line 1) | function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}
function allDone (line 1) | function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(...
function load (line 1) | function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader...
function done (line 1) | function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(do...
function g (line 1) | function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){...
function f (line 1) | function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value))...
function j (line 1) | function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.repl...
function s (line 1) | function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasC...
function j (line 1) | function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinym...
function r (line 1) | function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}...
function x (line 1) | function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}
function y (line 1) | function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~...
function q (line 1) | function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s....
function u (line 1) | function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(...
function q (line 1) | function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(...
function z (line 1) | function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}...
function r (line 1) | function r(){w.undoManager.typing=0;w.undoManager.add()}
function x (line 1) | function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("ta...
function y (line 1) | function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("fo...
function l (line 1) | function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}
function m (line 1) | function m(r){return n.getParent(r,"*")}
function l (line 1) | function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":retu...
function l (line 1) | function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(...
function i (line 1) | function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nod...
function h (line 1) | function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(...
function g (line 1) | function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFa...
function e (line 1) | function e(k,l){var j=l.ownerDocument.createRange();j.setStart(k.endCont...
function d (line 1) | function d(j){j=j.innerHTML;j=j.replace(/<(img|hr|table|input|select|tex...
function j (line 1) | function j(p,q){if(b){q.content=q.content.replace(l.reOpera,"</"+n+">")}...
function m (line 1) | function m(o,n){var p=j.dom.create(n);g(o.attributes,function(q){if(q.sp...
function P (line 1) | function P(y,s){var r=[],U,T,t;y.innerHTML="";if(S.keep_styles){T=s;do{i...
function v (line 1) | function v(r){return O.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,fals...
function y (line 1) | function y(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(k=...
function e (line 1) | function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i...
function a (line 1) | function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o)...
function k (line 1) | function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("remo...
function p (line 1) | function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}
function t (line 1) | function t(r){p(r);b.walk(r,p,"childNodes")}
function g (line 1) | function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOC...
FILE: TinyMCE/tiny_mce/tiny_mce_popup.js
function b (line 5) | function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.edit...
FILE: TinyMCE/tiny_mce/utils/form_utils.js
function getColorPickerHTML (line 12) | function getColorPickerHTML(id, target_form_element) {
function updateColor (line 21) | function updateColor(img_id, form_element_id) {
function setBrowserDisabled (line 25) | function setBrowserDisabled(id, state) {
function getBrowserHTML (line 43) | function getBrowserHTML(id, target_form_element, type, prefix) {
function openBrowser (line 58) | function openBrowser(img_id, target_form_element, type, option) {
function selectByValue (line 65) | function selectByValue(form_obj, field_name, value, add_custom, ignore_c...
function getSelectValue (line 92) | function getSelectValue(form_obj, field_name) {
function addSelectValue (line 101) | function addSelectValue(form_obj, field_name, name, value) {
function addClassesToList (line 107) | function addClassesToList(list_id, specific_option) {
function isVisible (line 133) | function isVisible(element_id) {
function convertRGBToHex (line 139) | function convertRGBToHex(col) {
function convertHexToRGB (line 158) | function convertHexToRGB(col) {
function trimSize (line 172) | function trimSize(size) {
function getCSSSize (line 176) | function getCSSSize(size) {
function getStyle (line 189) | function getStyle(elm, attrib, style) {
FILE: TinyMCE/tiny_mce/utils/mctabs.js
function MCTabs (line 10) | function MCTabs() {
FILE: WordpressToTypecho/Action.php
class WordpressToTypecho_Action (line 3) | class WordpressToTypecho_Action extends Typecho_Widget implements Widget...
method doImport (line 5) | public function doImport()
method action (line 210) | public function action()
FILE: WordpressToTypecho/Plugin.php
class WordpressToTypecho_Plugin (line 10) | class WordpressToTypecho_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 45) | public static function deactivate()
method config (line 58) | public static function config(Typecho_Widget_Helper_Form $form)
method personalConfig (line 94) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
FILE: ZenCoding/Plugin.php
class ZenCoding_Plugin (line 10) | class ZenCoding_Plugin implements Typecho_Plugin_Interface
method activate (line 19) | public static function activate()
method deactivate (line 34) | public static function deactivate()
method config (line 44) | public static function config(Typecho_Widget_Helper_Form $form){}
method personalConfig (line 53) | public static function personalConfig(Typecho_Widget_Helper_Form $form){}
method themeBottom (line 61) | public static function themeBottom($files)
method writeBottom (line 78) | public static function writeBottom($post)
FILE: ZenCoding/zen_textarea.js
function tag (line 747) | function tag(match, ix) {
function comment (line 760) | function comment(start, end) {
function makeMap (line 768) | function makeMap(str){
function makeRange (line 781) | function makeRange(opening_tag, closing_tag, ix) {
function saveMatch (line 813) | function saveMatch(opening_tag, closing_tag, ix) {
function findPair (line 834) | function findPair(html, start_ix, action) {
function isAllowedChar (line 1024) | function isAllowedChar(ch) {
function getNewline (line 1038) | function getNewline() {
function splitByLines (line 1049) | function splitByLines(text, remove_empty) {
function trim (line 1073) | function trim(text) {
function createProfile (line 1077) | function createProfile(options) {
function setupProfile (line 1085) | function setupProfile(name, options) {
function stringToHash (line 1093) | function stringToHash(str){
function padString (line 1106) | function padString(text, pad, verbose) {
function isShippet (line 1130) | function isShippet(abbr, type) {
function isEndsWithTag (line 1141) | function isEndsWithTag(str) {
function getElementsCollection (line 1152) | function getElementsCollection(resource, type) {
function replaceVariables (line 1165) | function replaceVariables(str, vars) {
function Tag (line 1179) | function Tag(name, count, type) {
function allowNewline (line 1351) | function allowNewline(tag) {
function Snippet (line 1452) | function Snippet(name, count, type) {
function getAbbreviation (line 1582) | function getAbbreviation(type, abbr) {
function getSnippet (line 1592) | function getSnippet(type, snippet_name) {
function getSettingsResource (line 1603) | function getSettingsResource(type, abbr, res_name) {
function inRange (line 1762) | function inRange(start, end) {
function entry (line 1866) | function entry(type, key, value) {
function makeExpando (line 1884) | function makeExpando(key, value) {
function makeAbbreviation (line 1896) | function makeAbbreviation(key, tag_name, attrs, is_empty) {
function parseAbbreviations (line 1920) | function parseAbbreviations(obj) {
function getContent (line 2037) | function getContent() {
function getSelectionRange (line 2044) | function getSelectionRange() {
function createSelection (line 2082) | function createSelection(start, end) {
function findNewlineBounds (line 2111) | function findNewlineBounds(text, from) {
function getCaretPos (line 2139) | function getCaretPos() {
function getStringPadding (line 2149) | function getStringPadding(str) {
function findAbbreviation (line 2260) | function findAbbreviation(editor) {
function expandAbbreviation (line 2280) | function expandAbbreviation(editor, type, profile_name) {
function expandAbbreviationWithTab (line 2305) | function expandAbbreviationWithTab(editor, type, profile_name) {
function matchPair (line 2316) | function matchPair(editor, direction) {
function wrapWithAbbreviation (line 2372) | function wrapWithAbbreviation(editor, abbr, type, profile_name) {
function unindent (line 2432) | function unindent(editor, text) {
function getCurrentLinePadding (line 2448) | function getCurrentLinePadding(editor) {
function findNewEditPoint (line 2459) | function findNewEditPoint(editor, inc, offset) {
function prevEditPoint (line 2524) | function prevEditPoint(editor) {
function nextEditPoint (line 2540) | function nextEditPoint(editor) {
function insertFormattedNewline (line 2551) | function insertFormattedNewline(editor, mode) {
function selectLine (line 2580) | function selectLine(editor) {
function copyOptions (line 2867) | function copyOptions(opt) {
function capitalize (line 2883) | function capitalize(str) {
function humanize (line 2887) | function humanize(str) {
function formatShortcut (line 2891) | function formatShortcut(char_map, glue) {
function getOptionsFromElement (line 2923) | function getOptionsFromElement(elem) {
function normalizeActionName (line 2948) | function normalizeActionName(name) {
function runAction (line 2960) | function runAction(name, evt) {
function addShortcut (line 3033) | function addShortcut(keystroke, action_name) {
Condensed preview — 232 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,560K chars).
[
{
"path": ".gitattributes",
"chars": 386,
"preview": "# Set default behaviour, in case users don't have core.autocrlf set.\n* text=auto\n\n# Explicitly declare text files we wan"
},
{
"path": ".gitignore",
"chars": 226,
"preview": ".*.swp\n.*.swo\n._*\n.DS_Store\n/Debug/\n/ImgCache/\n/Backup_rar/\n/Debug/\n/debug/\n/upload/\n/avatar/\n/.idea/\n.svn/\n*.orig\n*.aps"
},
{
"path": "Akismet/Plugin.php",
"chars": 6858,
"preview": "<?php\n/**\n * Akismet 反垃圾评论插件 for Typecho\n * \n * @package Akismet\n * @author qining\n * @version 1.1.4\n * @link http://typ"
},
{
"path": "AliUpload/Plugin.php",
"chars": 22579,
"preview": "<?php\n\nif(!defined('OSS_API_PATH'))\ndefine('OSS_API_PATH', dirname(__FILE__));\n\n//ACCESS_ID\ndefine('OSS_ACCESS_ID', '');"
},
{
"path": "AliUpload/lib/mimetypes.class.php",
"chars": 6026,
"preview": "<?php\n/**\n * 获得文件的mime type类型\n * @author xiaobing.meng\n *\n */\nclass MimeTypes {\n\tpublic static $mime_types = array (\n\t\t\t"
},
{
"path": "AliUpload/lib/requestcore.class.php",
"chars": 29371,
"preview": "<?php\n/**\n * Handles all HTTP requests using cURL and manages the responses.\n *\n * @version 2011.06.07\n * @copyright 200"
},
{
"path": "AliUpload/lib/sdk.class.php",
"chars": 63328,
"preview": "<?php\n/**\n * OSS(Open Storage Services) PHP SDK v1.1.5\n */\n//设置默认时区\ndate_default_timezone_set('Asia/Shanghai');\n\n//检测API"
},
{
"path": "AliUpload/lib/zh.inc.php",
"chars": 4830,
"preview": "<?php\n/*%*************************************************************************************%*/\n//access id & access k"
},
{
"path": "Avartar.php",
"chars": 2426,
"preview": "<?php\n\n\n/**\n * 头像代理修改插件\n * \n * @package Avartar\n * @author loftor\n * @version 1.0.0 Beta\n * @link http://loftor.com/\n */"
},
{
"path": "B3logForHacPai/Action.php",
"chars": 2239,
"preview": "<?php ! defined('__TYPECHO_ROOT_DIR__') and exit();\n\nclass B3logForHacPai_Action extends Typecho_Widget\n{\n\n /**\n "
},
{
"path": "B3logForHacPai/LICENSE.txt",
"chars": 35147,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "B3logForHacPai/Plugin.php",
"chars": 6227,
"preview": "<?php\nif (!defined('__TYPECHO_ROOT_DIR__')) exit;\n//如果没有json库,加载兼容包\n! extension_loaded('json') and include('libs/compat_"
},
{
"path": "B3logForHacPai/README.md",
"chars": 513,
"preview": "# [B3logForHacPai](https://dt27.org/php/b3log-hacpai-typecho/)\n**黑客派社区实时同步插件 For Typecho**\n\n基于[B3log理念][1],整合 [Typecho]["
},
{
"path": "B3logForHacPai/libs/compat_json.php",
"chars": 27503,
"preview": "<?php\nif ( !class_exists( 'Services_JSON' ) ) :\n/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */\n/**\n * Co"
},
{
"path": "BlockComment/Plugin.php",
"chars": 3667,
"preview": "<?php\n/**\n * 增加评论黑名单(根据 IP 地址过滤)\n * \n * @package Block Comment\n * @author 明城\n * @version 0.0.1\n * @link http://typecho.o"
},
{
"path": "ConnectToTwitter/OAuth.php",
"chars": 22973,
"preview": "<?php\n// vim: foldmethod=marker\n\n/* Generic exception class\n */\nclass OAuthException extends Exception {/*{{{*/\n // pas"
},
{
"path": "ConnectToTwitter/Plugin.php",
"chars": 5412,
"preview": "<?php\n/**\n * 支持用twitter帐号在blog中留言并同步到twitter上\n * \n * @package Connect to Twittter\n * @author blankyao\n * @version 1.0.0 "
},
{
"path": "ConnectToTwitter/twitterOAuth.php",
"chars": 4676,
"preview": "<?php\n/*\n * Abraham Williams (abraham@abrah.am) http://abrah.am\n *\n * Basic lib to work with Twitter's OAuth beta. This "
},
{
"path": "Creole/Creole_Wiki.php",
"chars": 43264,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Parse structured wiki text and render into arbi"
},
{
"path": "Creole/Parse/Address.php",
"chars": 1396,
"preview": "<?php\n\n/**\n *\n * Parses for signatures.\n * This class implements a Text_Wiki rule to find sections of the source\n * text"
},
{
"path": "Creole/Parse/Blockquote.php",
"chars": 4724,
"preview": "<?php\n\n/**\n *\n * Parse for block-quoted text.\n *\n * Find source text marked as a blockquote, identified by any number of"
},
{
"path": "Creole/Parse/Box.php",
"chars": 1868,
"preview": "<?php\n\n/**\n* \n* Parses for bold text.\n* \n* @category Text\n* \n* @package Text_Wiki\n* \n* @author Justin Patrin <papercrane"
},
{
"path": "Creole/Parse/Break.php",
"chars": 1284,
"preview": "<?php\n\n/**\n* \n* Parses for explicit line breaks.\n* \n* @category Text\n* \n* @package Text_Wiki\n* \n* @author Paul M. Jones "
},
{
"path": "Creole/Parse/Center.php",
"chars": 1773,
"preview": "<?php\n\n/**\n *\n * Parses for centered text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked to\n "
},
{
"path": "Creole/Parse/Delete.php",
"chars": 1893,
"preview": "<?php\n\n/**\n *\n * Parses for italic text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked for\n *"
},
{
"path": "Creole/Parse/Delimiter.php",
"chars": 1646,
"preview": "<?php\n\n/**\n *\n * Parses for Text_Wiki delimiter characters already in the source text.\n *\n * This class implements a Tex"
},
{
"path": "Creole/Parse/Emphasis.php",
"chars": 1898,
"preview": "<?php\n\n/**\n *\n * Parses for italic text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked for\n *"
},
{
"path": "Creole/Parse/Footnote.php",
"chars": 1916,
"preview": "<?php\n\n/**\n *\n * Parses for bold text.\n *\n * This class implements a Text_Wiki_Rule to find source text marked for\n * st"
},
{
"path": "Creole/Parse/Heading.php",
"chars": 2440,
"preview": "<?php\n\n/**\n *\n * Parses for heading text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked to\n *"
},
{
"path": "Creole/Parse/Horiz.php",
"chars": 1105,
"preview": "<?php\n\n/**\n *\n * Parses for horizontal ruling lines.\n *\n * This class implements a Text_Wiki_Parse to find source text m"
},
{
"path": "Creole/Parse/Image.php",
"chars": 1265,
"preview": "<?php\n\n/**\n *\n * Parse for images in the source text.\n *\n * @category Text\n *\n * @package Text_Wiki\n *\n * @author Tomaiu"
},
{
"path": "Creole/Parse/List.php",
"chars": 8089,
"preview": "<?php\n\n/**\n *\n * Parses for bulleted and numbered lists.\n *\n * This class implements a Text_Wiki_Parse to find source te"
},
{
"path": "Creole/Parse/Newline.php",
"chars": 1220,
"preview": "<?php\n\n/**\n *\n * Parses for implied line breaks indicated by newlines.\n * Newlines are not considered if followed by ano"
},
{
"path": "Creole/Parse/Paragraph.php",
"chars": 3488,
"preview": "<?php\n\n/**\n *\n * Parses for paragraph blocks.\n * This class implements a Text_Wiki rule to find sections of the source\n "
},
{
"path": "Creole/Parse/Prefilter.php",
"chars": 1157,
"preview": "<?php\n\n/**\n *\n * \"Pre-filter\" the source text.\n *\n * Convert DOS and Mac line endings to Unix, convert tabs to 4-spaces,"
},
{
"path": "Creole/Parse/Preformatted.php",
"chars": 1527,
"preview": "<?php\n\n/**\n *\n * Parses for preformatted text.\n *\n * @category Text\n *\n * @package Text_Wiki\n *\n * @author Tomaiuolo Mic"
},
{
"path": "Creole/Parse/Raw.php",
"chars": 1244,
"preview": "<?php\n\n/**\n *\n * Parses for monospaced inline text.\n *\n * @category Text\n *\n * @package Text_Wiki\n *\n * @author Tomaiuol"
},
{
"path": "Creole/Parse/Strong.php",
"chars": 1970,
"preview": "<?php\n\n/**\n *\n * Parses for bold text.\n *\n * This class implements a Text_Wiki_Rule to find source text marked for\n * st"
},
{
"path": "Creole/Parse/Subscript.php",
"chars": 1721,
"preview": "<?php\n\n/**\n *\n * Parses for italic text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked for\n *"
},
{
"path": "Creole/Parse/Superscript.php",
"chars": 1723,
"preview": "<?php\n\n/**\n *\n * Parses for italic text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked for\n *"
},
{
"path": "Creole/Parse/Table.php",
"chars": 5916,
"preview": "<?php\n\n/**\n *\n * Parses for table markup.\n *\n * This class implements a Text_Wiki_Parse to find source text marked as\n *"
},
{
"path": "Creole/Parse/Tighten.php",
"chars": 547,
"preview": "<?php\n\n/**\n *\n * The rule removes all remaining newlines.\n *\n * @category Text\n *\n * @package Text_Wiki\n *\n * @author Pa"
},
{
"path": "Creole/Parse/Trim.php",
"chars": 1889,
"preview": "<?php\n\n/**\n *\n * Trim lines in the source text and compress 3 or more newlines to\n * 2 newlines.\n *\n * @category Text\n *"
},
{
"path": "Creole/Parse/Tt.php",
"chars": 1652,
"preview": "<?php\n\n/**\n *\n * Parses for monospaced inline text.\n *\n * @category Text\n *\n * @package Text_Wiki\n *\n * @author Tomaiuol"
},
{
"path": "Creole/Parse/Underline.php",
"chars": 1902,
"preview": "<?php\n\n/**\n *\n * Parses for italic text.\n *\n * This class implements a Text_Wiki_Parse to find source text marked for\n *"
},
{
"path": "Creole/Parse/Url.php",
"chars": 2909,
"preview": "<?php\n\n/**\n *\n * Parse for URLS in the source text.\n *\n * raw -- http://example.com\n * no descr. -- [[http://examp"
},
{
"path": "Creole/Parse.inc.php",
"chars": 6607,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Baseline rule class for extension into a \"real\""
},
{
"path": "Creole/Plugin.php",
"chars": 1669,
"preview": "<?php\n/**\n * 使用 <a href=\"http://www.wikicreole.org/\" target=\"_blank\">Creole 语法</a>发布文章。改进版本支持中文(utf-8 编码)、并除去不必要的标签。\n * "
},
{
"path": "Creole/Render/Plain/Anchor.php",
"chars": 357,
"preview": "<?php\n\n/**\n* \n* This class renders an anchor target name in XHTML.\n*\n* @author Manuel Holtgrewe <purestorm at ggnore dot"
},
{
"path": "Creole/Render/Plain/Blockquote.php",
"chars": 907,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Blockquote extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into"
},
{
"path": "Creole/Render/Plain/Bold.php",
"chars": 419,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Bold extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text matc"
},
{
"path": "Creole/Render/Plain/Box.php",
"chars": 1236,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Box rule end renderer for Plain\n *\n * PHP versi"
},
{
"path": "Creole/Render/Plain/Break.php",
"chars": 426,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Break extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text mat"
},
{
"path": "Creole/Render/Plain/Center.php",
"chars": 421,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Center extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text ma"
},
{
"path": "Creole/Render/Plain/Code.php",
"chars": 461,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Code extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Colortext.php",
"chars": 428,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Colortext extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Deflist.php",
"chars": 1112,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Deflist extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into te"
},
{
"path": "Creole/Render/Plain/Delete.php",
"chars": 422,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Delete extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text ma"
},
{
"path": "Creole/Render/Plain/Delimiter.php",
"chars": 428,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Delimiter extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Embed.php",
"chars": 453,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Embed extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into text"
},
{
"path": "Creole/Render/Plain/Emphasis.php",
"chars": 427,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Emphasis extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into t"
},
{
"path": "Creole/Render/Plain/Font.php",
"chars": 1323,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * BBCode: extra Font rules renderer to size the t"
},
{
"path": "Creole/Render/Plain/Freelink.php",
"chars": 444,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Freelink extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into t"
},
{
"path": "Creole/Render/Plain/Function.php",
"chars": 924,
"preview": "<?php\n\n// $Id: Function.php 182 2008-09-14 15:56:00Z i.feelinglucky $\n\nclass Text_Wiki_Render_Plain_Function extends Tex"
},
{
"path": "Creole/Render/Plain/Heading.php",
"chars": 241,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Heading extends Text_Wiki_Render {\n \n function token($options)\n {\n i"
},
{
"path": "Creole/Render/Plain/Horiz.php",
"chars": 429,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Horiz extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into text"
},
{
"path": "Creole/Render/Plain/Html.php",
"chars": 457,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Html extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Image.php",
"chars": 419,
"preview": "<?php\nclass Text_Wiki_Render_Plain_Image extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text matc"
},
{
"path": "Creole/Render/Plain/Include.php",
"chars": 130,
"preview": "<?php\nclass Text_Wiki_Render_Plain_Include extends Text_Wiki_Render { \n function token()\n {\n return '';\n"
},
{
"path": "Creole/Render/Plain/Interwiki.php",
"chars": 689,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Interwiki extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Italic.php",
"chars": 425,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Italic extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into tex"
},
{
"path": "Creole/Render/Plain/List.php",
"chars": 1745,
"preview": "<?php\n\n\nclass Text_Wiki_Render_Plain_List extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into text"
},
{
"path": "Creole/Render/Plain/Newline.php",
"chars": 148,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Newline extends Text_Wiki_Render {\n \n \n function token($options)\n {\n "
},
{
"path": "Creole/Render/Plain/Page.php",
"chars": 1244,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Page rule end renderer for Plain\n *\n * PHP vers"
},
{
"path": "Creole/Render/Plain/Paragraph.php",
"chars": 596,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Paragraph extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into "
},
{
"path": "Creole/Render/Plain/Phplookup.php",
"chars": 501,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Phplookup extends Text_Wiki_Render {\n \n var $conf = array('target' => '_blank'"
},
{
"path": "Creole/Render/Plain/Plugin.php",
"chars": 1336,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Plugin rule end renderer for Plain\n *\n * PHP ve"
},
{
"path": "Creole/Render/Plain/Prefilter.php",
"chars": 1687,
"preview": "<?php\n/* vim: set expandtab tabstop=4 shiftwidth=4: */\n// +-------------------------------------------------------------"
},
{
"path": "Creole/Render/Plain/Preformatted.php",
"chars": 1282,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Preformatted rule end renderer for Plain\n *\n * "
},
{
"path": "Creole/Render/Plain/Raw.php",
"chars": 439,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Raw extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token into text m"
},
{
"path": "Creole/Render/Plain/Revise.php",
"chars": 430,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Revise extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token int"
},
{
"path": "Creole/Render/Plain/Smiley.php",
"chars": 1297,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Smiley rule Plain renderer\n *\n * PHP versions 4"
},
{
"path": "Creole/Render/Plain/Specialchar.php",
"chars": 1652,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Specialchar rule end renderer for Plain\n *\n * P"
},
{
"path": "Creole/Render/Plain/Strong.php",
"chars": 430,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Strong extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token int"
},
{
"path": "Creole/Render/Plain/Subscript.php",
"chars": 1257,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Subscript rule end renderer for Plain\n *\n * PHP"
},
{
"path": "Creole/Render/Plain/Superscript.php",
"chars": 430,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Superscript extends Text_Wiki_Render {\n \n /**\n * \n * Renders a token int"
},
{
"path": "Creole/Render/Plain/Table.php",
"chars": 1134,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Table extends Text_Wiki_Render {\n\n /**\n *\n * Renders a token into text matc"
},
{
"path": "Creole/Render/Plain/Tighten.php",
"chars": 136,
"preview": "<?php\nclass Text_Wiki_Render_Plain_Tighten extends Text_Wiki_Render {\n \n \n function token()\n {\n retur"
},
{
"path": "Creole/Render/Plain/Titlebar.php",
"chars": 1397,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Titlebar rule end renderer for Plain\n *\n * PHP "
},
{
"path": "Creole/Render/Plain/Toc.php",
"chars": 784,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Toc extends Text_Wiki_Render {\n \n \n \n /**\n * \n * Renders a token i"
},
{
"path": "Creole/Render/Plain/Tt.php",
"chars": 426,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_tt extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token into te"
},
{
"path": "Creole/Render/Plain/Underline.php",
"chars": 424,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Underline extends Text_Wiki_Render {\n\n /**\n * \n * Renders a token into text"
},
{
"path": "Creole/Render/Plain/Url.php",
"chars": 554,
"preview": "<?php\n\n\nclass Text_Wiki_Render_Plain_Url extends Text_Wiki_Render {\n\n\n /**\n *\n * Renders a token into text matc"
},
{
"path": "Creole/Render/Plain/Wikilink.php",
"chars": 425,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain_Wikilink extends Text_Wiki_Render {\n \n \n /**\n * \n * Renders a token i"
},
{
"path": "Creole/Render/Plain.php",
"chars": 177,
"preview": "<?php\n\nclass Text_Wiki_Render_Plain extends Text_Wiki_Render {\n \n function pre()\n {\n return;\n }\n \n"
},
{
"path": "Creole/Render/Xhtml/Address.php",
"chars": 1086,
"preview": "<?php\n\n/**\n *\n * Address rule end renderer for Xhtml\n *\n * PHP versions 4 and 5\n *\n * @category Text\n *\n * @package "
},
{
"path": "Creole/Render/Xhtml/Anchor.php",
"chars": 1248,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Anchor rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/Blockquote.php",
"chars": 1898,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Blockquote rule end renderer for Xhtml\n *\n * PH"
},
{
"path": "Creole/Render/Xhtml/Bold.php",
"chars": 1411,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Bold rule end renderer for Xhtml\n *\n * PHP vers"
},
{
"path": "Creole/Render/Xhtml/Box.php",
"chars": 1566,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Box rule end renderer for Xhtml\n *\n * PHP versi"
},
{
"path": "Creole/Render/Xhtml/Break.php",
"chars": 1282,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Break rule end renderer for Xhtml\n *\n * PHP ver"
},
{
"path": "Creole/Render/Xhtml/Center.php",
"chars": 1556,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Center rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/Code.php",
"chars": 4423,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Code rule end renderer for Xhtml\n *\n * PHP vers"
},
{
"path": "Creole/Render/Xhtml/Colortext.php",
"chars": 1821,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Colortext rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Deflist.php",
"chars": 2068,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Deflist rule end renderer for Xhtml\n *\n * PHP v"
},
{
"path": "Creole/Render/Xhtml/Delete.php",
"chars": 1527,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Underline rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Delimiter.php",
"chars": 1199,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Delimiter rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Embed.php",
"chars": 1187,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Embed rule end renderer for Xhtml\n *\n * PHP ver"
},
{
"path": "Creole/Render/Xhtml/Emphasis.php",
"chars": 1432,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Emphasis rule end renderer for Xhtml\n *\n * PHP "
},
{
"path": "Creole/Render/Xhtml/Font.php",
"chars": 2100,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * BBCode: extra Font rules renderer to size the t"
},
{
"path": "Creole/Render/Xhtml/Freelink.php",
"chars": 1009,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Freelink rule end renderer for Xhtml\n *\n * PHP "
},
{
"path": "Creole/Render/Xhtml/Function.php",
"chars": 3532,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Function rule end renderer for Xhtml\n *\n * PHP "
},
{
"path": "Creole/Render/Xhtml/Heading.php",
"chars": 1531,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Heading rule end renderer for Xhtml\n *\n * PHP v"
},
{
"path": "Creole/Render/Xhtml/Horiz.php",
"chars": 1287,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Horiz rule end renderer for Xhtml\n *\n * PHP ver"
},
{
"path": "Creole/Render/Xhtml/Html.php",
"chars": 1177,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Html rule end renderer for Xhtml\n *\n * PHP vers"
},
{
"path": "Creole/Render/Xhtml/Image.php",
"chars": 6170,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Image rule end renderer for Xhtml\n *\n * PHP ver"
},
{
"path": "Creole/Render/Xhtml/Include.php",
"chars": 889,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Include rule end renderer for Xhtml\n *\n * PHP v"
},
{
"path": "Creole/Render/Xhtml/Interwiki.php",
"chars": 3121,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Interwiki rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Italic.php",
"chars": 1419,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Italic rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/List.php",
"chars": 4736,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * List rule end renderer for Xhtml\n *\n * PHP vers"
},
{
"path": "Creole/Render/Xhtml/Newline.php",
"chars": 894,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Newline rule end renderer for Xhtml\n *\n * PHP v"
},
{
"path": "Creole/Render/Xhtml/Page.php",
"chars": 1198,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Page rule end renderer for Xhtml\n *\n * PHP vers"
},
{
"path": "Creole/Render/Xhtml/Paragraph.php",
"chars": 1444,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Paragraph rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Phplookup.php",
"chars": 2330,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Phplookup rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Plugin.php",
"chars": 1254,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Plugin rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/Prefilter.php",
"chars": 1066,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Prefilter rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Preformatted.php",
"chars": 1259,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Preformatted rule end renderer for Xhtml\n *\n * "
},
{
"path": "Creole/Render/Xhtml/Raw.php",
"chars": 1196,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Raw rule end renderer for Xhtml\n *\n * PHP versi"
},
{
"path": "Creole/Render/Xhtml/Revise.php",
"chars": 1709,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Revise rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/Smiley.php",
"chars": 2622,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Smiley rule Xhtml renderer\n *\n * PHP versions 4"
},
{
"path": "Creole/Render/Xhtml/Specialchar.php",
"chars": 1659,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Specialchar rule end renderer for Xhtml\n *\n * P"
},
{
"path": "Creole/Render/Xhtml/Strong.php",
"chars": 1440,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Strong rule end renderer for Xhtml\n *\n * PHP ve"
},
{
"path": "Creole/Render/Xhtml/Subscript.php",
"chars": 1435,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Subscript rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Superscript.php",
"chars": 1443,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Superscript rule end renderer for Xhtml\n *\n * P"
},
{
"path": "Creole/Render/Xhtml/Table.php",
"chars": 3494,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Table rule end renderer for Xhtml\n *\n * PHP ver"
},
{
"path": "Creole/Render/Xhtml/Tighten.php",
"chars": 888,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Tighten rule end renderer for Xhtml\n *\n * PHP v"
},
{
"path": "Creole/Render/Xhtml/Titlebar.php",
"chars": 1435,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Titlebar rule end renderer for Xhtml\n *\n * PHP "
},
{
"path": "Creole/Render/Xhtml/Toc.php",
"chars": 2903,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Toc rule end renderer for Xhtml\n *\n * PHP versi"
},
{
"path": "Creole/Render/Xhtml/Tt.php",
"chars": 1414,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Tt rule end renderer for Xhtml\n *\n * PHP versio"
},
{
"path": "Creole/Render/Xhtml/Underline.php",
"chars": 1533,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Underline rule end renderer for Xhtml\n *\n * PHP"
},
{
"path": "Creole/Render/Xhtml/Url.php",
"chars": 4529,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Url rule end renderer for Xhtml\n *\n * PHP versi"
},
{
"path": "Creole/Render/Xhtml/Wikilink.php",
"chars": 5961,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Wikilink rule end renderer for Xhtml\n *\n * PHP "
},
{
"path": "Creole/Render/Xhtml.php",
"chars": 3225,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Format class for the Xhtml rendering\n *\n * PHP "
},
{
"path": "Creole/Render.inc.php",
"chars": 5027,
"preview": "<?php\n// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:\n/**\n * Base rendering class for parsed and tokenized t"
},
{
"path": "FlashMp3Player/Plugin.php",
"chars": 3238,
"preview": "<?php\n/**\n * 小巧的mp3播放器,在编辑器代码模式下使用<strong><mp3>http://...</mp3></strong>的格式来添加一个音乐播放器\n * \n * @package Dewpla"
},
{
"path": "GitHubGit/Action.php",
"chars": 3852,
"preview": "<?php\n\nrequire_once \"Spyc.php\";\n\nclass GitHubGit_Action extends Widget_Abstract_Contents implements Widget_Interface_Do\n"
},
{
"path": "GitHubGit/Plugin.php",
"chars": 1552,
"preview": "<?php\n/**\n * GitHub git 同步文章\n * \n * @package GitHub Git Transmit\n * @author weakish\n * @version 0.0.1\n * @dependence 10."
},
{
"path": "GitHubGit/README.md",
"chars": 1860,
"preview": "Configuration\n-------------\n\n### configure security code\n\nOpen `Plugin.php` in your editor, find this line:\n\n```php\ncons"
},
{
"path": "GitHubGit/Spyc.php",
"chars": 34486,
"preview": "<?php\n/**\n * Spyc -- A Simple PHP YAML Class\n * @version 0.5.1\n * @author Vlad Andersen <vlad.andersen@gmail.com>\n"
},
{
"path": "GoogleAnalytics/Plugin.php",
"chars": 2019,
"preview": "<?php\n/**\n * Google Analytics\n * \n * @package GoogleAnalytics\n * @author mutoo\n * @version 1.0.0\n * @link http://typecho"
},
{
"path": "GoogleCodePrettify/Plugin.php",
"chars": 4209,
"preview": "<?php\n/**\n * Google高亮代码\n * \n * @package Google Code Prettify\n * @author qining\n * @version 1.0.0\n * @dependence 9.9.2-*\n"
},
{
"path": "GoogleCodePrettify/src/lang-apollo.js",
"chars": 2588,
"preview": "// Copyright (C) 2009 Onno Hommes.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not "
},
{
"path": "GoogleCodePrettify/src/lang-css.js",
"chars": 2746,
"preview": "// Copyright (C) 2009 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-hs.js",
"chars": 4619,
"preview": "// Copyright (C) 2009 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-lisp.js",
"chars": 3507,
"preview": "// Copyright (C) 2008 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-lua.js",
"chars": 2413,
"preview": "// Copyright (C) 2008 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-ml.js",
"chars": 2917,
"preview": "// Copyright (C) 2008 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-proto.js",
"chars": 1317,
"preview": "// Copyright (C) 2006 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-sql.js",
"chars": 3347,
"preview": "// Copyright (C) 2008 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-vb.js",
"chars": 3481,
"preview": "// Copyright (C) 2009 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/lang-wiki.js",
"chars": 1881,
"preview": "// Copyright (C) 2009 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodePrettify/src/prettify.css",
"chars": 1257,
"preview": "/* Pretty printing styles. Used with prettify.js. */\n\n.str { color: #B1D631; font-style: italic; }\n.kwd { color: #527AA2"
},
{
"path": "GoogleCodePrettify/src/prettify.js",
"chars": 57685,
"preview": "// Copyright (C) 2006 Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not u"
},
{
"path": "GoogleCodeSVN/Action.php",
"chars": 5492,
"preview": "<?php\n\nclass GoogleCodeSVN_Action extends Widget_Abstract_Contents implements Widget_Interface_Do\n{\n private function"
},
{
"path": "GoogleCodeSVN/Plugin.php",
"chars": 1866,
"preview": "<?php\n/**\n * google code svn 同步文章\n * \n * @package Google Code SVN Transmit\n * @author qining\n * @version 1.0.0\n * @depen"
},
{
"path": "LaTex/Plugin.php",
"chars": 1774,
"preview": "<?php\n/**\n * LaTex 公式解析\n * \n * @package LaTex\n * @author mutoo\n * @version 1.1.0\n * @link http://blog.mutoo.im/LaTex.htm"
},
{
"path": "LaTex/latex.js",
"chars": 672,
"preview": "(function(global) {\n\tvar previousLatex = global.latex;\n\n\tglobal.latex = {\n\t\tparse: function(mark) {\n\t\t\tif (!mark) {\n\t\t\t\t"
},
{
"path": "MagikeToTypecho/Action.php",
"chars": 9150,
"preview": "<?php\n\nclass MagikeToTypecho_Action extends Typecho_Widget implements Widget_Interface_Do\n{\n public function doImport"
},
{
"path": "MagikeToTypecho/Plugin.php",
"chars": 3217,
"preview": "<?php\n/**\n * 将 Magike 数据库中的数据转换为 Typecho\n * \n * @package Magike to Typecho\n * @author qining\n * @version 1.0.0\n * @link "
},
{
"path": "MagikeToTypecho/panel.php",
"chars": 2506,
"preview": "<?php\nif (!defined('__TYPECHO_ROOT_DIR__')) {\n exit;\n}\n\n$success = true;\ntry {\n $dbConfig = $options->plugin('Magi"
},
{
"path": "MathJax.php",
"chars": 1516,
"preview": "<?php\n/**\n * MathJax\n * \n * @package MathJax\n * @author mutoo\n * @version 1.0.0\n * @link http://blog.mutoo.im/mathjax-pl"
},
{
"path": "PageToLinks.php",
"chars": 2108,
"preview": "<?php\n/**\n * 将页面转化为友情链接列表的插件\n * \n * @package Page To Links\n * @author qining\n * @version 1.0.0\n * @link http://typecho.o"
},
{
"path": "PostToQzone/Plugin.php",
"chars": 4870,
"preview": "<?php\n/**\n * 将文章同时发布到您的Qzone\n *\n * @package PostToQzone\n * @version 1.0 beta\n * @author blankyao\n * @link http://www.bla"
},
{
"path": "PostToQzone/phpmailer.php",
"chars": 56083,
"preview": "<?php\n/*~ class.phpmailer.php\n.---------------------------------------------------------------------------.\n| Software:"
},
{
"path": "PostToQzone/smtp.php",
"chars": 31379,
"preview": "<?php\n/*~ class.smtp.php\n.---------------------------------------------------------------------------.\n| Software: PHPM"
},
{
"path": "README.md",
"chars": 29,
"preview": "plugins\n=======\n\nTypecho插件列表\n"
},
{
"path": "SaeUpload/Plugin.php",
"chars": 8073,
"preview": "<?php\n/**\n * <a href=\"http://sae.sina.com.cn\" target=\"_blank\">Sina App Engine</a>专用的文件上传插件,使用Storage做持久化存储。\n * \n * @pack"
},
{
"path": "ShareCode/Plugin.php",
"chars": 1989,
"preview": "<?php\n/**\n * 直接在在文章中插入[embed_snipt:{code_id}]({code_id}为snipt上面的id)就可引用http://snipt.org/上分享的代码\n * \n * @package ShareCode"
},
{
"path": "SimpleCode.php",
"chars": 2052,
"preview": "<?php\n/**\n * 解析内容源代码中的code串\n * \n * @package Simple Code \n * @author qining\n * @version 1.0.2\n * @dependence 9.9.2-*\n * @"
},
{
"path": "Textile2/Plugin.php",
"chars": 4793,
"preview": "<?php\n/**\n * This is a wrapper for Jim Riggs' <a href=\"http://jimandlissa.com/project/textilephp\">PHP implementation</a>"
},
{
"path": "Textile2/Textile.php",
"chars": 144730,
"preview": "<?php\n// @(#) $Id: Textile.php,v 1.13 2005/03/21 15:26:55 jhriggs Exp $\n\n/* This program is free software; you can redis"
},
{
"path": "TinyMCE/Plugin.php",
"chars": 4748,
"preview": "<?php\n/**\n * 集成tinyMCE编辑器\n * \n * @package tinyMCE Editor \n * @author qining\n * @version 1.0.1\n * @dependence 9.9.2-*\n * "
},
{
"path": "TinyMCE/tiny_mce/langs/typecho.js",
"chars": 42,
"preview": "/** nothing to do, just sleep...Zzz... */\n"
},
{
"path": "TinyMCE/tiny_mce/langs.php",
"chars": 12407,
"preview": "<?php\nif (!defined('__TYPECHO_ROOT_DIR__')) {\n exit;\n}\n\n$response->setContentType('text/javascript');\n?>\n\ntinyMCE.add"
},
{
"path": "TinyMCE/tiny_mce/plugins/coder/editor_plugin.js",
"chars": 2432,
"preview": "/**\n * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\n *\n * @author Moxiecode\n * @copyright Copyright 2004"
},
{
"path": "TinyMCE/tiny_mce/plugins/inlinepopups/editor_plugin.js",
"chars": 10677,
"preview": "(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create(\"tiny"
},
{
"path": "TinyMCE/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css",
"chars": 6410,
"preview": "/* Clearlooks 2 */\n\n/* Reset */\n.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseli"
},
{
"path": "TinyMCE/tiny_mce/plugins/inlinepopups/template.htm",
"chars": 12491,
"preview": "<!-- <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> -->\n<"
},
{
"path": "TinyMCE/tiny_mce/plugins/media/css/content.css",
"chars": 524,
"preview": ".mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000;"
},
{
"path": "TinyMCE/tiny_mce/plugins/media/css/media.css",
"chars": 1255,
"preview": "#id, #name, #hspace, #vspace, #class_name, #align {\twidth: 100px }\n#hspace, #vspace { width: 50px }\n#flash_quality, #fla"
},
{
"path": "TinyMCE/tiny_mce/plugins/media/editor_plugin.js",
"chars": 8142,
"preview": "(function(){var a=tinymce.each;tinymce.create(\"tinymce.plugins.MediaPlugin\",{init:function(b,c){var e=this;e.editor=b;e."
},
{
"path": "TinyMCE/tiny_mce/plugins/media/js/embed.js",
"chars": 1865,
"preview": "/**\n * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.\n "
},
{
"path": "TinyMCE/tiny_mce/plugins/media/js/media.js",
"chars": 17934,
"preview": "tinyMCEPopup.requireLangPack();\n\nvar oldWidth, oldHeight, ed, url;\n\nif (url = tinyMCEPopup.getParam(\"media_external_list"
},
{
"path": "TinyMCE/tiny_mce/plugins/media/langs/typecho_dlg.js",
"chars": 1,
"preview": "\n"
},
{
"path": "TinyMCE/tiny_mce/plugins/media/media.htm",
"chars": 31932,
"preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmln"
},
{
"path": "TinyMCE/tiny_mce/plugins/morebreak/css/content.css",
"chars": 169,
"preview": ".mceMoreBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff "
},
{
"path": "TinyMCE/tiny_mce/plugins/morebreak/editor_plugin.js",
"chars": 2120,
"preview": "/**\n * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\n *\n * @author Moxiecode\n * @copyright Copyright 2004"
},
{
"path": "TinyMCE/tiny_mce/plugins/safari/blank.htm",
"chars": 15,
"preview": "<!-- WebKit -->"
},
{
"path": "TinyMCE/tiny_mce/plugins/safari/editor_plugin.js",
"chars": 6394,
"preview": "(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.create"
},
{
"path": "TinyMCE/tiny_mce/themes/advanced/about.htm",
"chars": 2932,
"preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""
}
]
// ... and 32 more files (download for full content)
About this extraction
This page contains the full source code of the typecho/plugins GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 232 files (1.4 MB), approximately 423.7k tokens, and a symbol index with 1078 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.